core/vgui/vgui_drag_mixin.cxx
Go to the documentation of this file.
00001 // This is core/vgui/vgui_drag_mixin.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 
00006 //:
00007 // \file
00008 // \author Philip C. Pritchett, RRG, University of Oxford
00009 // \date   11 Sep 99
00010 // \brief  See vgui_drag_mixin.h for a description of this file.
00011 
00012 #include "vgui_drag_mixin.h"
00013 
00014 #include <vcl_iostream.h>
00015 
00016 #include <vgui/vgui_event.h>
00017 
00018 static bool debug=false;
00019 
00020 vgui_drag_mixin::vgui_drag_mixin()
00021 {
00022   last_down_button_ = vgui_BUTTON_NULL;
00023 }
00024 
00025 vgui_drag_mixin::~vgui_drag_mixin()
00026 {
00027 }
00028 
00029 bool vgui_drag_mixin::handle(vgui_event const &event)
00030 {
00031   if ((event.type==vgui_MOTION) && (last_down_button_ != vgui_BUTTON_NULL))
00032     return mouse_drag(event.wx, event.wy, last_down_button_, event.modifier);
00033 
00034   if (event.type==vgui_BUTTON_DOWN)
00035     last_down_button_ = event.button;
00036 
00037   else if (event.type==vgui_BUTTON_UP)
00038     last_down_button_ = vgui_BUTTON_NULL;
00039 
00040   return false;
00041 }
00042 
00043 
00044 bool vgui_drag_mixin::mouse_drag(int, int, vgui_button, vgui_modifier)
00045 {
00046   if (debug) vcl_cerr << "vgui_drag_mixin::mouse_drag\n";
00047   return false;
00048 }
00049