]> git.saurik.com Git - wxWidgets.git/blame - samples/applet/combobox.h
Initial check in of wxApplet code to CVS
[wxWidgets.git] / samples / applet / combobox.h
CommitLineData
54921697
KB
1/****************************************************************************
2*
3* wxWindows HTML Applet Package
4*
5* ========================================================================
6*
7* The contents of this file are subject to the wxWindows licence; you
8* may not use this file except in compliance with the License. You may
9* obtain a copy of the License at http://www.wxwindows.org/licence.htm
10*
11* Software distributed under the License is distributed on an
12* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13* implied. See the License for the specific language governing
14* rights and limitations under the License.
15*
16* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
17*
18* The Initial Developer of the Original Code is SciTech Software, Inc.
19* All Rights Reserved.
20*
21* ========================================================================
22*
23* Language: ANSI C++
24* Environment: Any
25*
26* Description: Combobox wrapper. This header file defines the custom
27* combo boxes used for this sample program.
28*
29****************************************************************************/
30
31#ifndef __COMBOBOX_H
32#define __COMBOBOX_H
33
34/*--------------------------- Class Definitions ---------------------------*/
35
36/****************************************************************************
37REMARKS:
38Defines a Custom ComboBox. This combobox is a portable implementation of
39the msw combobox control. It is made of the wxWindows textctrl primitive and
40the listbox primitive. This object does not create or display the controls,
41it provides the relationship and underlying behavior layer for the primitives
42allready created via wxDesigner.
43****************************************************************************/
44class ComboBox {
45private:
46 int m_ListBoxId;
47 int m_TextCtrlId;
48 wxWindow *m_Parent;
49 wxListBox *m_ListBox;
50 wxTextCtrl *m_TextCtrl;
51
52public:
53 // Constructor
54 ComboBox(wxWindow *parent, int,int);
55
56 // Returns the id of the listbox: listBoxId.
57 int GetListBoxId();
58
59 // Inserts: Used to insert items into the listbox
60 void Insert(const wxString& item, int pos);
61 void Insert(const wxString& item, int pos, void *clientData);
62 void Insert(const wxString& item, int pos, wxClientData *clientData);
63 void InsertItems(int nItems, const wxString *items, int pos);
64 void InsertItems(const wxArrayString& items, int pos);
65
66 // Sets: Used to set items in the combo box
67 void Set(int n, const wxString* items, void **clientData );
68 void Set(const wxArrayString& items, void **clientData);
69 int FindString(const wxString &s);
70
71 // Selections: Used to get/de/select items in the listbox
72 void Select(int n);
73 void Deselect(int n);
74 int GetSelection();
75 wxString GetStringSelection();
76 bool SetStringSelection(const wxString& s, bool select);
77
78 // Set the specified item at the first visible item or scroll to max
79 // range.
80 void SetFirstItem(int n);
81 void SetFirstItem(const wxString& s);
82
83 // Append items to the listbox
84 void Append(const wxString& item);
85 void Append(const wxString& item, void *clientData);
86 void Append(const wxString& item, wxClientData *clientData);
87
88 // Deleting items from the list box
89 void Clear();
90 void Delete(int n);
91
92 // OnChange event function (called from SDD dialog box code, see: dialog.h) Mimic
93 // msw combobox behavior: Click on listbox item it shows in textbox.
94 void OnChange(wxCommandEvent &event);
95 };
96
97#endif // __COMBOBOX_H
98