locator.h

Go to the documentation of this file.
00001 
00007 /*
00008 Copyright (C) 2001-2002 The Exult Team
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 */
00024 
00025 #ifndef INCL_LOCATOR
00026 #define INCL_LOCATOR
00027 
00028 /*
00029  *  The 'locator' window:
00030  */
00031 class Locator
00032   {
00033   GtkWidget *win;     // Main window.
00034   GtkWidget *draw;    // GTK draw area to display.
00035   GdkGC *drawgc;      // For drawing in 'draw'.
00036   GtkAdjustment *hadj, *vadj; // For horiz., vert. scales.
00037   int tx, ty, txs, tys, scale;  // Current Exult win. info. in tiles.
00038   GdkRectangle viewbox;   // Where view box was last drawn.
00039   bool dragging;      // True if dragging view box.
00040   int drag_relx, drag_rely; // Mouse pos. rel to view box.
00041   int send_location_timer;  // For sending new loc. to Exult.
00042   void send_location();   // Send location/size to Exult.
00043   void query_location();
00044   static gint delayed_send_location(gpointer data);
00045           // Set view to mouse location.
00046   void goto_mouse(int mx, int my, bool delay_send = false);
00047 public:
00048   Locator();
00049   ~Locator();
00050   void show(bool tf);   // Show/hide.
00051           // Configure when created/resized.
00052   void configure(GtkWidget *widget);
00053   void render(GdkRectangle *area = 0);
00054           // Message from exult.
00055   void view_changed(unsigned char *data, int datalen);
00056           // Handle scrollbar.
00057   static void vscrolled(GtkAdjustment *adj, gpointer data);
00058   static void hscrolled(GtkAdjustment *adj, gpointer data);
00059           // Handle mouse.
00060   gint mouse_press(GdkEventButton *event);
00061   gint mouse_release(GdkEventButton *event);
00062   gint mouse_motion(GdkEventMotion *event);
00063   };
00064 
00065 #endif

Generated on Mon Jul 9 14:42:47 2007 for ExultEngine by  doxygen 1.5.1