1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-09-27 12:54:43 -04:00
|
|
|
// Name: wx/gtk/combobox.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 01/02/97
|
1998-06-22 10:40:59 -04:00
|
|
|
// Id: $Id$
|
1998-10-26 05:56:58 -05:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2005-01-19 11:25:34 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#ifndef _WX_GTK_COMBOBOX_H_
|
|
|
|
#define _WX_GTK_COMBOBOX_H_
|
1998-05-30 13:11:51 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxComboBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
|
1998-05-30 13:11:51 -04:00
|
|
|
{
|
1998-11-06 03:50:52 -05:00
|
|
|
public:
|
2007-07-26 09:54:14 -04:00
|
|
|
inline wxComboBox() { m_strings = NULL; }
|
1999-10-11 06:05:36 -04:00
|
|
|
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
1998-05-30 13:11:51 -04:00
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-08-22 23:22:56 -04:00
|
|
|
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
1998-07-04 11:17:59 -04:00
|
|
|
long style = 0,
|
1998-08-14 06:07:38 -04:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
1998-05-30 13:11:51 -04:00
|
|
|
const wxString& name = wxComboBoxNameStr)
|
1999-10-11 06:05:36 -04:00
|
|
|
{
|
|
|
|
Create(parent, id, value, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05:00
|
|
|
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, value, pos, size, choices, style, validator, name);
|
|
|
|
}
|
2003-09-20 12:31:06 -04:00
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxComboBox();
|
2003-09-20 12:31:06 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
1998-05-30 13:11:51 -04:00
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-08-22 23:22:56 -04:00
|
|
|
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
1998-07-04 11:17:59 -04:00
|
|
|
long style = 0,
|
1998-08-14 06:07:38 -04:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
1998-05-30 13:11:51 -04:00
|
|
|
const wxString& name = wxComboBoxNameStr);
|
2004-01-31 13:21:45 -05:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxComboBoxNameStr);
|
1998-05-30 13:11:51 -04:00
|
|
|
|
2006-04-28 20:46:05 -04:00
|
|
|
// From wxItemContainerImmutable:
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual unsigned int GetCount() const;
|
2006-04-28 20:46:05 -04:00
|
|
|
virtual wxString GetString(unsigned int n) const;
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void SetString(unsigned int n, const wxString &text);
|
2006-04-28 20:46:05 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
|
|
|
virtual void SetSelection(int n);
|
|
|
|
virtual int GetSelection() const;
|
|
|
|
wxString GetStringSelection() const; // not a virtual in parent class
|
|
|
|
|
|
|
|
// From wxItemContainer:
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual void DoClear();
|
|
|
|
virtual void DoDeleteOneItem(unsigned int n);
|
2006-04-28 20:46:05 -04:00
|
|
|
|
|
|
|
// From wxBomboBoxBase:
|
|
|
|
virtual wxString GetValue() const;
|
|
|
|
virtual void SetValue(const wxString& value);
|
|
|
|
virtual void Copy();
|
|
|
|
virtual void Cut();
|
|
|
|
virtual void Paste();
|
|
|
|
virtual void SetInsertionPoint( long pos );
|
|
|
|
virtual long GetInsertionPoint() const;
|
2005-01-19 11:25:34 -05:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
2006-04-28 20:46:05 -04:00
|
|
|
virtual void Replace( long from, long to, const wxString& value );
|
|
|
|
virtual void SetSelection( long from, long to );
|
|
|
|
virtual void SetEditable( bool editable );
|
|
|
|
virtual void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
|
|
|
virtual void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
|
|
|
virtual bool IsEditable() const;
|
|
|
|
virtual void Undo();
|
|
|
|
virtual void Redo();
|
|
|
|
virtual void SelectAll();
|
|
|
|
virtual bool CanCopy() const;
|
|
|
|
virtual bool CanCut() const;
|
|
|
|
virtual bool CanPaste() const;
|
|
|
|
virtual bool CanUndo() const;
|
|
|
|
virtual bool CanRedo() const;
|
2003-07-09 17:55:04 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
// implementation
|
2006-04-28 20:46:05 -04:00
|
|
|
bool HasSelection() const;
|
|
|
|
void GetSelection( long* from, long* to ) const;
|
|
|
|
int GetCurrentSelection() const;
|
2003-07-09 17:55:04 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
virtual void SetFocus();
|
2003-07-09 17:55:04 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void OnSize( wxSizeEvent &event );
|
|
|
|
void OnChar( wxKeyEvent &event );
|
2003-07-09 17:55:04 -04:00
|
|
|
|
2004-12-09 10:16:51 -05:00
|
|
|
// Standard event handling
|
|
|
|
void OnCut(wxCommandEvent& event);
|
|
|
|
void OnCopy(wxCommandEvent& event);
|
|
|
|
void OnPaste(wxCommandEvent& event);
|
|
|
|
void OnUndo(wxCommandEvent& event);
|
|
|
|
void OnRedo(wxCommandEvent& event);
|
|
|
|
void OnDelete(wxCommandEvent& event);
|
|
|
|
void OnSelectAll(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnUpdateCut(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateCopy(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdatePaste(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUndo(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateRedo(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateDelete(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateSelectAll(wxUpdateUIEvent& event);
|
|
|
|
|
2007-07-26 09:54:14 -04:00
|
|
|
bool m_ignoreNextUpdate:1;
|
|
|
|
wxArrayPtrVoid m_clientData;
|
|
|
|
int m_prevSelection;
|
1999-10-11 06:05:36 -04:00
|
|
|
|
|
|
|
void DisableEvents();
|
|
|
|
void EnableEvents();
|
|
|
|
GtkWidget* GetConnectWidget();
|
2003-07-09 17:55:04 -04:00
|
|
|
|
2003-09-20 12:31:06 -04:00
|
|
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2004-12-09 10:16:51 -05:00
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
protected:
|
2006-04-28 20:46:05 -04:00
|
|
|
// From wxWindowGTK:
|
2006-08-25 08:59:28 -04:00
|
|
|
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
|
|
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
2006-04-28 20:46:05 -04:00
|
|
|
|
|
|
|
// From wxItemContainer:
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
|
|
|
unsigned int pos,
|
|
|
|
void **clientData, wxClientDataType type);
|
2006-03-23 17:05:23 -05:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
2007-07-26 09:54:14 -04:00
|
|
|
virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
|
2003-09-20 12:31:06 -04:00
|
|
|
|
2006-04-28 20:46:05 -04:00
|
|
|
// From wxControl:
|
1999-11-19 16:01:20 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2004-05-06 13:26:25 -04:00
|
|
|
// Widgets that use the style->base colour for the BG colour should
|
|
|
|
// override this and return true.
|
|
|
|
virtual bool UseGTKStyleBase() const { return true; }
|
|
|
|
|
2003-07-09 17:55:04 -04:00
|
|
|
private:
|
2007-07-26 09:54:14 -04:00
|
|
|
// this array is only used for controls with wxCB_SORT style, so only
|
|
|
|
// allocate it if it's needed (hence using pointer)
|
|
|
|
wxSortedArrayString *m_strings;
|
|
|
|
|
2003-09-20 12:31:06 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
|
1999-10-11 06:05:36 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-30 13:11:51 -04:00
|
|
|
};
|
|
|
|
|
2006-08-30 01:55:56 -04:00
|
|
|
#endif // _WX_GTK_COMBOBOX_H_
|