1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-23 02:28:01 +00:00
|
|
|
// Name: wx/gtk1/combobox.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Created: 01/02/97
|
1998-06-22 14:40:59 +00:00
|
|
|
// Id: $Id$
|
1998-10-26 10:56:58 +00:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2005-01-19 16:25:34 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKCOMBOBOXH__
|
|
|
|
#define __GTKCOMBOBOXH__
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-01-04 13:52:06 +00:00
|
|
|
|
1999-06-14 23:04:05 +00:00
|
|
|
#if wxUSE_COMBOBOX
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/object.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1998-05-30 17:11:51 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2006-01-16 14:59:55 +00:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[];
|
2005-08-02 22:58:06 +00:00
|
|
|
extern WXDLLIMPEXP_BASE const wxChar* wxEmptyString;
|
1998-05-30 17:11:51 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxComboBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
|
1998-05-30 17:11:51 +00:00
|
|
|
{
|
1998-11-06 08:50:52 +00:00
|
|
|
public:
|
1999-10-11 10:05:36 +00:00
|
|
|
inline wxComboBox() {}
|
|
|
|
inline wxComboBox(wxWindow *parent, wxWindowID id,
|
1998-05-30 17:11:51 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-08-23 03:22:56 +00:00
|
|
|
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
1998-07-04 15:17:59 +00:00
|
|
|
long style = 0,
|
1998-08-14 10:07:38 +00:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
1998-05-30 17:11:51 +00:00
|
|
|
const wxString& name = wxComboBoxNameStr)
|
1999-10-11 10:05:36 +00:00
|
|
|
{
|
|
|
|
Create(parent, id, value, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 18:21:45 +00: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 16:31:06 +00:00
|
|
|
|
2006-09-05 20:47:48 +00:00
|
|
|
virtual ~wxComboBox();
|
2003-09-20 16:31:06 +00:00
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
1998-05-30 17:11:51 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
1998-08-23 03:22:56 +00:00
|
|
|
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
1998-07-04 15:17:59 +00:00
|
|
|
long style = 0,
|
1998-08-14 10:07:38 +00:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
1998-05-30 17:11:51 +00:00
|
|
|
const wxString& name = wxComboBoxNameStr);
|
2004-01-31 18:21:45 +00: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 17:11:51 +00:00
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
void Clear();
|
2006-03-23 22:05:23 +00:00
|
|
|
void Delete(unsigned int n);
|
2003-07-09 21:55:04 +00:00
|
|
|
|
2005-09-27 16:54:43 +00:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
1999-10-11 10:05:36 +00:00
|
|
|
int GetSelection() const;
|
2005-08-17 14:22:41 +00:00
|
|
|
int GetCurrentSelection() const;
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual wxString GetString(unsigned int n) const;
|
1999-10-11 10:05:36 +00:00
|
|
|
wxString GetStringSelection() const;
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual unsigned int GetCount() const;
|
|
|
|
virtual void SetSelection(int n);
|
|
|
|
virtual void SetString(unsigned int n, const wxString &text);
|
1999-10-11 10:05:36 +00:00
|
|
|
|
|
|
|
wxString GetValue() const;
|
|
|
|
void SetValue(const wxString& value);
|
|
|
|
|
|
|
|
void Copy();
|
|
|
|
void Cut();
|
|
|
|
void Paste();
|
2004-12-09 15:16:51 +00:00
|
|
|
bool CanCopy() const;
|
|
|
|
bool CanCut() const;
|
|
|
|
bool CanPaste() const;
|
1999-10-11 10:05:36 +00:00
|
|
|
void SetInsertionPoint( long pos );
|
2003-09-20 16:31:06 +00:00
|
|
|
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
1999-10-11 10:05:36 +00:00
|
|
|
long GetInsertionPoint() const;
|
2005-01-19 16:25:34 +00:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
2003-09-20 16:31:06 +00:00
|
|
|
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
1999-10-11 10:05:36 +00:00
|
|
|
void Replace( long from, long to, const wxString& value );
|
|
|
|
void SetSelection( long from, long to );
|
2004-12-09 15:16:51 +00:00
|
|
|
void GetSelection( long* from, long* to ) const;
|
1999-10-11 10:05:36 +00:00
|
|
|
void SetEditable( bool editable );
|
2004-12-09 15:16:51 +00:00
|
|
|
void Undo() ;
|
|
|
|
void Redo() ;
|
|
|
|
bool CanUndo() const;
|
|
|
|
bool CanRedo() const;
|
|
|
|
void SelectAll();
|
2004-12-09 15:27:54 +00:00
|
|
|
bool IsEditable() const ;
|
2004-12-09 15:16:51 +00:00
|
|
|
bool HasSelection() const ;
|
2003-07-09 21:55:04 +00:00
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
// implementation
|
2003-07-09 21:55:04 +00:00
|
|
|
|
2002-12-04 14:11:26 +00:00
|
|
|
virtual void SetFocus();
|
2003-07-09 21:55:04 +00:00
|
|
|
|
1999-10-11 10:05:36 +00:00
|
|
|
void OnSize( wxSizeEvent &event );
|
|
|
|
void OnChar( wxKeyEvent &event );
|
2003-07-09 21:55:04 +00:00
|
|
|
|
2004-12-09 15:16:51 +00: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);
|
|
|
|
|
2004-12-08 22:08:28 +00:00
|
|
|
bool m_ignoreNextUpdate:1;
|
1999-10-11 10:05:36 +00:00
|
|
|
wxList m_clientDataList;
|
|
|
|
wxList m_clientObjectList;
|
2001-08-06 21:06:13 +00:00
|
|
|
int m_prevSelection;
|
1999-10-11 10:05:36 +00:00
|
|
|
|
|
|
|
void DisableEvents();
|
|
|
|
void EnableEvents();
|
|
|
|
GtkWidget* GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
2004-06-14 17:34:00 +00:00
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
2003-07-09 21:55:04 +00:00
|
|
|
|
2003-09-20 16:31:06 +00:00
|
|
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
|
|
|
|
2004-05-06 17:26:25 +00:00
|
|
|
static wxVisualAttributes
|
|
|
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
2004-12-09 15:16:51 +00:00
|
|
|
|
1999-11-19 21:01:20 +00:00
|
|
|
protected:
|
2003-09-20 16:31:06 +00:00
|
|
|
virtual int DoAppend(const wxString& item);
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual int DoInsert(const wxString& item, unsigned int pos);
|
2003-09-20 16:31:06 +00:00
|
|
|
|
2006-03-23 22:05:23 +00:00
|
|
|
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
|
|
|
virtual void* DoGetItemClientData(unsigned int n) const;
|
|
|
|
virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
|
|
|
|
virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
|
2003-09-20 16:31:06 +00:00
|
|
|
|
1999-11-19 21:01:20 +00:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
2004-05-06 17:26:25 +00: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 21:55:04 +00:00
|
|
|
private:
|
2003-09-20 16:31:06 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
|
1999-10-11 10:05:36 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-30 17:11:51 +00:00
|
|
|
};
|
|
|
|
|
1999-06-14 23:04:05 +00:00
|
|
|
#endif
|
|
|
|
|
1999-01-04 13:52:06 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// __GTKCOMBOBOXH__
|