]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/control.h
some new functions:
[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__
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
24class WXDLLEXPORT wxControl: public wxWindow
25{
26 DECLARE_ABSTRACT_CLASS(wxControl)
27public:
28 wxControl(void);
29 ~wxControl(void);
30
7f555861 31 virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
2bda0e17
KB
32 virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
33 // appropriate event handlers
debe6624 34 virtual void SetClientSize(int width, int height);
2bda0e17
KB
35 virtual void SetLabel(const wxString& label);
36 virtual wxString GetLabel(void) const ;
37
38#if WXWIN_COMPATIBILITY
39 inline virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
40 inline wxColour*GetButtonColour(void) const { return NULL; }
41
42 inline virtual void SetLabelFont(const wxFont& font);
43 inline virtual void SetButtonFont(const wxFont& font);
44 inline wxFont *GetLabelFont(void) const ;
45 inline wxFont *GetButtonFont(void) const ;
46#endif
47
48 // Places item in centre of panel - so can't be used BEFORE panel->Fit()
debe6624 49 void Centre(int direction = wxHORIZONTAL);
2bda0e17
KB
50 inline void Callback(const wxFunction function); // Adds callback
51
52 // MSW-specific
53
54 // Window procedure
55 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
debe6624
JS
56 virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
57 virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
2bda0e17
KB
58
59 void OnEraseBackground(wxEraseEvent& event);
60
61 // For ownerdraw items
62 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
63 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
64
65 inline wxFunction GetCallback(void) { return m_callback; }
66 inline wxList& GetSubcontrols(void) { return m_subControls; }
67protected:
68 wxFunction m_callback; // Callback associated with the window
69
70 // MSW implementation
71 wxList m_subControls; // For controls like radiobuttons which are really composite
72
73DECLARE_EVENT_TABLE()
74};
75
76inline void wxControl::Callback(const wxFunction function) { m_callback = function; }; // Adds callback
77
78#if WXWIN_COMPATIBILITY
79inline wxFont *wxControl::GetLabelFont(void) const { return GetFont() ; }
80inline wxFont *wxControl::GetButtonFont(void) const { return GetFont() ; }
81inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
82inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
83#endif
84
85#endif
bbcdf8bc 86 // _WX_CONTROL_H_