Back to index

texmacs  1.0.7.15
message.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : message.hpp
00004 * DESCRIPTION: Messages to and between widgets
00005 * COPYRIGHT  : (C) 2007  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 MESSAGE_H
00013 #define MESSAGE_H
00014 #include "renderer.hpp"
00015 #include "widget.hpp"
00016 #include "ntuple.hpp"
00017 #include "rectangles.hpp"
00018 
00019 /******************************************************************************
00020 * C++ stupidity does not allow forward declaration of enums.
00021 * Slots should really be defined in message.hpp
00022 ******************************************************************************/
00023 
00024 enum slot_id {
00025   SLOT_IDENTIFIER,
00026   SLOT_WINDOW,
00027   SLOT_RENDERER,
00028   SLOT_VISIBILITY,
00029   SLOT_FULL_SCREEN,
00030   SLOT_NAME,
00031   SLOT_SIZE,
00032   SLOT_POSITION,
00033   SLOT_UPDATE,
00034   SLOT_REFRESH,
00035   SLOT_KEYBOARD,
00036   SLOT_KEYBOARD_FOCUS,
00037   SLOT_MOUSE,
00038   SLOT_MOUSE_GRAB,
00039   SLOT_MOUSE_POINTER,
00040   SLOT_INVALIDATE,
00041   SLOT_INVALIDATE_ALL,
00042   SLOT_REPAINT,
00043   SLOT_DELAYED_MESSAGE,
00044   SLOT_DESTROY,
00045 
00046   SLOT_SHRINKING_FACTOR,
00047   SLOT_EXTENTS,
00048   SLOT_VISIBLE_PART,
00049   SLOT_SCROLLBARS_VISIBILITY,
00050   SLOT_SCROLL_POSITION,
00051   SLOT_CANVAS,
00052   SLOT_SCROLLABLE,
00053   SLOT_CURSOR,
00054 
00055   SLOT_HEADER_VISIBILITY,
00056   SLOT_MAIN_MENU,
00057   SLOT_MAIN_ICONS_VISIBILITY,
00058   SLOT_MAIN_ICONS,
00059   SLOT_MODE_ICONS_VISIBILITY,
00060   SLOT_MODE_ICONS,
00061   SLOT_FOCUS_ICONS_VISIBILITY,
00062   SLOT_FOCUS_ICONS,
00063   SLOT_USER_ICONS_VISIBILITY,
00064   SLOT_USER_ICONS,
00065   SLOT_SIDE_TOOLS_VISIBILITY,
00066   SLOT_SIDE_TOOLS,
00067   SLOT_FOOTER_VISIBILITY,
00068   SLOT_LEFT_FOOTER,
00069   SLOT_RIGHT_FOOTER,
00070   SLOT_INTERACTIVE_MODE,
00071   SLOT_INTERACTIVE_PROMPT,
00072   SLOT_INTERACTIVE_INPUT,
00073 
00074   SLOT_FORM_FIELD,
00075   SLOT_STRING_INPUT,
00076   SLOT_INPUT_TYPE,
00077   SLOT_INPUT_PROPOSAL,
00078   SLOT_FILE,
00079   SLOT_DIRECTORY
00080 };
00081 
00082 class slot {
00083 public:
00084   slot_id sid;
00085   inline slot (slot_id sid2): sid (sid2) {}
00086   inline slot (const slot& s): sid (s.sid) {}
00087   inline slot& operator = (slot s) { sid= s.sid; return *this; }
00088   inline operator slot_id () { return sid; }
00089   inline bool operator == (slot_id sid2) { return sid == sid2; }
00090   inline bool operator != (slot_id sid2) { return sid != sid2; }
00091   inline bool operator == (slot s) { return sid == s.sid; }
00092   inline bool operator != (slot s) { return sid != s.sid; }
00093   inline friend tm_ostream& operator << (tm_ostream& out, slot s) {
00094     return out << s.sid; }
00095 };
00096 
00097 const char * slot_name (const slot s);
00098 
00099 //extern bool* slot_state_table;
00100 //inline bool is_state_slot (slot s) { return slots_state_table[s]; }
00101 
00102 /******************************************************************************
00103 * Helper templates for sending messages
00104 ******************************************************************************/
00105 
00106 inline void
00107 send (widget w, slot s) {
00108   w->send (s, blackbox ());
00109 }
00110 
00111 template<class T1> inline void
00112 send (widget w, slot s, T1 val) {
00113   w->send (s, close_box (val));
00114 }
00115 
00116 template<class T1, class T2> void
00117 send (widget w, slot s, T1 val1, T2 val2) {
00118   typedef pair<T1,T2> T;
00119   w->send (s, close_box<T> (T (val1, val2)));
00120 }
00121 
00122 template<class T1, class T2, class T3> void
00123 send (widget w, slot s, T1 val1, T2 val2, T3 val3) {
00124   typedef triple<T1,T2,T3> T;
00125   w->send (s, close_box<T> (T (val1, val2, val3)));
00126 }
00127 
00128 template<class T1, class T2, class T3, class T4> void
00129 send (widget w, slot s, T1 val1, T2 val2, T3 val3, T4 val4) {
00130   typedef quartet<T1,T2,T3,T4> T;
00131   w->send (s, close_box<T> (T (val1, val2, val3, val4)));
00132 }
00133 
00134 template<class T1, class T2, class T3, class T4, class T5> void
00135 send (widget w, slot s, T1 val1, T2 val2, T3 val3, T4 val4, T5 val5) {
00136   typedef quintuple<T1,T2,T3,T4,T5> T;
00137   w->send (s, close_box<T> (T (val1, val2, val3, val4, val5)));
00138 }
00139 
00140 template<class T1> inline T1
00141 query (widget w, slot s) {
00142   return open_box<T1> (w->query (s, type_helper<T1>::id));
00143 }
00144 
00145 template<class T1, class T2> void
00146 query (widget w, slot s, T1& val1, T2& val2) {
00147   typedef pair<T1,T2> T;
00148   T p= open_box<T> (w->query (s, type_helper<T>::id));
00149   val1= p.x1; val2= p.x2;
00150 }
00151 
00152 template<class T1, class T2, class T3> void
00153 query (widget w, slot s, T1& val1, T2& val2, T3& val3) {
00154   typedef triple<T1,T2,T3> T;
00155   T t= open_box<T> (w->query (s, type_helper<T>::id));
00156   val1= t.x1; val2= t.x2; val3= t.x3;
00157 }
00158 
00159 template<class T1, class T2, class T3, class T4> void
00160 query (widget w, slot s, T1& val1, T2& val2, T3& val3, T4& val4) {
00161   typedef quartet<T1,T2,T3,T4> T;
00162   T q= open_box<T> (w->query (s, type_helper<T>::id));
00163   val1= q.x1; val2= q.x2; val3= q.x3; val4= q.x4;
00164 }
00165 
00166 template<class T1, class T2, class T3, class T4, class T5> void
00167 query (widget w, slot s, T1& val1, T2& val2, T3& val3, T4& val4, T5& val5) {
00168   typedef quintuple<T1,T2,T3,T4,T5> T;
00169   T q= open_box<T> (w->query (s, type_helper<T>::id));
00170   val1= q.x1; val2= q.x2; val3= q.x3; val4= q.x4; val5= q.x5;
00171 }
00172 
00173 inline void
00174 notify (widget w, slot s) {
00175   w->notify (s, blackbox ());
00176 }
00177 
00178 template<class T1> inline void
00179 notify (widget w, slot s, T1 val) {
00180   w->notify (s, close_box (val));
00181 }
00182 
00183 template<class T1, class T2> void
00184 notify (widget w, slot s, T1 val1, T2 val2) {
00185   typedef pair<T1,T2> T;
00186   w->notify (s, close_box<T> (T (val1, val2)));
00187 }
00188 
00189 inline widget
00190 read (widget w, slot s) {
00191   return w->read (s, blackbox ());
00192 }
00193 
00194 template<class T1> inline widget
00195 read (widget w, slot s, T1 i1) {
00196   return w->read (s, close_box (i1));
00197 }
00198 
00199 inline void
00200 write (widget w, slot s, widget val) {
00201   w->write (s, blackbox (), val);
00202 }
00203 
00204 template<class T1> inline void
00205 write (widget w, slot s, T1 i1, widget val) {
00206   w->write (s, close_box (i1), val);
00207 }
00208 
00209 inline void
00210 connect (widget w1, slot s1, widget w2, slot s2) {
00211   w1->connect (s1, w2, s2);
00212 }
00213 
00214 inline void
00215 deconnect (widget w1, slot s1, widget w2, slot s2) {
00216   w1->deconnect (s1, w2, s2);
00217 }
00218 
00219 /******************************************************************************
00220 * Standard messages
00221 ******************************************************************************/
00222 
00223 inline int
00224 get_identifier (widget w) {
00225   // get low-level handle for the widget's window, as used by the OS
00226   // widgets which have not been attached to a window have a zero identifier
00227   return query<int> (w, SLOT_IDENTIFIER);
00228 }
00229 
00230 inline bool
00231 is_attached (widget w) {
00232   // is the widget attached to some window?
00233   return get_identifier (w) != 0;
00234 }
00235 
00236 inline void
00237 set_identifier (widget w, int id) {
00238   // attach a widget w to the window given by its low-level identifier id
00239   // if id=0, then the widget is detached from its underlying window
00240   return send<int> (w, SLOT_IDENTIFIER, id);
00241 }
00242 
00243 inline widget
00244 get_window (widget w) {
00245   // get the top-level window widget in which the widget is embedded
00246   return read (w, SLOT_WINDOW);
00247 }
00248 
00249 inline renderer
00250 get_renderer (widget w) {
00251   // get renderer associated to widget (or NULL if the widget is not attached)
00252   return query<renderer> (w, SLOT_RENDERER);
00253 }
00254 
00255 inline void
00256 set_visibility (widget w, bool flag) {
00257   // map or unmap a window widget
00258   send<bool> (w, SLOT_VISIBILITY, flag);
00259 }
00260 
00261 inline void
00262 set_full_screen (widget w, bool flag) {
00263   // set or reset full screen mode for a window widget
00264   send<bool> (w, SLOT_FULL_SCREEN, flag);
00265 }
00266 
00267 inline void
00268 set_name (widget w, string s) {
00269   // set the name of a widget (usually a window)
00270   send<string> (w, SLOT_NAME, s);
00271 }
00272 
00273 inline void
00274 set_size (widget w, SI width, SI height) {
00275   // set the current size of the widget
00276   send<SI,SI> (w, SLOT_SIZE, width, height);
00277 }
00278 
00279 inline void
00280 get_size (widget w, SI& width, SI& height) {
00281   // get the current size of the widget
00282   query<SI,SI> (w, SLOT_SIZE, width, height);
00283 }
00284 
00285 inline void
00286 notify_size (widget w, SI new_width, SI new_height) {
00287   // notify a size change for the widget
00288   notify<SI,SI> (w, SLOT_SIZE, new_width, new_height);
00289 }
00290 
00291 inline void
00292 set_position (widget w, SI x, SI y) {
00293   // set the position of the top left corner of the widget w
00294   // w.r.t. the top left of its parent widget
00295   send<SI,SI> (w, SLOT_POSITION, x, y);
00296 }
00297 
00298 inline void
00299 get_position (widget w, SI& x, SI& y) {
00300   // get the position of the top left corner of the widget w
00301   // w.r.t. the top left of its parent widget
00302   query<SI,SI> (w, SLOT_POSITION, x, y);
00303 }
00304 
00305 inline void
00306 notify_position (widget w, SI new_x, SI new_y) {
00307   // notify a change in the position of the widget
00308   notify<SI,SI> (w, SLOT_POSITION, new_x, new_y);
00309 }
00310 
00311 inline void
00312 send_update (widget w) {
00313   // this message is issued if the contents of w or a subwidget of w
00314   // has changed in such a way that the geometries of w and its subwidgets
00315   // may need to be adjusted. Example: a change of the current output language
00316   send (w, SLOT_UPDATE);
00317 }
00318 
00319 inline void
00320 send_refresh (widget w) {
00321   // this message is issued if the contents of one of the dynamic
00322   // subwidgets (as constructed using refresh_widget) of w
00323   // may have changed and needs to be recomputed
00324   send (w, SLOT_REFRESH);
00325 }
00326 
00327 inline void
00328 send_keyboard (widget w, string key, time_t t= 0) {
00329   // send a key press event
00330   send<string,time_t> (w, SLOT_KEYBOARD, key, t);
00331 }
00332 
00333 inline void
00334 send_keyboard_focus (widget w, bool get_focus= true) {
00335   // request the keyboard focus for a widget
00336   send<bool> (w, SLOT_KEYBOARD_FOCUS, get_focus);
00337 }
00338 
00339 inline void
00340 notify_keyboard_focus (widget w, bool has_focus) {
00341   // notify that the widget got or lost keyboard focus
00342   notify<bool> (w, SLOT_KEYBOARD_FOCUS, has_focus);
00343 }
00344 
00345 inline bool
00346 query_keyboard_focus (widget w) {
00347   // does this widget have the keyboard focus?
00348   return query<bool> (w, SLOT_KEYBOARD_FOCUS);
00349 }
00350 
00351 inline void
00352 send_mouse (widget w, string kind, SI x, SI y, int mods, time_t t) {
00353   // send a mouse event of a given kind at position (x, y) and time t
00354   // mods corresponds to active buttons and keyboard modifiers at time t
00355   // the position is specified w.r.t. the top left corner of w
00356   send<string,SI,SI,int,time_t> (w, SLOT_MOUSE, kind, x, y, mods, t);
00357 }
00358 
00359 inline void
00360 send_mouse_grab (widget w, bool get_grab) {
00361   // request a mouse grab for the widget
00362   send<bool> (w, SLOT_MOUSE_GRAB, get_grab);
00363 }
00364 
00365 inline void
00366 notify_mouse_grab (widget w, bool has_grab) {
00367   // notify that the widget got or lost the mouse grab
00368   notify<bool> (w, SLOT_MOUSE_GRAB, has_grab);
00369 }
00370 
00371 inline bool
00372 query_mouse_grab (widget w) {
00373   // does this widget have the mouse grab?
00374   return query<bool> (w, SLOT_MOUSE_GRAB);
00375 }
00376 
00377 inline void
00378 send_mouse_pointer (widget w, string name, string mask_name= "") {
00379   // request a permanent change for the mouse pointer
00380   send<string,string> (w, SLOT_MOUSE_POINTER, name, mask_name);
00381 }
00382 
00383 inline void
00384 send_invalidate_all (widget w) {
00385   // invalidate the widget so that it will be repaint at a next iteration
00386   send (w, SLOT_INVALIDATE_ALL);
00387 }
00388 
00389 inline void
00390 send_invalidate (widget w, SI x1, SI y1, SI x2, SI y2) {
00391   // invalidate a region so that it will be repaint at a next iteration;
00392   // the region is specified w.r.t. the top left corner of w
00393   send<SI,SI,SI,SI> (w, SLOT_INVALIDATE, x1, y1, x2, y2);
00394 }
00395 
00396 inline void
00397 send_repaint (widget w, SI x1, SI y1, SI x2, SI y2) {
00398   // request widget to repaint a region;
00399   // the region is specified w.r.t. the top left corner of w
00400   send<SI,SI,SI,SI> (w, SLOT_REPAINT, x1, y1, x2, y2);
00401 }
00402 
00403 inline void
00404 send_delayed_message (widget w, string message, time_t delay) {
00405   // send a message to w which will only be received after a given delay
00406   send<string,time_t> (w, SLOT_DELAYED_MESSAGE, message, delay);
00407 }
00408 
00409 inline void
00410 send_destroy (widget w) {
00411   // request a widget to be destroyed
00412   send (w, SLOT_DESTROY);
00413 }
00414 
00415 /******************************************************************************
00416 * Canvas related messages
00417 ******************************************************************************/
00418 
00419 inline void
00420 set_shrinking_factor (widget w, int sf) {
00421   // set shrinking factor for canvas
00422   send<int> (w, SLOT_SHRINKING_FACTOR, sf);
00423 }
00424 
00425 inline void
00426 set_extents (widget w, SI x1, SI y1, SI x2, SI y2) {
00427   // set extents of a canvas
00428   send<SI,SI,SI,SI> (w, SLOT_EXTENTS, x1, y1, x2, y2);
00429 }
00430 
00431 inline void
00432 get_extents (widget w, SI& x1, SI& y1, SI& x2, SI& y2) {
00433   // get extents of a canvas
00434   query<SI,SI,SI,SI> (w, SLOT_EXTENTS, x1, y1, x2, y2);
00435 }
00436 
00437 inline void
00438 get_visible_part (widget w, SI& x1, SI& y1, SI& x2, SI& y2) {
00439   // get visible part of a canvas
00440   query<SI,SI,SI,SI> (w, SLOT_VISIBLE_PART, x1, y1, x2, y2);
00441 }
00442 
00443 inline void
00444 set_scrollbars_visibility (widget w, int sb) {
00445   // set visibility of scrollbars
00446   send<int> (w, SLOT_SCROLLBARS_VISIBILITY, sb);
00447 }
00448 
00449 inline void
00450 set_scroll_position (widget w, SI x, SI y) {
00451   // set scroll position in a canvas
00452   send<SI,SI> (w, SLOT_SCROLL_POSITION, x, y);
00453 }
00454 
00455 inline void
00456 get_scroll_position (widget w, SI& x, SI& y) {
00457   // get scroll position in a canvas
00458   query<SI,SI> (w, SLOT_SCROLL_POSITION, x, y);
00459 }
00460 
00461 inline void
00462 set_scrollable (widget w, widget cv) {
00463   // set the scrollable canvas itself
00464   write (w, SLOT_SCROLLABLE, cv);
00465 }
00466 
00467 inline widget
00468 get_canvas (widget w) {
00469   // get the scrollable canvas itself
00470   return read (w, SLOT_CANVAS);
00471 }
00472 
00473 inline void
00474 send_cursor (widget w, SI x1, SI y1) {
00475   // send current cursor coordinates
00476   send<SI,SI> (w, SLOT_CURSOR, x1, y1);
00477 }
00478 
00479 /******************************************************************************
00480 * Top-level window related messages (also behaves as a canvas)
00481 ******************************************************************************/
00482 
00483 inline void
00484 set_header_visibility (widget w, bool visible) {
00485   // set visibility of header (menu and icon bars)
00486   send<bool> (w, SLOT_HEADER_VISIBILITY, visible);
00487 }
00488 
00489 inline bool
00490 get_header_visibility (widget w) {
00491   // get visibility of header (menu and icon bars)
00492   return query<bool> (w, SLOT_HEADER_VISIBILITY);
00493 }
00494 
00495 inline void
00496 set_main_menu (widget w, widget bar) {
00497   // set main menu bar
00498   write (w, SLOT_MAIN_MENU, bar);
00499 }
00500 
00501 inline void
00502 set_main_icons_visibility (widget w, bool visible) {
00503   // set visibility of main icons bar
00504   send<bool> (w, SLOT_MAIN_ICONS_VISIBILITY, visible);
00505 }
00506 
00507 inline bool
00508 get_main_icons_visibility (widget w) {
00509   // get visibility of main icons bar
00510   return query<bool> (w, SLOT_MAIN_ICONS_VISIBILITY);
00511 }
00512 
00513 inline void
00514 set_main_icons (widget w, widget bar) {
00515   // set main icons bar
00516   write (w, SLOT_MAIN_ICONS, bar);
00517 }
00518 
00519 inline void
00520 set_mode_icons_visibility (widget w, bool visible) {
00521   // set visibility of mode dependent icons bar
00522   send<bool> (w, SLOT_MODE_ICONS_VISIBILITY, visible);
00523 }
00524 
00525 inline bool
00526 get_mode_icons_visibility (widget w) {
00527   // get visibility of mode dependent icons bar
00528   return query<bool> (w, SLOT_MODE_ICONS_VISIBILITY);
00529 }
00530 
00531 inline void
00532 set_mode_icons (widget w, widget bar) {
00533   // set mode dependent icons bar
00534   write (w, SLOT_MODE_ICONS, bar);
00535 }
00536 
00537 inline void
00538 set_focus_icons_visibility (widget w, bool visible) {
00539   // set visibility of focus dependent icons bar
00540   send<bool> (w, SLOT_FOCUS_ICONS_VISIBILITY, visible);
00541 }
00542 
00543 inline bool
00544 get_focus_icons_visibility (widget w) {
00545   // get visibility of focus dependent icons bar
00546   return query<bool> (w, SLOT_FOCUS_ICONS_VISIBILITY);
00547 }
00548 
00549 inline void
00550 set_focus_icons (widget w, widget bar) {
00551   // set focus dependent icons bar
00552   write (w, SLOT_FOCUS_ICONS, bar);
00553 }
00554 
00555 inline void
00556 set_user_icons_visibility (widget w, bool visible) {
00557   // set visibility of user icons bar
00558   send<bool> (w, SLOT_USER_ICONS_VISIBILITY, visible);
00559 }
00560 
00561 inline bool
00562 get_user_icons_visibility (widget w) {
00563   // get visibility of user icons bar
00564   return query<bool> (w, SLOT_USER_ICONS_VISIBILITY);
00565 }
00566 
00567 inline void
00568 set_user_icons (widget w, widget bar) {
00569   // set user icons bar
00570   write (w, SLOT_USER_ICONS, bar);
00571 }
00572 
00573 inline void
00574 set_side_tools_visibility (widget w, bool visible) {
00575   // set visibility of user icons bar
00576   send<bool> (w, SLOT_SIDE_TOOLS_VISIBILITY, visible);
00577 }
00578 
00579 inline bool
00580 get_side_tools_visibility (widget w) {
00581   // get visibility of user icons bar
00582   return query<bool> (w, SLOT_SIDE_TOOLS_VISIBILITY);
00583 }
00584 
00585 inline void
00586 set_side_tools (widget w, widget bar) {
00587   // set user icons bar
00588   write (w, SLOT_SIDE_TOOLS, bar);
00589 }
00590 
00591 inline void
00592 set_footer_visibility (widget w, bool visible) {
00593   // set visibility of footer
00594   send<bool> (w, SLOT_FOOTER_VISIBILITY, visible);
00595 }
00596 
00597 inline bool
00598 get_footer_visibility (widget w) {
00599   // get visibility of footer
00600   return query<bool> (w, SLOT_FOOTER_VISIBILITY);
00601 }
00602 
00603 inline void
00604 set_left_footer (widget w, string s) {
00605   // set left footer
00606   send<string> (w, SLOT_LEFT_FOOTER, s);
00607 }
00608 
00609 inline void
00610 set_right_footer (widget w, string s) {
00611   // set right footer
00612   send<string> (w, SLOT_RIGHT_FOOTER, s);
00613 }
00614 
00615 inline void
00616 set_interactive_mode (widget w, bool on) {
00617   // set interactive mode, allowing users to input text on footer
00618   send<bool> (w, SLOT_INTERACTIVE_MODE, on);
00619 }
00620 
00621 inline bool
00622 get_interactive_mode (widget w) {
00623   // check whether footer is in interactive mode
00624   return query<bool> (w, SLOT_INTERACTIVE_MODE);
00625 }
00626 
00627 inline void
00628 set_interactive_prompt (widget w, widget prompt) {
00629   // set prompt for interactive input
00630   write (w, SLOT_INTERACTIVE_PROMPT, prompt);
00631 }
00632 
00633 inline void
00634 set_interactive_input (widget w, widget input) {
00635   // set interactive input widget
00636   write (w, SLOT_INTERACTIVE_INPUT, input);
00637 }
00638 
00639 inline string
00640 get_interactive_input (widget w) {
00641   // set interactive input widget
00642   return query<string> (w, SLOT_INTERACTIVE_INPUT);
00643 }
00644 
00645 /******************************************************************************
00646 * Dialogue windows
00647 ******************************************************************************/
00648 
00649 inline widget
00650 get_form_field (widget w, int i) {
00651   // get the i-th input widget from a dialogue widget
00652   return read<int> (w, SLOT_FORM_FIELD, i);
00653 }
00654 
00655 inline string
00656 get_string_input (widget w) {
00657   // get input string from input widget
00658   return query<string> (w, SLOT_STRING_INPUT);
00659 }
00660 
00661 inline void
00662 set_string_input (widget w, string s) {
00663   // set default input string of input widget
00664   send<string> (w, SLOT_STRING_INPUT, s);
00665 }
00666 
00667 inline void
00668 set_input_type (widget w, string s) {
00669   // set the type of an input field
00670   send<string> (w, SLOT_INPUT_TYPE, s);
00671 }
00672 
00673 inline void
00674 add_input_proposal (widget w, string s) {
00675   // add an extra proposal for input widget (e.g. from history)
00676   send<string> (w, SLOT_INPUT_PROPOSAL, s);
00677 }
00678 
00679 inline void
00680 set_file (widget w, string s) {
00681   // set current file of file chooser widget
00682   send<string> (w, SLOT_FILE, s);
00683 }
00684 
00685 inline widget
00686 get_file (widget w) {
00687   // get file input widget
00688   return read (w, SLOT_FILE);
00689 }
00690 
00691 inline void
00692 set_directory (widget w, string s) {
00693   // set current directory of directory chooser widget
00694   send<string> (w, SLOT_DIRECTORY, s);
00695 }
00696 
00697 inline widget
00698 get_directory (widget w) {
00699   // get directory input widget
00700   return read (w, SLOT_DIRECTORY);
00701 }
00702 
00703 #endif // defined MESSAGE_H