Added further 'missing' wxTextCtrl-like functions to wxComboBox
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -123,6 +123,41 @@ Creates the combobox for two-step construction. Derived classes
|
|||||||
should call or replace this function. See \helpref{wxComboBox::wxComboBox}{wxcomboboxctor}\rtfsp
|
should call or replace this function. See \helpref{wxComboBox::wxComboBox}{wxcomboboxctor}\rtfsp
|
||||||
for further details.
|
for further details.
|
||||||
|
|
||||||
|
\membersection{wxComboBox::CanCopy}\label{wxcomboboxcancopy}
|
||||||
|
|
||||||
|
\constfunc{bool}{CanCopy}{\void}
|
||||||
|
|
||||||
|
Returns true if the combobox is editable and there is a text selection to copy to the clipboard.
|
||||||
|
Only available on Windows.
|
||||||
|
|
||||||
|
\membersection{wxComboBox::CanCut}\label{wxcomboboxcancut}
|
||||||
|
|
||||||
|
\constfunc{bool}{CanCut}{\void}
|
||||||
|
|
||||||
|
Returns true if the combobox is editable and there is a text selection to copy to the clipboard.
|
||||||
|
Only available on Windows.
|
||||||
|
|
||||||
|
\membersection{wxComboBox::CanPaste}\label{wxcomboboxcanpaste}
|
||||||
|
|
||||||
|
\constfunc{bool}{CanPaste}{\void}
|
||||||
|
|
||||||
|
Returns true if the combobox is editable and there is text on the clipboard that can be pasted into the
|
||||||
|
text field. Only available on Windows.
|
||||||
|
|
||||||
|
\membersection{wxComboBox::CanRedo}\label{wxcomboboxcanredo}
|
||||||
|
|
||||||
|
\constfunc{bool}{CanRedo}{\void}
|
||||||
|
|
||||||
|
Returns true if the combobox is editable and the last undo can be redone.
|
||||||
|
Only available on Windows.
|
||||||
|
|
||||||
|
\membersection{wxComboBox::CanUndo}\label{wxcomboboxcanundo}
|
||||||
|
|
||||||
|
\constfunc{bool}{CanUndo}{\void}
|
||||||
|
|
||||||
|
Returns true if the combobox is editable and the last edit can be undone.
|
||||||
|
Only available on Windows.
|
||||||
|
|
||||||
\membersection{wxComboBox::Copy}\label{wxcomboboxcopy}
|
\membersection{wxComboBox::Copy}\label{wxcomboboxcopy}
|
||||||
|
|
||||||
\func{void}{Copy}{\void}
|
\func{void}{Copy}{\void}
|
||||||
@@ -159,6 +194,12 @@ Returns the current value in the combobox text field.
|
|||||||
|
|
||||||
Pastes text from the clipboard to the text field.
|
Pastes text from the clipboard to the text field.
|
||||||
|
|
||||||
|
\membersection{wxComboBox::Redo}\label{wxcomboboxredo}
|
||||||
|
|
||||||
|
\func{void}{Redo}{\void}
|
||||||
|
|
||||||
|
Redoes the last undo in the text field. Windows only.
|
||||||
|
|
||||||
\membersection{wxComboBox::Replace}\label{wxcomboboxreplace}
|
\membersection{wxComboBox::Replace}\label{wxcomboboxreplace}
|
||||||
|
|
||||||
\func{void}{Replace}{\param{long}{ from}, \param{long}{ to}, \param{const wxString\& }{text}}
|
\func{void}{Replace}{\param{long}{ from}, \param{long}{ to}, \param{const wxString\& }{text}}
|
||||||
@@ -230,4 +271,9 @@ the combobox choices list, otherwise the call to SetValue() is ignored.
|
|||||||
|
|
||||||
\docparam{text}{The text to set.}
|
\docparam{text}{The text to set.}
|
||||||
|
|
||||||
|
\membersection{wxComboBox::Undo}\label{wxcomboboxundo}
|
||||||
|
|
||||||
|
\func{void}{Undo}{\void}
|
||||||
|
|
||||||
|
Undoes the last edit in the text field. Windows only.
|
||||||
|
|
||||||
|
@@ -122,6 +122,24 @@ public:
|
|||||||
{ wxTextCtrl::SetSelection(from,to); }
|
{ wxTextCtrl::SetSelection(from,to); }
|
||||||
virtual void SetEditable(bool editable)
|
virtual void SetEditable(bool editable)
|
||||||
{ wxTextCtrl::SetEditable(editable); }
|
{ wxTextCtrl::SetEditable(editable); }
|
||||||
|
virtual bool IsEditable() const
|
||||||
|
{ return !HasFlag(wxCB_READONLY); }
|
||||||
|
virtual void Undo()
|
||||||
|
{ wxTextCtrl::Undo(); }
|
||||||
|
virtual void Redo()
|
||||||
|
{ wxTextCtrl::Redo(); }
|
||||||
|
virtual void SelectAll()
|
||||||
|
{ wxTextCtrl::SelectAll(); }
|
||||||
|
virtual bool CanCopy() const
|
||||||
|
{ return wxTextCtrl::CanCopy(); }
|
||||||
|
virtual bool CanCut() const = 0
|
||||||
|
{ return wxTextCtrl::CanCut(); }
|
||||||
|
virtual bool CanPaste() const
|
||||||
|
{ return wxTextCtrl::CanPaste(); }
|
||||||
|
virtual bool CanUndo() const
|
||||||
|
{ return wxTextCtrl::CanUndo(); }
|
||||||
|
virtual bool CanRedo() const
|
||||||
|
{ return wxTextCtrl::CanRedo(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __WX_COCOA_COMBOBOX_H__
|
#endif // __WX_COCOA_COMBOBOX_H__
|
||||||
|
@@ -45,6 +45,19 @@ public:
|
|||||||
{ SetInsertionPoint(GetLastPosition()); }
|
{ SetInsertionPoint(GetLastPosition()); }
|
||||||
virtual void Remove(long from, long to)
|
virtual void Remove(long from, long to)
|
||||||
{ Replace(from, to, wxEmptyString); }
|
{ Replace(from, to, wxEmptyString); }
|
||||||
|
|
||||||
|
virtual bool IsEditable() const = 0;
|
||||||
|
|
||||||
|
virtual void Undo() = 0;
|
||||||
|
virtual void Redo() = 0;
|
||||||
|
virtual void SelectAll() = 0;
|
||||||
|
|
||||||
|
virtual bool CanCopy() const = 0;
|
||||||
|
virtual bool CanCut() const = 0;
|
||||||
|
virtual bool CanPaste() const = 0;
|
||||||
|
virtual bool CanUndo() const = 0;
|
||||||
|
virtual bool CanRedo() const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -105,6 +105,9 @@ public:
|
|||||||
void Copy();
|
void Copy();
|
||||||
void Cut();
|
void Cut();
|
||||||
void Paste();
|
void Paste();
|
||||||
|
bool CanCopy() const;
|
||||||
|
bool CanCut() const;
|
||||||
|
bool CanPaste() const;
|
||||||
void SetInsertionPoint( long pos );
|
void SetInsertionPoint( long pos );
|
||||||
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
||||||
long GetInsertionPoint() const;
|
long GetInsertionPoint() const;
|
||||||
@@ -112,7 +115,15 @@ public:
|
|||||||
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
||||||
void Replace( long from, long to, const wxString& value );
|
void Replace( long from, long to, const wxString& value );
|
||||||
void SetSelection( long from, long to );
|
void SetSelection( long from, long to );
|
||||||
|
void GetSelection( long* from, long* to ) const;
|
||||||
void SetEditable( bool editable );
|
void SetEditable( bool editable );
|
||||||
|
void Undo() ;
|
||||||
|
void Redo() ;
|
||||||
|
bool CanUndo() const;
|
||||||
|
bool CanRedo() const;
|
||||||
|
void SelectAll();
|
||||||
|
bool IsEditable() const { return !HasFlag(wxCB_READONLY); }
|
||||||
|
bool HasSelection() const ;
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
@@ -121,6 +132,23 @@ public:
|
|||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
void OnChar( wxKeyEvent &event );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
bool m_ignoreNextUpdate:1;
|
bool m_ignoreNextUpdate:1;
|
||||||
wxList m_clientDataList;
|
wxList m_clientDataList;
|
||||||
wxList m_clientObjectList;
|
wxList m_clientObjectList;
|
||||||
|
@@ -105,6 +105,9 @@ public:
|
|||||||
void Copy();
|
void Copy();
|
||||||
void Cut();
|
void Cut();
|
||||||
void Paste();
|
void Paste();
|
||||||
|
bool CanCopy() const;
|
||||||
|
bool CanCut() const;
|
||||||
|
bool CanPaste() const;
|
||||||
void SetInsertionPoint( long pos );
|
void SetInsertionPoint( long pos );
|
||||||
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
|
||||||
long GetInsertionPoint() const;
|
long GetInsertionPoint() const;
|
||||||
@@ -112,7 +115,15 @@ public:
|
|||||||
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
|
||||||
void Replace( long from, long to, const wxString& value );
|
void Replace( long from, long to, const wxString& value );
|
||||||
void SetSelection( long from, long to );
|
void SetSelection( long from, long to );
|
||||||
|
void GetSelection( long* from, long* to ) const;
|
||||||
void SetEditable( bool editable );
|
void SetEditable( bool editable );
|
||||||
|
void Undo() ;
|
||||||
|
void Redo() ;
|
||||||
|
bool CanUndo() const;
|
||||||
|
bool CanRedo() const;
|
||||||
|
void SelectAll();
|
||||||
|
bool IsEditable() const { return !HasFlag(wxCB_READONLY); }
|
||||||
|
bool HasSelection() const ;
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
@@ -121,6 +132,23 @@ public:
|
|||||||
void OnSize( wxSizeEvent &event );
|
void OnSize( wxSizeEvent &event );
|
||||||
void OnChar( wxKeyEvent &event );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
bool m_ignoreNextUpdate:1;
|
bool m_ignoreNextUpdate:1;
|
||||||
wxList m_clientDataList;
|
wxList m_clientDataList;
|
||||||
wxList m_clientObjectList;
|
wxList m_clientObjectList;
|
||||||
|
@@ -117,6 +117,19 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
|
|||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
virtual int GetCount() const ;
|
virtual int GetCount() const ;
|
||||||
|
|
||||||
|
virtual bool IsEditable() const ;
|
||||||
|
|
||||||
|
virtual void Undo() ;
|
||||||
|
virtual void Redo() ;
|
||||||
|
virtual void SelectAll() ;
|
||||||
|
|
||||||
|
virtual bool CanCopy() const ;
|
||||||
|
virtual bool CanCut() const ;
|
||||||
|
virtual bool CanPaste() const ;
|
||||||
|
virtual bool CanUndo() const ;
|
||||||
|
virtual bool CanRedo() const ;
|
||||||
|
|
||||||
wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
||||||
|
|
||||||
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
||||||
|
@@ -112,6 +112,19 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
|
|||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
virtual int GetCount() const { return m_choice->GetCount() ; }
|
virtual int GetCount() const { return m_choice->GetCount() ; }
|
||||||
|
|
||||||
|
virtual bool IsEditable() const ;
|
||||||
|
|
||||||
|
virtual void Undo() ;
|
||||||
|
virtual void Redo() ;
|
||||||
|
virtual void SelectAll() ;
|
||||||
|
|
||||||
|
virtual bool CanCopy() const ;
|
||||||
|
virtual bool CanCut() const ;
|
||||||
|
virtual bool CanPaste() const ;
|
||||||
|
virtual bool CanUndo() const ;
|
||||||
|
virtual bool CanRedo() const ;
|
||||||
|
|
||||||
void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
|
void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
|
||||||
|
|
||||||
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
||||||
|
@@ -86,6 +86,9 @@ public:
|
|||||||
virtual void Copy();
|
virtual void Copy();
|
||||||
virtual void Cut();
|
virtual void Cut();
|
||||||
virtual void Paste();
|
virtual void Paste();
|
||||||
|
virtual bool CanCopy() const;
|
||||||
|
virtual bool CanCut() const;
|
||||||
|
virtual bool CanPaste() const;
|
||||||
virtual void SetInsertionPoint(long pos);
|
virtual void SetInsertionPoint(long pos);
|
||||||
virtual void SetInsertionPointEnd();
|
virtual void SetInsertionPointEnd();
|
||||||
virtual long GetInsertionPoint() const;
|
virtual long GetInsertionPoint() const;
|
||||||
@@ -99,6 +102,14 @@ public:
|
|||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
virtual void Clear() { wxChoice::Clear(); m_selectionOld = -1; }
|
virtual void Clear() { wxChoice::Clear(); m_selectionOld = -1; }
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
|
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
@@ -106,6 +117,23 @@ public:
|
|||||||
|
|
||||||
WXHWND GetEditHWND() const;
|
WXHWND GetEditHWND() const;
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
@@ -121,6 +149,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_COMBOBOX
|
#endif // wxUSE_COMBOBOX
|
||||||
|
@@ -91,6 +91,17 @@ public:
|
|||||||
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
|
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
|
||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
|
virtual bool IsEditable() const;
|
||||||
|
|
||||||
|
virtual void Undo();
|
||||||
|
virtual void Redo();
|
||||||
|
virtual void SelectAll();
|
||||||
|
|
||||||
|
virtual bool CanCopy() const;
|
||||||
|
virtual bool CanCut() const;
|
||||||
|
virtual bool CanPaste() const;
|
||||||
|
virtual bool CanUndo() const;
|
||||||
|
virtual bool CanRedo() const;
|
||||||
|
|
||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
|
@@ -282,6 +282,17 @@ public:
|
|||||||
virtual void Remove(long from, long to);
|
virtual void Remove(long from, long to);
|
||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
|
virtual bool IsEditable() const;
|
||||||
|
|
||||||
|
virtual void Undo();
|
||||||
|
virtual void Redo();
|
||||||
|
virtual void SelectAll();
|
||||||
|
|
||||||
|
virtual bool CanCopy() const;
|
||||||
|
virtual bool CanCut() const;
|
||||||
|
virtual bool CanPaste() const;
|
||||||
|
virtual bool CanUndo() const;
|
||||||
|
virtual bool CanRedo() const;
|
||||||
|
|
||||||
// wxControlWithItems methods
|
// wxControlWithItems methods
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
@@ -122,6 +122,22 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
|
|||||||
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
||||||
EVT_SIZE(wxComboBox::OnSize)
|
EVT_SIZE(wxComboBox::OnSize)
|
||||||
EVT_CHAR(wxComboBox::OnChar)
|
EVT_CHAR(wxComboBox::OnChar)
|
||||||
|
|
||||||
|
EVT_MENU(wxID_CUT, wxComboBox::OnCut)
|
||||||
|
EVT_MENU(wxID_COPY, wxComboBox::OnCopy)
|
||||||
|
EVT_MENU(wxID_PASTE, wxComboBox::OnPaste)
|
||||||
|
EVT_MENU(wxID_UNDO, wxComboBox::OnUndo)
|
||||||
|
EVT_MENU(wxID_REDO, wxComboBox::OnRedo)
|
||||||
|
EVT_MENU(wxID_CLEAR, wxComboBox::OnDelete)
|
||||||
|
EVT_MENU(wxID_SELECTALL, wxComboBox::OnSelectAll)
|
||||||
|
|
||||||
|
EVT_UPDATE_UI(wxID_CUT, wxComboBox::OnUpdateCut)
|
||||||
|
EVT_UPDATE_UI(wxID_COPY, wxComboBox::OnUpdateCopy)
|
||||||
|
EVT_UPDATE_UI(wxID_PASTE, wxComboBox::OnUpdatePaste)
|
||||||
|
EVT_UPDATE_UI(wxID_UNDO, wxComboBox::OnUpdateUndo)
|
||||||
|
EVT_UPDATE_UI(wxID_REDO, wxComboBox::OnUpdateRedo)
|
||||||
|
EVT_UPDATE_UI(wxID_CLEAR, wxComboBox::OnUpdateDelete)
|
||||||
|
EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
|
bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
|
||||||
@@ -646,6 +662,63 @@ void wxComboBox::Paste()
|
|||||||
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG);
|
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
Select(0, GetLastPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::HasSelection() const
|
||||||
|
{
|
||||||
|
long from, to;
|
||||||
|
GetSelection(&from, &to);
|
||||||
|
return from != to;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
// Can copy if there's a selection
|
||||||
|
return HasSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
return CanCopy() && IsEditable();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
// TODO: check for text on the clipboard
|
||||||
|
return IsEditable() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
return !HasFlag(wxCB_READONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxComboBox::SetInsertionPoint( long pos )
|
void wxComboBox::SetInsertionPoint( long pos )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
||||||
@@ -692,6 +765,16 @@ void wxComboBox::SetSelection( long from, long to )
|
|||||||
gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
|
gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::GetSelection( long* from, long* to ) const
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
{
|
||||||
|
GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry);
|
||||||
|
*from = (long) editable->selection_start_pos;
|
||||||
|
*to = (long) editable->selection_end_pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxComboBox::SetEditable( bool editable )
|
void wxComboBox::SetEditable( bool editable )
|
||||||
{
|
{
|
||||||
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
||||||
@@ -828,4 +911,82 @@ wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
|||||||
return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
|
return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// standard event handling
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxComboBox::OnCut(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Cut();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnCopy(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Paste();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUndo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnDelete(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
long from, to;
|
||||||
|
GetSelection(& from, & to);
|
||||||
|
if (from != -1 && to != -1)
|
||||||
|
Remove(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnSelectAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetSelection(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateCut(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanCut() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateCopy(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanCopy() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdatePaste(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanPaste() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateUndo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanUndo() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateRedo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanRedo() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateDelete(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable(HasSelection() && IsEditable()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable(GetLastPosition() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -122,6 +122,22 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
|
|||||||
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
||||||
EVT_SIZE(wxComboBox::OnSize)
|
EVT_SIZE(wxComboBox::OnSize)
|
||||||
EVT_CHAR(wxComboBox::OnChar)
|
EVT_CHAR(wxComboBox::OnChar)
|
||||||
|
|
||||||
|
EVT_MENU(wxID_CUT, wxComboBox::OnCut)
|
||||||
|
EVT_MENU(wxID_COPY, wxComboBox::OnCopy)
|
||||||
|
EVT_MENU(wxID_PASTE, wxComboBox::OnPaste)
|
||||||
|
EVT_MENU(wxID_UNDO, wxComboBox::OnUndo)
|
||||||
|
EVT_MENU(wxID_REDO, wxComboBox::OnRedo)
|
||||||
|
EVT_MENU(wxID_CLEAR, wxComboBox::OnDelete)
|
||||||
|
EVT_MENU(wxID_SELECTALL, wxComboBox::OnSelectAll)
|
||||||
|
|
||||||
|
EVT_UPDATE_UI(wxID_CUT, wxComboBox::OnUpdateCut)
|
||||||
|
EVT_UPDATE_UI(wxID_COPY, wxComboBox::OnUpdateCopy)
|
||||||
|
EVT_UPDATE_UI(wxID_PASTE, wxComboBox::OnUpdatePaste)
|
||||||
|
EVT_UPDATE_UI(wxID_UNDO, wxComboBox::OnUpdateUndo)
|
||||||
|
EVT_UPDATE_UI(wxID_REDO, wxComboBox::OnUpdateRedo)
|
||||||
|
EVT_UPDATE_UI(wxID_CLEAR, wxComboBox::OnUpdateDelete)
|
||||||
|
EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
|
bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
|
||||||
@@ -646,6 +662,63 @@ void wxComboBox::Paste()
|
|||||||
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG);
|
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
Select(0, GetLastPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::HasSelection() const
|
||||||
|
{
|
||||||
|
long from, to;
|
||||||
|
GetSelection(&from, &to);
|
||||||
|
return from != to;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
// Can copy if there's a selection
|
||||||
|
return HasSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
return CanCopy() && IsEditable();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
// TODO: check for text on the clipboard
|
||||||
|
return IsEditable() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
return !HasFlag(wxCB_READONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxComboBox::SetInsertionPoint( long pos )
|
void wxComboBox::SetInsertionPoint( long pos )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
||||||
@@ -692,6 +765,16 @@ void wxComboBox::SetSelection( long from, long to )
|
|||||||
gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
|
gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::GetSelection( long* from, long* to ) const
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
{
|
||||||
|
GtkEditable *editable = GTK_EDITABLE(GTK_COMBO(m_widget)->entry);
|
||||||
|
*from = (long) editable->selection_start_pos;
|
||||||
|
*to = (long) editable->selection_end_pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxComboBox::SetEditable( bool editable )
|
void wxComboBox::SetEditable( bool editable )
|
||||||
{
|
{
|
||||||
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
|
||||||
@@ -828,4 +911,82 @@ wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
|||||||
return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
|
return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// standard event handling
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxComboBox::OnCut(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Cut();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnCopy(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Paste();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUndo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnDelete(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
long from, to;
|
||||||
|
GetSelection(& from, & to);
|
||||||
|
if (from != -1 && to != -1)
|
||||||
|
Remove(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnSelectAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetSelection(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateCut(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanCut() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateCopy(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanCopy() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdatePaste(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanPaste() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateUndo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanUndo() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateRedo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanRedo() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateDelete(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable(HasSelection() && IsEditable()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable(GetLastPosition() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -580,6 +580,68 @@ void wxComboBox::SetString(int n, const wxString& s)
|
|||||||
m_choice->SetString( n , s ) ;
|
m_choice->SetString( n , s ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
return m_text != NULL && !HasFlag(wxCB_READONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanCopy();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanCut();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanPaste();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanUndo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanRedo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
|
@@ -742,6 +742,110 @@ void wxComboBox::SetString(int n, const wxString& s)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
return !HasFlag(wxCB_READONLY);
|
||||||
|
#else
|
||||||
|
return m_text != NULL && !HasFlag(wxCB_READONLY);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->Undo();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->Redo();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->SelectAll();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanCopy();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanCut();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanPaste();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanUndo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
#if USE_HICOMBOBOX
|
||||||
|
// TODO
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanRedo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
|
@@ -528,6 +528,69 @@ void wxComboBox::SetString(int n, const wxString& s)
|
|||||||
m_choice->SetString( n , s ) ;
|
m_choice->SetString( n , s ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
|
||||||
|
return m_text != NULL && !HasFlag(wxCB_READONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
m_text->SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanCopy();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanCut();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanPaste();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanUndo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
if (m_text != NULL)
|
||||||
|
return m_text->CanRedo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void wxComboBox::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown))
|
void wxComboBox::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown))
|
||||||
{
|
{
|
||||||
|
@@ -111,6 +111,25 @@ wxEND_HANDLERS_TABLE()
|
|||||||
wxCONSTRUCTOR_5( wxComboBox , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size )
|
wxCONSTRUCTOR_5( wxComboBox , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size )
|
||||||
#else
|
#else
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
||||||
|
EVT_MENU(wxID_CUT, wxComboBox::OnCut)
|
||||||
|
EVT_MENU(wxID_COPY, wxComboBox::OnCopy)
|
||||||
|
EVT_MENU(wxID_PASTE, wxComboBox::OnPaste)
|
||||||
|
EVT_MENU(wxID_UNDO, wxComboBox::OnUndo)
|
||||||
|
EVT_MENU(wxID_REDO, wxComboBox::OnRedo)
|
||||||
|
EVT_MENU(wxID_CLEAR, wxComboBox::OnDelete)
|
||||||
|
EVT_MENU(wxID_SELECTALL, wxComboBox::OnSelectAll)
|
||||||
|
|
||||||
|
EVT_UPDATE_UI(wxID_CUT, wxComboBox::OnUpdateCut)
|
||||||
|
EVT_UPDATE_UI(wxID_COPY, wxComboBox::OnUpdateCopy)
|
||||||
|
EVT_UPDATE_UI(wxID_PASTE, wxComboBox::OnUpdatePaste)
|
||||||
|
EVT_UPDATE_UI(wxID_UNDO, wxComboBox::OnUpdateUndo)
|
||||||
|
EVT_UPDATE_UI(wxID_REDO, wxComboBox::OnUpdateRedo)
|
||||||
|
EVT_UPDATE_UI(wxID_CLEAR, wxComboBox::OnUpdateDelete)
|
||||||
|
EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -477,6 +496,88 @@ void wxComboBox::Paste()
|
|||||||
SendMessage(GetHwnd(), WM_PASTE, 0, 0L);
|
SendMessage(GetHwnd(), WM_PASTE, 0, 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
if (CanUndo())
|
||||||
|
{
|
||||||
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
|
if ( hEditWnd )
|
||||||
|
::SendMessage(hEditWnd, EM_UNDO, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
if (CanUndo())
|
||||||
|
{
|
||||||
|
// Same as Undo, since Undo undoes the undo, i.e. a redo.
|
||||||
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
|
if ( hEditWnd )
|
||||||
|
::SendMessage(hEditWnd, EM_UNDO, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
SetSelection(0, GetLastPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
|
if ( hEditWnd )
|
||||||
|
return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
HWND hEditWnd = (HWND) GetEditHWND() ;
|
||||||
|
if ( hEditWnd )
|
||||||
|
return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::HasSelection() const
|
||||||
|
{
|
||||||
|
long from, to;
|
||||||
|
GetSelection(&from, &to);
|
||||||
|
return from != to;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
// Can copy if there's a selection
|
||||||
|
return HasSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
return CanCopy() && IsEditable();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
if ( !IsEditable() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Standard edit control: check for straight text on clipboard
|
||||||
|
if ( !::OpenClipboard(GetHwndOf(wxTheApp->GetTopWindow())) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool isTextAvailable = ::IsClipboardFormatAvailable(CF_TEXT) != 0;
|
||||||
|
::CloseClipboard();
|
||||||
|
|
||||||
|
return isTextAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
return !HasFlag(wxCB_READONLY);
|
||||||
|
}
|
||||||
|
|
||||||
void wxComboBox::SetEditable(bool WXUNUSED(editable))
|
void wxComboBox::SetEditable(bool WXUNUSED(editable))
|
||||||
{
|
{
|
||||||
// Can't implement in MSW?
|
// Can't implement in MSW?
|
||||||
@@ -588,5 +689,82 @@ int wxComboBox::GetSelection() const
|
|||||||
return wxChoice::GetSelection();
|
return wxChoice::GetSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// standard event handling
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxComboBox::OnCut(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Cut();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnCopy(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Paste();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUndo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnDelete(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
long from, to;
|
||||||
|
GetSelection(& from, & to);
|
||||||
|
if (from != -1 && to != -1)
|
||||||
|
Remove(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnSelectAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetSelection(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateCut(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanCut() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateCopy(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanCopy() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdatePaste(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanPaste() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateUndo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanUndo() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateRedo(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable( CanRedo() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateDelete(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable(HasSelection() && IsEditable()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event)
|
||||||
|
{
|
||||||
|
event.Enable(GetLastPosition() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_COMBOBOX
|
#endif // wxUSE_COMBOBOX
|
||||||
|
|
||||||
|
@@ -261,5 +261,48 @@ void wxComboBox::SetSelection(long from, long to)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_COMBOBOX
|
#endif // wxUSE_COMBOBOX
|
||||||
|
|
||||||
|
@@ -890,6 +890,69 @@ wxClientData* wxComboBox::DoGetItemClientObject(int n) const
|
|||||||
return GetLBox()->GetClientObject(n);
|
return GetLBox()->GetClientObject(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsEditable() const
|
||||||
|
{
|
||||||
|
return GetText() != NULL && (!HasFlag(wxCB_READONLY) || GetText()->IsEditable());
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Undo()
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
GetText()->Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::Redo()
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
GetText()->Redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxComboBox::SelectAll()
|
||||||
|
{
|
||||||
|
GetText()->SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCopy() const
|
||||||
|
{
|
||||||
|
if (GetText() != NULL)
|
||||||
|
return GetText()->CanCopy();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanCut() const
|
||||||
|
{
|
||||||
|
if (GetText() != NULL)
|
||||||
|
return GetText()->CanCut();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanPaste() const
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
return GetText()->CanPaste();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanUndo() const
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
return GetText()->CanUndo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::CanRedo() const
|
||||||
|
{
|
||||||
|
if (IsEditable())
|
||||||
|
return GetText()->CanRedo();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// input handling
|
// input handling
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user