public:
MyTextCtrl(wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size, int style = 0)
- : wxTextCtrl(parent, id, value, pos, size, style) { }
+ : wxTextCtrl(parent, id, value, pos, size, style) { m_hasCapture = FALSE; }
void OnKeyDown(wxKeyEvent& event);
void OnKeyUp(wxKeyEvent& event);
void OnChar(wxKeyEvent& event);
+ bool m_hasCapture;
+
private:
static inline wxChar GetChar(bool on, wxChar c) { return on ? c : _T('-'); }
void LogEvent(const wxChar *name, wxKeyEvent& event) const;
// go to position 10
SetInsertionPoint(10);
break;
+
+ case WXK_F4:
+ if (!m_hasCapture)
+ {
+ wxLogDebug( wxT("Now capturing mouse and events.") );
+ m_hasCapture = TRUE;
+ CaptureMouse();
+ }
+ else
+ {
+ wxLogDebug( wxT("Stopped capturing mouse and events.") );
+ m_hasCapture = TRUE;
+ ReleaseMouse();
+ }
+ break;
}
LogEvent( _("Key down"), event);
m_multitext->WriteText( "Prepended. " );
#if wxUSE_TOOLTIPS
- m_multitext->SetToolTip("Press F1 here.");
+ m_multitext->SetToolTip("Press F1 here for statitics, F4 for capture and uncapture mouse.");
#endif
m_tab = new MyTextCtrl( this, -1, "Multiline, allow <TAB> processing.",
if ( !smallicons )
{
currentX += width + 5;
- toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
+ toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
currentX += width + 5;
toolBar->AddSeparator();
- toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Disable/Enable print button");
+ toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 2");
currentX += width + 5;
toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Toggle/Untoggle help button");
currentX += width + 5;
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
currentX += width + 5;
toolBar->AddSeparator();
- toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), *(toolBarBitmaps[6]), TRUE, currentX, -1, (wxObject *) NULL, "Help");
+ toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help button");
+ toolBar->ToggleTool( wxID_SAVE, TRUE );
+ toolBar->ToggleTool( wxID_COPY, TRUE );
+ toolBar->ToggleTool( wxID_COPY, FALSE );
toolBar->EnableTool( wxID_PRINT, FALSE );
}