]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/control.h
3738d445e0ce48655ca7ac473205509673fd9ddd
[wxWidgets.git] / include / wx / msw / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.h
3 // Purpose: wxControl class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
14
15 #ifdef __GNUG__
16 #pragma interface "control.h"
17 #endif
18
19 #include "wx/window.h"
20 #include "wx/list.h"
21 #include "wx/validate.h"
22
23 // General item class
24 class WXDLLEXPORT wxControl: public wxWindow
25 {
26 DECLARE_ABSTRACT_CLASS(wxControl)
27 public:
28 wxControl(void);
29 ~wxControl(void);
30
31 virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
32 virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
33 // appropriate event handlers
34 virtual void SetClientSize(int width, int height);
35 virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
36
37 virtual void SetLabel(const wxString& label);
38 virtual wxString GetLabel(void) const ;
39
40 #if WXWIN_COMPATIBILITY
41 inline virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
42 inline wxColour*GetButtonColour(void) const { return NULL; }
43
44 inline virtual void SetLabelFont(const wxFont& font);
45 inline virtual void SetButtonFont(const wxFont& font);
46 inline wxFont *GetLabelFont(void) const ;
47 inline wxFont *GetButtonFont(void) const ;
48 #endif
49
50 // Places item in centre of panel - so can't be used BEFORE panel->Fit()
51 void Centre(int direction = wxHORIZONTAL);
52 inline void Callback(const wxFunction function); // Adds callback
53
54 // MSW-specific
55
56 // Window procedure
57 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
58 virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
59 virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
60
61 void OnEraseBackground(wxEraseEvent& event);
62
63 // For ownerdraw items
64 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
65 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
66
67 inline wxFunction GetCallback(void) { return m_callback; }
68 inline wxList& GetSubcontrols(void) { return m_subControls; }
69 protected:
70 wxFunction m_callback; // Callback associated with the window
71
72 // MSW implementation
73 wxList m_subControls; // For controls like radiobuttons which are really composite
74
75 DECLARE_EVENT_TABLE()
76 };
77
78 inline void wxControl::Callback(const wxFunction function) { m_callback = function; }; // Adds callback
79
80 #if WXWIN_COMPATIBILITY
81 inline wxFont *wxControl::GetLabelFont(void) const { return GetFont() ; }
82 inline wxFont *wxControl::GetButtonFont(void) const { return GetFont() ; }
83 inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
84 inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
85 #endif
86
87 #endif
88 // _WX_CONTROL_H_