Menu/toolbar event handling now tries the window with the focus first.
wxTextCtrl processes cut, copy, paste, undo, redo commands and UI updates automatically. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1427,5 +1427,13 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
||||
#define EVT_UPDATE_UI(id, func) \
|
||||
{ wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL },\
|
||||
|
||||
/*
|
||||
* Helper functions
|
||||
*/
|
||||
|
||||
// Find a window with the focus, that is also a descendant of the given window.
|
||||
// This is used to determine the window to initially send commands to.
|
||||
wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
|
||||
|
||||
#endif
|
||||
// _WX_EVENTH__
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
void DoMenuUpdates();
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
wxMenuBar *m_frameMenuBar;
|
||||
|
@@ -118,6 +118,18 @@ class wxTextCtrl: public wxControl
|
||||
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
void OnCut(wxCommandEvent& event);
|
||||
void OnCopy(wxCommandEvent& event);
|
||||
void OnPaste(wxCommandEvent& event);
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateCut(wxUpdateUIEvent& event);
|
||||
void OnUpdateCopy(wxUpdateUIEvent& event);
|
||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int overflow(int i);
|
||||
int sync();
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
void DoMenuUpdates();
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
wxMenuBar *m_frameMenuBar;
|
||||
|
@@ -118,6 +118,18 @@ class wxTextCtrl: public wxControl
|
||||
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
void OnCut(wxCommandEvent& event);
|
||||
void OnCopy(wxCommandEvent& event);
|
||||
void OnPaste(wxCommandEvent& event);
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateCut(wxUpdateUIEvent& event);
|
||||
void OnUpdateCopy(wxUpdateUIEvent& event);
|
||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int overflow(int i);
|
||||
int sync();
|
||||
|
@@ -136,7 +136,7 @@ public:
|
||||
|
||||
// Query app for menu item updates (called from OnIdle)
|
||||
void DoMenuUpdates();
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
||||
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
// Query app for menu item updates (called from OnIdle)
|
||||
void DoMenuUpdates();
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
||||
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
@@ -16,8 +16,8 @@
|
||||
#pragma interface "textctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/ioswrap.h"
|
||||
#include "wx/control.h"
|
||||
#include "wx/ioswrap.h"
|
||||
|
||||
// TODO Some platforms/compilers don't like inheritance from streambuf.
|
||||
#if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__)
|
||||
@@ -133,6 +133,18 @@ public:
|
||||
void OnChar(wxKeyEvent& event);
|
||||
// void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
void OnCut(wxCommandEvent& event);
|
||||
void OnCopy(wxCommandEvent& event);
|
||||
void OnPaste(wxCommandEvent& event);
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateCut(wxUpdateUIEvent& event);
|
||||
void OnUpdateCopy(wxUpdateUIEvent& event);
|
||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
||||
// implementation from here to the end
|
||||
|
@@ -153,7 +153,7 @@ public:
|
||||
|
||||
// Query app for menu item updates (called from OnIdle)
|
||||
void DoMenuUpdates();
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
||||
|
||||
WXHMENU GetWinMenu() const ;
|
||||
|
||||
|
@@ -154,6 +154,18 @@ public:
|
||||
void OnChar(wxKeyEvent& event); // Process 'enter' if required
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
void OnCut(wxCommandEvent& event);
|
||||
void OnCopy(wxCommandEvent& event);
|
||||
void OnPaste(wxCommandEvent& event);
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateCut(wxUpdateUIEvent& event);
|
||||
void OnUpdateCopy(wxUpdateUIEvent& event);
|
||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
|
||||
// Implementation
|
||||
// --------------
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
@@ -136,7 +136,7 @@ public:
|
||||
|
||||
// Query app for menu item updates (called from OnIdle)
|
||||
void DoMenuUpdates();
|
||||
void DoMenuUpdates(wxMenu* menu);
|
||||
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
|
||||
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
@@ -141,7 +141,18 @@ public:
|
||||
void OnDropFiles(wxDropFilesEvent& event);
|
||||
// void OnChar(wxKeyEvent& event); // Process 'enter' if required
|
||||
// void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
void OnCut(wxCommandEvent& event);
|
||||
void OnCopy(wxCommandEvent& event);
|
||||
void OnPaste(wxCommandEvent& event);
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
|
||||
void OnUpdateCut(wxUpdateUIEvent& event);
|
||||
void OnUpdateCopy(wxUpdateUIEvent& event);
|
||||
void OnUpdatePaste(wxUpdateUIEvent& event);
|
||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||
|
||||
// Implementation
|
||||
// --------------
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
Reference in New Issue
Block a user