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