fltk::MenuWindow Class Reference

Inherits fltk::Window.

Inherited by ColorMenu, fltk::ComboWindow, fltk::Tooltip, MenuTitle, and MWindow.

List of all members.

Public Member Functions

void clear_overlay ()
virtual void create ()
virtual void destroy ()
virtual void flush ()
void set_overlay ()

Static Public Attributes

static NamedStyledefault_style = &::style

Detailed Description

This is the window type used by Menu to make the pop-ups, and for tooltip popups. It will send special information to the window server to indicate that the windows are temporary, won't move, and should not have any decorations.

On X this turns on override_redirect and save-under and thus avoids the window manager.


Member Function Documentation

void MenuWindow::clear_overlay ( ) [inline]

Tells FLTK to not try to use the overlay hardware planes. This is disabled except on Irix. On Irix you will have to call this if you want to draw colored images in the popup.

void MenuWindow::create ( ) [virtual]

This virtual function may be overridden to use something other than FLTK's default code to create the system's window. This must call either CreatedWindow::create() or CreatedWindow::set_xid().

An example for Xlib (include x.h to make this work):

void MyWindow::create() {
  fltk::open_display(); // necessary if this is first window
  // we only calcualte the necessary visual & colormap once:
  static XVisualInfo* visual;
  static Colormap colormap;
  static int background;
  if (!visual) {
    visual = figure_out_visual();
    colormap = XCreateColormap(xdisplay, RootWindow(xdisplay,xscreen),
                                vis->visual, AllocNone);
    XColor xcol; xcol.red = 1; xcol.green = 2; xcol.blue = 3;
    XAllocColor(fltk::display, colormap, &xcol);
    background = xcol.pixel;
  }
  CreatedWindow::create(this, visual, colormap, background);
}

Reimplemented from fltk::Window.

void MenuWindow::destroy ( ) [virtual]

Hides the window and also deletes all window system information about the window, and thus returns it back to the state it was in before the first show(). It is harmless to call this if the window is already destroyed.

Subclasses can override this, if you do this you must also override the destructor and make it call destroy().

Reimplemented from fltk::Window.

void MenuWindow::flush ( ) [virtual]

This virtual function is called by fltk::flush() to update the window. You can override it for special window subclasses to change how they draw.

For FLTK's normal windows this calls Window::make_current(), then perhaps sets up the clipping if the only damage is expose events, and then draw(), and then does some extra work to get the back buffer copied or swapped into the front buffer.

For your own windows you might just want to put all the drawing code in here.

Reimplemented from fltk::Window.

void MenuWindow::set_overlay ( ) [inline]

Undoes clear_overlay().


Member Data Documentation

NamedStyle * MenuWindow::default_style = &::style [static]

The default style sets box() to UP_BOX. This box is used around all popup menus.

Reimplemented from fltk::Window.

Reimplemented in fltk::Tooltip.


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