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