1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: combobox.h
|
|
|
|
// 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
|
1998-05-20 10:01:55 -04:00
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKCOMBOBOXH__
|
|
|
|
#define __GTKCOMBOBOXH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1998-06-22 10:40:59 -04:00
|
|
|
#pragma interface "combobox.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#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"
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxComboBox;
|
|
|
|
|
1998-05-30 13:11:51 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2002-08-05 14:04:08 -04:00
|
|
|
extern const wxChar* wxComboBoxNameStr;
|
1999-04-12 18:20:19 -04:00
|
|
|
extern const wxChar* wxEmptyString;
|
1998-05-30 13:11:51 -04:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxComboBox
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
class wxComboBox : public wxControl
|
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);
|
|
|
|
}
|
|
|
|
~wxComboBox();
|
|
|
|
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);
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void Append( const wxString &item );
|
|
|
|
void Append( const wxString &item, void* clientData );
|
|
|
|
void Append( const wxString &item, wxClientData* clientData );
|
1998-11-06 03:50:52 -05:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void SetClientData( int n, void* clientData );
|
|
|
|
void* GetClientData( int n );
|
|
|
|
void SetClientObject( int n, wxClientData* clientData );
|
|
|
|
wxClientData* GetClientObject( int n );
|
1998-11-06 03:50:52 -05:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); }
|
|
|
|
wxClientData *GetClientObject() const { return wxControl::GetClientObject(); }
|
|
|
|
void SetClientData( void *data ) { wxControl::SetClientData( data ); }
|
|
|
|
void *GetClientData() const { return wxControl::GetClientData(); }
|
1999-05-12 16:26:54 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void Clear();
|
|
|
|
void Delete( int n );
|
1998-09-06 09:46:50 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
int FindString( const wxString &item );
|
|
|
|
int GetSelection() const;
|
|
|
|
wxString GetString( int n ) const;
|
|
|
|
wxString GetStringSelection() const;
|
2001-06-26 16:59:19 -04:00
|
|
|
int GetCount() const { return Number(); }
|
1999-10-11 06:05:36 -04:00
|
|
|
int Number() const;
|
|
|
|
void SetSelection( int n );
|
|
|
|
void SetStringSelection( const wxString &string );
|
|
|
|
|
|
|
|
wxString GetValue() const;
|
|
|
|
void SetValue(const wxString& value);
|
|
|
|
|
|
|
|
void Copy();
|
|
|
|
void Cut();
|
|
|
|
void Paste();
|
|
|
|
void SetInsertionPoint( long pos );
|
|
|
|
void SetInsertionPointEnd();
|
|
|
|
long GetInsertionPoint() const;
|
|
|
|
long GetLastPosition() const;
|
|
|
|
void Replace( long from, long to, const wxString& value );
|
|
|
|
void Remove( long from, long to );
|
|
|
|
void SetSelection( long from, long to );
|
|
|
|
void SetEditable( bool editable );
|
1998-09-06 09:46:50 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
// implementation
|
1998-09-06 09:46:50 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
void OnSize( wxSizeEvent &event );
|
|
|
|
void OnChar( wxKeyEvent &event );
|
1998-07-31 16:04:04 -04:00
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
bool m_alreadySent;
|
|
|
|
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();
|
|
|
|
void AppendCommon( const wxString &item );
|
|
|
|
GtkWidget* GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
|
|
|
void ApplyWidgetStyle();
|
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
protected:
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
1999-10-11 06:05:36 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
|
|
|
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__
|