Back to index

texmacs  1.0.7.15
Classes | Defines | Functions
wk_widget.hpp File Reference
#include "widget.hpp"
#include "Widkit/event.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  wk_widget_rep
class  wk_widget

Defines

#define WK_FAILED(msg)   { wk_error (msg); FAILED ("widget_error"); }

Functions

 ABSTRACT_NULL_CODE (wk_widget)
abstract widget (wk_widget w)
wk_widget concrete (widget w)
abstract array< widget > (array< wk_widget > a)
array< wk_widgetconcrete (array< widget > a)
tm_ostreamoperator<< (tm_ostream &out, wk_widget w)
wk_widget operator<< (wk_widget w, event ev)
void wk_grab_pointer (wk_widget w)
void wk_ungrab_pointer (wk_widget w)
bool wk_has_pointer_grab (wk_widget w)
SI decode_length (string s, wk_widget w, int style)
wk_widget extend (wk_widget w, array< wk_widget > a)
wk_widget horizontal_list (array< wk_widget > a)
wk_widget horizontal_list (array< wk_widget > a, array< string > name)
wk_widget vertical_list (array< wk_widget > a)
wk_widget vertical_list (array< wk_widget > a, array< string > name)
wk_widget vertical_menu (array< wk_widget > a)
wk_widget tile (array< wk_widget > a, int cols)
wk_widget tile (array< wk_widget > a, int cols, array< string > name)
wk_widget aligned_widget (array< wk_widget > lhs, array< wk_widget > rhs, SI hsep=3 *PIXEL, SI vsep=3 *PIXEL, SI lpad=0, SI rpad=0)
wk_widget horizontal_array (array< wk_widget > a, int stretch_me=-1)
wk_widget horizontal_array (array< wk_widget > a, array< string > s, int stretch_me=-1)
wk_widget tabs_widget (array< wk_widget > tabs, array< wk_widget > bodies)
wk_widget switch_widget (array< wk_widget > a, array< string > name, int init=0)
wk_widget optional_widget (wk_widget w, bool on=true)
wk_widget wrapped_widget (wk_widget w, command cmd)
wk_widget glue_wk_widget (bool hx=true, bool vx=true, SI w=0, SI h=0)
wk_widget glue_wk_widget (tree c, bool hx=true, bool vx=true, SI w=0, SI h=0)
wk_widget separator_wk_widget (SI pre=0, SI post=0, bool vert=false)
wk_widget text_wk_widget (string s, int style=0, bool tsp=false)
wk_widget menu_text_wk_widget (string s, int style, color col, bool tsp=true, bool tt=false)
wk_widget xpm_wk_widget (url file_name, bool transp=true)
wk_widget minibar_widget (wk_widget w)
wk_widget command_button (wk_widget w, command cmd, int style=0)
wk_widget command_button (wk_widget lw, wk_widget rw, command cmd, int st=0)
wk_widget command_button (wk_widget lw, wk_widget cw, wk_widget rw, command c, int style=0)
wk_widget pulldown_button (wk_widget w, wk_widget m, int style=0)
wk_widget pullright_button (wk_widget w, wk_widget m, int style=0)
wk_widget pulldown_button (wk_widget w, promise< wk_widget > pw)
wk_widget pullright_button (wk_widget w, promise< wk_widget > pw)
wk_widget toggle_wk_widget (command cmd, bool on=false, int style=0)
wk_widget popup_widget (wk_widget w, gravity quit=center)
wk_widget canvas_widget (wk_widget w, gravity grav=north_west, bool rf=false)
wk_widget user_canvas_widget (wk_widget wid, int style=0)
wk_widget resize_widget (wk_widget w, int style, string w1, string h1, string w2, string h2, string w3, string h3)
wk_widget hsplit_widget (wk_widget l, wk_widget r)
wk_widget vsplit_widget (wk_widget t, wk_widget b)
wk_widget input_text_wk_widget (command cb, int style=0, string w="1w", bool pf=true)
wk_widget input_text_wk_widget (command cb, string type, array< string > def, int style=0, string w="1w", bool pf=false)
wk_widget inputs_list_wk_widget (command call_back, array< string > prompts)
wk_widget enum_wk_widget (command cb, array< string > vals, string cur, int style=0, string w="1w")
wk_widget choice_wk_widget (command cb, array< string > vals, string val)
wk_widget choice_wk_widget (command cb, array< string > vals, array< string > mc)
wk_widget file_chooser_wk_widget (command cmd, string type)
wk_widget color_picker_wk_widget (command cmd, bool bg, array< tree > proposals)
wk_widget balloon_widget (wk_widget w, wk_widget help)
wk_widget wait_wk_widget (SI w, SI h, string message)
wk_widget ink_wk_widget (command cb)
wk_widget refresh_wk_widget (string tmwid)
wk_widget texmacs_wk_widget (int mask, command quit)
wk_widget plain_window_widget (wk_widget wid, string s, command q=command())
wk_widget popup_window_widget (wk_widget wid, string s)
void destroy_window_widget (wk_widget w)

