gcp::View Class Reference
#include <gcp/view.h>
Inherits gccv::Client.
List of all members.
Public Member Functions |
| View (Document *pDoc, bool Embedded) |
virtual | ~View () |
GtkWidget * | GetWidget () |
Document * | GetDoc () |
void | AddObject (gcu::Object *pObject) |
void | Update (gcu::Object *pObject) |
GtkWidget * | CreateNewWidget () |
void | OnDestroy (GtkWidget *widget) |
double | GetZoomFactor () |
void | UpdateFont () |
void | Remove (gcu::Object *pObject) |
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) |
void | SetTextActive (gccv::Text *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) |
char * | BuildSVG () |
char * | BuildEPS () |
GdkPixbuf * | BuildPixbuf (int resolution) |
void | EnsureSize () |
void | Zoom (double zoom) |
void | ShowCursor (bool show) |
void | UpdateTheme () |
void | Render (cairo_t *cr) |
void | SetSelectionState (gcu::Object *object, int state) |
double | GetBaseLineOffset (void) const |
gccv::Text * | GetActiveRichText (void) const |
double | GetCHeight (void) const |
double | GetHWidth (void) const |
Detailed Description
The GChempaint document view.
Definition at line 55 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
- Parameters:
-
| pObject | the object to add. |
Adds the object to the canvas.
char* gcp::View::BuildEPS |
( |
|
) |
|
- Returns:
- the eps output as a newly allocated string. Call g_free when done with it.
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.
char* gcp::View::BuildSVG |
( |
|
) |
|
- Returns:
- the svg output as a newly allocated string. Call g_free when done with it.
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 |
|
) |
const [inline] |
- Returns:
- the currently edited text item if any, or NULL.
Definition at line 310 of file gcp/view.h.
gcp::View::GetBaseLineOffset |
( |
void |
|
) |
const [inline] |
- Returns:
- the vertical offset for algnment of an atomic symbol. This value is half the height of the "C" character.
Definition at line 306 of file gcp/view.h.
gcp::View::GetCHeight |
( |
void |
|
) |
const [inline] |
- Returns:
- the half height of a carbon atom symbol in the current theme.
Definition at line 314 of file gcp/view.h.
Document* gcp::View::GetDoc |
( |
|
) |
[inline] |
- Returns:
- the document associated with the view.
Definition at line 81 of file gcp/view.h.
double gcp::View::GetFontHeight |
( |
|
) |
[inline] |
- Returns:
- the height of the font used to display atomic symbols.
Definition at line 123 of file gcp/view.h.
gchar* gcp::View::GetFontName |
( |
|
) |
[inline] |
- Returns:
- the name of the font used to display atomic symbols.
Definition at line 127 of file gcp/view.h.
gcp::View::GetHWidth |
( |
void |
|
) |
const [inline] |
- Returns:
- the half width of a hydrogen atom symbol in the current theme.
Definition at line 318 of file gcp/view.h.
int gcp::View::GetNbWidgets |
( |
|
) |
[inline] |
- Returns:
- the number of existing canvases for this view.
Definition at line 215 of file gcp/view.h.
PangoFontDescription* gcp::View::GetPangoFontDesc |
( |
|
) |
[inline] |
- Returns:
- the description of the font used to display atomic symbols.
Definition at line 135 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 139 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 131 of file gcp/view.h.
GtkWidget* gcp::View::GetWidget |
( |
void |
|
) |
[inline] |
- Returns:
- the canvas widget used for the view.
Definition at line 77 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 211 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::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::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::SetSelectionState |
( |
gcu::Object * |
object, |
|
|
int |
state | |
|
) |
| | |
- Parameters:
-
| object | the object which seection state should be changed. |
| state | the new selection state. |
Changes the selection state of object if it owns an item and of all its descendents.
void gcp::View::SetTextActive |
( |
gccv::Text * |
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::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: