]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/control.h
added .cur and .ico files
[wxWidgets.git] / include / wx / msw / control.h
... / ...
CommitLineData
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
22// General item class
23class WXDLLEXPORT wxControl : public wxWindow
24{
25 DECLARE_ABSTRACT_CLASS(wxControl)
26
27public:
28 wxControl();
29 virtual ~wxControl();
30
31 // Simulates an event
32 bool Command(wxCommandEvent& event) { return ProcessCommand(event); }
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 wxList& GetSubcontrols() { return m_subControls; }
47
48 void OnEraseBackground(wxEraseEvent& event);
49
50#if WXWIN_COMPATIBILITY
51 virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
52 wxColour* GetButtonColour() const { return NULL; }
53
54 inline virtual void SetLabelFont(const wxFont& font);
55 inline virtual void SetButtonFont(const wxFont& font);
56 inline wxFont& GetLabelFont() const;
57 inline wxFont& GetButtonFont() const;
58
59 // Adds callback
60 inline void Callback(const wxFunction function);
61
62 wxFunction GetCallback() { return m_callback; }
63
64protected:
65 wxFunction m_callback; // Callback associated with the window
66#endif // WXWIN_COMPATIBILITY
67
68protected:
69 // For controls like radiobuttons which are really composite
70 wxList m_subControls;
71
72 virtual wxSize DoGetBestSize();
73
74private:
75 DECLARE_EVENT_TABLE()
76};
77
78
79#if WXWIN_COMPATIBILITY
80 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
81 inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; }
82 inline wxFont& wxControl::GetButtonFont() 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 // WXWIN_COMPATIBILITY
86
87#endif
88 // _WX_CONTROL_H_