[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5024] Improve pop-up menu handling (VS)
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5024] Improve pop-up menu handling (VS) |
Date: |
Mon, 05 Jul 2010 15:51:12 +0000 |
Revision: 5024
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5024
Author: chicares
Date: 2010-07-05 15:51:12 +0000 (Mon, 05 Jul 2010)
Log Message:
-----------
Improve pop-up menu handling (VS)
Modified Paths:
--------------
lmi/trunk/census_view.cpp
lmi/trunk/census_view.hpp
lmi/trunk/single_choice_popup_menu.cpp
Modified: lmi/trunk/census_view.cpp
===================================================================
--- lmi/trunk/census_view.cpp 2010-07-04 16:45:38 UTC (rev 5023)
+++ lmi/trunk/census_view.cpp 2010-07-05 15:51:12 UTC (rev 5024)
@@ -87,11 +87,7 @@
IMPLEMENT_DYNAMIC_CLASS(CensusView, ViewEx)
BEGIN_EVENT_TABLE(CensusView, ViewEx)
-// TODO ?? Experimental: (Ask Vadim whether wxGTK supports this.)
-// EVT_COMMAND_RIGHT_CLICK(ID_LISTWINDOW ,CensusView::UponRightClick0)
-// TODO ?? No effect--dunno why; but prolly wanted for gtk:
-// EVT_RIGHT_UP( CensusView::UponRightClick1)
- EVT_CONTEXT_MENU( CensusView::UponRightClick2)
+ EVT_CONTEXT_MENU( CensusView::UponRightClick)
EVT_MENU(XRCID("edit_cell" ),CensusView::UponEditCell )
EVT_MENU(XRCID("edit_class" ),CensusView::UponEditClass)
EVT_MENU(XRCID("edit_case" ),CensusView::UponEditCase )
@@ -719,20 +715,16 @@
}
}
-// TODO ?? Right-click handlers: pick one approach, and remove failed
experiments.
-
-void CensusView::UponRightClick0(wxCommandEvent&)
+void CensusView::UponRightClick(wxContextMenuEvent&)
{
- status() << "UponRightClick0()" << LMI_FLUSH;
wxMenuBar* menu_bar = MenuBar();
if(menu_bar)
{
int census_menu_index = menu_bar->FindMenu("Census");
if(wxNOT_FOUND != census_menu_index)
{
- status() << "Menu found." << LMI_FLUSH;
wxMenu* census_menu = menu_bar->GetMenu(census_menu_index);
- list_window_->PopupMenu(census_menu, list_window_->GetPosition());
+ list_window_->PopupMenu(census_menu);
}
else
{
@@ -741,45 +733,6 @@
}
}
-void CensusView::UponRightClick1(wxMouseEvent& e)
-{
- status() << "UponRightClick1()" << LMI_FLUSH;
- wxMenuBar* menu_bar = MenuBar();
- if(menu_bar)
- {
- int census_menu_index = menu_bar->FindMenu("Census");
- if(wxNOT_FOUND != census_menu_index)
- {
- status() << "Menu found." << LMI_FLUSH;
- wxMenu* census_menu = menu_bar->GetMenu(census_menu_index);
- wxPoint* point = new wxPoint(e.m_x, e.m_y);
- list_window_->PopupMenu(census_menu, *point);
- }
- else
- {
- status() << "Menu not found." << LMI_FLUSH;
- }
- }
-}
-
-void CensusView::UponRightClick2(wxContextMenuEvent& e)
-{
- wxMenuBar* menu_bar = MenuBar();
- if(menu_bar)
- {
- int census_menu_index = menu_bar->FindMenu("Census");
- if(wxNOT_FOUND != census_menu_index)
- {
- wxMenu* census_menu = menu_bar->GetMenu(census_menu_index);
- list_window_->PopupMenu(census_menu,
GetFrame()->ScreenToClient(e.GetPosition()));
- }
- else
- {
- status() << "Menu not found." << LMI_FLUSH;
- }
- }
-}
-
void CensusView::UponUpdateApplicable(wxUpdateUIEvent& e)
{
e.Enable(true);
Modified: lmi/trunk/census_view.hpp
===================================================================
--- lmi/trunk/census_view.hpp 2010-07-04 16:45:38 UTC (rev 5023)
+++ lmi/trunk/census_view.hpp 2010-07-05 15:51:12 UTC (rev 5024)
@@ -75,9 +75,7 @@
void UponColumnWidthVarying (wxCommandEvent&);
void UponColumnWidthFixed (wxCommandEvent&);
void UponPasteCensus (wxCommandEvent&);
- void UponRightClick0 (wxCommandEvent&);
- void UponRightClick1 (wxMouseEvent&);
- void UponRightClick2 (wxContextMenuEvent&);
+ void UponRightClick (wxContextMenuEvent&);
void UponPrintCase (wxCommandEvent&);
void UponPrintCaseToDisk (wxCommandEvent&);
void UponRunCell (wxCommandEvent&);
Modified: lmi/trunk/single_choice_popup_menu.cpp
===================================================================
--- lmi/trunk/single_choice_popup_menu.cpp 2010-07-04 16:45:38 UTC (rev
5023)
+++ lmi/trunk/single_choice_popup_menu.cpp 2010-07-05 15:51:12 UTC (rev
5024)
@@ -29,7 +29,6 @@
#include "single_choice_popup_menu.hpp"
#include <wx/gdicmn.h> // wxDefaultPosition, wxSize
-#include <wx/utils.h> // wxGetMousePosition()
SingleChoicePopupMenu::SingleChoicePopupMenu
(wxArrayString const& choices
@@ -73,7 +72,7 @@
// WX !! Can't be const because PopupMenu() isn't.
int SingleChoicePopupMenu::Choose()
{
- PopupMenu(&menu_, ScreenToClient(wxGetMousePosition()));
+ PopupMenu(&menu_);
return selection_index_;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5024] Improve pop-up menu handling (VS),
Greg Chicares <=