]>
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
16 #pragma interface "control.h"
19 #include "wx/window.h"
23 class WXDLLEXPORT wxControl
: public wxWindow
25 DECLARE_ABSTRACT_CLASS(wxControl
)
32 virtual void Command(wxCommandEvent
& WXUNUSED(event
)) { }
33 // Calls the callback and appropriate event handlers
34 virtual void ProcessCommand(wxCommandEvent
& event
);
36 virtual void SetClientSize(int width
, int height
);
37 virtual void SetClientSize(const wxSize
& sz
) { wxWindow::SetClientSize(sz
); }
39 virtual void SetLabel(const wxString
& label
);
40 virtual wxString
GetLabel() const;
42 #if WXWIN_COMPATIBILITY
43 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
44 wxColour
* GetButtonColour() const { return NULL
; }
46 inline virtual void SetLabelFont(const wxFont
& font
);
47 inline virtual void SetButtonFont(const wxFont
& font
);
48 inline wxFont
& GetLabelFont() const;
49 inline wxFont
& GetButtonFont() const;
52 // Places item in centre of panel - so can't be used BEFORE panel->Fit()
53 void Centre(int direction
= wxHORIZONTAL
);
56 inline void Callback(const wxFunction function
);
61 virtual void MSWOnMouseMove(int x
, int y
, WXUINT flags
);
62 virtual bool MSWNotify(WXWPARAM wParam
, WXLPARAM lParam
, WXLPARAM
*result
);
64 void OnEraseBackground(wxEraseEvent
& event
);
66 // For ownerdraw items
67 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
68 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
70 wxFunction
GetCallback() { return m_callback
; }
71 wxList
& GetSubcontrols() { return m_subControls
; }
74 wxFunction m_callback
; // Callback associated with the window
77 wxList m_subControls
; // For controls like radiobuttons which are really composite
84 inline void wxControl::Callback(const wxFunction function
)
86 m_callback
= function
;
89 #if WXWIN_COMPATIBILITY
90 inline wxFont
& wxControl::GetLabelFont() const { return GetFont() ; }
91 inline wxFont
& wxControl::GetButtonFont() const { return GetFont() ; }
92 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
93 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }