]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/control.h
HTML help: index panel now displays only part of index matching given substring ...
[wxWidgets.git] / include / wx / os2 / control.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: control.h
3// Purpose: wxControl class
45fcbf3b 4// Author: David Webster
0e320a79 5// Modified by:
45fcbf3b 6// Created: 09/17/99
0e320a79 7// RCS-ID: $Id$
45fcbf3b
DW
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CONTROL_H_
13#define _WX_CONTROL_H_
14
0e320a79 15// General item class
45fcbf3b 16class WXDLLEXPORT wxControl : public wxControlBase
0e320a79 17{
45fcbf3b
DW
18 DECLARE_ABSTRACT_CLASS(wxControl)
19
0e320a79
DW
20public:
21 wxControl();
45fcbf3b
DW
22 virtual ~wxControl();
23
24 // Simulates an event
25 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
26
27 // implementation from now on
28 // --------------------------
29
30 // Calls the callback and appropriate event handlers
31 bool ProcessCommand(wxCommandEvent& event);
32
33 // OS2-specific
34 virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
35
36 // For ownerdraw items
37 virtual bool OS2OnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
38 virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
39
40 wxList& GetSubcontrols() { return m_subControls; }
41
42 void OnEraseBackground(wxEraseEvent& event);
0e320a79 43
45fcbf3b
DW
44#if WXWIN_COMPATIBILITY
45 virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
46 wxColour* GetButtonColour() const { return NULL; }
0e320a79 47
45fcbf3b
DW
48 inline virtual void SetLabelFont(const wxFont& font);
49 inline virtual void SetButtonFont(const wxFont& font);
50 inline wxFont& GetLabelFont() const;
51 inline wxFont& GetButtonFont() const;
0e320a79 52
45fcbf3b
DW
53 // Adds callback
54 inline void Callback(const wxFunction function);
55
56 wxFunction GetCallback() { return m_callback; }
0e320a79
DW
57
58protected:
59 wxFunction m_callback; // Callback associated with the window
45fcbf3b
DW
60#endif // WXWIN_COMPATIBILITY
61
62protected:
63 // For controls like radiobuttons which are really composite
64 wxList m_subControls;
65
e78c4d50 66 virtual wxSize DoGetBestSize() const;
0e320a79 67
45fcbf3b
DW
68 // create the control of the given class with the given style, returns FALSE
69 // if creation failed
70 bool OS2CreateControl(const wxChar *classname, WXDWORD style);
71
72 // determine the extended styles combination for this window (may slightly
73 // modify styl parameter)
74 WXDWORD GetExStyle(WXDWORD& style) const;
75
76private:
77 DECLARE_EVENT_TABLE()
0e320a79
DW
78};
79
45fcbf3b
DW
80
81#if WXWIN_COMPATIBILITY
82 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
83 inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
84 inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
85 inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
86 inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
87#endif // WXWIN_COMPATIBILITY
88
0e320a79
DW
89#endif
90 // _WX_CONTROL_H_