]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/control.h
467db17931b16ae450a2f94d7ce6ac94acfa7a82
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: David Webster
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
15 WXDLLEXPORT_DATA(extern const wxChar
*) wxControlNameStr
;
18 class WXDLLEXPORT wxControl
: public wxControlBase
20 DECLARE_ABSTRACT_CLASS(wxControl
)
24 wxControl(wxWindow
*parent
,
26 const wxPoint
& pos
= wxDefaultPosition
,
27 const wxSize
& size
= wxDefaultSize
,
30 const wxValidator
& validator
= wxDefaultValidator
,
32 const wxString
& name
= wxControlNameStr
)
34 Create(parent
, id
, pos
, size
, style
, validator
, name
);
37 bool Create(wxWindow
*parent
, wxWindowID id
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
, long style
= 0,
41 const wxValidator
& validator
= wxDefaultValidator
,
43 const wxString
& name
= wxControlNameStr
);
47 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
49 // implementation from now on
50 // --------------------------
52 // Calls the callback and appropriate event handlers
53 bool ProcessCommand(wxCommandEvent
& event
);
56 virtual bool OS2OnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
58 // For ownerdraw items
59 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
60 virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
62 wxArrayLong
& GetSubcontrols() { return m_subControls
; }
64 void OnEraseBackground(wxEraseEvent
& event
);
66 #if WXWIN_COMPATIBILITY
67 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
68 wxColour
* GetButtonColour() const { return NULL
; }
70 inline virtual void SetLabelFont(const wxFont
& font
);
71 inline virtual void SetButtonFont(const wxFont
& font
);
72 inline wxFont
& GetLabelFont() const;
73 inline wxFont
& GetButtonFont() const;
76 inline void Callback(const wxFunction function
);
78 wxFunction
GetCallback() { return m_callback
; }
81 wxFunction m_callback
; // Callback associated with the window
82 #endif // WXWIN_COMPATIBILITY
85 // For controls like radiobuttons which are really composite
88 virtual wxSize
DoGetBestSize() const;
90 // create the control of the given class with the given style, returns FALSE
92 bool OS2CreateControl(const wxChar
*classname
, WXDWORD style
,
93 const wxPoint
& pos
= wxDefaultPosition
,
94 const wxSize
& size
= wxDefaultSize
,
95 const wxString
& label
= wxEmptyString
,
96 WXDWORD exstyle
= (WXDWORD
)-1);
98 // determine the extended styles combination for this window (may slightly
99 // modify styl parameter)
100 WXDWORD
GetExStyle(WXDWORD
& style
) const;
103 DECLARE_EVENT_TABLE()
107 #if WXWIN_COMPATIBILITY
108 inline void wxControl::Callback(const wxFunction f
) { m_callback
= f
; };
109 inline wxFont
& wxControl::GetLabelFont() const { return GetFont(); }
110 inline wxFont
& wxControl::GetButtonFont() const { return GetFont(); }
111 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
112 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }
113 #endif // WXWIN_COMPATIBILITY