Added context menu accessors; context menu now created in constructor.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -160,6 +160,12 @@ public:
|
|||||||
wxCursor GetURLCursor() const { return m_urlCursor; }
|
wxCursor GetURLCursor() const { return m_urlCursor; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxABI_VERSION >= 20811
|
||||||
|
/// Get/set context menu
|
||||||
|
wxMenu* GetContextMenu() const { return m_contextMenu; }
|
||||||
|
void SetContextMenu(wxMenu* menu);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
|
|
||||||
// editing
|
// editing
|
||||||
|
@@ -297,6 +297,17 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
|
|||||||
wxAcceleratorTable accel(6, entries);
|
wxAcceleratorTable accel(6, entries);
|
||||||
SetAcceleratorTable(accel);
|
SetAcceleratorTable(accel);
|
||||||
|
|
||||||
|
m_contextMenu = new wxMenu;
|
||||||
|
m_contextMenu->Append(wxID_UNDO, _("&Undo"));
|
||||||
|
m_contextMenu->Append(wxID_REDO, _("&Redo"));
|
||||||
|
m_contextMenu->AppendSeparator();
|
||||||
|
m_contextMenu->Append(wxID_CUT, _("Cu&t"));
|
||||||
|
m_contextMenu->Append(wxID_COPY, _("&Copy"));
|
||||||
|
m_contextMenu->Append(wxID_PASTE, _("&Paste"));
|
||||||
|
m_contextMenu->Append(wxID_CLEAR, _("&Delete"));
|
||||||
|
m_contextMenu->AppendSeparator();
|
||||||
|
m_contextMenu->Append(wxID_SELECTALL, _("Select &All"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2505,6 +2516,13 @@ bool wxRichTextCtrl::CanDeleteSelection() const
|
|||||||
// Accessors
|
// Accessors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxRichTextCtrl::SetContextMenu(wxMenu* menu)
|
||||||
|
{
|
||||||
|
if (m_contextMenu && m_contextMenu != menu)
|
||||||
|
delete m_contextMenu;
|
||||||
|
m_contextMenu = menu;
|
||||||
|
}
|
||||||
|
|
||||||
void wxRichTextCtrl::SetEditable(bool editable)
|
void wxRichTextCtrl::SetEditable(bool editable)
|
||||||
{
|
{
|
||||||
m_editable = editable;
|
m_editable = editable;
|
||||||
@@ -2809,20 +2827,8 @@ void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_contextMenu)
|
if (m_contextMenu)
|
||||||
{
|
PopupMenu(m_contextMenu);
|
||||||
m_contextMenu = new wxMenu;
|
|
||||||
m_contextMenu->Append(wxID_UNDO, _("&Undo"));
|
|
||||||
m_contextMenu->Append(wxID_REDO, _("&Redo"));
|
|
||||||
m_contextMenu->AppendSeparator();
|
|
||||||
m_contextMenu->Append(wxID_CUT, _("Cu&t"));
|
|
||||||
m_contextMenu->Append(wxID_COPY, _("&Copy"));
|
|
||||||
m_contextMenu->Append(wxID_PASTE, _("&Paste"));
|
|
||||||
m_contextMenu->Append(wxID_CLEAR, _("&Delete"));
|
|
||||||
m_contextMenu->AppendSeparator();
|
|
||||||
m_contextMenu->Append(wxID_SELECTALL, _("Select &All"));
|
|
||||||
}
|
|
||||||
PopupMenu(m_contextMenu);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,9 +27,11 @@
|
|||||||
@WX_VERSION_TAG@.11 {
|
@WX_VERSION_TAG@.11 {
|
||||||
*wxDC*SetDeviceClippingRegion*;
|
*wxDC*SetDeviceClippingRegion*;
|
||||||
*wxGraphicsContext*GetCairoRenderer*;
|
*wxGraphicsContext*GetCairoRenderer*;
|
||||||
|
*wxIconizeEvent*IsIconized*;
|
||||||
|
*wxRichTextCtrl*GetContextMenu*;
|
||||||
|
*wxRichTextCtrl*SetContextMenu*;
|
||||||
*wxShowEvent*IsShown*;
|
*wxShowEvent*IsShown*;
|
||||||
*wxSound*Create*;
|
*wxSound*Create*;
|
||||||
*wxIconizeEvent*IsIconized*;
|
|
||||||
*wxXmlNode*Attribute*;
|
*wxXmlNode*Attribute*;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user