diff options
author | Kandrashin Denis <mail@lintest.ru> | 2012-06-28 12:54:12 +0400 |
---|---|---|
committer | Kandrashin Denis <mail@lintest.ru> | 2012-06-28 20:02:09 +0400 |
commit | 53f28207215e853a1ad4a79fc9ce2c3fda6d3fa5 (patch) | |
tree | 362d773d167d241805bfefbd2133c8ad89dc33f0 /sources | |
parent | 211a5c10c4f2d5439b93d10c285d6b46d6319c80 (diff) |
Fix keyboard command wxID_SELECTALL
Diffstat (limited to 'sources')
-rw-r--r-- | sources/MyRuLib/FbMainFrame.cpp | 21 | ||||
-rw-r--r-- | sources/MyRuLib/FbMainFrame.h | 3 | ||||
-rw-r--r-- | sources/MyRuLib/FbMainMenu.cpp | 2 | ||||
-rw-r--r-- | sources/MyRuLib/controls/FbSearchCombo.cpp | 2 | ||||
-rw-r--r-- | sources/MyRuLib/controls/FbSearchCombo.h | 1 | ||||
-rw-r--r-- | sources/MyRuLib/controls/FbTreeView.cpp | 17 |
6 files changed, 35 insertions, 11 deletions
diff --git a/sources/MyRuLib/FbMainFrame.cpp b/sources/MyRuLib/FbMainFrame.cpp index 82053c3d..942f3cbc 100644 --- a/sources/MyRuLib/FbMainFrame.cpp +++ b/sources/MyRuLib/FbMainFrame.cpp @@ -56,6 +56,8 @@ BEGIN_EVENT_TABLE(FbMainFrame, wxFrame) EVT_MENU(wxID_SELECTALL, FbMainFrame::OnSubmenu)
EVT_MENU(ID_UNSELECTALL, FbMainFrame::OnSubmenu)
EVT_UPDATE_UI(wxID_COPY, FbMainFrame::OnSubmenuUpdateUI)
+ EVT_UPDATE_UI(wxID_SELECTALL, FbMainFrame::OnEnableUI)
+ EVT_UPDATE_UI(ID_UNSELECTALL, FbMainFrame::OnEnableUI)
EVT_UPDATE_UI(ID_MASTER_APPEND, FbMainFrame::OnDisableUI)
EVT_UPDATE_UI(ID_MASTER_MODIFY, FbMainFrame::OnDisableUI)
EVT_UPDATE_UI(ID_MASTER_REPLACE, FbMainFrame::OnDisableUI)
@@ -176,6 +178,16 @@ bool FbMainFrame::ProcessEvent(wxEvent& event) FbEventLocker locker(*this, event);
wxWindow * focused = wxDynamicCast(FindFocus(), wxWindow);
+
+ if (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED) {
+ if (event.GetId() == wxID_SELECTALL) {
+ wxTextCtrlBase * text = wxDynamicCast(focused, wxTextCtrlBase);
+ if (text) { text->SelectAll(); return true; }
+ wxComboCtrl * combo = wxDynamicCast(focused, wxComboCtrl);
+ if (combo) { combo->GetTextCtrl()->SelectAll(); return true; }
+ }
+ }
+
if (focused && focused->GetEventHandler()->ProcessEvent(event)) return true;
wxWindow * window = GetActiveChild();
@@ -879,15 +891,6 @@ void FbMainFrame::Localize(int language) wxToolBar * toolbar = GetToolBar();
SetToolBar(CreateToolBar());
wxDELETE(toolbar);
-
- size_t count = m_FrameNotebook.GetPageCount();
- size_t index = m_FrameNotebook.GetSelection();
- for (size_t i = 0; i < count; ++i) {
-/*
- FbAuiMDIChildFrame * frame = wxDynamicCast(m_FrameNotebook.GetPage(i), FbAuiMDIChildFrame);
- if (frame) frame->Localize(i == index);
-*/
- }
}
void FbMainFrame::OnDatabaseGenres(wxCommandEvent & event)
diff --git a/sources/MyRuLib/FbMainFrame.h b/sources/MyRuLib/FbMainFrame.h index 575519de..326d4a59 100644 --- a/sources/MyRuLib/FbMainFrame.h +++ b/sources/MyRuLib/FbMainFrame.h @@ -56,6 +56,9 @@ class FbMainFrame : public wxFrame wxMenu * m_MenuTree;
wxMenu * m_MenuRead;
private:
+ void OnEnableUI(wxUpdateUIEvent & event) {
+ event.Enable(true);
+ }
void OnDisableUI(wxUpdateUIEvent & event) {
event.Enable(false);
}
diff --git a/sources/MyRuLib/FbMainMenu.cpp b/sources/MyRuLib/FbMainMenu.cpp index 55b2bac5..ca312ee3 100644 --- a/sources/MyRuLib/FbMainMenu.cpp +++ b/sources/MyRuLib/FbMainMenu.cpp @@ -38,7 +38,7 @@ FbMenuBar::MenuEdit::MenuEdit() AppendSeparator();
#ifdef FB_INCLUDE_READER
Append(ID_READER_OPTIONS , _("Cool Reader options"));
- #endif // FB_INCLUDE_READER
+ #endif // FB_INCLUDE_READER
Append(wxID_PREFERENCES , _("Settings"));
}
diff --git a/sources/MyRuLib/controls/FbSearchCombo.cpp b/sources/MyRuLib/controls/FbSearchCombo.cpp index a14df74c..79ccb7fe 100644 --- a/sources/MyRuLib/controls/FbSearchCombo.cpp +++ b/sources/MyRuLib/controls/FbSearchCombo.cpp @@ -4,6 +4,8 @@ // FbSearchCombo
//-----------------------------------------------------------------------------
+IMPLEMENT_CLASS(FbSearchCombo, wxComboCtrl)
+
static int GetMultiplier()
{
#ifdef __WXWINCE__
diff --git a/sources/MyRuLib/controls/FbSearchCombo.h b/sources/MyRuLib/controls/FbSearchCombo.h index 0f552e96..7faafc7e 100644 --- a/sources/MyRuLib/controls/FbSearchCombo.h +++ b/sources/MyRuLib/controls/FbSearchCombo.h @@ -43,6 +43,7 @@ class FbSearchCombo: public wxComboCtrl void Init() {}
private:
wxBitmap RenderButtonBitmap();
+ DECLARE_CLASS(FbSearchCombo)
};
#endif // __FBSEARCHCOMBO_H__
diff --git a/sources/MyRuLib/controls/FbTreeView.cpp b/sources/MyRuLib/controls/FbTreeView.cpp index 14ca92dd..ee0474b2 100644 --- a/sources/MyRuLib/controls/FbTreeView.cpp +++ b/sources/MyRuLib/controls/FbTreeView.cpp @@ -193,6 +193,8 @@ class FbTreeViewMainWindow: public wxScrolledWindow size_t m_count;
private:
+ void OnSelectAll(wxCommandEvent & event);
+ void OnUpdateSelectAll(wxUpdateUIEvent& event);
void OnPaint( wxPaintEvent &event );
void OnEraseBackground(wxEraseEvent& WXUNUSED(event)) { ;; } // to reduce flicker
void OnSetFocus( wxFocusEvent &event );
@@ -588,6 +590,8 @@ void FbTreeViewHeaderWindow::SetColumnWidth (int column, int delta) // ---------------------------------------------------------------------------
BEGIN_EVENT_TABLE(FbTreeViewMainWindow, wxScrolledWindow)
+ EVT_MENU (wxID_SELECTALL, FbTreeViewMainWindow::OnSelectAll)
+ EVT_UPDATE_UI(wxID_SELECTALL, FbTreeViewMainWindow::OnUpdateSelectAll)
EVT_PAINT (FbTreeViewMainWindow::OnPaint)
EVT_ERASE_BACKGROUND(FbTreeViewMainWindow::OnEraseBackground) // to reduce flicker
EVT_MOUSE_EVENTS (FbTreeViewMainWindow::OnMouse)
@@ -728,8 +732,19 @@ void FbTreeViewMainWindow::OnPaint (wxPaintEvent &WXUNUSED(event)) }
}
+void FbTreeViewMainWindow::OnSelectAll(wxCommandEvent & event)
+{
+ m_owner->SelectAll(true);
+}
+
+void FbTreeViewMainWindow::OnUpdateSelectAll(wxUpdateUIEvent& event)
+{
+ event.Enable( m_model );
+}
+
void FbTreeViewMainWindow::OnChar(wxKeyEvent &event)
{
+
if (event.GetKeyCode() == WXK_TAB) {
wxWindow * owner = GetParent()->GetParent();
wxNavigationKeyEvent nevent;
@@ -958,7 +973,7 @@ void FbTreeViewMainWindow::OnMouse (wxMouseEvent &event) size_t pos = m_model->FindRow(row, false);
m_model->SingleCheck(pos);
} else if (HasFlag(fbTR_DIRECTORY) && left <= x && x <= right) {
- size_t pos = m_model->FindRow(row, false);
+ m_model->FindRow(row, false);
bool ok = item.Expand(!item.IsExpanded());
if (ok) AdjustMyScrollbars();
} else {
|