]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/ctrlsub.h
Removed unnecessary code from utilsunx.cpp
[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
33 // adding items
34 // ------------
35
36 void Append(const wxString& item)
37 { DoAppend(item); }
38 void Append(const wxString& item, void *clientData)
39 { int n = DoAppend(item); SetClientData(n, clientData); }
40 void Append(const wxString& item, wxClientData *clientData)
41 { int n = DoAppend(item); SetClientObject(n, clientData); }
42
43 // deleting items
44 // --------------
45
46 virtual void Clear() = 0;
47 virtual void Delete(int n) = 0;
48
49 // accessing strings
50 // -----------------
51
52 virtual int GetCount() const = 0;
53 virtual wxString GetString(int n) const = 0;
54 virtual void SetString(int n, const wxString& s) = 0;
55 virtual int FindString(const wxString& s) const = 0;
56
57 // selection
58 // ---------
59
60 virtual void Select(int n) = 0;
61 virtual int GetSelection() const = 0;
62
63 wxString GetStringSelection() const;
64
65 // misc
66 // ----
67
68 // client data stuff
69 void SetClientData(int n, void* clientData);
70 void* GetClientData(int n) const;
71
72 void SetClientObject(int n, wxClientData* clientData);
73 wxClientData* GetClientObject(int n) const;
74
75 bool HasClientObjectData() const
76 { return m_clientDataItemsType == ClientData_Object; }
77 bool HasClientUntypedData() const
78 { return m_clientDataItemsType == ClientData_Void; }
79
80 // compatibility - these functions are deprecated, use the new ones
81 // instead
82 int Number() const { return GetCount(); }
83
84protected:
85 virtual int DoAppend(const wxString& item) = 0;
86
87 virtual void DoSetItemClientData(int n, void* clientData) = 0;
88 virtual void* DoGetItemClientData(int n) const = 0;
89 virtual void DoSetItemClientObject(int n, wxClientData* clientData) = 0;
90 virtual wxClientData* DoGetItemClientObject(int n) const = 0;
91
92 // the type of the client data for the items
93 wxClientDataType m_clientDataItemsType;
94};
95
96#endif // _WX_CTRLSUB_H_BASE_
97
98