]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/choice.h
Applied patch [ 670782 ] Combobox uses popup window width
[wxWidgets.git] / include / wx / motif / choice.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: choice.h
3// Purpose: wxChoice 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_CHOICE_H_
13#define _WX_CHOICE_H_
14
15#ifdef __GNUG__
16#pragma interface "choice.h"
17#endif
18
9b6dbb09
JS
19WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
20
ec75d791
MB
21#include "wx/clntdata.h"
22#include "wx/dynarray.h"
23
24WX_DEFINE_ARRAY(WXWidget, wxWidgetArray);
25
9b6dbb09 26// Choice item
c33c81c3 27class WXDLLEXPORT wxChoice: public wxChoiceBase
9b6dbb09 28{
bfc6fde4 29 DECLARE_DYNAMIC_CLASS(wxChoice)
ec75d791 30
bfc6fde4
VZ
31public:
32 wxChoice();
33 ~wxChoice();
83df96d6 34
bfc6fde4 35 wxChoice(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 = wxChoiceNameStr)
bfc6fde4 42 {
ec75d791 43 Init();
bfc6fde4
VZ
44 Create(parent, id, pos, size, n, choices, style, validator, name);
45 }
83df96d6 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 = wxChoiceNameStr);
ec75d791
MB
54
55 // implementation of wxControlWithItems
6adaedf0
JS
56 virtual int GetCount() const;
57 virtual int DoAppend(const wxString& item);
6adaedf0
JS
58 virtual void DoSetItemClientData(int n, void* clientData);
59 virtual void* DoGetItemClientData(int n) const;
60 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
61 virtual wxClientData* DoGetItemClientObject(int n) const;
ec75d791 62 virtual int GetSelection() const;
bfc6fde4 63 virtual void Delete(int n);
ec75d791 64 virtual int FindString(const wxString& s) const;
bfc6fde4 65 virtual void Clear();
ec75d791
MB
66 virtual void SetString(int n, const wxString& s);
67 virtual wxString GetString(int n) const;
68
69 // implementation of wxChoiceBase
bfc6fde4 70 virtual void SetSelection(int n);
bfc6fde4
VZ
71 virtual void SetColumns(int n = 1 );
72 virtual int GetColumns() const ;
83df96d6 73
ec75d791
MB
74 // Original API
75 virtual void Command(wxCommandEvent& event);
76
bfc6fde4 77 void SetFocus();
83df96d6 78
bfc6fde4
VZ
79 // Implementation
80 virtual void ChangeFont(bool keepOriginalSize = TRUE);
81 virtual void ChangeBackgroundColour();
82 virtual void ChangeForegroundColour();
83 WXWidget GetTopWidget() const { return m_formWidget; }
84 WXWidget GetMainWidget() const { return m_buttonWidget; }
ec75d791
MB
85
86 virtual wxSize DoGetBestSize() const;
87
88 // implementation, for wxChoiceCallback
89 const wxWidgetArray& GetWidgets() const { return m_widgetArray; }
90 const wxStringList& GetStrings() const { return m_stringList; }
9b6dbb09 91protected:
ec75d791
MB
92 // minimum size for the text ctrl
93 wxSize GetItemsSize() const;
94 // common part of all contructors
95 void Init();
96
fd304d98 97 size_t m_noStrings;
bfc6fde4
VZ
98 WXWidget m_menuWidget;
99 WXWidget m_buttonWidget;
ec75d791 100 wxWidgetArray m_widgetArray;
bfc6fde4
VZ
101 WXWidget m_formWidget;
102 wxStringList m_stringList;
ec75d791 103 wxClientDataDictionary m_clientDataDict;
83df96d6 104
bfc6fde4 105 virtual void DoSetSize(int x, int y,
83df96d6
JS
106 int width, int height,
107 int sizeFlags = wxSIZE_AUTO);
9b6dbb09
JS
108};
109
110#endif
83df96d6 111// _WX_CHOICE_H_