Back to index

texmacs  1.0.7.15
qt_ui_element.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  * MODULE     : qt_ui_element.hpp
00004  * DESCRIPTION: User interface proxies
00005  * COPYRIGHT  : (C) 2010  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_UI_ELEMENT_HPP
00013 #define QT_UI_ELEMENT_HPP
00014 
00015 #include "qt_widget.hpp"
00016 #include "ntuple.hpp"
00017 #include "promise.hpp"
00018 #include "url.hpp"
00019 
00020 #include <QAction>
00021 
00022 /*******************************************************************************
00023  * ui element widget  
00024  *******************************************************************************/
00025 
00032 class qt_ui_element_rep: public qt_widget_rep {
00033 public:
00034   
00035   enum types {
00036     horizontal_menu, vertical_menu, horizontal_list, vertical_list,
00037     tile_menu, minibar_menu, menu_separator, menu_group, 
00038     pulldown_button, pullright_button, menu_button,
00039     balloon_widget, text_widget, xpm_widget, toggle_widget,
00040     enum_widget, choice_widget, scrollable_widget,
00041     hsplit_widget, vsplit_widget,
00042     aligned_widget, tabs_widget, wrapped_widget,
00043     glue_widget 
00044   } ;
00045   
00046   types type;
00047   blackbox load;
00048   
00049   QAction *cachedAction;
00050   
00051   qt_ui_element_rep (types _type, blackbox _load) 
00052   : type(_type), load(_load), cachedAction(NULL)  {};
00053 
00054   ~qt_ui_element_rep(); 
00055 
00056   virtual widget make_popup_widget ();
00057   virtual widget popup_window_widget (string s);
00058   virtual widget plain_window_widget (string s, command q);
00059   virtual QAction* as_qaction ();
00060   virtual QMenu *get_qmenu();
00061   virtual QLayoutItem *as_qlayoutitem ();
00062   virtual QWidget *as_qwidget ();
00063     
00064 
00065   template<class X1> static widget create (types _type, X1 x1) {
00066     return tm_new <qt_ui_element_rep> (_type, close_box<X1>(x1));
00067   }
00068   
00069   template <class X1, class X2> 
00070   static widget create (types _type, X1 x1, X2 x2) {
00071     typedef pair<X1,X2> T;
00072     return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2)));
00073   }
00074   
00075   template <class X1, class X2, class X3> 
00076   static widget create (types _type, X1 x1, X2 x2, X3 x3) {
00077     typedef triple<X1,X2,X3> T;
00078     return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2,x3)));
00079   }
00080   
00081   template <class X1, class X2, class X3, class X4> 
00082   static widget create (types _type, X1 x1, X2 x2, X3 x3, X4 x4) {
00083     typedef quartet<X1,X2,X3,X4> T;
00084     return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2,x3,x4)));
00085   }
00086   
00087   template <class X1, class X2, class X3, class X4, class X5> 
00088   static widget create (types _type, X1 x1, X2 x2, X3 x3, X4 x4, X5 x5) {
00089     typedef quintuple<X1,X2,X3,X4,X5> T;
00090     return tm_new <qt_ui_element_rep> (_type, close_box<T> (T (x1,x2,x3,x4,x5)));
00091   }
00092   
00093 };
00094 
00095 
00096 #endif // defined QT_UI_ELEMENT_HPP