1. wxMDIParentFrame::~wxMDIParentFrame() bug fixed
[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 // General item class
20 class WXDLLEXPORT wxControl : public wxControlBase
21 {
22 DECLARE_ABSTRACT_CLASS(wxControl)
23
24 public:
25 wxControl();
26 virtual ~wxControl();
27
28 // Simulates an event
29 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
30
31 // implementation from now on
32 // --------------------------
33
34 // Calls the callback and appropriate event handlers
35 bool ProcessCommand(wxCommandEvent& event);
36
37 // MSW-specific
38 #ifdef __WIN95__
39 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
40 #endif // Win95
41
42 // For ownerdraw items
43 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
44 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
45
46 wxArrayLong GetSubcontrols() { return m_subControls; }
47
48 void OnEraseBackground(wxEraseEvent& event);
49
50 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
51 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
52
53 #if WXWIN_COMPATIBILITY
54 virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
55 wxColour* GetButtonColour() const { return NULL; }
56
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;
61
62 // Adds callback
63 inline void Callback(const wxFunction function);
64
65 wxFunction GetCallback() { return m_callback; }
66
67 protected:
68 wxFunction m_callback; // Callback associated with the window
69 #endif // WXWIN_COMPATIBILITY
70
71 protected:
72 // for controls like radiobuttons which are really composite this array
73 // holds the ids (not HWNDs!) of the sub controls
74 wxArrayLong m_subControls;
75
76 virtual wxSize DoGetBestSize() const;
77
78 // create the control of the given class with the given style, returns FALSE
79 // if creation failed
80 //
81 // All parameters except classname and style are optional, if the
82 // size/position are not given, they should be set later with SetSize() and,
83 // label (the title of the window), of course, is left empty. The extended
84 // style is determined from the style and the app 3D settings automatically
85 // if it's not specified explicitly.
86 bool MSWCreateControl(const wxChar *classname,
87 WXDWORD style,
88 const wxPoint& pos = wxDefaultPosition,
89 const wxSize& size = wxDefaultSize,
90 const wxString& label = wxEmptyString,
91 WXDWORD exstyle = (WXDWORD)-1);
92
93 // determine the extended styles combination for this window (may slightly
94 // modify style parameter, this is why it's non const)
95 WXDWORD GetExStyle(WXDWORD& style, bool *want3D) const;
96
97 private:
98 DECLARE_EVENT_TABLE()
99 };
100
101
102 #if WXWIN_COMPATIBILITY
103 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
104 inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
105 inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
106 inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
107 inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
108 #endif // WXWIN_COMPATIBILITY
109
110 #endif
111 // _WX_CONTROL_H_