]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/combobox.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / motif / combobox.h
CommitLineData
9b6dbb09 1/////////////////////////////////////////////////////////////////////////////
853dcc57 2// Name: wx/motif/combobox.h
9b6dbb09
JS
3// Purpose: wxComboBox class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
9b6dbb09 7// Copyright: (c) Julian Smart
7d8268a1 8// Licence: wxWindows licence
9b6dbb09
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_COMBOBOX_H_
12#define _WX_COMBOBOX_H_
13
9b6dbb09 14#include "wx/choice.h"
978c6e41 15#include "wx/textentry.h"
9b6dbb09 16
9b6dbb09 17// Combobox item
53a2db12 18class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
978c6e41 19 public wxTextEntry
9b6dbb09 20{
bfc6fde4 21public:
d8d18184 22 wxComboBox() { m_inSetSelection = false; }
d3c7fc99 23 virtual ~wxComboBox();
7d8268a1 24
bfc6fde4 25 inline wxComboBox(wxWindow *parent, wxWindowID id,
83df96d6
JS
26 const wxString& value = wxEmptyString,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 int n = 0, const wxString choices[] = NULL,
30 long style = 0,
31 const wxValidator& validator = wxDefaultValidator,
32 const wxString& name = wxComboBoxNameStr)
bfc6fde4 33 {
d8d18184 34 m_inSetSelection = false;
ec75d791
MB
35 Create(parent, id, value, pos, size, n, choices,
36 style, validator, name);
bfc6fde4 37 }
7d8268a1 38
584ad2a3
MB
39 inline wxComboBox(wxWindow *parent, wxWindowID id,
40 const wxString& value,
41 const wxPoint& pos,
42 const wxSize& size,
43 const wxArrayString& choices,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxComboBoxNameStr)
47 {
48 m_inSetSelection = false;
49 Create(parent, id, value, pos, size, choices,
50 style, validator, name);
51 }
7d8268a1 52
bfc6fde4 53 bool Create(wxWindow *parent, wxWindowID id,
83df96d6
JS
54 const wxString& value = wxEmptyString,
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 = wxComboBoxNameStr);
7d8268a1 61
584ad2a3
MB
62 bool Create(wxWindow *parent, wxWindowID id,
63 const wxString& value,
64 const wxPoint& pos,
65 const wxSize& size,
66 const wxArrayString& choices,
67 long style = 0,
68 const wxValidator& validator = wxDefaultValidator,
69 const wxString& name = wxComboBoxNameStr);
7d8268a1 70
36a96421
VZ
71 // See wxComboBoxBase discussion of IsEmpty().
72 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
73 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
74
978c6e41
VZ
75 // resolve ambiguities among virtual functions inherited from both base
76 // classes
77 virtual void Clear();
78 virtual wxString GetValue() const { return wxTextEntry::GetValue(); }
79 virtual void SetValue(const wxString& value);
80 virtual wxString GetStringSelection() const
81 { return wxChoice::GetStringSelection(); }
82
83 virtual void SetSelection(long from, long to)
84 { wxTextEntry::SetSelection(from, to); }
85 virtual void GetSelection(long *from, long *to) const
86 { wxTextEntry::GetSelection(from, to); }
87
88
ec75d791 89 // implementation of wxControlWithItems
a236aa20
VZ
90 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
91 unsigned int pos,
92 void **clientData, wxClientDataType type);
93 virtual void DoDeleteOneItem(unsigned int n);
bfc6fde4
VZ
94 virtual int GetSelection() const ;
95 virtual void SetSelection(int n);
853dcc57 96 virtual int FindString(const wxString& s, bool bCase = false) const;
aa61d352
VZ
97 virtual wxString GetString(unsigned int n) const ;
98 virtual void SetString(unsigned int n, const wxString& s);
9b1bd0c6 99
bfc6fde4 100 // Implementation
7d8268a1 101 virtual void ChangeFont(bool keepOriginalSize = true);
bfc6fde4
VZ
102 virtual void ChangeBackgroundColour();
103 virtual void ChangeForegroundColour();
104 WXWidget GetTopWidget() const { return m_mainWidget; }
105 WXWidget GetMainWidget() const { return m_mainWidget; }
ec75d791 106
7a3c45f2 107 //Copied from wxComboBoxBase because for wxMOTIF wxComboBox does not inherit from it.
6dd0883d
SN
108 virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
109 virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
7a3c45f2 110
bfc6fde4 111protected:
978c6e41 112 virtual wxSize DoGetBestSize() const;
bfc6fde4 113 virtual void DoSetSize(int x, int y,
978c6e41
VZ
114 int width, int height,
115 int sizeFlags = wxSIZE_AUTO);
116
63f7d502
VZ
117 // implement wxTextEntry pure virtual methods
118 virtual wxWindow *GetEditableWindow() { return this; }
978c6e41
VZ
119 virtual WXWidget GetTextWidget() const;
120
e1aae528
MB
121private:
122 // only implemented for native combo box
123 void AdjustDropDownListSize();
d8d18184
MB
124
125 // implementation detail, should really be private
126public:
127 bool m_inSetSelection;
978c6e41
VZ
128
129 DECLARE_DYNAMIC_CLASS(wxComboBox)
9b6dbb09
JS
130};
131
978c6e41 132#endif // _WX_COMBOBOX_H_