gcp::View Class Reference
#include <gcp/view.h>
List of all members.
Public Member Functions |
| View (Document *pDoc, bool Embedded) |
virtual | ~View () |
GtkWidget * | GetWidget () |
Document * | GetDoc () |
bool | OnEvent (GnomeCanvasItem *item, GdkEvent *event, GtkWidget *widget) |
void | AddObject (gcu::Object const *pObject) |
void | Update (gcu::Object const *pObject) |
GtkWidget * | CreateNewWidget () |
void | OnDestroy (GtkWidget *widget) |
GnomeCanvasItem * | GetCanvasItem (GtkWidget *widget, gcu::Object *object) |
GnomeCanvasItem * | GetBackground () |
double | GetZoomFactor () |
void | UpdateFont () |
void | Remove (gcu::Object *pObject) |
PangoContext * | GetPangoContext () |
double | GetFontHeight () |
gchar * | GetFontName () |
gchar * | GetSmallFontName () |
PangoFontDescription * | GetPangoFontDesc () |
PangoFontDescription * | GetPangoSmallFontDesc () |
void | OnDeleteSelection (GtkWidget *w) |
void | OnCopySelection (GtkWidget *w, GtkClipboard *clipboard) |
void | OnPasteSelection (GtkWidget *w, GtkClipboard *clipboard) |
void | OnCutSelection (GtkWidget *w, GtkClipboard *clipboard) |
bool | OnKeyPress (GtkWidget *w, GdkEventKey *event) |
bool | OnKeyRelease (GtkWidget *w, GdkEventKey *event) |
bool | OnSize (GtkWidget *w, int width, int height) |
void | UpdateSize (double x1, double y1, double x2, double y2) |
void | SetGnomeCanvasPangoActive (GnomeCanvasPango *item) |
bool | PrepareUnselect () |
void | OnReceive (GtkClipboard *clipboard, GtkSelectionData *selection_data) |
void | OnSelectAll () |
bool | IsEmbedded () |
int | GetNbWidgets () |
void | ExportImage (std::string const &filename, const char *type, int resolution=-1) |
xmlDocPtr | BuildSVG () |
GdkPixbuf * | BuildPixbuf (int resolution) |
void | EnsureSize () |
void | Zoom (double zoom) |
void | ShowCursor (bool show) |
void | UpdateTheme () |
void | Render (cairo_t *cr) |
double | GetBaseLineOffset (void) |
GnomeCanvasPango * | GetActiveRichText (void) |
Detailed Description
The GChempaint document view.
Definition at line 47 of file gcp/view.h.
Constructor & Destructor Documentation
gcp::View::View |
( |
Document * |
pDoc, |
|
|
bool |
Embedded | |
|
) |
| | |
- Parameters:
-
| pDoc | the GchemPaint document for the new view. |
| Embedded | whether the document is embedded in another application or is standalone. |
Constructs the document view.
virtual gcp::View::~View |
( |
|
) |
[virtual] |
Member Function Documentation
void gcp::View::AddObject |
( |
gcu::Object const * |
pObject |
) |
|
- Parameters:
-
| pObject | the object to add. |
Adds the object to the canvas.
GdkPixbuf* gcp::View::BuildPixbuf |
( |
int |
resolution |
) |
|
- Parameters:
-
| resolution | the resolution for the new image. |
Builds a new image with the given resolution in ppi. The size is evaluated using the guessed screen resolution.
- Returns:
- the new pixbuf.
xmlDocPtr gcp::View::BuildSVG |
( |
|
) |
|
- Returns:
- the xml document containig the svg output.
GtkWidget* gcp::View::CreateNewWidget |
( |
|
) |
|
Creates a new canvas widget for the view.
- Returns:
- the new widget.
void gcp::View::EnsureSize |
( |
|
) |
|
Called by the framework to ensure that the view size is enough large to contain all objects.
void gcp::View::ExportImage |
( |
std::string const & |
filename, |
|
|
const char * |
type, |
|
|
int |
resolution = -1 | |
|
) |
| | |
- Parameters:
-
| filename | the file name to use for the export. |
| type | a string representing the image type as used by the GdkPixbuf library. Other types supported are "svg", "ps", "pdf", and "eps". |
| resolution | the image resolution to use for bitmaps. |
Exports the current document to an image. The resolution parameter is significative only for bitmap images; if it is not given, of if negative, 1 will be used which will result as a one to one pixel export.
gcp::View::GetActiveRichText |
( |
void |
|
) |
[inline] |
- Returns:
- the currently edited text item if any, or NULL.
Definition at line 327 of file gcp/view.h.
GnomeCanvasItem* gcp::View::GetBackground |
( |
|
) |
|
- Returns:
- the canvas background.
gcp::View::GetBaseLineOffset |
( |
void |
|
) |
[inline] |
- Returns:
- the vertical offset for algnment of an atomic symbol. This value is half the height of the "C" character.
Definition at line 323 of file gcp/view.h.
GnomeCanvasItem* gcp::View::GetCanvasItem |
( |
GtkWidget * |
widget, |
|
|
gcu::Object * |
object | |
|
) |
| | |
- Parameters:
-
| widget | the canvas in which an item is searched. |
| object | the object represented by the item. |
Searches the item representing object in the canvas widget.
- Returns:
- the found item if any, or NULL.
Document* gcp::View::GetDoc |
( |
|
) |
[inline] |
- Returns:
- the document associated with the view.
Definition at line 73 of file gcp/view.h.
double gcp::View::GetFontHeight |
( |
|
) |
[inline] |
- Returns:
- the height of the font used to display atomic symbols.
Definition at line 140 of file gcp/view.h.
gchar* gcp::View::GetFontName |
( |
|
) |
[inline] |
- Returns:
- the name of the font used to display atomic symbols.
Definition at line 144 of file gcp/view.h.
int gcp::View::GetNbWidgets |
( |
|
) |
[inline] |
- Returns:
- the number of existing canvases for this view.
Definition at line 251 of file gcp/view.h.
PangoContext* gcp::View::GetPangoContext |
( |
|
) |
[inline] |
- Returns:
- the pango context associated to the view.
Definition at line 136 of file gcp/view.h.
PangoFontDescription* gcp::View::GetPangoFontDesc |
( |
|
) |
[inline] |
- Returns:
- the description of the font used to display atomic symbols.
Definition at line 152 of file gcp/view.h.
PangoFontDescription* gcp::View::GetPangoSmallFontDesc |
( |
|
) |
[inline] |
- Returns:
- the description of the font used to display stoichiometry indices and charges.
Definition at line 156 of file gcp/view.h.
gchar* gcp::View::GetSmallFontName |
( |
|
) |
[inline] |
- Returns:
- the name of the font used to display stoichiometry indices and charges.
Definition at line 148 of file gcp/view.h.
GtkWidget* gcp::View::GetWidget |
( |
void |
|
) |
[inline] |
- Returns:
- the canvas widget used for the view.
Definition at line 69 of file gcp/view.h.
double gcp::View::GetZoomFactor |
( |
|
) |
|
- Returns:
- the current zoom factor.
bool gcp::View::IsEmbedded |
( |
|
) |
[inline] |
- Returns:
- true if the view is embedded in another document view.
Definition at line 247 of file gcp/view.h.
void gcp::View::OnCopySelection |
( |
GtkWidget * |
w, |
|
|
GtkClipboard * |
clipboard | |
|
) |
| | |
- Parameters:
-
| w | the active document widget. |
| clipboard | a GtkClipboard. |
Called by the framework to copy the selection.
void gcp::View::OnCutSelection |
( |
GtkWidget * |
w, |
|
|
GtkClipboard * |
clipboard | |
|
) |
| | |
- Parameters:
-
| w | the active document widget. |
| clipboard | a GtkClipboard. |
Called by the framework to copy and delete the selection.
void gcp::View::OnDeleteSelection |
( |
GtkWidget * |
w |
) |
|
- Parameters:
-
| w | the active document widget. |
Removes all objects in the widget.
void gcp::View::OnDestroy |
( |
GtkWidget * |
widget |
) |
|
- Parameters:
-
| widget | the destroyed widget. |
Called by the framework when a widget is destroyed.
bool gcp::View::OnEvent |
( |
GnomeCanvasItem * |
item, |
|
|
GdkEvent * |
event, |
|
|
GtkWidget * |
widget | |
|
) |
| | |
- Parameters:
-
| item | the canvas item at the positionof the event. |
| event | the GdkEvent. |
| widget | the canvas widget. |
Called by the framework when an event occured in the canvas.
- Returns:
- false if the event should be processed further, true otherwise.
bool gcp::View::OnKeyPress |
( |
GtkWidget * |
w, |
|
|
GdkEventKey * |
event | |
|
) |
| | |
- Parameters:
-
| w | the widget which received the event. |
| event | the current event. |
Called by the framework when a key has been pressed on the keyboard.
- Returns:
- true if the key was significant, false otherwise.
bool gcp::View::OnKeyRelease |
( |
GtkWidget * |
w, |
|
|
GdkEventKey * |
event | |
|
) |
| | |
- Parameters:
-
| w | the widget which received the event. |
| event | the current event. |
Called by the framework when a key has been released on the keyboard.
- Returns:
- true if the key was significant, false otherwise.
void gcp::View::OnPasteSelection |
( |
GtkWidget * |
w, |
|
|
GtkClipboard * |
clipboard | |
|
) |
| | |
- Parameters:
-
| w | the active document widget. |
| clipboard | a GtkClipboard. |
Called by the framework to paste clipboard contents.
void gcp::View::OnReceive |
( |
GtkClipboard * |
clipboard, |
|
|
GtkSelectionData * |
selection_data | |
|
) |
| | |
- Parameters:
-
| clipboard | the clipboard used. |
| selection_data | the data to paste. |
Called by the framework to effectively paste data in the document.
void gcp::View::OnSelectAll |
( |
|
) |
|
Called by the framework to select everything in the document.
bool gcp::View::OnSize |
( |
GtkWidget * |
w, |
|
|
int |
width, |
|
|
int |
height | |
|
) |
| | |
- Parameters:
-
| w | the widget which received the event. |
| width | the ne widget width. |
| height | the new widget height. |
Called by the framework when the widget size changed.
- Returns:
- true (always).
bool gcp::View::PrepareUnselect |
( |
|
) |
|
Called by the framework when the active window changes to stop current edition and inhibit timer events.
- Returns:
- true if the change is possible, false to abort it.
- Parameters:
-
| pObject | the object to remove. |
Removes the object from the view and destroys the items representing it.
void gcp::View::Render |
( |
cairo_t * |
cr |
) |
|
- Parameters:
-
| cr | the cairo_t to which render. |
Renders the document using cairo.
void gcp::View::SetGnomeCanvasPangoActive |
( |
GnomeCanvasPango * |
item |
) |
|
- Parameters:
-
| item | a text item or NULL. |
Sets the currently edited text item. item should be NULL to tell the view that no text edition is currently taking place.
void gcp::View::ShowCursor |
( |
bool |
show |
) |
|
- Parameters:
-
| show | whether to show the cursor or not. |
Shows or hides the cursor in the currently edited text item if any.
- Parameters:
-
| pObject | the object to update. |
Updates the object in the canvas.
void gcp::View::UpdateFont |
( |
|
) |
|
Updates fonts descriptions after a theme change.
void gcp::View::UpdateSize |
( |
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2 | |
|
) |
| | |
- Parameters:
-
| x1 | the left coordinate of the bounding rectangle of the used canvas area. |
| y1 | the top coordinate of the bounding rectangle of the used canvas area. |
| x2 | the right coordinate of the bounding rectangle of the used canvas area. |
| y2 | the bottom coordinate of the bounding rectangle of the used canvas area. |
Ensures the canvas is large enough to display everything and, if x1 or y1 is negative moves all the items so that they are visible.
void gcp::View::UpdateTheme |
( |
|
) |
|
Called by the framework to update the default font size after a theme change.
void gcp::View::Zoom |
( |
double |
zoom |
) |
|
- Parameters:
-
Sets the zoom level.
The documentation for this class was generated from the following file: