Back to index

texmacs  1.0.7.15
qt_simple_widget.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : qt_simple_widget.hpp
00004 * DESCRIPTION: QT simple widget 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_SIMPLE_WIDGET_HPP
00013 #define QT_SIMPLE_WIDGET_HPP
00014 
00015 #include "widget.hpp"
00016 #include "qt_widget.hpp"
00017 #include "qt_simple_widget.hpp"
00018 #include "qt_view_widget.hpp"
00019 #include "QTMWidget.hpp"
00020 
00021 class simple_widget_rep: public qt_view_widget_rep {
00022 public:
00023   simple_widget_rep ();
00024         
00025   virtual void handle_get_size_hint (SI& w, SI& h);
00026   virtual void handle_notify_resize (SI w, SI h);
00027   virtual void handle_keypress (string key, time_t t);
00028   virtual void handle_keyboard_focus (bool has_focus, time_t t);
00029   virtual void handle_mouse (string kind, SI x, SI y, int mods, time_t t);
00030   virtual void handle_set_shrinking_factor (int sf);
00031   virtual void handle_clear (SI x1, SI y1, SI x2, SI y2);
00032   virtual void handle_repaint (SI x1, SI y1, SI x2, SI y2);
00033 
00034   virtual void send (slot s, blackbox val);
00035   // send a message val to the slot s
00036   virtual blackbox query (slot s, int type_id);
00037   // obtain information of a given type from the slot s
00038   virtual widget read (slot s, blackbox index);
00039   // abstract read access (of type s) of a subwidget at position index
00040   virtual void write (slot s, blackbox index, widget w);
00041   // abstract write access (of type s) of a subwidget at position index
00042   virtual void notify (slot s, blackbox new_val);
00043 
00044   virtual QAction* as_qaction();
00045   // virtual TMMenuItem* as_menuitem();
00046   virtual QWidget* get_canvas() { return tm_canvas(); }
00047 
00048   QTMWidget* tm_canvas () { return qobject_cast <QTMWidget*>(view); }
00049 };
00050 
00051 inline simple_widget_rep *concrete_simple_widget (widget w) { return static_cast<simple_widget_rep*>(w.rep); }
00052 
00053 #endif // defined QT_SIMPLE_WIDGET_HPP