Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Protected Attributes | Friends
qt_glue_widget_rep Class Reference
Inheritance diagram for qt_glue_widget_rep:
Inheritance graph
[legend]
Collaboration diagram for qt_glue_widget_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 qt_glue_widget_rep (tree _col, bool _hx, bool _vx, SI _w, SI _h)
 qt_glue_widget_rep ()
QPixmap render ()
virtual QAction * as_qaction ()
virtual QWidget * as_qwidget ()
 Returns the actual QWidget wrapped by this qt_widget_rep.
virtual widget plain_window_widget (string s, command q)
 Returns the widget as window.
virtual widget make_popup_widget ()
virtual widget popup_window_widget (string s)
virtual QMenu * get_qmenu ()
 This method must not give ownership of the menu to the caller, thus allowing menu caching at the TeXmacs level.
virtual QWidget * get_canvas ()
 Get a texmacs canvas (if available).
virtual QLayoutItem * as_qlayoutitem ()
 Returns a QLayoutItem...
virtual tm_ostreamprint (tm_ostream &out)
virtual void send (slot s, blackbox val)
virtual blackbox query (slot s, int type_id)
virtual widget read (slot s, blackbox index)
virtual void write (slot s, blackbox index, widget w)
virtual void notify (slot s, blackbox new_val)
virtual void connect (slot s, widget w2, slot s2)
virtual void deconnect (slot s, widget w2, slot s2)

Public Attributes

tree col
bool hx
bool vx
SI w
SI h
int ref_count

Protected Attributes

list< widget_connectionin
list< widget_connectionout

Friends

class widget

Detailed Description

Definition at line 49 of file qt_widget.cpp.


Constructor & Destructor Documentation

qt_glue_widget_rep::qt_glue_widget_rep ( tree  _col,
bool  _hx,
bool  _vx,
SI  _w,
SI  _h 
) [inline]

Definition at line 57 of file qt_widget.cpp.

  : col(_col), hx(_hx), vx(_vx), w(_w), h(_h) 
  {}

Definition at line 61 of file qt_widget.cpp.

{};

Member Function Documentation

QAction * qt_glue_widget_rep::as_qaction ( ) [virtual]

Reimplemented from qt_widget_rep.

Definition at line 112 of file qt_widget.cpp.

                               {
  QAction *a= new QTMAction();
  a->setText(to_qstring(as_string(col)));
  QIcon icon;
#if 0
  tree old_col = col;
  icon.addPixmap(render(), QIcon::Active, QIcon::On);
  col = "";
  icon.addPixmap(render(), QIcon::Normal, QIcon::On);
  col = old_col;
#else
  icon.addPixmap (render ());
#endif
  a->setIcon (icon);  
  a->setEnabled(false);
  return a;
}

Here is the call graph for this function:

virtual QLayoutItem* qt_widget_rep::as_qlayoutitem ( ) [inline, virtual, inherited]

Returns a QLayoutItem...

Reimplemented in qt_ui_element_rep, and qt_input_text_widget_rep.

Definition at line 84 of file qt_widget.hpp.

{ return NULL; }
QWidget * qt_glue_widget_rep::as_qwidget ( ) [virtual]

Returns the actual QWidget wrapped by this qt_widget_rep.

This is used to connect to signals, to change properties of the QWidget, etc.

Reimplemented from qt_widget_rep.

Definition at line 131 of file qt_widget.cpp.

                               {
  QLabel *w= new QLabel();
  w->setText(to_qstring(as_string(col)));
  QIcon icon;
  w->setPixmap (render ());  
//  w->setEnabled(false);
  return w;
}

Here is the call graph for this function:

void widget_rep::connect ( slot  s,
widget  w2,
slot  s2 
) [virtual, inherited]

