From 0f442030c49fd83eea24a332f286bcbbf4c4055c Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 25 Jan 2001 18:27:01 +0000 Subject: [PATCH] Prepare wxToolBarSimple for event type change. Make wxGrid use new event types. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 20 ++++++++ src/generic/tbarsmpl.cpp | 98 ++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 55 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 7b2b3b3f43..d6de399fb8 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -96,6 +96,26 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxGridCellWithAttr, wxGridCellWithAttrArray); WX_DEFINE_OBJARRAY(wxGridCellCoordsArray) WX_DEFINE_OBJARRAY(wxGridCellWithAttrArray) +// ---------------------------------------------------------------------------- +// events +// ---------------------------------------------------------------------------- + +const int wxEVT_GRID_CELL_LEFT_CLICK = wxNewEventType(); +const int wxEVT_GRID_CELL_RIGHT_CLICK = wxNewEventType(); +const int wxEVT_GRID_CELL_LEFT_DCLICK = wxNewEventType(); +const int wxEVT_GRID_CELL_RIGHT_DCLICK = wxNewEventType(); +const int wxEVT_GRID_LABEL_LEFT_CLICK = wxNewEventType(); +const int wxEVT_GRID_LABEL_RIGHT_CLICK = wxNewEventType(); +const int wxEVT_GRID_LABEL_LEFT_DCLICK = wxNewEventType(); +const int wxEVT_GRID_LABEL_RIGHT_DCLICK = wxNewEventType(); +const int wxEVT_GRID_ROW_SIZE = wxNewEventType(); +const int wxEVT_GRID_COL_SIZE = wxNewEventType(); +const int wxEVT_GRID_RANGE_SELECT = wxNewEventType(); +const int wxEVT_GRID_CELL_CHANGE = wxNewEventType(); +const int wxEVT_GRID_SELECT_CELL = wxNewEventType(); +const int wxEVT_GRID_EDITOR_SHOWN = wxNewEventType(); +const int wxEVT_GRID_EDITOR_HIDDEN = wxNewEventType(); + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- diff --git a/src/generic/tbarsmpl.cpp b/src/generic/tbarsmpl.cpp index 53f382c402..33d0dfeb9f 100644 --- a/src/generic/tbarsmpl.cpp +++ b/src/generic/tbarsmpl.cpp @@ -789,63 +789,51 @@ int wxToolBarSimple::CalcScrollInc(wxScrollEvent& event) int orient = event.GetOrientation(); int nScrollInc = 0; - switch (event.GetEventType()) + if (event.GetEventType() == wxEVT_SCROLL_TOP) { - case wxEVT_SCROLL_TOP: - { - if (orient == wxHORIZONTAL) - nScrollInc = - m_xScrollPosition; - else - nScrollInc = - m_yScrollPosition; - break; - } - case wxEVT_SCROLL_BOTTOM: - { - if (orient == wxHORIZONTAL) - nScrollInc = m_xScrollLines - m_xScrollPosition; - else - nScrollInc = m_yScrollLines - m_yScrollPosition; - break; - } - case wxEVT_SCROLL_LINEUP: - { - nScrollInc = -1; - break; - } - case wxEVT_SCROLL_LINEDOWN: - { - nScrollInc = 1; - break; - } - case wxEVT_SCROLL_PAGEUP: - { - if (orient == wxHORIZONTAL) - nScrollInc = -GetScrollPageSize(wxHORIZONTAL); - else - nScrollInc = -GetScrollPageSize(wxVERTICAL); - break; - } - case wxEVT_SCROLL_PAGEDOWN: - { - if (orient == wxHORIZONTAL) - nScrollInc = GetScrollPageSize(wxHORIZONTAL); - else - nScrollInc = GetScrollPageSize(wxVERTICAL); - break; - } - case wxEVT_SCROLL_THUMBTRACK: - { - if (orient == wxHORIZONTAL) - nScrollInc = pos - m_xScrollPosition; - else - nScrollInc = pos - m_yScrollPosition; - break; - } - default: - { - break; - } + if (orient == wxHORIZONTAL) + nScrollInc = - m_xScrollPosition; + else + nScrollInc = - m_yScrollPosition; + } else + if (event.GetEventType() == wxEVT_SCROLL_BOTTOM) + { + if (orient == wxHORIZONTAL) + nScrollInc = m_xScrollLines - m_xScrollPosition; + else + nScrollInc = m_yScrollLines - m_yScrollPosition; + } else + if (event.GetEventType() == wxEVT_SCROLL_LINEUP) + { + nScrollInc = -1; + } else + if (event.GetEventType() == wxEVT_SCROLL_LINEDOWN) + { + nScrollInc = 1; + } else + if (event.GetEventType() == wxEVT_SCROLL_PAGEUP) + { + if (orient == wxHORIZONTAL) + nScrollInc = -GetScrollPageSize(wxHORIZONTAL); + else + nScrollInc = -GetScrollPageSize(wxVERTICAL); + } else + if (event.GetEventType() == wxEVT_SCROLL_PAGEDOWN) + { + if (orient == wxHORIZONTAL) + nScrollInc = GetScrollPageSize(wxHORIZONTAL); + else + nScrollInc = GetScrollPageSize(wxVERTICAL); + } else + if ((event.GetEventType() == wxEVT_SCROLL_THUMBTRACK) || + (event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE)) + { + if (orient == wxHORIZONTAL) + nScrollInc = pos - m_xScrollPosition; + else + nScrollInc = pos - m_yScrollPosition; } + if (orient == wxHORIZONTAL) { int w, h;