]>
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 bool Command(wxCommandEvent
& event
) { return ProcessCommand(event
); }
34 // Calls the callback and appropriate event handlers
35 bool ProcessCommand(wxCommandEvent
& event
);
37 // Places item in centre of panel - so can't be used BEFORE panel->Fit()
38 void Centre(int direction
= wxHORIZONTAL
);
42 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
45 // For ownerdraw items
46 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
47 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*WXUNUSED(item
)) { return FALSE
; };
49 wxList
& GetSubcontrols() { return m_subControls
; }
51 void OnEraseBackground(wxEraseEvent
& event
);
53 #if WXWIN_COMPATIBILITY
54 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
55 wxColour
* GetButtonColour() const { return NULL
; }
57 inline virtual void SetLabelFont(const wxFont
& font
);
58 inline virtual void SetButtonFont(const wxFont
& font
);
59 inline wxFont
& GetLabelFont() const;
60 inline wxFont
& GetButtonFont() const;
63 inline void Callback(const wxFunction function
);
65 wxFunction
GetCallback() { return m_callback
; }
68 wxFunction m_callback
; // Callback associated with the window
69 #endif // WXWIN_COMPATIBILITY
72 // For controls like radiobuttons which are really composite
80 #if WXWIN_COMPATIBILITY
81 inline void wxControl::Callback(const wxFunction f
) { m_callback
= f
; };
82 inline wxFont
& wxControl::GetLabelFont() const { return GetFont() ; }
83 inline wxFont
& wxControl::GetButtonFont() const { return GetFont() ; }
84 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
85 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }
86 #endif // WXWIN_COMPATIBILITY