diff options
-rw-r--r-- | include/widgets.h | 6 | ||||
-rw-r--r-- | lib/widgets.cc | 26 |
2 files changed, 29 insertions, 3 deletions
diff --git a/include/widgets.h b/include/widgets.h index 6469ea7..2bf2300 100644 --- a/include/widgets.h +++ b/include/widgets.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: widgets.h,v 1.8 2004-11-27 21:48:01 pixel Exp $ */ +/* $Id: widgets.h,v 1.9 2004-12-27 18:47:24 pixel Exp $ */ #ifndef __WIDGETS_H__ #define __WIDGETS_H__ @@ -37,7 +37,11 @@ namespace mogltk { E_MOUSE_MOVE, E_MOUSE_OUT, E_MOUSE_DOWN, + E_MOUSE_RIGHT_DOWN, + E_MOUSE_MIDDLE_DOWN, E_MOUSE_UP, + E_MOUSE_RIGHT_UP, + E_MOUSE_MIDDLE_UP, E_MOUSE_CLICK, E_MOUSE_OUT_CLICK, E_MOUSE_DBL_CLICK, diff --git a/lib/widgets.cc b/lib/widgets.cc index 55c709c..16899da 100644 --- a/lib/widgets.cc +++ b/lib/widgets.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: widgets.cc,v 1.10 2004-11-27 21:48:03 pixel Exp $ */ +/* $Id: widgets.cc,v 1.11 2004-12-27 18:47:24 pixel Exp $ */ #include <SDL.h> #include <vector> @@ -33,6 +33,8 @@ #include "gettext.h" + +// Why so much ugly globals... ? mogltk::widget * dragged_widget = 0; std::vector<mogltk::widget *> out_move, out_click; @@ -180,6 +182,26 @@ void widget_mouse_event::action(SDL_MouseButtonEvent b) { root->m_event(mx, my, mogltk::E_MOUSE_UP); // generate a mouse_up event. } + } else if (b.button == 2) { + if (b.state) { + printm(M_INFO, "mouse_right_down\n"); + root->m_event(mx, my, mogltk::E_MOUSE_RIGHT_DOWN); + // generate a mouse_right_down event; + } else { + printm(M_INFO, "mouse_right_down\n"); + root->m_event(mx, my, mogltk::E_MOUSE_RIGHT_UP); + // generate a mouse_right_up event; + } + } else if (b.button == 3) { + if (b.state) { + printm(M_INFO, "mouse_middle_down\n"); + root->m_event(mx, my, mogltk::E_MOUSE_MIDDLE_DOWN); + // generate a mouse_right_down event; + } else { + printm(M_INFO, "mouse_right_down\n"); + root->m_event(mx, my, mogltk::E_MOUSE_MIDDLE_UP); + // generate a mouse_right_up event; + } } } @@ -1171,7 +1193,7 @@ void mogltk::widget::mainloop() { Sprite::Cursor->draw(mx - 8, my - 6); if (w = root->find_widget(mx, my)) { - sh->box(w->GetAX(), w->GetAY(), w->GetAX2(), w->GetAY2(), Color(100, 150, 60, 50)); +// sh->box(w->GetAX(), w->GetAY(), w->GetAX2(), w->GetAY2(), Color(100, 150, 60, 50)); } engine::base_o->Flip(); |