]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/ctrlsub.h
Added DECLARE_LOCAL_EVENT_TYPE which doesn't use WXDLLEXPORT. This is
[wxWidgets.git] / include / wx / ctrlsub.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems")
3// Purpose: wxControlWithItems interface
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 22.10.99
7// RCS-ID: $Id$
8// Copyright: (c) wxWindows team
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CTRLSUB_H_BASE_
13#define _WX_CTRLSUB_H_BASE_
14
15#ifdef __GNUG__
16 #pragma interface "controlwithitems.h"
17#endif
18
19#include "wx/control.h" // base class
20
21// ----------------------------------------------------------------------------
22// wxControlWithItems defines an interface which is implemented by all controls
23// which have string subitems each of which may be selected.
24//
25// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox
26// ----------------------------------------------------------------------------
27
28class WXDLLEXPORT wxControlWithItems : public wxControl
29{
30public:
31 wxControlWithItems() { m_clientDataItemsType = ClientData_None; }
32#ifdef __WXMAC_X__
33 virtual ~wxControlWithItems() {} // Added min for Mac X
34#endif
35
36 // adding items
37 // ------------
38
39 void Append(const wxString& item)
40 { DoAppend(item); }
41 void Append(const wxString& item, void *clientData)
42 { int n = DoAppend(item); SetClientData(n, clientData); }
43 void Append(const wxString& item, wxClientData *clientData)
44 { int n = DoAppend(item); SetClientObject(n, clientData); }
45
46 // deleting items
47 // --------------
48
49 virtual void Clear() = 0;
50 virtual void Delete(int n) = 0;
51
52 // accessing strings
53 // -----------------
54
55 virtual int GetCount() const = 0;
56 virtual wxString GetString(int n) const = 0;
57 virtual void SetString(int n, const wxString& s) = 0;
58 virtual int FindString(const wxString& s) const = 0;
59
60 // selection
61 // ---------
62
63 virtual void Select(int n) = 0;
64 virtual int GetSelection() const = 0;
65
66 wxString GetStringSelection() const;
67
68 // misc
69 // ----
70
71 // client data stuff
72 void SetClientData(int n, void* clientData);
73 void* GetClientData(int n) const;
74
75 void SetClientObject(int n, wxClientData* clientData);
76 wxClientData* GetClientObject(int n) const;
77
78 bool HasClientObjectData() const
79 { return m_clientDataItemsType == ClientData_Object; }
80 bool HasClientUntypedData() const
81 { return m_clientDataItemsType == ClientData_Void; }
82
83 // compatibility - these functions are deprecated, use the new ones
84 // instead
85 int Number() const { return GetCount(); }
86
87protected:
88 virtual int DoAppend(const wxString& item) = 0;
89
90 virtual void DoSetItemClientData(int n, void* clientData) = 0;
91 virtual void* DoGetItemClientData(int n) const = 0;
92 virtual void DoSetItemClientObject(int n, wxClientData* clientData) = 0;
93 virtual wxClientData* DoGetItemClientObject(int n) const = 0;
94
95 // the type of the client data for the items
96 wxClientDataType m_clientDataItemsType;
97};
98
99#endif // _WX_CTRLSUB_H_BASE_
100
101