Define Documentation

#define WK_FAILED (   msg)    { wk_error (msg); FAILED ("widget_error"); }

Definition at line 80 of file wk_widget.hpp.


Function Documentation

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

Definition at line 16 of file aligned_widget.cpp.

{
  ASSERT (N(lhs) > 0, "at least one widget expected");
  ASSERT (N(lhs) == N(rhs), "sizes don't match");
  int i, n= N (lhs);
  SI max_w= 0;
  for (i=0; i<n; i++) {
    SI ww=1280*PIXEL, hh=64*PIXEL;
    lhs[i] << get_size (ww, hh, 0);
    max_w= max (ww, max_w);
  }

  array<wk_widget> fields_w (2*n-1);
  for (i=0; i<n; i++) {
    SI ww=1280*PIXEL, hh=64*PIXEL;
    lhs[i] << get_size (ww, hh, 0);
    array<wk_widget> line_w (5);
    array<string> line_n (5);
    line_w[0]= glue_wk_widget (false, false, lpad + max_w - ww);
    line_w[1]= lhs[i];
    line_n[1]= "prompt";
    line_w[2]= glue_wk_widget (false, false, hsep);
    line_w[3]= rhs[i];
    line_n[3]= "input";
    line_w[4]= glue_wk_widget (false, false, rpad);
    fields_w[2*i]= horizontal_list (line_w, line_n);
    if (i < n-1) fields_w[2*i + 1]= glue_wk_widget (false, false, 0, vsep);
  }

  return vertical_list (fields_w);
}

Here is the call graph for this function:

abstract array< widget > ( array< wk_widget a) [pure virtual]

Definition at line 29 of file widkit_wrapper.cpp.

                              {
  int i, n= N(a);
  array<widget> b (n);
  for (i=0; i<n; i++) b[i]= abstract (a[i]);
  return b;
}

Here is the call graph for this function:

Definition at line 138 of file balloon_widget.cpp.

                                             {
  return tm_new<balloon_widget_rep> (w, tm_new<balloon_decoration_widget_rep> (help));
}
wk_widget canvas_widget ( wk_widget  w,
gravity  grav = north_west,
bool  rf = false 
) [get, set]

Definition at line 379 of file canvas_widget.cpp.

                                                              {
  return tm_new<canvas_widget_rep> (w, grav, request_focus);
}
wk_widget choice_wk_widget ( command  cb,
array< string vals,
string  val 
)

