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
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern const char* 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
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
public:
|
1998-05-30 13:11:51 -04:00
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
inline wxComboBox() {}
|
1998-07-04 11:17:59 -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)
|
|
|
|
{
|
1998-08-14 06:07:38 -04:00
|
|
|
Create(parent, id, value, pos, size, n, choices, style, validator, name);
|
1998-05-30 13:11:51 -04:00
|
|
|
}
|
1998-11-06 03:50:52 -05:00
|
|
|
~wxComboBox();
|
1998-07-04 11:17:59 -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);
|
|
|
|
|
|
|
|
void Append( const wxString &item );
|
1998-11-06 03:50:52 -05:00
|
|
|
void Append( const wxString &item, void* clientData );
|
|
|
|
void Append( const wxString &item, wxClientData* clientData );
|
|
|
|
|
|
|
|
void SetClientData( int n, void* clientData );
|
|
|
|
void* GetClientData( int n );
|
|
|
|
void SetClientObject( int n, wxClientData* clientData );
|
|
|
|
wxClientData* GetClientObject( int n );
|
|
|
|
|
1999-05-12 16:26:54 -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(); }
|
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
void Clear();
|
1998-07-04 11:17:59 -04:00
|
|
|
void Delete( int n );
|
1998-11-06 03:50:52 -05:00
|
|
|
|
1998-05-30 13:11:51 -04:00
|
|
|
int FindString( const wxString &item );
|
1998-11-06 03:50:52 -05:00
|
|
|
int GetSelection() const;
|
1998-07-04 11:17:59 -04:00
|
|
|
wxString GetString( int n ) const;
|
1998-11-06 03:50:52 -05:00
|
|
|
wxString GetStringSelection() const;
|
|
|
|
int Number() const;
|
1998-07-04 11:17:59 -04:00
|
|
|
void SetSelection( int n );
|
1998-07-31 16:04:04 -04:00
|
|
|
void SetStringSelection( const wxString &string );
|
1998-07-04 11:17:59 -04:00
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
wxString GetValue() const;
|
1998-05-30 13:11:51 -04:00
|
|
|
void SetValue(const wxString& value);
|
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
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
|
|
|
|
1998-09-07 08:29:07 -04:00
|
|
|
void OnSize( wxSizeEvent &event );
|
1999-03-14 17:00:56 -05:00
|
|
|
void OnChar( wxKeyEvent &event );
|
1998-09-06 09:46:50 -04:00
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
// implementation
|
1998-09-06 09:46:50 -04:00
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
bool m_alreadySent;
|
|
|
|
wxList m_clientDataList;
|
1998-11-06 08:13:43 -05:00
|
|
|
wxList m_clientObjectList;
|
1998-09-07 08:29:07 -04:00
|
|
|
|
1998-11-06 03:50:52 -05:00
|
|
|
void AppendCommon( const wxString &item );
|
|
|
|
GtkWidget* GetConnectWidget();
|
|
|
|
bool IsOwnGtkWindow( GdkWindow *window );
|
|
|
|
void ApplyWidgetStyle();
|
1998-07-31 16:04:04 -04:00
|
|
|
|
1998-09-07 08:29:07 -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__
|