]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
e1d63b79 | 2 | // Name: wx/palmos/control.h |
ffecfa5a | 3 | // Purpose: wxControl class |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
ffecfa5a JS |
5 | // Modified by: |
6 | // Created: 10/13/04 | |
e1d63b79 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
8 | // Copyright: (c) William Osborne |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CONTROL_H_ | |
13 | #define _WX_CONTROL_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "control.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/dynarray.h" | |
20 | ||
21 | // General item class | |
22 | class WXDLLEXPORT wxControl : public wxControlBase | |
23 | { | |
24 | public: | |
25 | wxControl() { } | |
26 | ||
27 | wxControl(wxWindow *parent, wxWindowID id, | |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, long style = 0, | |
30 | const wxValidator& validator = wxDefaultValidator, | |
31 | const wxString& name = wxControlNameStr) | |
32 | { | |
33 | Create(parent, id, pos, size, style, validator, name); | |
34 | } | |
35 | ||
36 | bool Create(wxWindow *parent, wxWindowID id, | |
37 | const wxPoint& pos = wxDefaultPosition, | |
38 | const wxSize& size = wxDefaultSize, long style = 0, | |
39 | const wxValidator& validator = wxDefaultValidator, | |
40 | const wxString& name = wxControlNameStr); | |
41 | ||
42 | virtual ~wxControl(); | |
43 | ||
44 | // Simulates an event | |
45 | virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } | |
46 | ||
db101bd3 WS |
47 | virtual bool Enable( bool enable = true ); |
48 | virtual bool IsEnabled() const; | |
49 | ||
50 | virtual bool Show( bool show = true ); | |
51 | virtual bool IsShown() const; | |
ffecfa5a JS |
52 | |
53 | // implementation from now on | |
54 | // -------------------------- | |
55 | ||
56 | virtual wxVisualAttributes GetDefaultAttributes() const | |
57 | { | |
58 | return GetClassDefaultAttributes(GetWindowVariant()); | |
59 | } | |
60 | ||
61 | static wxVisualAttributes | |
62 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
63 | ||
64 | // Calls the callback and appropriate event handlers | |
65 | bool ProcessCommand(wxCommandEvent& event); | |
66 | ||
ffecfa5a JS |
67 | const wxArrayLong& GetSubcontrols() const { return m_subControls; } |
68 | ||
69 | void OnEraseBackground(wxEraseEvent& event); | |
70 | ||
71 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, | |
72 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
73 | ||
74 | protected: | |
75 | // choose the default border for this window | |
76 | virtual wxBorder GetDefaultBorder() const; | |
77 | ||
78 | // return default best size (doesn't really make any sense, override this) | |
79 | virtual wxSize DoGetBestSize() const; | |
80 | ||
db101bd3 | 81 | // create the control of the given ControlStyleType: this is typically called |
ffecfa5a JS |
82 | // from Create() method of the derived class passing its label, pos and |
83 | // size parameter (style parameter is not needed because m_windowStyle is | |
84 | // supposed to had been already set and so is used instead when this | |
85 | // function is called) | |
db101bd3 WS |
86 | bool PalmCreateControl(ControlStyleType style, |
87 | wxWindow *parent, | |
88 | wxWindowID id, | |
89 | const wxString& label, | |
90 | const wxPoint& pos, | |
91 | const wxSize& size); | |
ffecfa5a JS |
92 | |
93 | // this is a helper for the derived class GetClassDefaultAttributes() | |
94 | // implementation: it returns the right colours for the classes which | |
95 | // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of | |
96 | // being simple controls (such as wxButton, wxCheckBox, ...) | |
97 | static wxVisualAttributes | |
98 | GetCompositeControlsDefaultAttributes(wxWindowVariant variant); | |
99 | ||
100 | ||
101 | // for controls like radiobuttons which are really composite this array | |
102 | // holds the ids (not HWNDs!) of the sub controls | |
103 | wxArrayLong m_subControls; | |
104 | ||
db101bd3 WS |
105 | ControlType *m_control; |
106 | uint16_t m_objectIndex; | |
107 | ||
ffecfa5a JS |
108 | private: |
109 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl) | |
110 | DECLARE_EVENT_TABLE() | |
111 | }; | |
112 | ||
113 | #endif | |
114 | // _WX_CONTROL_H_ |