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
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-07-02 18:02:05 -04:00
|
|
|
#pragma interface "combobox.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/choice.h"
|
|
|
|
|
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
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
class WXDLLEXPORT wxComboBox: public wxChoice
|
|
|
|
{
|
1999-07-02 18:02:05 -04:00
|
|
|
public:
|
2004-09-15 19:07:15 -04:00
|
|
|
wxComboBox() { Init(); }
|
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)
|
|
|
|
{
|
2004-09-15 19:07:15 -04:00
|
|
|
Init();
|
|
|
|
|
2004-01-15 08:49:22 -05:00
|
|
|
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)
|
|
|
|
{
|
2004-09-15 19:07:15 -04:00
|
|
|
Init();
|
|
|
|
|
2004-01-31 13:21:45 -05:00
|
|
|
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
|
|
|
|
|
|
|
// List functions: see wxChoice
|
|
|
|
|
|
|
|
// Text field functions
|
2004-09-15 19:07:15 -04:00
|
|
|
wxString GetValue() const { return m_value; }
|
1999-07-02 18:02:05 -04:00
|
|
|
virtual void SetValue(const wxString& value);
|
|
|
|
|
|
|
|
// Clipboard operations
|
|
|
|
virtual void Copy();
|
|
|
|
virtual void Cut();
|
|
|
|
virtual void Paste();
|
2004-12-09 10:16:51 -05:00
|
|
|
virtual bool CanCopy() const;
|
|
|
|
virtual bool CanCut() const;
|
|
|
|
virtual bool CanPaste() const;
|
1999-07-02 18:02:05 -04:00
|
|
|
virtual void SetInsertionPoint(long pos);
|
|
|
|
virtual void SetInsertionPointEnd();
|
|
|
|
virtual long GetInsertionPoint() const;
|
2005-01-19 11:25:34 -05:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
1999-07-02 18:02:05 -04:00
|
|
|
virtual void Replace(long from, long to, const wxString& value);
|
|
|
|
virtual void Remove(long from, long to);
|
|
|
|
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
|
|
|
|
virtual void SetSelection(long from, long to);
|
2004-11-19 02:46:34 -05:00
|
|
|
virtual int GetSelection() const;
|
|
|
|
virtual void GetSelection(long* from, long* to) const;
|
1999-07-02 18:02:05 -04:00
|
|
|
virtual void SetEditable(bool editable);
|
2004-11-10 14:17:40 -05:00
|
|
|
virtual void Clear() { wxChoice::Clear(); m_selectionOld = -1; }
|
1999-07-02 18:02:05 -04:00
|
|
|
|
2004-12-09 10:16:51 -05:00
|
|
|
virtual void Undo() ;
|
|
|
|
virtual void Redo() ;
|
|
|
|
virtual bool CanUndo() const;
|
|
|
|
virtual bool CanRedo() const;
|
|
|
|
virtual void SelectAll();
|
|
|
|
virtual bool IsEditable() const ;
|
|
|
|
virtual bool HasSelection() const;
|
|
|
|
|
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);
|
2004-02-07 19:59:23 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
WXHWND GetEditHWND() const;
|
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
|
|
|
protected:
|
|
|
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
2005-01-21 09:39:29 -05:00
|
|
|
virtual void DoSetSize(int x, int y,
|
|
|
|
int width, int height,
|
|
|
|
int sizeFlags = wxSIZE_AUTO);
|
2004-02-07 14:26:22 -05:00
|
|
|
|
2004-09-15 19:07:15 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init() { m_selectionOld = -1; }
|
|
|
|
|
|
|
|
|
|
|
|
// the previous selection (see MSWCommand() to see why it is needed)
|
|
|
|
int m_selectionOld;
|
|
|
|
|
|
|
|
// the current selection (also see MSWCommand())
|
|
|
|
wxString m_value;
|
|
|
|
|
2003-07-21 20:24:07 -04:00
|
|
|
private:
|
|
|
|
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
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_COMBOBOX_H_
|