]>
Commit | Line | Data |
---|---|---|
54921697 KB |
1 | /**************************************************************************** |
2 | * | |
d20cf96f | 3 | * wxWindows HTML Applet Package |
54921697 | 4 | * |
716cd410 KB |
5 | * Copyright (C) 1991-2001 SciTech Software, Inc. |
6 | * All rights reserved. | |
7 | * | |
54921697 KB |
8 | * ======================================================================== |
9 | * | |
716cd410 KB |
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 | |
54921697 KB |
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 | * | |
54921697 KB |
20 | * ======================================================================== |
21 | * | |
d20cf96f KB |
22 | * Language: ANSI C++ |
23 | * Environment: Any | |
54921697 KB |
24 | * |
25 | * Description: Combobox wrapper. This header file defines the custom | |
d20cf96f | 26 | * combo boxes used for this sample program. |
54921697 KB |
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 | |
d20cf96f | 39 | the listbox primitive. This object does not create or display the controls, |
54921697 KB |
40 | it provides the relationship and underlying behavior layer for the primitives |
41 | allready created via wxDesigner. | |
42 | ****************************************************************************/ | |
43 | class ComboBox { | |
44 | private: | |
d20cf96f KB |
45 | int m_ListBoxId; |
46 | int m_TextCtrlId; | |
47 | wxWindow *m_Parent; | |
48 | wxListBox *m_ListBox; | |
49 | wxTextCtrl *m_TextCtrl; | |
54921697 KB |
50 | |
51 | public: | |
d20cf96f KB |
52 | // Constructor |
53 | ComboBox(wxWindow *parent, int,int); | |
716cd410 | 54 | |
d20cf96f KB |
55 | // Returns the id of the listbox: listBoxId. |
56 | int GetListBoxId(); | |
716cd410 | 57 | |
d20cf96f KB |
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); | |
716cd410 | 64 | |
d20cf96f KB |
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); | |
716cd410 | 69 | |
d20cf96f KB |
70 | // Selections: Used to get/de/select items in the listbox |
71 | void Select(int n); | |
72 | void Deselect(int n); | |
716cd410 | 73 | int GetSelection(); |
d20cf96f KB |
74 | wxString GetStringSelection(); |
75 | bool SetStringSelection(const wxString& s, bool select); | |
716cd410 | 76 | |
d20cf96f KB |
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); | |
716cd410 | 81 | |
d20cf96f KB |
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); | |
716cd410 | 86 | |
d20cf96f | 87 | // Deleting items from the list box |
716cd410 | 88 | void Clear(); |
d20cf96f | 89 | void Delete(int n); |
716cd410 | 90 | |
d20cf96f | 91 | // OnChange event function (called from SDD dialog box code, see: dialog.h) Mimic |
716cd410 | 92 | // msw combobox behavior: Click on listbox item it shows in textbox. |
d20cf96f KB |
93 | void OnChange(wxCommandEvent &event); |
94 | }; | |
54921697 | 95 | |
d20cf96f | 96 | #endif // __COMBOBOX_H |
54921697 | 97 |