]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/listbox.h
const added to GetBitmap it was my fault.
[wxWidgets.git] / include / wx / msw / listbox.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: listbox.h
3// Purpose: wxListBox class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
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#if USE_OWNER_DRAWN
24 class WXDLLEXPORT wxOwnerDrawn;
25
26 // define the array of list box items
27 #include <wx/dynarray.h>
28 WX_DEFINE_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
29#endif
30
31// forward decl for GetSelections()
32class wxArrayInt;
33
34WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
35
36// List box item
37class WXDLLEXPORT wxListBox: public wxControl
38{
39 DECLARE_DYNAMIC_CLASS(wxListBox)
40 public:
41
42 wxListBox(void);
43 inline wxListBox(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 int n = 0, const wxString choices[] = NULL,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxListBoxNameStr)
50 {
51 Create(parent, id, pos, size, n, choices, style, validator, name);
52 }
53
54 bool Create(wxWindow *parent, wxWindowID id,
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
62 ~wxListBox();
63
64 bool MSWCommand(WXUINT param, WXWORD id);
65
66#if USE_OWNER_DRAWN
67 bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
68 bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
69
70 // plug-in for derived classes
71 virtual wxOwnerDrawn *CreateItem(size_t n);
72
73 // allows to get the item and use SetXXX functions to set it's appearance
74 wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
75#endif
76
77 virtual void Append(const wxString& item);
78 virtual void Append(const wxString& item, char *clientData);
79 virtual void Set(int n, const wxString* choices, char **clientData = NULL);
80 virtual int FindString(const wxString& s) const ;
81 virtual void Clear(void);
82 virtual void SetSelection(int n, bool select = TRUE);
83
84 virtual void Deselect(int n);
85
86 // For single choice list item only
87 virtual int GetSelection() const ;
88 virtual void Delete(int n);
89 virtual char *GetClientData(int n) const ;
90 virtual void SetClientData(int n, char *clientData);
91 virtual void SetString(int n, const wxString& s);
92
93 // For single or multiple choice list item
94 virtual int GetSelections(wxArrayInt& aSelections) const;
95 virtual bool Selected(int n) const ;
96 virtual wxString GetString(int n) const ;
97 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
98
99 // Set the specified item at the first visible item
100 // or scroll to max range.
101 virtual void SetFirstItem(int n) ;
102 virtual void SetFirstItem(const wxString& s) ;
103
104 virtual void InsertItems(int nItems, const wxString items[], int pos);
105
106 virtual wxString GetStringSelection(void) const ;
107 virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
108 virtual int Number(void) const ;
109
110 void Command(wxCommandEvent& event);
111
112 // Windows-specific code to set the horizontal extent of
113 // the listbox, if necessary. If s is non-NULL, it's
114 // used to calculate the horizontal extent.
115 // Otherwise, all strings are used.
116 virtual void SetHorizontalExtent(const wxString& s = wxEmptyString);
117
118 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
119 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
120
121 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
122 virtual void SetupColours(void);
123
124 protected:
125 int m_noItems;
126 int m_selected;
127
128#if USE_OWNER_DRAWN
129 // control items
130 wxListBoxItemsArray m_aItems;
131#endif
132
133};
134
135#endif
136 // _WX_LISTBOX_H_