# gcp::Window Class Reference

`#include <gcp/window.h>`

Inheritance diagram for gcp::Window:

List of all members.

## Public Member Functions

| Window (gcp::Application *app, char const *theme=NULL, char const *extra_ui=NULL)
virtual | ~Window ()
void | OnFileNew ()
void | OnFileOpen ()
void | OnProperties ()
void | SetActive (gcp::Document *pDoc, GtkWidget *w)
void | OnUndo ()
void | OnRedo ()
void | OnSelectAll ()
void | OnPasteSelection ()
void | OnCutSelection ()
void | OnCopySelection ()
void | OnDeleteSelection ()
void | OnPreferences ()
void | Zoom (double zoom)
void | ClearStatus ()
void | SetStatusText (const char *text)
void | Show ()
bool | OnKeyPressed (GtkWidget *widget, GdkEventKey *ev)
bool | OnKeyReleased (GtkWidget *widget, GdkEventKey *ev)
bool | Close ()
virtual void | OnSave ()
virtual char const * | GetDefaultTitle ()
void | Destroy ()
void | SetTitle (char const *title)
void | ActivateActionWidget (char const *path, bool activate)
bool | VerifySaved ()
void | OnPageSetup ()

## Protected Attributes

GtkUIManager * | m_UIManager

## Detailed Description

The top level window class for GChemPaint. Each document is associated with a view which might be itself associated with a window.

Definition at line 41 of file gcp/window.h.

## Constructor & Destructor Documentation

gcp::Window::Window | ( | gcp::Application * | app,
|  | char const * | theme = `NULL`,
|  | char const * | extra_ui = `NULL` |
| ) |  |  |

Parameters:

  | app | the gcp::Application instance.
  | theme | the name of the theme used by the document.
  | extra_ui | a string describing the menu items to add.

Contructs the new window. Default menus do not have a File/Quit item. extra_ui can be used to add it. GChemPaint uses:

    "<ui>"
    "  <menubar name='MainMenu'>"
    "    <menu action='FileMenu'>"
    "          <placeholder name='file1'>"
    "        <menuitem action='Quit'/>"
    "          </placeholder>"
    "    </menu>"
    "  </menubar>"
    "</ui>";

virtual gcp::Window::~Window | ( |  | ) | `[virtual]`

The destructor.

Reimplemented from gcu::Window.

## Member Function Documentation

void gcp::Window::OnFileNew | ( |  | ) |

Method called by the framework when the File/New File menu command is fired.

void gcp::Window::OnFileOpen | ( |  | ) |

Method called by the framework when the File/Open menu command is fired.

void gcp::Window::OnProperties | ( |  | ) |

Method called by the framework when the File/Properties menu command is fired.

void gcp::Window::SetActive | ( | gcp::Document * | pDoc,
|  | GtkWidget * | w |
| ) |  |  |

Method called by the framework when the File/Save menu command is fired.

void gcp::Window::OnUndo | ( |  | ) |

Method called by the framework when the Edit/Undo menu command is fired.

void gcp::Window::OnRedo | ( |  | ) |

Method called by the framework when the Edit/Redo menu command is fired.

void gcp::Window::OnSelectAll | ( |  | ) |

Method called by the framework when the Edit/Select All menu command is fired.

void gcp::Window::OnPasteSelection | ( |  | ) |

Method called by the framework when the Edit/Paste menu command is fired.

void gcp::Window::OnCutSelection | ( |  | ) |

Method called by the framework when the Edit/Cut menu command is fired.

void gcp::Window::OnCopySelection | ( |  | ) |

Method called by the framework when the Edit/Copy menu command is fired.

void gcp::Window::OnDeleteSelection | ( |  | ) |

Method called by the framework when the Edit/Delete menu command is fired.

void gcp::Window::OnPreferences | ( |  | ) |

Method called by the framework when the Edit/Preferences menu command is fired.

void gcp::Window::Zoom | ( | double | zoom | ) |

Parameters:

  | zoom | the new zoom level.

Sets the zoom level.

void gcp::Window::ClearStatus | ( |  | ) |

Clears the status bar message.

void gcp::Window::SetStatusText | ( | const char * | text | ) |

Parameters:

  | text | the text to display in the status bar.

Sets the status bar message.

void gcp::Window::Show | ( |  | ) | `[virtual]`

Raises the window and makes it active.

Reimplemented from gcu::Window.

bool gcp::Window::OnKeyPressed | ( | GtkWidget * | widget,
|  | GdkEventKey * | ev |
| ) |  |  |

Called by the framework on a "key-press-event" event.

bool gcp::Window::OnKeyReleased | ( | GtkWidget * | widget,
|  | GdkEventKey * | ev |
| ) |  |  |

Called by the framework on a "key-release-event" event.

bool gcp::Window::Close | ( |  | ) | `[virtual]`

Checks if the document must be saved (see VerifySaved()) and safely closes the window.

Implements gcp::Target.

virtual void gcp::Window::OnSave | ( |  | ) | `[virtual]`

Method called by the framework when the File/Save menu command is fired.

virtual char const* gcp::Window::GetDefaultTitle | ( |  | ) | `[virtual]`

Returns:
  the default window title used when the document does not have a title.

void gcp::Window::Destroy | ( |  | ) | `[virtual]`

Destroys the window.

Reimplemented from gcu::Window.

void gcp::Window::SetTitle | ( | char const * | title | ) |

Parameters:

  | title | the new window title.

Sets the window title.

void gcp::Window::ActivateActionWidget | ( | char const * | path,
|  | bool | activate |
| ) |  |  |

Parameters:

  | path | the path to activate.
  | activate | whether to activate or deactivate.

Activates or deactivates the menu item corresponding to path according to the value of activate.

To deactivate the "Paste" menu item, use:

    ActivateActionWidget ("/MainMenu/EditMenu/Paste", false);

bool gcp::Window::VerifySaved | ( |  | ) |

If the document has been modified since last saving, pops-up a dialog box to ask the user if he wants to save the document, to drop the changes or to abort closing.

Returns:
  true if the document can be closed, false otherwise.

void gcp::Window::OnPageSetup | ( |  | ) |

Method called by the framework when the File/Page setup menu command is fired.

## Member Data Documentation

GtkUIManager* gcp::Window::m_UIManager `[protected]`

The GtkUIManager associated with the window.

Definition at line 197 of file gcp/window.h.

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

- gcp/window.h