Definition at line 158 of file choice_widget.cpp.

                                                              {
  array<string> ch (1);
  ch[0]= cur;
  return tm_new<choice_widget_rep> (cb, vals, ch, false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

wk_widget choice_wk_widget ( command  cb,
array< string vals,
array< string mc 
)

Definition at line 165 of file choice_widget.cpp.

                                                                    {
  return tm_new<choice_widget_rep> (cb, vals, mc, true);
}
wk_widget color_picker_wk_widget ( command  cmd,
bool  bg,
array< tree proposals 
)

Definition at line 113 of file color_picker_widget.cpp.

                                                                     {
  return direct_color_picker (cmd, bg, proposals);
}

Here is the call graph for this function:

Here is the caller graph for this function:

wk_widget command_button ( wk_widget  w,
command  cmd,
int  style = 0 
)

Definition at line 219 of file button_widget.cpp.

                                                     {
  return tm_new<command_button_rep> (w, cmd, style);
}
wk_widget command_button ( wk_widget  lw,
wk_widget  rw,
command  cmd,
int  st = 0 
)

Definition at line 224 of file button_widget.cpp.

                                                                    {
  return tm_new<command_button_rep> (lw, rw, cmd, style);
}
wk_widget command_button ( wk_widget  lw,
wk_widget  cw,
wk_widget  rw,
command  c,
int  style = 0 
)

Definition at line 229 of file button_widget.cpp.

{
  return tm_new<command_button_rep> (lw, cw, rw, cmd, style);
}
wk_widget concrete ( widget  w) [inline]

Definition at line 66 of file wk_widget.hpp.

                                     {
  return wk_widget ((wk_widget_rep*) w.rep); }

Definition at line 37 of file widkit_wrapper.cpp.

                           {
  int i, n= N(a);
  array<wk_widget> b (n);
  for (i=0; i<n; i++) b[i]= concrete (a[i]);
  return b;
}

Here is the call graph for this function:

SI decode_length ( string  s,
wk_widget  w,
int  style 
)

Definition at line 185 of file wk_widget.cpp.

                                                       {
  SI ex, ey;
  if (wid->win == NULL) gui_maximal_extents (ex, ey);
  else wid->win->get_size (ex, ey);
  if (ends (width, "w") && is_double (width (0, N(width) - 1))) {
    double x= as_double (width (0, N(width) - 1));
    return (SI) (x * ex);
  }
  else if (ends (width, "h") && is_double (width (0, N(width) - 1))) {
    double y= as_double (width (0, N(width) - 1));
    return (SI) (y * ey);
  }
  else if (ends (width, "em") && is_double (width (0, N(width) - 2))) {
    font fn= get_default_styled_font (style);
    double x= as_double (width (0, N(width) - 2));
    return (SI) ((x * fn->wquad) / SHRINK);
  }
  else if (ends (width, "px") && is_double (width (0, N(width) - 2))) {
    double x= as_double (width (0, N(width) - 2));
    return (SI) (x * PIXEL);
  }
  else return ex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 82 of file window_widget.cpp.

                                    {
  ASSERT (w->is_window_widget (), "not a window widget");
  tm_delete (w->win);
}

Here is the call graph for this function:

wk_widget enum_wk_widget ( command  cb,
array< string vals,
string  cur,
int  style = 0,
string  w = "1w" 
)

Definition at line 49 of file enum_widget.cpp.

                                     {
  int i, n= N(vals);
  array<string> def (1);
  def[0]= val;
  wk_widget in= input_text_wk_widget (cb, "string", def, style, w, true);
  if (n == 0) return in;
  bool editable= (val == "" || vals[n-1] == "");
  if (vals[n-1] == "") { n= n-1; vals= range (vals, 0, n); }
  array<wk_widget> entries (n);
  for (i=0; i<n; i++) {
    wk_widget txt= text_wk_widget (vals[i], style);
    command cmd= enum_command (in, vals[i], cb);
    entries[i]= command_button (txt, cmd, style);
  }
  wk_widget menu= vertical_menu (entries);
  if (!editable)
    return pulldown_button (in, menu, style);
  wk_widget v= text_wk_widget ("v", style);
  wk_widget v_but= command_button (v, command (), style|WIDGET_STYLE_BUTTON);
  wk_widget v_pop= pulldown_button (v_but, menu, style);
  array<wk_widget> ret (2);
  ret[0]= in;
  ret[1]= v_pop;
  return horizontal_list (ret);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 97 of file extend_widget.cpp.

                                         {
  return tm_new<extend_widget_rep> (w, a);
}

Definition at line 704 of file file_chooser_widget.cpp.

                                                  {
  return tm_new<file_chooser_widget_rep> (cmd, type);
}

Here is the caller graph for this function:

wk_widget glue_wk_widget ( bool  hx = true,
bool  vx = true,
SI  w = 0,
SI  h = 0 
)

Definition at line 95 of file glue_widget.cpp.

                                                          {
  return tm_new<glue_widget_rep> (hflag, vflag, minw, minh);
}

Here is the caller graph for this function:

wk_widget glue_wk_widget ( tree  c,
bool  hx = true,
bool  vx = true,
SI  w = 0,
SI  h = 0 
)

Definition at line 100 of file glue_widget.cpp.

                                                                    {
  return tm_new<glue_widget_rep> (col, hflag, vflag, minw, minh);
}
wk_widget horizontal_array ( array< wk_widget a,
int  stretch_me = -1 
)

Definition at line 124 of file array_widget.cpp.

                                                      {
  return tm_new<horizontal_array_rep> (a, stretch_me);
}

Here is the caller graph for this function:

wk_widget horizontal_array ( array< wk_widget a,
array< string s,
int  stretch_me = -1 
)

Definition at line 129 of file array_widget.cpp.

                                                                  {
  return tm_new<horizontal_array_rep> (a, name, sm);
}

Definition at line 242 of file list_widget.cpp.

                                     {
  return tm_new<horizontal_list_rep> (a);
}

Definition at line 247 of file list_widget.cpp.

                                                         {
  return tm_new<horizontal_list_rep> (a, name);
}

Definition at line 171 of file split_widget.cpp.

                                         {
  array<wk_widget> a (2);
  a[0]= l; a[1]= r;
  array<string> names (2);
  names[0]= "left"; names[1]= "right";
  return tm_new<hsplit_widget_rep> (a, names);
}

Definition at line 183 of file ink_widget.cpp.

                           {
  return tm_new<ink_widget_rep> (cb);
}

Here is the caller graph for this function:

wk_widget input_text_wk_widget ( command  cb,
int  style = 0,
string  w = "1w",
bool  pf = true 
)
wk_widget input_text_wk_widget ( command  cb,
string  type,
array< string def,
int  style = 0,
string  w = "1w",
bool  pf = false 
)

Definition at line 405 of file input_widget.cpp.

{
  (void) style;
  int i, n= N(def);
  wk_widget inp= input_text_wk_widget (cb, style, w, persistent);
  inp << set_string ("type", type);
  if (n>0) inp << set_string ("input", def[0]);
  for (i=0; i<n; i++) inp << set_string ("default", def[i]);
  return inp;
}

Here is the call graph for this function:

wk_widget inputs_list_wk_widget ( command  call_back,
array< string prompts 
)

Definition at line 169 of file inputs_list_widget.cpp.

                                                          {
  return tm_new<inputs_list_widget_rep> (cmd, fields);
}

Here is the caller graph for this function:

wk_widget menu_text_wk_widget ( string  s,
int  style,
color  col,
bool  tsp = true,
bool  tt = false 
)

Definition at line 87 of file text_widget.cpp.

                                                                        {
  return tm_new<text_widget_rep> (s, style, col, tsp, tt, 3*PIXEL, 0);
}

Here is the caller graph for this function:

Definition at line 90 of file minibar_widget.cpp.

                             {
  return tm_new<minibar_widget_rep> (w);
}
tm_ostream& operator<< ( tm_ostream out,
wk_widget  w 
)

Definition at line 151 of file wk_widget.cpp.

                                           {
  print_tree (out, (tree) w, 0);
  return out;
}

Here is the call graph for this function:

wk_widget operator<< ( wk_widget  w,
event  ev 
)

Definition at line 126 of file wk_widget.cpp.

                                    {
  if (!w->handle (ev))
    cerr << "Warning: " << ((tree) ev)
        << " cannot be handled by\n" << w << "\n";
  return w;
}
wk_widget optional_widget ( wk_widget  w,
bool  on = true 
)

Definition at line 169 of file switch_widget.cpp.

                                       {
  array<wk_widget> a (2);
  a[0]= w;
  a[1]= glue_wk_widget (false, false);
  array<string> name (2);
  name[0]= "default";
  return switch_widget (a, name, on? 0: 1);
}

Here is the call graph for this function:

Definition at line 54 of file window_widget.cpp.

                                                            {
  SI W, H;
  gui_root_extents (W, H);
  SI min_w= 0, min_h= 0, def_w= W, def_h= H, max_w= W, max_h= H;
  wid << get_size (min_w, min_h, -1);
  wid << get_size (def_w, def_h, 0);
  wid << get_size (max_w, max_h, 1);
  wid= window_widget (wid, quit);
  (void) plain_window (abstract (wid), s,
                     min_w, min_h, def_w, def_h, max_w, max_h);
  return wid;
}

Here is the call graph for this function:

Definition at line 175 of file popup_widget.cpp.

                                         {
  return tm_new<popup_widget_rep> (w, quit);
}

Definition at line 68 of file window_widget.cpp.

                                              {
  SI W, H;
  gui_root_extents (W, H);
  SI min_w= 0, min_h= 0, def_w= W, def_h= H, max_w= W, max_h= H;
  wid << get_size (min_w, min_h, -1);
  wid << get_size (def_w, def_h, 0);
  wid << get_size (max_w, max_h, 1);
  wid= window_widget (wid, command ());
  (void) popup_window (abstract (wid), s,
                     min_w, min_h, def_w, def_h, max_w, max_h);
  return wid;
}

Here is the call graph for this function:

wk_widget pulldown_button ( wk_widget  w,
wk_widget  m,
int  style = 0 
)

Definition at line 302 of file popup_button.cpp.

                                                       {
  return tm_new<popup_button_rep> (w, pw, south_east, style);
}

Definition at line 312 of file popup_button.cpp.

                                                       {
  return tm_new<popup_button_rep> (w, prom, south_east);
}
wk_widget pullright_button ( wk_widget  w,
wk_widget  m,
int  style = 0 
)

Definition at line 307 of file popup_button.cpp.

                                                        {
  return tm_new<popup_button_rep> (w, pw, east, style);
}

Definition at line 317 of file popup_button.cpp.

                                                        {
  return tm_new<popup_button_rep> (w, prom, east);
}

Definition at line 93 of file refresh_widget.cpp.

                                 {
  return tm_new<refresh_widget_rep> (tmwid);
}

Here is the caller graph for this function:

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

Definition at line 330 of file canvas_widget.cpp.

                                                           {
  //cout << "min: " << w1 << ", " << h1 << "\n";
  //cout << "def: " << w2 << ", " << h2 << "\n";
  //cout << "max: " << w3 << ", " << h3 << "\n";
  return tm_new<resize_widget_rep> (w, style, w1, h1, w2, h2, w3, h3);
}
wk_widget separator_wk_widget ( SI  pre = 0,
SI  post = 0,
bool  vert = false 
)

Definition at line 88 of file separator_widget.cpp.

                                                 {
  return tm_new<separator_widget_rep> (pre, post, vert);
}

Here is the caller graph for this function:

wk_widget switch_widget ( array< wk_widget a,
array< string name,
int  init = 0 
)

Definition at line 164 of file switch_widget.cpp.

                                                                 {
  return tm_new<switch_widget_rep> (a, name, init);
}

Here is the call graph for this function:

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

Definition at line 181 of file tabs_widget.cpp.

                                                     {
  return tm_new<tabs_widget_rep> (a, b);
}
wk_widget texmacs_wk_widget ( int  mask,
command  quit 
)

Definition at line 532 of file texmacs_widget.cpp.

                                           {
  return tm_new<texmacs_widget_rep> (mask, quit);
}

Here is the caller graph for this function:

wk_widget text_wk_widget ( string  s,
int  style = 0,
bool  tsp = false 
)

Definition at line 82 of file text_widget.cpp.

                                               {
  return tm_new<text_widget_rep> (s, style, black, tsp, false, 3*PIXEL, 0);
}

Here is the caller graph for this function:

wk_widget tile ( array< wk_widget a,
int  cols 
)

Definition at line 128 of file tile_widget.cpp.

                                    {
  return tm_new<tile_rep> (a, cols);
}

Here is the caller graph for this function:

wk_widget tile ( array< wk_widget a,
int  cols,
array< string name 
)

Definition at line 133 of file tile_widget.cpp.

                                                        {
  return tm_new<tile_rep> (a, cols, name);
}
wk_widget toggle_wk_widget ( command  cmd,
bool  on = false,
int  style = 0 
)

Definition at line 81 of file toggle_widget.cpp.

                                                   {
  return tm_new<toggle_widget_rep> (cmd, on, style);
}

Here is the caller graph for this function:

wk_widget user_canvas_widget ( wk_widget  wid,
int  style = 0 
)

Definition at line 384 of file canvas_widget.cpp.

                                              {
  wk_widget cv= canvas_widget (wrap_scroll_widget (wid));
  SI widw, widh;
  gui_maximal_extents (widw, widh);
  wid << get_size (widw, widh, -1);
  abs_round (widw, widh);
  cv << set_coord4 ("extents", 0, -widh, widw, 0);
  return cv;
}

Here is the call graph for this function:

Definition at line 252 of file list_widget.cpp.

                                   {
  return tm_new<vertical_list_rep> (a);
}

Definition at line 257 of file list_widget.cpp.

                                                       {
  return tm_new<vertical_list_rep> (a, name);
}

Definition at line 262 of file list_widget.cpp.

                                   {
  return tm_new<vertical_list_rep> (a, true);
}

Definition at line 395 of file canvas_widget.cpp.

                                         {
  (void) t; (void) b;
  FAILED ("not yet implemented");
}
wk_widget wait_wk_widget ( SI  w,
SI  h,
string  message 
)

Definition at line 94 of file wait_widget.cpp.

                                                     {
  return tm_new<wait_widget_rep> (width, height, message);
}

Here is the caller graph for this function:

abstract widget ( wk_widget  w) [inline, pure virtual]

Definition at line 64 of file wk_widget.hpp.

                                     {
  return widget (w.rep); }

Here is the call graph for this function:

Definition at line 161 of file wk_widget.cpp.

                              {
  ASSERT (!is_nil (w) && w->win != NULL, "widget should be attached");
  w->win->set_mouse_grab (abstract (w), true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 173 of file wk_widget.cpp.

                                  {
  return !is_nil (w) && w->win != NULL &&
    w->win->get_mouse_grab (abstract (w));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 167 of file wk_widget.cpp.

                                {
  ASSERT (!is_nil (w) && w->win != NULL, "widget should be attached");
  w->win->set_mouse_grab (abstract (w), false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 179 of file switch_widget.cpp.

                                          {
  return tm_new<wrapped_widget_rep> (w, cmd);
}
wk_widget xpm_wk_widget ( url  file_name,
bool  transp = true 
)

Definition at line 68 of file xpm_widget.cpp.

                                      {
  return tm_new<xpm_widget_rep> (name, transp, PIXEL, PIXEL);
}

Here is the caller graph for this function: