]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/listbox.h
typo fixed
[wxWidgets.git] / include / wx / motif / listbox.h
... / ...
CommitLineData
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
19#include "wx/control.h"
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
29class WXDLLEXPORT wxListBox: public wxControl
30{
31DECLARE_DYNAMIC_CLASS(wxListBox)
32
33public:
34 wxListBox();
35 wxListBox(wxWindow *parent, wxWindowID id,
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
47 bool Create(wxWindow *parent, wxWindowID id,
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
55 ~wxListBox();
56
57 virtual void Append(const wxString& item);
58 virtual void Append(const wxString& item, void *clientData);
59 virtual void Set(int n, const wxString* choices, void **clientData = NULL);
60 virtual int FindString(const wxString& s) const ;
61 virtual void Clear();
62 virtual void SetSelection(int n, bool select = TRUE);
63
64 virtual void Deselect(int n);
65
66 // For single choice list item only
67 virtual int GetSelection() const ;
68 virtual void Delete(int n);
69 virtual void *GetClientData(int n) const ;
70 virtual void *GetClientData() { return wxWindow::GetClientData(); }
71 virtual void SetClientData(int n, void *clientData);
72 virtual void SetClientData( void *data ) { wxWindow::SetClientData(data); }
73 virtual void SetString(int n, const wxString& s);
74
75 // For single or multiple choice list item
76 virtual int GetSelections(wxArrayInt& aSelections) const;
77 virtual bool Selected(int n) const ;
78 virtual wxString GetString(int n) const ;
79
80 // Set the specified item at the first visible item
81 // or scroll to max range.
82 virtual void SetFirstItem(int n) ;
83 virtual void SetFirstItem(const wxString& s) ;
84
85 virtual void InsertItems(int nItems, const wxString items[], int pos);
86
87 virtual wxString GetStringSelection() const ;
88 virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
89 virtual int Number() const ;
90
91 void Command(wxCommandEvent& event);
92
93 // Implementation
94 virtual void ChangeFont(bool keepOriginalSize = TRUE);
95 virtual void ChangeBackgroundColour();
96 virtual void ChangeForegroundColour();
97 WXWidget GetTopWidget() const;
98
99protected:
100 int m_noItems;
101 int m_selected;
102
103 // List mapping positions->client data
104 wxList m_clientDataList;
105
106 virtual void DoSetSize(int x, int y,
107 int width, int height,
108 int sizeFlags = wxSIZE_AUTO);
109};
110
111#endif
112 // _WX_LISTBOX_H_