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