Back to index

texmacs  1.0.7.15
Classes | Defines | Typedefs | Functions | Variables
widget.hpp File Reference
#include "list.hpp"
#include "tree.hpp"
#include "blackbox.hpp"
#include "command.hpp"
#include "timer.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  widget_rep
class  widget

Defines

#define PIXEL   256
#define WIDGET_STYLE_MINI   1
#define WIDGET_STYLE_MONOSPACED   2
#define WIDGET_STYLE_GREY   4
#define WIDGET_STYLE_PRESSED   8
#define WIDGET_STYLE_INERT   16
#define WIDGET_STYLE_BUTTON   32
#define WIDGET_STYLE_CENTERED   64
#define WIDGET_STYLE_BOLD   128

Typedefs

typedef window_repwindow
typedef unsigned int color

Functions

 ABSTRACT_NULL_CODE (widget)
tm_ostreamoperator<< (tm_ostream &out, widget w)
widget plain_window_widget (widget w, string s, command quit=command())
 Creates a decorated window using the given widget.
widget popup_window_widget (widget w, string s)
void destroy_window_widget (widget w)
widget texmacs_widget (int mask, command quit)
 A factory for the main TeXmacs window.
widget file_chooser_widget (command cmd, string type, bool save)
widget printer_widget (command cmd, url ps_pdf_file)
widget color_picker_widget (command cmd, bool bg, array< tree > proposals)
widget inputs_list_widget (command call_back, array< string > prompts)
widget popup_widget (widget w)
 A factory for a popup widget container whose contents are to be unmapped as soon as the mouse exits the widget.
widget horizontal_menu (array< widget > a)
widget vertical_menu (array< widget > a)
widget tile_menu (array< widget > a, int cols)
widget minibar_menu (array< widget > a)
widget menu_separator (bool vertical)
widget menu_group (string name, int style)
widget pulldown_button (widget w, promise< widget > pw)
widget pullright_button (widget w, promise< widget > pw)
widget menu_button (widget w, command cmd, string pre="", string ks="", int style=0)
widget balloon_widget (widget w, widget help)
widget text_widget (string s, int style, color col, bool tsp=true)
widget xpm_widget (url file_name)
widget input_text_widget (command call_back, string type, array< string > def, int style=0, string width="1w")
widget enum_widget (command cb, array< string > vals, string val, int st=0, string w="1w")
widget choice_widget (command cb, array< string > vals, string val)
widget choice_widget (command cb, array< string > vals, array< string > mc)
widget empty_widget ()
widget glue_widget (bool hx=true, bool vx=true, SI w=0, SI h=0)
widget glue_widget (tree col, bool hx=true, bool vx=true, SI w=0, SI h=0)
widget horizontal_list (array< widget > a)
widget vertical_list (array< widget > a)
widget aligned_widget (array< widget > lhs, array< widget > rhs, SI hsep=3 *PIXEL, SI vsep=3 *PIXEL, SI lpad=0, SI rpad=0)
widget tabs_widget (array< widget > tabs, array< widget > bodies)
widget wrapped_widget (widget w, command quit)
widget user_canvas_widget (widget wid, int style=0)
widget resize_widget (widget w, int style, string w1, string h1, string w2, string h2, string w3, string h3)
widget hsplit_widget (widget l, widget r)
widget vsplit_widget (widget t, widget b)
widget extend (widget w, array< widget > a)
widget toggle_widget (command cmd, bool on=false, int style=0)
widget wait_widget (SI width, SI height, string message)
widget ink_widget (command cb)
widget refresh_widget (string tmwid)

Variables

bool use_side_tools

Define Documentation

#define PIXEL   256

Definition at line 19 of file widget.hpp.

#define WIDGET_STYLE_BOLD   128

Definition at line 96 of file widget.hpp.

#define WIDGET_STYLE_BUTTON   32

Definition at line 92 of file widget.hpp.

#define WIDGET_STYLE_CENTERED   64

Definition at line 94 of file widget.hpp.

#define WIDGET_STYLE_GREY   4

Definition at line 86 of file widget.hpp.

#define WIDGET_STYLE_INERT   16

Definition at line 90 of file widget.hpp.

#define WIDGET_STYLE_MINI   1

Definition at line 82 of file widget.hpp.

#define WIDGET_STYLE_MONOSPACED   2

Definition at line 84 of file widget.hpp.

#define WIDGET_STYLE_PRESSED   8

Definition at line 88 of file widget.hpp.


Typedef Documentation

typedef unsigned int color

Definition at line 23 of file widget.hpp.

