2004-10-19 09:40:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-01-18 16:14:27 -05:00
|
|
|
// Name: wx/palmos/control.h
|
2004-10-19 09:40:30 -04:00
|
|
|
// Purpose: wxControl class
|
2005-01-18 16:14:27 -05:00
|
|
|
// Author: William Osborne - minimal working wxPalmOS port
|
2005-01-25 01:55:10 -05:00
|
|
|
// Modified by: Wlodzimierz ABX Skiba - native implementation
|
2004-10-19 09:40:30 -04:00
|
|
|
// Created: 10/13/04
|
2005-01-18 16:14:27 -05:00
|
|
|
// RCS-ID: $Id$
|
2005-01-25 01:55:10 -05:00
|
|
|
// Copyright: (c) William Osborne, Wlodzimierz Skiba
|
2004-10-19 09:40:30 -04:00
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_CONTROL_H_
|
|
|
|
#define _WX_CONTROL_H_
|
|
|
|
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
|
|
|
|
// General item class
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxControl : public wxControlBase
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-01-31 03:04:44 -05:00
|
|
|
wxControl() { Init(); }
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
wxControl(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxControlNameStr)
|
|
|
|
{
|
2005-01-31 03:04:44 -05:00
|
|
|
Init();
|
2004-10-19 09:40:30 -04:00
|
|
|
Create(parent, id, pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize, long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxControlNameStr);
|
|
|
|
|
|
|
|
virtual ~wxControl();
|
|
|
|
|
|
|
|
// Simulates an event
|
|
|
|
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
|
|
|
|
2005-01-24 02:38:52 -05:00
|
|
|
virtual bool Enable( bool enable = true );
|
|
|
|
virtual bool IsEnabled() const;
|
|
|
|
|
|
|
|
virtual bool Show( bool show = true );
|
|
|
|
virtual bool IsShown() const;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-25 01:55:10 -05:00
|
|
|
virtual void SetLabel(const wxString& label);
|
2007-12-14 20:25:56 -05:00
|
|
|
//virtual wxString GetLabel();
|
2005-01-25 01:55:10 -05:00
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// implementation from now on
|
|
|
|
// --------------------------
|
|
|
|
|
|
|
|
virtual wxVisualAttributes GetDefaultAttributes() const
|
|
|
|
{
|
|
|
|
return GetClassDefaultAttributes(GetWindowVariant());
|
|
|
|
}
|
|
|
|
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
|
|
|
|
|
|
|
// Calls the callback and appropriate event handlers
|
|
|
|
bool ProcessCommand(wxCommandEvent& event);
|
|
|
|
|
|
|
|
const wxArrayLong& GetSubcontrols() const { return m_subControls; }
|
|
|
|
|
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
|
|
|
|
|
|
|
protected:
|
2005-01-27 06:01:06 -05:00
|
|
|
// regardless how deeply we are in wxWidgets hierarchy always get correct form
|
2005-07-01 15:36:58 -04:00
|
|
|
WXFORMPTR GetParentForm() const;
|
|
|
|
WXFORMPTR GetObjectFormIndex(uint16_t& index) const;
|
2005-01-31 03:04:44 -05:00
|
|
|
void* GetObjectPtr() const;
|
2005-01-27 06:01:06 -05:00
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// choose the default border for this window
|
|
|
|
virtual wxBorder GetDefaultBorder() const;
|
|
|
|
|
2005-01-27 06:01:06 -05:00
|
|
|
// on/off-like controls
|
|
|
|
void SetBoolValue(bool value);
|
|
|
|
bool GetBoolValue() const;
|
|
|
|
void SetIntValue(int val);
|
|
|
|
|
2005-01-31 03:04:44 -05:00
|
|
|
// native labels access
|
|
|
|
void SetFieldLabel(const wxString& label);
|
|
|
|
void SetControlLabel(const wxString& label);
|
|
|
|
wxString GetFieldLabel();
|
|
|
|
wxString GetControlLabel();
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// return default best size (doesn't really make any sense, override this)
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2005-01-28 05:58:13 -05:00
|
|
|
// getting and setting sizes
|
|
|
|
virtual void DoGetPosition( int *x, int *y ) const;
|
|
|
|
virtual void DoGetSize( int *width, int *height ) const;
|
2005-02-14 05:49:02 -05:00
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
2005-01-28 05:58:13 -05:00
|
|
|
|
2005-01-24 02:38:52 -05:00
|
|
|
// create the control of the given ControlStyleType: this is typically called
|
2004-10-19 09:40:30 -04:00
|
|
|
// from Create() method of the derived class passing its label, pos and
|
|
|
|
// size parameter (style parameter is not needed because m_windowStyle is
|
|
|
|
// supposed to had been already set and so is used instead when this
|
|
|
|
// function is called)
|
2005-07-01 15:36:58 -04:00
|
|
|
bool PalmCreateControl(int palmStyle,
|
2005-01-24 02:38:52 -05:00
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos,
|
2005-01-31 03:04:44 -05:00
|
|
|
const wxSize& size,
|
2005-02-08 04:38:08 -05:00
|
|
|
uint8_t groupID = 0);
|
2005-01-31 03:04:44 -05:00
|
|
|
inline bool IsPalmControl() const { return m_palmControl; }
|
|
|
|
|
|
|
|
bool PalmCreateField(const wxString& label,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
bool editable,
|
|
|
|
bool underlined,
|
2005-07-01 15:36:58 -04:00
|
|
|
int justification);
|
2005-01-31 03:04:44 -05:00
|
|
|
inline bool IsPalmField() const { return m_palmField; }
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// this is a helper for the derived class GetClassDefaultAttributes()
|
|
|
|
// implementation: it returns the right colours for the classes which
|
|
|
|
// contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of
|
|
|
|
// being simple controls (such as wxButton, wxCheckBox, ...)
|
|
|
|
static wxVisualAttributes
|
|
|
|
GetCompositeControlsDefaultAttributes(wxWindowVariant variant);
|
|
|
|
|
|
|
|
|
|
|
|
// for controls like radiobuttons which are really composite this array
|
|
|
|
// holds the ids (not HWNDs!) of the sub controls
|
|
|
|
wxArrayLong m_subControls;
|
|
|
|
|
2005-02-22 02:22:11 -05:00
|
|
|
// m_label stores label in case of wxButton, wxCheckBox, wxToggleButton etc.
|
|
|
|
// We must ensure that it persists for as long as it is being displayed
|
|
|
|
// (that is, for as long as the control is displayed or until we call
|
|
|
|
// CtlSetLabel() with a new string), and we must free the string after
|
|
|
|
// it is no longer in use (typically after the form containing the
|
|
|
|
// control is freed).
|
|
|
|
wxString m_label;
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
private:
|
2005-01-27 06:01:06 -05:00
|
|
|
|
2005-01-31 03:04:44 -05:00
|
|
|
bool m_palmControl:1;
|
|
|
|
bool m_palmField:1;
|
|
|
|
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2005-07-01 15:36:58 -04:00
|
|
|
virtual void DoGetBounds( WXRECTANGLEPTR rect ) const;
|
|
|
|
virtual void DoSetBounds( WXRECTANGLEPTR rect );
|
2005-01-28 05:58:13 -05:00
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_CONTROL_H_
|