]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/listbox.h
Added wx/listbase.h with wxListCtrl types, so we can
[wxWidgets.git] / include / wx / motif / listbox.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: listbox.h
3// Purpose: wxListBox class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_LISTBOX_H_
13#define _WX_LISTBOX_H_
14
15#ifdef __GNUG__
16#pragma interface "listbox.h"
17#endif
18
6adaedf0 19#include "wx/ctrlsub.h"
9b6dbb09
JS
20
21WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr;
22
23// forward decl for GetSelections()
24class WXDLLEXPORT wxArrayInt;
25
26WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
27
28// List box item
d7d38ea4 29class WXDLLEXPORT wxListBox: public wxListBoxBase
9b6dbb09 30{
83df96d6
JS
31 DECLARE_DYNAMIC_CLASS(wxListBox)
32
bfc6fde4
VZ
33public:
34 wxListBox();
35 wxListBox(wxWindow *parent, wxWindowID id,
83df96d6
JS
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 int n = 0, const wxString choices[] = NULL,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxListBoxNameStr):
42 m_clientDataList(wxKEY_INTEGER)
43 {
44 Create(parent, id, pos, size, n, choices, style, validator, name);
45 }
46
bfc6fde4 47 bool Create(wxWindow *parent, wxWindowID id,
83df96d6
JS
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 int n = 0, const wxString choices[] = NULL,
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxListBoxNameStr);
54
bfc6fde4 55 ~wxListBox();
83df96d6 56
6adaedf0
JS
57 // Virtual functions required by wxControlWithItems.
58 // They are not all implemented yet :-(
59 virtual int GetCount() const;
60 virtual int DoAppend(const wxString& item);
61 virtual void DoInsertItems(const wxArrayString& items, int pos);
62 virtual void DoSetItems(const wxArrayString& items, void **clientData);
63 virtual void DoSetFirstItem(int n);
64 virtual void DoSetItemClientData(int n, void* clientData);
65 virtual void* DoGetItemClientData(int n) const;
66 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
67 virtual wxClientData* DoGetItemClientObject(int n) const;
68 virtual void Select(int n);
83df96d6 69
bfc6fde4 70 virtual void Append(const wxString& item);
813c20a6
VZ
71 virtual void Append(const wxString& item, void *clientData);
72 virtual void Set(int n, const wxString* choices, void **clientData = NULL);
18128cbb
MB
73 void Set(const wxArrayString& items, void **clientData = NULL)
74 { DoSetItems(items, clientData); }
bfc6fde4
VZ
75 virtual int FindString(const wxString& s) const ;
76 virtual void Clear();
77 virtual void SetSelection(int n, bool select = TRUE);
83df96d6 78
bfc6fde4 79 virtual void Deselect(int n);
83df96d6 80
bfc6fde4
VZ
81 // For single choice list item only
82 virtual int GetSelection() const ;
83 virtual void Delete(int n);
813c20a6 84 virtual void *GetClientData(int n) const ;
bfc6fde4 85 virtual void *GetClientData() { return wxWindow::GetClientData(); }
813c20a6 86 virtual void SetClientData(int n, void *clientData);
bfc6fde4
VZ
87 virtual void SetClientData( void *data ) { wxWindow::SetClientData(data); }
88 virtual void SetString(int n, const wxString& s);
83df96d6 89
bfc6fde4
VZ
90 // For single or multiple choice list item
91 virtual int GetSelections(wxArrayInt& aSelections) const;
d7d38ea4 92 virtual bool IsSelected(int n) const ;
bfc6fde4 93 virtual wxString GetString(int n) const ;
83df96d6 94
bfc6fde4
VZ
95 // Set the specified item at the first visible item
96 // or scroll to max range.
97 virtual void SetFirstItem(int n) ;
98 virtual void SetFirstItem(const wxString& s) ;
83df96d6 99
bfc6fde4 100 virtual void InsertItems(int nItems, const wxString items[], int pos);
18128cbb
MB
101 void InsertItems(const wxArrayString& items, int pos)
102 { DoInsertItems(items, pos); }
103
bfc6fde4
VZ
104 virtual wxString GetStringSelection() const ;
105 virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
106 virtual int Number() const ;
83df96d6 107
bfc6fde4 108 void Command(wxCommandEvent& event);
83df96d6 109
bfc6fde4
VZ
110 // Implementation
111 virtual void ChangeFont(bool keepOriginalSize = TRUE);
112 virtual void ChangeBackgroundColour();
113 virtual void ChangeForegroundColour();
114 WXWidget GetTopWidget() const;
83df96d6 115
f97c9854 116protected:
bfc6fde4
VZ
117 int m_noItems;
118 int m_selected;
83df96d6 119
bfc6fde4
VZ
120 // List mapping positions->client data
121 wxList m_clientDataList;
83df96d6 122
bfc6fde4 123 virtual void DoSetSize(int x, int y,
83df96d6
JS
124 int width, int height,
125 int sizeFlags = wxSIZE_AUTO);
9b6dbb09
JS
126};
127
128#endif
83df96d6 129// _WX_LISTBOX_H_