]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/control.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "control.h"
19 #include "wx/window.h"
21 #include "wx/validate.h"
24 class WXDLLEXPORT wxControl
: public wxWindow
26 DECLARE_ABSTRACT_CLASS(wxControl
)
31 virtual void Command(wxCommandEvent
& WXUNUSED(event
)) = 0; // Simulates an event
32 virtual void ProcessCommand(wxCommandEvent
& event
); // Calls the callback and
33 // appropriate event handlers
34 virtual void SetClientSize(const int width
, const int height
);
35 virtual void SetLabel(const wxString
& label
);
36 virtual wxString
GetLabel(void) const ;
38 #if WXWIN_COMPATIBILITY
39 inline virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
40 inline wxColour
*GetButtonColour(void) const { return NULL
; }
42 inline virtual void SetLabelFont(const wxFont
& font
);
43 inline virtual void SetButtonFont(const wxFont
& font
);
44 inline wxFont
*GetLabelFont(void) const ;
45 inline wxFont
*GetButtonFont(void) const ;
48 // Places item in centre of panel - so can't be used BEFORE panel->Fit()
49 void Centre(const int direction
= wxHORIZONTAL
);
50 inline void Callback(const wxFunction function
); // Adds callback
55 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
56 virtual void MSWOnMouseMove(const int x
, const int y
, const WXUINT flags
);
57 virtual bool MSWNotify(const WXWPARAM wParam
, const WXLPARAM lParam
);
59 void OnEraseBackground(wxEraseEvent
& event
);
61 // For ownerdraw items
62 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
63 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
65 inline wxFunction
GetCallback(void) { return m_callback
; }
66 inline wxList
& GetSubcontrols(void) { return m_subControls
; }
68 wxFunction m_callback
; // Callback associated with the window
71 wxList m_subControls
; // For controls like radiobuttons which are really composite
76 inline void wxControl::Callback(const wxFunction function
) { m_callback
= function
; }; // Adds callback
78 #if WXWIN_COMPATIBILITY
79 inline wxFont
*wxControl::GetLabelFont(void) const { return GetFont() ; }
80 inline wxFont
*wxControl::GetButtonFont(void) const { return GetFont() ; }
81 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
82 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }