Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Protected Attributes | Friends
qt_menu_rep Class Reference

#include <qt_menu.hpp>

Inheritance diagram for qt_menu_rep:
Inheritance graph
[legend]
Collaboration diagram for qt_menu_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 qt_menu_rep (QAction *_item)
 ~qt_menu_rep ()
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 void send (slot s, blackbox val)
virtual widget make_popup_widget ()
virtual widget popup_window_widget (string s)
virtual widget plain_window_widget (string s, command q)
 Returns the widget as window.
virtual QAction * as_qaction ()
virtual QWidget * as_qwidget ()
 Returns the actual QWidget wrapped by this qt_widget_rep.
virtual QWidget * get_canvas ()
 Get a texmacs canvas (if available).
virtual QLayoutItem * as_qlayoutitem ()
 Returns a QLayoutItem...
virtual tm_ostreamprint (tm_ostream &out)
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

QAction * item
int ref_count

Protected Attributes

list< widget_connectionin
list< widget_connectionout

Friends

class widget

Detailed Description

Definition at line 21 of file qt_menu.hpp.


Constructor & Destructor Documentation

qt_menu_rep::qt_menu_rep ( QAction *  _item)

Definition at line 117 of file qt_menu.cpp.

 : item (_item ? _item : new QTMAction (NULL)) {  }

Definition at line 25 of file qt_menu.hpp.

                  { 
    delete item; // the submenu is usually also deleted since item is a QTMAction
  }

Member Function Documentation

QAction * qt_menu_rep::as_qaction ( ) [virtual]

Reimplemented from qt_widget_rep.

Definition at line 122 of file qt_menu.cpp.

                        {
  // FIXME: the convention is that as_qaction give ownership of
  // the action to the caller. However in this case we do not want
  // to replicate the action so we must be sure to be called only once.
  if (!item) cout << "THIS MUST NOT HAPPEN TWICE" << LF;
  QAction *ret = item;
  item = NULL;
  return ret;
}
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; }
virtual QWidget* qt_widget_rep::as_qwidget ( ) [inline, virtual, inherited]

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 in qt_glue_widget_rep, qt_ui_element_rep, qt_view_widget_rep, and qt_input_text_widget_rep.

Definition at line 66 of file qt_widget.hpp.

{ return NULL; }
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_menu_rep::get_qmenu ( ) [inline, virtual]

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 from qt_widget_rep.

Definition at line 29 of file qt_menu.hpp.

{ return (item ? item->menu() : NULL); }

Reimplemented from qt_widget_rep.

Definition at line 133 of file qt_menu.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:

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 from qt_widget_rep.

Definition at line 144 of file qt_menu.cpp.

                                                     {
  item->menu()->setWindowTitle (to_qstring (s));
  (void) q; // FIXME: to be ignored?
  return this;
}

Here is the call graph for this function:

Reimplemented from qt_widget_rep.

Definition at line 138 of file qt_menu.cpp.

                                          {
  item->menu()->setWindowTitle (to_qstring (s));
  return this;
}

Here is the call graph for this function:

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]
void qt_menu_rep::send ( slot  s,
blackbox  val 
) [virtual]

Reimplemented from widget_rep.

Definition at line 151 of file qt_menu.cpp.

                                       {
  if (DEBUG_QT)
    cout << "qt_menu_rep::send " << slot_name(s) << LF;
  switch (s) {
  case SLOT_POSITION:
    ASSERT (type_box (val) == type_helper<coord2>::id, "type mismatch");
    break;
  case SLOT_VISIBILITY:
    {   
      check_type<bool> (val, "SLOT_VISIBILITY");
      bool flag = open_box<bool> (val);
      if (flag)
        item->menu()->show();
      (void) flag;
    }   
    break;
  case SLOT_MOUSE_GRAB:
    {   
      check_type<bool> (val, "SLOT_MOUSE_GRAB");
      bool flag = open_box<bool> (val);
      (void) flag;
      // [NSMenu popUpContextMenu:[item submenu] withEvent:[NSApp currentEvent] forView:( (qt_view_widget_rep*)(the_keyboard_focus.rep))->view ];
      if (item->menu ())
        item->menu()->exec (QCursor::pos ());
    }   
    break;
  default:
    FAILED ("cannot handle slot type");
  }
}

Here is the call graph for this function:

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

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

Definition at line 36 of file widget.hpp.

Definition at line 23 of file qt_menu.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.


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