mouse.h

Go to the documentation of this file.
00001 #ifndef MOUSE_CLASS
00002 #define MOUSE_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : mouse                                                             *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *  Purpose:                                                                   *
00010 *                                                                             *
00011 *    Provides access to the mouse's position and button state.                *
00012 *                                                                             *
00013 *******************************************************************************
00014 * Copyright (c) 1991-$now By Author.  This program is free software; you can  *
00015 * redistribute it and/or modify it under the terms of the GNU General Public  *
00016 * License as published by the Free Software Foundation; either version 2 of   *
00017 * the License or (at your option) any later version.  This is online at:      *
00018 *     http://www.fsf.org/copyleft/gpl.html                                    *
00019 * Please send any updates to: fred@gruntose.com                               *
00020 \*****************************************************************************/
00021 
00022 #include "dll_wp_active.h"
00023 
00024 #include <wp_passive/nub.h>
00025 
00026 class WP_ACTIVE_CLASS_STYLE mouse
00027 {
00028 public:
00029   mouse(nub &to_connect);
00030   virtual ~mouse();
00031 
00032   IMPLEMENT_CLASS_NAME("mouse");
00033 
00034   c_point position() const;
00035     // Returns the position of the pointer relative to the nub and in
00036     // device coordinates.
00037   
00038   //  void position(c_point new_position);
00039   
00040   enum button_positions { up, down };
00041     // the mouse button is down when the user is pushing the button and up
00042     // when the user is not pushing it.
00043   
00044   virtual void button_event(const c_point &where, int button_number,
00045           button_positions state) = 0;
00046     // invoked when the button is pressed or released.  where is in the
00047     // same system as position().
00048 
00049   static void mouse_callback(window_handle, mouse *me, XEvent *parms);
00050 
00051 private:
00052   nub &_connection;
00053   c_point convert(const c_point &to_convert) const;
00054 };
00055 
00056 #endif
00057 

Generated on Fri Nov 28 04:29:04 2008 for HOOPLE Libraries by  doxygen 1.5.1