Back to index

texmacs  1.0.7.15
window.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : window.hpp
00004 * DESCRIPTION: Abstract window class
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef WINDOW_H
00013 #define WINDOW_H
00014 #include "gui.hpp"
00015 #include "renderer.hpp"
00016 
00017 class widget;
00018 class window_rep;
00019 typedef window_rep* window;
00020 
00021 class window_rep {
00022 public:
00023   inline window_rep () {}
00024   inline virtual ~window_rep () {}
00025 
00026   virtual widget get_widget () = 0;
00027     // Get the top widget associated to the window
00028   virtual renderer get_renderer () = 0;
00029     // Get the renderer associated to the window
00030   virtual void set_name (string name) = 0;
00031     // Set the window title
00032   virtual void set_visibility (bool flag) = 0;
00033     // Map or unmap the window
00034   virtual void set_full_screen (bool flag) = 0;
00035     // Set or reset full screen mode
00036   virtual void set_size (SI w, SI h) = 0;
00037     // Resize the window
00038   virtual void set_size_limits (SI min_w, SI min_h, SI max_w, SI max_h) = 0;
00039     // Specify how far the window can be resized
00040   virtual void get_size (SI& w, SI& h) = 0;
00041     // Get the current size of the window
00042   virtual void get_size_limits (SI& min_w, SI& min_h, SI& max_w, SI& max_h)=0;
00043     // Get information on how far the window can be resized
00044   virtual void set_position (SI x, SI y) = 0;
00045     // Move the window
00046   virtual void get_position (SI& x, SI& y) = 0;
00047     // Get the current position of the window on the screen
00048   virtual void invalidate (SI x1, SI y1, SI x2, SI y2) = 0;
00049     // Explicit request for redrawing a region in the window
00050   virtual void translate (SI x1, SI y1, SI x2, SI y2, SI dx, SI dy) = 0;
00051     // Fast translation of a region in the window (used for scrolling)
00052   virtual void set_keyboard_focus (widget wid, bool get_focus= true) = 0;
00053     // Obtain or release the keyboard focus
00054   virtual bool get_keyboard_focus (widget wid) = 0;
00055     // Does this widget have the keyboard focus
00056   virtual void set_mouse_grab (widget wid, bool get_grab) = 0;
00057     // Obtain or release the mouse grab. Recursive grabs are stored on
00058     // a stack: if w1 and w2 successively grab the mouse and w2 releases
00059     // the mouse grab, then w1 reobtains the mouse grab. Enter and leave
00060     // mouse events are also issued when obtaining or loosing the grab.
00061   virtual bool get_mouse_grab (widget wid) = 0;
00062     // Does this widget have the mouse grab?
00063   virtual void set_mouse_pointer (widget wid, string name, string mask) = 0;
00064     // Set the shape of the mouse pointer with a mask ("" means no mask)
00065   virtual void delayed_message (widget wid, string message, time_t delay) = 0;
00066     // Send message to wid for reception after delay (used for scrolling)
00067   inline virtual void begin_draw () {};
00068     // Use window as renderer outside dedicated repaint method
00069   inline virtual void end_draw () {};
00070     // Stop using window as renderer outside dedicated repaint method
00071 };
00072 
00073 window plain_window (widget w, string name, SI min_w, SI min_h,
00074                    SI def_w, SI def_h, SI max_w, SI max_h);
00075   // Construct a plain window with a given name and size hints
00076 window popup_window (widget w, string name, SI min_w, SI min_h,
00077                    SI def_w, SI def_h, SI max_w, SI max_h);
00078   // Construct a popup window with a given name and size hints
00079 int get_identifier (window w);
00080   // Get low-level handle for the window, as used by the operating system
00081 window get_window (int id);
00082   // Determine the window as a function of its identifier
00083 void windows_delayed_refresh (int ms);
00084   // Refresh all windows after ms milliseconds
00085 
00086 #endif // defined WINDOW_H