]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/listbox.h
Added __WXMAC_OSX__ guards around the CFRunLoop calls, CFRunLoop not available on...
[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
65571936 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_LISTBOX_H_
13#define _WX_LISTBOX_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
9b6dbb09
JS
16#pragma interface "listbox.h"
17#endif
18
6adaedf0 19#include "wx/ctrlsub.h"
99ab3e3f 20#include "wx/clntdata.h"
9b6dbb09 21
9b6dbb09
JS
22// forward decl for GetSelections()
23class WXDLLEXPORT wxArrayInt;
24
9b6dbb09 25// List box item
d7d38ea4 26class WXDLLEXPORT wxListBox: public wxListBoxBase
9b6dbb09 27{
83df96d6
JS
28 DECLARE_DYNAMIC_CLASS(wxListBox)
29
bfc6fde4
VZ
30public:
31 wxListBox();
32 wxListBox(wxWindow *parent, wxWindowID id,
83df96d6
JS
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
99ab3e3f 38 const wxString& name = wxListBoxNameStr)
83df96d6
JS
39 {
40 Create(parent, id, pos, size, n, choices, style, validator, name);
41 }
42
584ad2a3
MB
43 wxListBox(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos,
45 const wxSize& size,
46 const wxArrayString& choices,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxListBoxNameStr)
50 {
51 Create(parent, id, pos, size, choices, style, validator, name);
52 }
53
bfc6fde4 54 bool Create(wxWindow *parent, wxWindowID id,
83df96d6
JS
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 int n = 0, const wxString choices[] = NULL,
58 long style = 0,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString& name = wxListBoxNameStr);
61
584ad2a3
MB
62 bool Create(wxWindow *parent, wxWindowID id,
63 const wxPoint& pos,
64 const wxSize& size,
65 const wxArrayString& choices,
66 long style = 0,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxListBoxNameStr);
69
bfc6fde4 70 ~wxListBox();
83df96d6 71
ef41d80c 72 // implementation of wxControlWithItems
6adaedf0
JS
73 virtual int GetCount() const;
74 virtual int DoAppend(const wxString& item);
99ab3e3f
MB
75 virtual void DoSetItemClientData(int n, void* clientData);
76 virtual void* DoGetItemClientData(int n) const;
77 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
78 virtual wxClientData* DoGetItemClientObject(int n) const;
ef41d80c
MB
79 virtual int GetSelection() const;
80 virtual void Delete(int n);
81 virtual int FindString(const wxString& s) const;
82 virtual void Clear();
83 virtual void SetString(int n, const wxString& s);
84 virtual wxString GetString(int n) const;
85
86 // implementation of wxListBoxbase
c6179a84 87 virtual void DoSetSelection(int n, bool select);
6adaedf0
JS
88 virtual void DoInsertItems(const wxArrayString& items, int pos);
89 virtual void DoSetItems(const wxArrayString& items, void **clientData);
90 virtual void DoSetFirstItem(int n);
bfc6fde4 91 virtual int GetSelections(wxArrayInt& aSelections) const;
ef41d80c 92 virtual bool IsSelected(int n) const;
18128cbb 93
ef41d80c 94 // For single or multiple choice list item
bfc6fde4 95 void Command(wxCommandEvent& event);
83df96d6 96
bfc6fde4 97 // Implementation
bfc6fde4
VZ
98 virtual void ChangeBackgroundColour();
99 virtual void ChangeForegroundColour();
100 WXWidget GetTopWidget() const;
ef41d80c
MB
101
102#if wxUSE_CHECKLISTBOX
103 virtual void DoToggleItem(int item, int x) {};
104#endif
f97c9854 105protected:
e1aae528
MB
106 virtual wxSize DoGetBestSize() const;
107
bfc6fde4 108 int m_noItems;
83df96d6 109
bfc6fde4 110 // List mapping positions->client data
99ab3e3f
MB
111 wxClientDataDictionary m_clientDataDict;
112private:
113 void SetSelectionPolicy();
9b6dbb09
JS
114};
115
116#endif
83df96d6 117// _WX_LISTBOX_H_