Back to index

texmacs  1.0.7.15
qt_gui.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : qt_gui.hpp
00004 * DESCRIPTION: QT GUI class
00005 * COPYRIGHT  : (C) 2008 Massimiliano Gubinelli
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 QT_GUI_HPP
00013 #define QT_GUI_HPP
00014 
00015 #include <QPixmap>
00016 #include <QApplication>
00017 #include <QTimer>
00018 #include <QLabel>
00019 #include <QList>
00020 
00021 #include "timer.hpp"
00022 #include "gui.hpp"
00023 #include "font.hpp"
00024 #include "widget.hpp"
00025 #include "array.hpp"
00026 #include "hashmap.hpp"
00027 #include "socket_notifier.hpp"
00028 
00029 /******************************************************************************
00030 * The qt_gui class
00031 ******************************************************************************/
00032 
00033 typedef class qt_gui_rep* qt_gui;
00034 extern qt_gui the_gui;
00035 class QTMGuiHelper;
00036 class simple_widget_rep;
00037 
00038 class qt_gui_rep {
00039 public:
00040   bool interrupted;
00041   time_t interrupt_time;
00042   QTMGuiHelper *gui_helper;
00043   QTimer *updatetimer;
00044   QList<QLabel*> waitDialogs;
00045   QWidget *waitWindow;
00046 
00047   hashmap<string,tree>   selection_t;
00048   hashmap<string,string> selection_s;
00049 
00050 public:
00051   qt_gui_rep (int &argc, char **argv);
00052   virtual ~qt_gui_rep ();
00053 
00054   /********************* extents, grabbing, selections ***********************/
00055   void get_extents (SI& width, SI& height);
00056   void get_max_size (SI& width, SI& height);
00057   // void set_button_state (unsigned int state);
00058 
00059   /* important routines */
00060   void event_loop ();
00061 
00062   /* interclient communication */
00063   virtual bool get_selection (string key, tree& t, string& s, string format);
00064   virtual bool set_selection (string key, tree t, string s, string format);
00065   virtual void clear_selection (string key);
00066 
00067   /* miscellaneous */
00068   void image_gc (string name= "*");
00069   void set_mouse_pointer (string name);
00070   void set_mouse_pointer (string curs_name, string mask_name);
00071   void show_wait_indicator (widget w, string message, string arg);
00072   bool check_event (int type);
00073 
00074   void update();
00075   
00076   void add_notifier (socket_notifier);
00077   void remove_notifier (socket_notifier);
00078   void enable_notifier (socket_notifier, bool);
00079   
00080   /* queued processing */
00081   void process_keypress (simple_widget_rep *wid, string key, time_t t);
00082   void process_keyboard_focus (simple_widget_rep *wid, bool has_focus, time_t t);
00083   void process_mouse (simple_widget_rep *wid, string kind, SI x, SI y, int mods, time_t t);
00084   void process_resize (simple_widget_rep *wid, SI x, SI y);
00085   void process_command (command _cmd);
00086   void process_command (command _cmd, object _args);
00087   void process_socket_notification (socket_notifier sn);
00088   void process_delayed_commands (); 
00089 
00090   void process_queued_events (int max = -1);
00091   //void process_get_size_hint (SI& w, SI& h);
00092   //void process_notify_resize (SI w, SI h);
00093   //void process_set_shrinking_factor (int sf);
00094   //void process_clear (SI x1, SI y1, SI x2, SI y2);
00095   //void process_repaint (SI x1, SI y1, SI x2, SI y2);
00096   
00097   
00098 };
00099 
00100 void force_update(); 
00101 // force an immediate update of the internal texmacs state
00102 
00103 #endif // defined QT_GUI_HPP