Back to index

texmacs  1.0.7.15
Defines | Functions | Variables
wk_widget.cpp File Reference
#include "window.hpp"
#include "Widkit/wk_widget.hpp"
#include "Widkit/Event/basic_event.hpp"
#include "analyze.hpp"
#include "font.hpp"

Go to the source code of this file.

Defines

#define SHRINK   3

Functions

SI get_dx (gravity grav, SI w)
SI get_dy (gravity grav, SI h)
static string get_first (string s)
wk_widget operator<< (wk_widget w, event ev)
static void print_tree (tm_ostream &out, tree t, int tab)
tm_ostreamoperator<< (tm_ostream &out, wk_widget w)
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 width, wk_widget wid, int style)

Variables

int widget_count

Define Documentation

#define SHRINK   3

Definition at line 182 of file wk_widget.cpp.


Function Documentation

SI decode_length ( string  width,
wk_widget  wid,
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:

SI get_dx ( gravity  grav,
SI  w 
)

Definition at line 35 of file wk_widget.cpp.

                            {
  switch (grav) {
  case north_west: case west: case south_west:
    return 0;
  case north: case center: case south:
    return (w/(2*PIXEL))*PIXEL;
  case north_east: case east: case south_east:
    return w;
  }
  FAILED ("unknown gravity");
  return 0;
}

Here is the caller graph for this function:

SI get_dy ( gravity  grav,
SI  h 
)

Definition at line 49 of file wk_widget.cpp.

                            {
  switch (grav) {
  case north_west: case north: case  north_east:
    return 0;
  case west: case center: case east:
    return ((-h)/(2*PIXEL))*PIXEL;
  case south_west: case south: case south_east:
    return -h;
  }
  FAILED ("unknown gravity");
  return 0;
}

Here is the caller graph for this function:

static string get_first ( string  s) [static]

Definition at line 87 of file wk_widget.cpp.

                     {
  int i;
  for (i=0; i<N(s); i++)
    if (s[i] == '|') return s (0, i);
  return s;
}

Here is the call graph for this function:

Here is the caller 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;
}
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:

static void print_tree ( tm_ostream out,
tree  t,
int  tab 
) [static]

Definition at line 134 of file wk_widget.cpp.

                                              {
  int i;
  for (i=0; i<tab; i++) out << "| ";
  if (is_atomic (t)) out << as_string (t) << "\n";
  else {
    out << as_string (t[0]) << "\n";
    for (i=1; i<N(t); i++) print_tree (out, t[i], tab+1);
  }
}

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:


Variable Documentation