1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2000-07-15 15:51:35 -04:00
|
|
|
// Name: wx/msw/combobox.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxComboBox class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_COMBOBOX_H_
|
|
|
|
#define _WX_COMBOBOX_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#include "wx/choice.h"
|
2007-09-26 12:52:48 -04:00
|
|
|
#include "wx/textentry.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_COMBOBOX
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-02 18:02:05 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Combobox control
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
|
2007-09-26 12:52:48 -04:00
|
|
|
public wxTextEntry
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-07-02 18:02:05 -04:00
|
|
|
public:
|
2006-03-12 15:53:27 -05:00
|
|
|
wxComboBox() { }
|
1999-07-02 18:02:05 -04:00
|
|
|
|
|
|
|
wxComboBox(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0, const wxString choices[] = NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2004-01-15 08:49:22 -05:00
|
|
|
const wxString& name = wxComboBoxNameStr)
|
|
|
|
{
|
|
|
|
Create(parent, id, value, pos, size, n, choices, style, validator, name);
|
|
|
|
}
|
2004-01-31 13:21:45 -05:00
|
|
|
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);
|
|
|
|
}
|
1999-07-02 18:02:05 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
|
|
|
const wxString choices[] = NULL,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
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);
|
1999-07-02 18:02:05 -04:00
|
|
|
|
2007-09-26 12:52:48 -04:00
|
|
|
// resolve ambiguities among virtual functions inherited from both base
|
|
|
|
// classes
|
2007-09-27 08:49:18 -04:00
|
|
|
virtual void Clear();
|
2007-10-07 07:19:09 -04:00
|
|
|
virtual wxString GetValue() const;
|
1999-07-02 18:02:05 -04:00
|
|
|
virtual void SetValue(const wxString& value);
|
2007-09-26 12:52:48 -04:00
|
|
|
virtual wxString GetStringSelection() const
|
|
|
|
{ return wxChoice::GetStringSelection(); }
|
1999-07-02 18:02:05 -04:00
|
|
|
|
2006-03-12 15:53:27 -05:00
|
|
|
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
|
2007-09-26 12:52:48 -04:00
|
|
|
virtual void SetSelection(long from, long to)
|
|
|
|
{ wxTextEntry::SetSelection(from, to); }
|
2006-03-12 15:53:27 -05:00
|
|
|
virtual int GetSelection() const { return wxChoice::GetSelection(); }
|
2007-10-07 07:19:09 -04:00
|
|
|
virtual void GetSelection(long *from, long *to) const;
|
2007-09-26 12:52:48 -04:00
|
|
|
|
2006-03-12 15:53:27 -05:00
|
|
|
virtual bool IsEditable() const;
|
2004-12-09 10:16:51 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// implementation only from now on
|
1999-07-02 18:02:05 -04:00
|
|
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
2000-07-15 15:51:35 -04:00
|
|
|
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
|
2004-02-25 05:45:02 -05:00
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2007-05-05 09:15:47 -04:00
|
|
|
bool MSWShouldPreProcessMessage(WXMSG *pMsg);
|
2003-07-21 20:24:07 -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-02-07 14:26:22 -05:00
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
|
|
|
|
2007-10-26 02:20:23 -04:00
|
|
|
protected:
|
2007-09-26 12:23:51 -04:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
virtual void DoSetToolTip(wxToolTip *tip);
|
|
|
|
#endif
|
|
|
|
|
2007-10-07 07:19:09 -04:00
|
|
|
// this is the implementation of GetEditHWND() which can also be used when
|
|
|
|
// we don't have the edit control, it simply returns NULL then
|
|
|
|
//
|
|
|
|
// try not to use this function unless absolutely necessary (as in the
|
|
|
|
// message handling code where the edit control might not be created yet
|
|
|
|
// for the messages we receive during the control creation) as normally
|
|
|
|
// just testing for IsEditable() and using GetEditHWND() should be enough
|
|
|
|
WXHWND GetEditHWNDIfAvailable() const;
|
|
|
|
|
2003-07-21 20:24:07 -04:00
|
|
|
private:
|
2007-10-26 02:20:23 -04:00
|
|
|
// this is the overridden wxTextEntry method which should only be called
|
|
|
|
// when we do have an edit control so it asserts if this is not the case
|
|
|
|
virtual WXHWND GetEditHWND() const;
|
|
|
|
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
|
2004-12-09 10:16:51 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#endif // wxUSE_COMBOBOX
|
2007-09-26 12:52:48 -04:00
|
|
|
|
|
|
|
#endif // _WX_COMBOBOX_H_
|