]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/control.h
Fix for missing -g from wx-config
[wxWidgets.git] / include / wx / univ / control.h
CommitLineData
1e6feb95
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/control.h
3// Purpose: universal wxControl: adds handling of mnemonics
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 14.08.00
7// RCS-ID: $Id$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
1e6feb95
VZ
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_UNIV_CONTROL_H_
13#define _WX_UNIV_CONTROL_H_
14
15#ifdef __GNUG__
16 #pragma interface "control.h"
17#endif
18
19class WXDLLEXPORT wxControlRenderer;
20class WXDLLEXPORT wxInputHandler;
21class WXDLLEXPORT wxRenderer;
22
23// we must include it as most/all control classes derive their handlers from
24// it
25#include "wx/univ/inphand.h"
26
23645bfa
VS
27#include "wx/univ/inpcons.h"
28
1e6feb95
VZ
29// ----------------------------------------------------------------------------
30// wxControlAction: the action is currently just a string which identifies it,
31// later it might become an atom (i.e. an opaque handler to string).
32// ----------------------------------------------------------------------------
33
34typedef wxString wxControlAction;
35
36// the list of actions which apply to all controls (other actions are defined
37// in the controls headers)
38
39#define wxACTION_NONE _T("") // no action to perform
40
41// ----------------------------------------------------------------------------
42// wxControl: the base class for all GUI controls
43// ----------------------------------------------------------------------------
44
23645bfa 45class WXDLLEXPORT wxControl : public wxControlBase, public wxInputConsumer
1e6feb95
VZ
46{
47public:
48 wxControl() { Init(); }
49
50 wxControl(wxWindow *parent,
51 wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize, long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxControlNameStr)
56 {
57 Init();
58
59 Create(parent, id, pos, size, style, validator, name);
60 }
61
62 bool Create(wxWindow *parent,
63 wxWindowID id,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize, long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxControlNameStr);
68
69 // this function will filter out '&' characters and will put the
70 // accelerator char (the one immediately after '&') into m_chAccel
71 virtual void SetLabel(const wxString &label);
72 virtual wxString GetLabel() const;
73
74 // wxUniversal-specific methods
75
76 // return the accel index in the string or -1 if none and puts the modified
77 // string intosecond parameter if non NULL
78 static int FindAccelIndex(const wxString& label,
79 wxString *labelOnly = NULL);
80
81 // return the index of the accel char in the label or -1 if none
82 int GetAccelIndex() const { return m_indexAccel; }
83
84 // return the accel char itself or 0 if none
85 wxChar GetAccelChar() const
86 {
87 return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel];
88 }
89
23645bfa 90 virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; }
1e6feb95
VZ
91
92protected:
1e6feb95
VZ
93 // common part of all ctors
94 void Init();
95
1e6feb95
VZ
96private:
97 // label and accel info
98 wxString m_label;
99 int m_indexAccel;
100
101 DECLARE_DYNAMIC_CLASS(wxControl)
102 DECLARE_EVENT_TABLE()
23645bfa 103 WX_DECLARE_INPUT_CONSUMER()
1e6feb95
VZ
104};
105
106#endif // _WX_UNIV_CONTROL_H_