Definition at line 150 of file widget.cpp.

                                               {
  widget_connection con (this, s, w2.rep, s2);
  insert (out, con);
  insert (w2->in, con);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void widget_rep::deconnect ( slot  s,
widget  w2,
slot  s2 
) [virtual, inherited]

Definition at line 157 of file widget.cpp.

                                                 {
  widget_connection con (this, s, w2.rep, s2);
  remove (out, con);
  remove (w2->in, con);
}
virtual QWidget* qt_widget_rep::get_canvas ( ) [inline, virtual, inherited]

Get a texmacs canvas (if available).

Reimplemented in simple_widget_rep.

Definition at line 80 of file qt_widget.hpp.

{ return NULL; }
virtual QMenu* qt_widget_rep::get_qmenu ( ) [inline, virtual, inherited]

This method must not give ownership of the menu to the caller, thus allowing menu caching at the TeXmacs level.

Called only by code which attaches root menus in the GUI elements.

Reimplemented in qt_ui_element_rep, and qt_menu_rep.

Definition at line 74 of file qt_widget.hpp.

{ return NULL; }
widget qt_widget_rep::make_popup_widget ( ) [virtual, inherited]

Reimplemented in qt_ui_element_rep, and qt_menu_rep.

Definition at line 34 of file qt_widget.cpp.

                                  {
  return this;
}
void widget_rep::notify ( slot  s,
blackbox  new_val 
) [virtual, inherited]

Reimplemented in aqua_input_widget_rep, aqua_chooser_widget_rep, qt_window_widget_rep, aqua_view_widget_rep, aqua_chooser_widget_rep, qt_input_widget_rep, qt_chooser_widget_rep, simple_widget_rep, simple_widget_rep, qt_view_widget_rep, wk_widget_rep, and qt_window_widget_rep.

Definition at line 194 of file widget.cpp.

                                            {
  list<widget_connection> l= out;
  while (!is_nil (l)) {
    l->item->w2->send (s, new_val);
    l= l->next;
  }  
}

Here is the call graph for this function:

widget qt_widget_rep::plain_window_widget ( string  s,
command  q 
) [virtual, inherited]

Returns the widget as window.

Each TeXmacs widget can at some point be asked to present itself into a window. The scheme-originating function window_create() expects this method in every widget. Widgets which are windows must declare themselves to be via the QProperty "texmacs_window_widget". This will be checked when processing messages from scheme asking to actually display the window. See qt_view_widget_rep::read() and qt_window_widget_rep::qt_window_widget_rep().

Parameters:
s(Often?) a title for the window.
q
Returns:
A pointer to this widget.

Reimplemented in qt_tm_widget_rep, qt_ui_element_rep, qt_input_widget_rep, qt_chooser_widget_rep, qt_printer_widget_rep, qt_view_widget_rep, qt_color_picker_widget_rep, and qt_menu_rep.

Definition at line 28 of file qt_widget.cpp.

                                                      {
  (void) s;
  return widget ();
}
widget qt_widget_rep::popup_window_widget ( string  s) [virtual, inherited]

Reimplemented in qt_ui_element_rep, and qt_menu_rep.

Definition at line 39 of file qt_widget.cpp.

                                            {
  (void) s;
  return widget ();
}
tm_ostream & widget_rep::print ( tm_ostream out) [virtual, inherited]

Reimplemented in wk_widget_rep.

Definition at line 207 of file widget.cpp.

                                  {
  return out << "widget";
}
blackbox widget_rep::query ( slot  s,
int  type_id 
) [virtual, inherited]
widget widget_rep::read ( slot  s,
blackbox  index 
) [virtual, inherited]

Definition at line 71 of file qt_widget.cpp.

                            {
  QSize s = QSize (w/PIXEL, h/PIXEL);
  QPixmap pxm(s);
  //cout << "glue (" << s.width() << "," << s.height() << ")\n";
  pxm.fill (Qt::transparent);
  QPaintDevice *pd = static_cast<QPaintDevice*>(&pxm);

  if (pd && !pxm.isNull()) {
    qt_renderer_rep *ren = the_qt_renderer();
    ren->begin (pd);
    rectangle r = rectangle (0, 0, s.width(), s.height());
    ren->set_origin(0,0);
    ren->encode (r->x1, r->y1);
    ren->encode (r->x2, r->y2);
    ren->set_clipping (r->x1, r->y2, r->x2, r->y1);
    
    if (col == "") {
      // do nothing
    } else {
      if (is_atomic (col)) {
        color c= named_color (col->label);
        ren->set_background (c);
        ren->set_color (c);
        ren->fill (r->x1, r->y2, r->x2, r->y1);
      } else {
        ren->set_shrinking_factor (5);
        int  old_a;
        tree old_bg= ren->get_background_pattern (old_a);
        ren->set_background_pattern (col);
        ren->clear_pattern (5*r->x1, 5*r->y2, 5*r->x2, 5*r->y1);
        ren->set_background_pattern (old_bg, old_a);
        ren->set_shrinking_factor (1);
      }
    }
    ren->end();
  }

  return pxm;  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void widget_rep::send ( slot  s,
blackbox  val 
) [virtual, inherited]
void widget_rep::write ( slot  s,
blackbox  index,
widget  w 
) [virtual, inherited]

Friends And Related Function Documentation

friend class widget [friend, inherited]

Definition at line 59 of file widget.hpp.


Member Data Documentation

Definition at line 52 of file qt_widget.cpp.

Definition at line 54 of file qt_widget.cpp.

Definition at line 53 of file qt_widget.cpp.

list<widget_connection> widget_rep::in [protected, inherited]

Definition at line 36 of file widget.hpp.

list<widget_connection> widget_rep::out [protected, inherited]

Definition at line 37 of file widget.hpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.

Definition at line 53 of file qt_widget.cpp.

Definition at line 54 of file qt_widget.cpp.


The documentation for this class was generated from the following file: