The Gnome Chemistry Utils
0.13.7
|
#include <gcp/view.h>
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) |
bool | OnButtonPressed (gccv::ItemClient *client, unsigned button, double x, double y, unsigned state) |
bool | OnButtonReleased (gccv::ItemClient *client, unsigned button, double x, double y, unsigned state) |
bool | OnDrag (gccv::ItemClient *client, double x, double y, unsigned state) |
bool | OnMotion (gccv::ItemClient *client, double x, double y, unsigned state) |
bool | OnLeaveNotify (unsigned state) |
WidgetData * | GetData () |
void | GetVisibleArea (double &x0, double &y0, double &x1, double &y1) |
double | GetBaseLineOffset (void) const |
gccv::Text * | GetActiveRichText (void) const |
double | GetCHeight (void) const |
double | GetHWidth (void) const |
The GChempaint document view.
Definition at line 61 of file gcp/view.h.
gcp::View::View | ( | Document * | pDoc, |
bool | Embedded | ||
) |
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] |
The destructor.
void gcp::View::AddObject | ( | gcu::Object * | pObject | ) |
pObject | the object to add. |
Adds the object to the canvas.
char* gcp::View::BuildEPS | ( | ) |
GdkPixbuf* gcp::View::BuildPixbuf | ( | int | resolution | ) |
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.
char* gcp::View::BuildSVG | ( | ) |
GtkWidget* gcp::View::CreateNewWidget | ( | ) |
Creates a new canvas widget for the view.
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 |
||
) |
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] |
Definition at line 331 of file gcp/view.h.
gcp::View::GetBaseLineOffset | ( | void | ) | const [inline] |
Definition at line 327 of file gcp/view.h.
gcp::View::GetCHeight | ( | void | ) | const [inline] |
Definition at line 335 of file gcp/view.h.
WidgetData* gcp::View::GetData | ( | ) | [inline] |
Definition at line 294 of file gcp/view.h.
Document* gcp::View::GetDoc | ( | ) | [inline] |
Definition at line 87 of file gcp/view.h.
double gcp::View::GetFontHeight | ( | ) | [inline] |
Definition at line 129 of file gcp/view.h.
gchar* gcp::View::GetFontName | ( | ) | [inline] |
Definition at line 133 of file gcp/view.h.
gcp::View::GetHWidth | ( | void | ) | const [inline] |
Definition at line 339 of file gcp/view.h.
int gcp::View::GetNbWidgets | ( | ) | [inline] |
Definition at line 221 of file gcp/view.h.
PangoFontDescription* gcp::View::GetPangoFontDesc | ( | ) | [inline] |
Definition at line 141 of file gcp/view.h.
PangoFontDescription* gcp::View::GetPangoSmallFontDesc | ( | ) | [inline] |
Definition at line 145 of file gcp/view.h.
gchar* gcp::View::GetSmallFontName | ( | ) | [inline] |
Definition at line 137 of file gcp/view.h.
void gcp::View::GetVisibleArea | ( | double & | x0, |
double & | y0, | ||
double & | x1, | ||
double & | y1 | ||
) |
x0 | where to store the left horizontal coordinate of the visible area. |
y0 | where to store the top vertical coordinate of the visible area. |
x1 | where to store the right horizontal coordinate of the visible area. |
y1 | where to store the bottom vertical coordinate of the visible area. |
Gets the visible area for the view.
GtkWidget* gcp::View::GetWidget | ( | void | ) | [inline] |
Definition at line 83 of file gcp/view.h.
double gcp::View::GetZoomFactor | ( | ) |
bool gcp::View::IsEmbedded | ( | ) | [inline] |
Definition at line 217 of file gcp/view.h.
bool gcp::View::OnButtonPressed | ( | gccv::ItemClient * | client, |
unsigned | button, | ||
double | x, | ||
double | y, | ||
unsigned | state | ||
) | [virtual] |
client | the ItemClient for the Item at the event position if any. |
button | the mouse button. |
x | horizontal event position. |
y | vertical event position. |
state | the GdkModifierType value for the event. |
Called when a mouse button is pressed. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient.
Reimplemented from gccv::Client.
bool gcp::View::OnButtonReleased | ( | gccv::ItemClient * | client, |
unsigned | button, | ||
double | x, | ||
double | y, | ||
unsigned | state | ||
) | [virtual] |
client | the ItemClient for the Item at the event position if any. |
button | the mouse button. |
x | horizontal event position. |
y | vertical event position. |
state | the GdkModifierType value for the event. |
Called when a mouse button is released. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient.
Reimplemented from gccv::Client.
void gcp::View::OnCopySelection | ( | GtkWidget * | w, |
GtkClipboard * | clipboard | ||
) |
w | the active document widget. |
clipboard | a GtkClipboard. |
Called by the framework to copy the selection.
void gcp::View::OnCutSelection | ( | GtkWidget * | w, |
GtkClipboard * | clipboard | ||
) |
w | the active document widget. |
clipboard | a GtkClipboard. |
Called by the framework to copy and delete the selection.
void gcp::View::OnDeleteSelection | ( | GtkWidget * | w | ) |
w | the active document widget. |
Removes all objects in the widget.
void gcp::View::OnDestroy | ( | GtkWidget * | widget | ) |
widget | the destroyed widget. |
Called by the framework when a widget is destroyed.
bool gcp::View::OnDrag | ( | gccv::ItemClient * | client, |
double | x, | ||
double | y, | ||
unsigned | state | ||
) | [virtual] |
client | the ItemClient for the Item at the event position if any. |
x | horizontal event position. |
y | vertical event position. |
state | the GdkModifierType value for the event. |
Called when the mouse moves over the canvas, with at least one button pressed. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient.
Reimplemented from gccv::Client.
bool gcp::View::OnKeyPress | ( | GtkWidget * | w, |
GdkEventKey * | event | ||
) |
w | the widget which received the event. |
event | the current event. |
Called by the framework when a key has been pressed on the keyboard.
bool gcp::View::OnKeyRelease | ( | GtkWidget * | w, |
GdkEventKey * | event | ||
) |
w | the widget which received the event. |
event | the current event. |
Called by the framework when a key has been released on the keyboard.
bool gcp::View::OnLeaveNotify | ( | unsigned | state | ) | [virtual] |
state | the GdkModifierType value for the event. |
Called when the mouse leaves the Canvas.
Reimplemented from gccv::Client.
bool gcp::View::OnMotion | ( | gccv::ItemClient * | client, |
double | x, | ||
double | y, | ||
unsigned | state | ||
) | [virtual] |
client | the ItemClient for the Item at the event position if any. |
x | horizontal event position. |
y | vertical event position. |
state | the GdkModifierType value for the event. |
Called when the mouse moves over the canvas, with no button pressed. client is NULL when there is no Item at the event position, or the Item does not have an associated ItemClient. @return true to stop other handlers from being invoked for the event. false to propagate the event further.
Reimplemented from gccv::Client.
void gcp::View::OnPasteSelection | ( | GtkWidget * | w, |
GtkClipboard * | clipboard | ||
) |
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 | ||
) |
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.
void gcp::View::Remove | ( | gcu::Object * | pObject | ) |
pObject | the object to remove. |
Removes the object from the view and destroys the items representing it.
void gcp::View::Render | ( | cairo_t * | cr | ) |
cr | the cairo_t to which render. |
Renders the document using cairo.
void gcp::View::SetSelectionState | ( | gcu::Object * | object, |
int | state | ||
) |
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 | ) |
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 | ) |
show | whether to show the cursor or not. |
Shows or hides the cursor in the currently edited text item if any.
void gcp::View::Update | ( | gcu::Object * | pObject | ) |
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 | ) |
zoom | the new zoom level. |
Sets the zoom level.