]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/control.h
wxURI/wxURL links in changes list.
[wxWidgets.git] / include / wx / palmos / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.h
3 // Purpose: wxControl class
4 // Author: William Osborne
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id:
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
47
48 // implementation from now on
49 // --------------------------
50
51 virtual wxVisualAttributes GetDefaultAttributes() const
52 {
53 return GetClassDefaultAttributes(GetWindowVariant());
54 }
55
56 static wxVisualAttributes
57 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
58
59 // Calls the callback and appropriate event handlers
60 bool ProcessCommand(wxCommandEvent& event);
61
62 // MSW-specific
63 #ifdef __WIN95__
64 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
65 #endif // Win95
66
67 // For ownerdraw items
68 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
69 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
70
71 const wxArrayLong& GetSubcontrols() const { return m_subControls; }
72
73 void OnEraseBackground(wxEraseEvent& event);
74
75 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
76 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
77
78 protected:
79 // choose the default border for this window
80 virtual wxBorder GetDefaultBorder() const;
81
82 // return default best size (doesn't really make any sense, override this)
83 virtual wxSize DoGetBestSize() const;
84
85 // create the control of the given Windows class: this is typically called
86 // from Create() method of the derived class passing its label, pos and
87 // size parameter (style parameter is not needed because m_windowStyle is
88 // supposed to had been already set and so is used instead when this
89 // function is called)
90 bool MSWCreateControl(const wxChar *classname,
91 const wxString& label,
92 const wxPoint& pos,
93 const wxSize& size);
94
95 // NB: the method below is deprecated now, with MSWGetStyle() the method
96 // above should be used instead! Once all the controls are updated to
97 // implement MSWGetStyle() this version will disappear.
98 //
99 // create the control of the given class with the given style (combination
100 // of WS_XXX flags, i.e. Windows style, not wxWidgets one), returns
101 // FALSE if creation failed
102 //
103 // All parameters except classname and style are optional, if the
104 // size/position are not given, they should be set later with SetSize()
105 // and, label (the title of the window), of course, is left empty. The
106 // extended style is determined from the style and the app 3D settings
107 // automatically if it's not specified explicitly.
108 bool MSWCreateControl(const wxChar *classname,
109 WXDWORD style,
110 const wxPoint& pos = wxDefaultPosition,
111 const wxSize& size = wxDefaultSize,
112 const wxString& label = wxEmptyString,
113 WXDWORD exstyle = (WXDWORD)-1);
114
115 // default style for the control include WS_TABSTOP if it AcceptsFocus()
116 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
117
118 // this is a helper for the derived class GetClassDefaultAttributes()
119 // implementation: it returns the right colours for the classes which
120 // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of
121 // being simple controls (such as wxButton, wxCheckBox, ...)
122 static wxVisualAttributes
123 GetCompositeControlsDefaultAttributes(wxWindowVariant variant);
124
125
126 // for controls like radiobuttons which are really composite this array
127 // holds the ids (not HWNDs!) of the sub controls
128 wxArrayLong m_subControls;
129
130 private:
131 DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl)
132 DECLARE_EVENT_TABLE()
133 };
134
135 #endif
136 // _WX_CONTROL_H_