1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-22 21:28:01 -05:00
|
|
|
// Name: wx/gtk1/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
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKCOMBOBOXH__
|
|
|
|
#define __GTKCOMBOBOXH__
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-01-04 08:52:06 -05:00
|
|
|
|
1999-06-14 19:04:05 -04:00
|
|
|
#if wxUSE_COMBOBOX
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#include "wx/object.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-05-30 13:11:51 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2006-01-16 09:59:55 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[];
|
2005-08-02 18:58:06 -04:00
|
|
|
extern WXDLLIMPEXP_BASE const wxChar* wxEmptyString;
|
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:
|
1999-10-11 06:05:36 -04:00
|
|
|
inline wxComboBox() {}
|
|
|
|
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
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
~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
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void Clear();
|
|
|
|
void Delete( int n );
|
2003-07-09 17:55:04 -04:00
|
|
|
|
2005-09-27 12:54:43 -04:00
|
|
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
1999-10-11 06:05:36 -04:00
|
|
|
int GetSelection() const;
|
2005-08-17 10:22:41 -04:00
|
|
|
int GetCurrentSelection() const;
|
1999-10-11 06:05:36 -04:00
|
|
|
wxString GetString( int n ) const;
|
|
|
|
wxString GetStringSelection() const;
|
2003-09-20 12:31:06 -04:00
|
|
|
int GetCount() const;
|
|
|
|
int Number() const { return GetCount(); }
|
1999-10-11 06:05:36 -04:00
|
|
|
void SetSelection( int n );
|
2003-03-01 05:00:29 -05:00
|
|
|
void SetString(int n, const wxString &text);
|
1999-10-11 06:05:36 -04:00
|
|
|
|
|
|
|
wxString GetValue() const;
|
|
|
|
void SetValue(const wxString& value);
|
|
|
|
|
|
|
|
void Copy();
|
|
|
|
void Cut();
|
|
|
|
void Paste();
|
2004-12-09 10:16:51 -05:00
|
|
|
bool CanCopy() const;
|
|
|
|
bool CanCut() const;
|
|
|
|
bool CanPaste() const;
|
1999-10-11 06:05:36 -04:00
|
|
|
void SetInsertionPoint( long pos );
|
2003-09-20 12:31:06 -04:00
|
|
|
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
1999-10-11 06:05:36 -04:00
|
|
|
long GetInsertionPoint() const;
|
2005-01-19 11:25:34 -05:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
2003-09-20 12:31:06 -04:00
|
|
|
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
1999-10-11 06:05:36 -04:00
|
|
|
void Replace( long from, long to, const wxString& value );
|
|
|
|
void SetSelection( long from, long to );
|
2004-12-09 10:16:51 -05:00
|
|
|
void GetSelection( long* from, long* to ) const;
|
1999-10-11 06:05:36 -04:00
|
|
|
void SetEditable( bool editable );
|
2004-12-09 10:16:51 -05:00
|
|
|
void Undo() ;
|
|
|
|
void Redo() ;
|
|
|
|
bool CanUndo() const;
|
|
|
|
bool CanRedo() const;
|
|
|
|
void SelectAll();
|
2004-12-09 10:27:54 -05:00
|
|
|
bool IsEditable() const ;
|
2004-12-09 10:16:51 -05:00
|
|
|
bool HasSelection() const ;
|
2003-07-09 17:55:04 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
// implementation
|
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);
|
|
|
|
|
2004-12-08 17:08:28 -05:00
|
|
|
bool m_ignoreNextUpdate:1;
|
1999-10-11 06:05:36 -04:00
|
|
|
wxList m_clientDataList;
|
|
|
|
wxList m_clientObjectList;
|
2001-08-06 17:06:13 -04:00
|
|
|
int m_prevSelection;
|
1999-10-11 06:05:36 -04:00
|
|
|
|
|
|
|
void DisableEvents();
|
|
|
|
void EnableEvents();
|
|
|
|
GtkWidget* GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
2004-06-14 13:34:00 -04:00
|
|
|
void DoApplyWidgetStyle(GtkRcStyle *style);
|
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:
|
2003-09-20 12:31:06 -04:00
|
|
|
virtual int DoAppend(const wxString& item);
|
|
|
|
virtual int DoInsert(const wxString& item, int pos);
|
|
|
|
|
|
|
|
virtual void DoSetItemClientData( int n, void* clientData );
|
|
|
|
virtual void* DoGetItemClientData( int n ) const;
|
|
|
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
|
|
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
|
|
|
|
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:
|
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
|
|
|
};
|
|
|
|
|
1999-06-14 19:04:05 -04:00
|
|
|
#endif
|
|
|
|
|
1999-01-04 08:52:06 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// __GTKCOMBOBOXH__
|