typedef window_rep* window

Definition at line 21 of file widget.hpp.


Function Documentation

widget aligned_widget ( array< widget lhs,
array< widget rhs,
SI  hsep = 3 *PIXEL,
SI  vsep = 3 *PIXEL,
SI  lpad = 0,
SI  rpad = 0 
)

Definition at line 1278 of file qt_ui_element.cpp.

                                                                                                 { 
  typedef quartet<SI, SI, SI, SI> T1;
  typedef triple<array<widget>, array<widget>, T1> T;
  return tm_new <qt_ui_element_rep> (qt_ui_element_rep::aligned_widget, 
                                     close_box (T (lhs,rhs, T1 (hsep, vsep, lpad, rpad)))); 
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget balloon_widget ( widget  w,
widget  help 
)

Definition at line 437 of file aqua_menu.mm.

{ 
  return tm_new <aqua_balloon_widget_rep> (w,help);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget choice_widget ( command  cb,
array< string vals,
string  val 
)

Definition at line 1299 of file qt_ui_element.cpp.

                                                                   {
  array<string> chosen (1);
  chosen[0]= cur;
  return qt_ui_element_rep::create(qt_ui_element_rep::choice_widget, cmd, vals, chosen, false); }

Here is the call graph for this function:

Here is the caller graph for this function:

widget choice_widget ( command  cb,
array< string vals,
array< string mc 
)

Definition at line 1298 of file qt_ui_element.cpp.

Here is the call graph for this function:

widget color_picker_widget ( command  cmd,
bool  bg,
array< tree proposals 
)

Definition at line 724 of file aqua_dialogues.mm.

                                                                        {
  // widgets for selecting a color, a pattern or a background image,
  // encoded by a tree. On input, we give a list of recently used proposals
  // on termination the command is called with the selected color as argument
  // the bg flag specifies whether we are picking a background color or fill
  NOT_IMPLEMENTED;
  (void) call_back; (void) bg; (void) proposals;
  return glue_widget (false, false, 100*PIXEL, 100*PIXEL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1036 of file aqua_widget.mm.

                                        {  
// destroys a window as created by the above routines
  (void) w;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1076 of file aqua_widget.mm.

                {
  // an empty widget of size zero
  NOT_IMPLEMENTED;
  return widget();
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget enum_widget ( command  cb,
array< string vals,
string  val,
int  st = 0,
string  w = "1w" 
)

Definition at line 1297 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

widget extend ( widget  w,
array< widget a 
)

Definition at line 1099 of file aqua_widget.mm.

                                   {
  (void) a;
  return w;
}

Here is the call graph for this function:

widget file_chooser_widget ( command  cmd,
string  type,
bool  save 
)

Definition at line 542 of file qt_dialogues.cpp.

                                                           {
  // file chooser widget for files of a given type; for files of type "image",
  // the widget includes a previsualizer and a default magnification
  // for importation can be specified
  return tm_new<qt_chooser_widget_rep> (cmd, type, save);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget glue_widget ( bool  hx = true,
bool  vx = true,
SI  w = 0,
SI  h = 0 
)

Definition at line 1083 of file aqua_widget.mm.

                                           {
  //{ return widget(); }
  // an empty widget of minimal width w and height h and which is horizontally
  // resp. vertically extensible if hx resp. vx is true
  NOT_IMPLEMENTED;
  (void) hx; (void) vx; (void) w; (void) h;
  return tm_new <aqua_view_widget_rep> ([[[NSView alloc] initWithFrame:NSMakeRect(0, 0, 50, 50)] autorelease]);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget glue_widget ( tree  col,
bool  hx = true,
bool  vx = true,
SI  w = 0,
SI  h = 0 
)

Definition at line 1093 of file aqua_widget.mm.

                                                     {
  (void) col;
  return glue_widget (hx, vx, w, h);
}

Here is the call graph for this function:

Definition at line 228 of file aqua_menu.mm.

                                  {
  return horizontal_menu (a);
}  

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 213 of file aqua_menu.mm.

{
       NSMenuItem* mi = [[alloc_menuitem() initWithTitle:@"Menu" action:NULL keyEquivalent:@""] autorelease];
       NSMenu *menu = [[alloc_menu() init] autorelease];
       for(int i = 0; i < N(a); i++) {
              if (is_nil(a[i])) 
                     break;
      [menu addItem: concrete(a[i])->as_menuitem()];
       };
       [mi setSubmenu:menu];
       return tm_new <aqua_menu_rep> (mi);       
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1310 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1312 of file qt_ui_element.cpp.

                               {
  (void) cb;
  FAILED ("not yet implemented"); }

Here is the call graph for this function:

Here is the caller graph for this function:

widget input_text_widget ( command  call_back,
string  type,
array< string def,
int  style = 0,
string  width = "1w" 
)

Definition at line 669 of file aqua_dialogues.mm.

{
  (void) style; (void) width;
  return tm_new <aqua_input_text_widget_rep> (call_back, type, def);
}

Here is the caller graph for this function:

widget inputs_list_widget ( command  call_back,
array< string prompts 
)

Definition at line 659 of file aqua_dialogues.mm.

{
       return tm_new <aqua_input_widget_rep> (call_back,prompts);

}

Here is the call graph for this function:

Here is the caller graph for this function:

widget menu_button ( widget  w,
command  cmd,
string  pre = "",
string  ks = "",
int  style = 0 
)

Definition at line 410 of file aqua_menu.mm.

{
  bool ok= (style & WIDGET_STYLE_INERT) == 0;
  TMMenuItem *mi = nil;
  
  if (typeid(*(w.rep)) == typeid(simple_widget_rep)) {
    mi = [[[TMMenuItem alloc] init] autorelease];
    [mi setWidget:(simple_widget_rep*)w.rep];
  } else  {
    mi = ((aqua_widget_rep*)w.rep)->as_menuitem();
  }

  [mi setCommand: cmd.rep];
  [mi setEnabled:(ok ? YES : NO)];
       // FIXME: implement complete prefix handling and keyboard shortcuts
       // cout << "ks: "<< ks << "\n";
       [mi setState:(pre!="" ? NSOnState: NSOffState)];
       if (pre == "v") {
       } else if (pre == "*") {
//            [mi setOnStateImage:[NSImage imageNamed:@"TMStarMenuBullet"]];
       } else if (pre == "o") {
       }
       return tm_new <aqua_menu_rep> (mi);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget menu_group ( string  name,
int  style 
)

Definition at line 341 of file aqua_menu.mm.

{
       (void) style;
       NSMenuItem* mi = [[alloc_menuitem() initWithTitle:to_nsstring_utf8(name) action:NULL keyEquivalent:@""] autorelease];

       //     NSAttributedString *str = [mi attributedTitle];
       NSMutableParagraphStyle *pstyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
//     NSMutableParagraphStyle *style = [(NSParagraphStyle*)[str attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:NULL] mutableCopy];
       [pstyle setAlignment: NSCenterTextAlignment];
       [mi setAttributedTitle:[[[NSAttributedString alloc] 
                               initWithString: [mi title]
                                   attributes: [NSDictionary 
                                      dictionaryWithObjectsAndKeys:pstyle, NSParagraphStyleAttributeName, nil]]
                                autorelease]];
       return tm_new <aqua_menu_rep> (mi);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget menu_separator ( bool  vertical)

Definition at line 339 of file aqua_menu.mm.

{ return tm_new <aqua_menu_rep> ([NSMenuItem separatorItem]); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 232 of file aqua_menu.mm.

                                      {
  return horizontal_menu (a);
}

Here is the call graph for this function:

Here is the caller graph for this function:

tm_ostream& operator<< ( tm_ostream out,
widget  w 
) [inline]

Definition at line 71 of file widget.hpp.

                                        {
  if (is_nil (w)) return out << "nil";
  else return w->print (out);
}

Here is the call graph for this function:

Creates a decorated window using the given widget.

The window will have name s, contents w and perform command q upon closing.

Definition at line 150 of file qt_widget.cpp.

                                                    {
  return concrete(w)->plain_window_widget (s, q);
}

Here is the call graph for this function:

Here is the caller graph for this function:

A factory for a popup widget container whose contents are to be unmapped as soon as the mouse exits the widget.

This is used in edit_mouse.cpp to implement a contextual menu in the canvas

Parameters:
wThe widget to be placed in the popup. It will be deleted after the mouse leaves the popup.
Returns:

Definition at line 1061 of file aqua_widget.mm.

{
  return concrete(w)->make_popup_widget();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1030 of file aqua_widget.mm.

{
  return concrete(w)->popup_window_widget(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget printer_widget ( command  cmd,
url  ps_pdf_file 
)

Definition at line 717 of file aqua_dialogues.mm.

                                    {
  (void) u;
  return menu_button (text_widget ("Cancel", 0, black), cmd, "", "", 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 359 of file aqua_menu.mm.

{
//     NSString *title = (is_nil(w)? @"":((aqua_menu_text_rep*)w.rep)->text);
//     NSMenuItem *mi = [[alloc_menuitem() initWithTitle:title action:NULL keyEquivalent:@""] autorelease];
//     TMMenuItem* mi =  (TMMenuItem*)((aqua_menu_rep*)w.rep) -> item;
  TMMenuItem* mi = concrete(w) -> as_menuitem();
   
  TMLazyMenu *lm = [[[TMLazyMenu alloc] init] autorelease];
       [lm setPromise:pw.rep];
       [mi setSubmenu: lm];
       return tm_new <aqua_menu_rep> (mi);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 373 of file aqua_menu.mm.

{
       return pulldown_button(w, pw);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1315 of file qt_ui_element.cpp.

                                     {
  (void) tmwid;
  FAILED ("not yet implemented"); }

Here is the call graph for this function:

Here is the caller graph for this function:

widget resize_widget ( widget  w,
int  style,
string  w1,
string  h1,
string  w2,
string  h2,
string  w3,
string  h3 
)

Definition at line 1304 of file qt_ui_element.cpp.

                                                                  {
  (void) w; (void) style; (void) w1; (void) h1; (void) w2; (void) h2; (void) w3; (void) h3;
  //FIXME: add a meaningul semantics
  return w;
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget tabs_widget ( array< widget tabs,
array< widget bodies 
)

Definition at line 1284 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

widget texmacs_widget ( int  mask,
command  quit 
)

A factory for the main TeXmacs window.

Parameters:
maskIndicates whether the menu, icon bars, status bar, etc. are visible or not.
quitCommand called on exit.

Definition at line 1046 of file aqua_widget.mm.

{
  (void) mask; (void) quit; // FIXME: handle correctly mask and quit

  widget w = tm_new <aqua_tm_widget_rep> (mask);
  return w; 
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget text_widget ( string  s,
int  style,
color  col,
bool  tsp = true 
)

Definition at line 444 of file aqua_menu.mm.

{
  (void) style;
  string t= tm_var_encode (s);
  return tm_new <aqua_text_widget_rep> (t,col,tsp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget tile_menu ( array< widget a,
int  cols 
)

Definition at line 317 of file aqua_menu.mm.

{ 
//     return horizontal_menu(a); 
       NSMutableArray *tiles = [NSMutableArray arrayWithCapacity:N(a)];
       for(int i = 0; i < N(a); i++) {
              if (is_nil(a[i]))  break;
//            [tiles addObject:( (aqua_menu_rep*)(a[i].rep))->item];
      [tiles addObject:concrete(a[i])->as_menuitem()];
       };
       TMTileView* tv = [[[TMTileView alloc] initWithObjects:tiles cols:cols] autorelease];
       
       NSMenuItem* mi = [[[NSMenuItem alloc] initWithTitle:@"Tile" action:NULL keyEquivalent:@""] autorelease];

       
       [mi setView:tv];
       return tm_new <aqua_menu_rep> (mi);
       
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget toggle_widget ( command  cmd,
bool  on = false,
int  style = 0 
)

Definition at line 1296 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

widget user_canvas_widget ( widget  wid,
int  style = 0 
)

Definition at line 1303 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 240 of file aqua_menu.mm.

                                {
  return vertical_menu (a);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 236 of file aqua_menu.mm.

{ return horizontal_menu(a); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1311 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

widget wait_widget ( SI  width,
SI  height,
string  message 
)

Definition at line 1105 of file aqua_widget.mm.

                                                  { 
  // a widget of a specified width and height, displaying a wait message
  // this widget is only needed when using the X11 plugin
  (void) width; (void) height; (void) message;
  return widget(); 
}

Here is the call graph for this function:

Here is the caller graph for this function:

widget wrapped_widget ( widget  w,
command  quit 
)

Definition at line 1285 of file qt_ui_element.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

widget xpm_widget ( url  file_name)

Definition at line 451 of file aqua_menu.mm.

{
  return tm_new <aqua_image_widget_rep> (file_name);
#if 0  
       NSImage *image = the_aqua_renderer()->xpm_image(file_name);
//     TMMenuItem *mi = [[[TMMenuItem alloc] initWithTitle:to_nsstring(as_string(file_name)) action:NULL keyEquivalent:@""] autorelease];
       TMMenuItem *mi = [[[TMMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""] autorelease];
       [mi setRepresentedObject:image];
       [mi setImage:image];
  return tm_new <aqua_menu_rep> (mi);
//     return new aqua_menu_text_rep(to_nsstring(as_string(file_name)));
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 219 of file widget.cpp.