xdrag.h

Go to the documentation of this file.
00001 /*
00002  *  Xdrag.h - Drag-and-drop under X.
00003  *
00004  *  Copyright (C) 2000-2001  The Exult Team
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef INCL_XDRAG
00022 #define INCL_XDRAG
00023 
00024 #include "u7drag.h"
00025 
00026 const int max_types = 15;
00027 
00028 /*
00029  *  This supports the 'drop' side of Xdnd:
00030  */
00031 class Xdnd
00032   {
00033   Display *display;
00034   Window xwmwin;      // Gets WM window.
00035   Window xgamewin;    // Game window within xwmwin.
00036   Atom shapeid_atom;    // For drag-and-drop of shapes.
00037   Atom chunkid_atom;    // For chunks.
00038   Atom comboid_atom;    // For combos.
00039   Atom xdnd_aware;    // For XdndAware.
00040   Atom xdnd_enter;
00041   Atom xdnd_leave;
00042   Atom xdnd_position;
00043   Atom xdnd_drop;
00044   Atom xdnd_status;
00045   Atom xdnd_copy;
00046   Atom xdnd_ask;
00047   Atom xdnd_typelist;
00048   Atom xdnd_selection;
00049   unsigned long xdnd_version;
00050   int num_types;
00051   Atom drag_types[max_types]; // Data type atoms source can supply.
00052           // Current drag info:
00053   int lastx, lasty;   // Last mouse pos. during drag, within
00054           //   our window.
00055   int winx, winy;     // Window coords. at start of drag.
00056   int file, shape, frame;   // Set when a shape is being dragged.
00057   int chunknum;     // Set when a chunk is dragged.
00058   int combo_cnt;      // Set when combo is dragged.
00059   int combo_xtiles, combo_ytiles, combo_tiles_right, combo_tiles_below;
00060   struct U7_combo_data *combo;  // Combo elements (allocated);
00061   bool data_valid;    // True when the above is retrieved.
00062 
00063   Move_shape_handler_fun move_shape_handler;  // For dragging shapes.
00064   Move_combo_handler_fun move_combo_handler;  // For dragging combos.
00065   Drop_shape_handler_fun shape_handler; // For dropping shapes.
00066   Drop_chunk_handler_fun chunk_handler; // For dropping chunks.
00067   Drop_combo_handler_fun combo_handler; // For dropping combos.
00068 public:
00069   Xdnd(Display *d, Window xw, Window xgw, Move_shape_handler_fun movefun,
00070     Move_combo_handler_fun movecmbfun,
00071     Drop_shape_handler_fun shapefun, Drop_chunk_handler_fun cfun,
00072           Drop_combo_handler_fun cmbfun);
00073   ~Xdnd();
00074   void client_msg(XClientMessageEvent& cev);
00075   void select_msg(XSelectionEvent& sev);
00076   };
00077 
00078 #endif

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