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 () |
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 () |
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 57 of file 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 316 of file 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 312 of file view.h.
gcp::View::GetCHeight |
( |
void |
|
) |
const [inline] |
- Returns:
- the half height of a carbon atom symbol in the current theme.
Definition at line 320 of file view.h.
Document* gcp::View::GetDoc |
( |
|
) |
[inline] |
- Returns:
- the document associated with the view.
Definition at line 83 of file view.h.
double gcp::View::GetFontHeight |
( |
|
) |
[inline] |
- Returns:
- the height of the font used to display atomic symbols.
Definition at line 125 of file view.h.
gchar* gcp::View::GetFontName |
( |
|
) |
[inline] |
- Returns:
- the name of the font used to display atomic symbols.
Definition at line 129 of file view.h.
gcp::View::GetHWidth |
( |
void |
|
) |
const [inline] |
- Returns:
- the half width of a hydrogen atom symbol in the current theme.
Definition at line 324 of file view.h.
int gcp::View::GetNbWidgets |
( |
|
) |
[inline] |
- Returns:
- the number of existing canvases for this view.
Definition at line 217 of file view.h.
PangoFontDescription* gcp::View::GetPangoFontDesc |
( |
|
) |
[inline] |
- Returns:
- the description of the font used to display atomic symbols.
Definition at line 137 of file view.h.
PangoFontDescription* gcp::View::GetPangoSmallFontDesc |
( |
|
) |
[inline] |
- Returns:
- the description of the font used to display stoichiometry indices and charges.
Definition at line 141 of file view.h.
gchar* gcp::View::GetSmallFontName |
( |
|
) |
[inline] |
- Returns:
- the name of the font used to display stoichiometry indices and charges.
Definition at line 133 of file view.h.
GtkWidget* gcp::View::GetWidget |
( |
void |
|
) |
[inline] |
- Returns:
- the canvas widget used for the view.
Definition at line 79 of file 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 213 of file view.h.
bool gcp::View::OnButtonPressed |
( |
gccv::ItemClient * |
client, |
|
|
unsigned |
button, |
|
|
double |
x, |
|
|
double |
y, |
|
|
unsigned |
state | |
|
) |
| | [virtual] |
- Parameters:
-
| 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.
- Returns:
- true to stop other handlers from being invoked for the event. false to propagate the event further.
Reimplemented from gccv::Client.
bool gcp::View::OnButtonReleased |
( |
gccv::ItemClient * |
client, |
|
|
unsigned |
button, |
|
|
double |
x, |
|
|
double |
y, |
|
|
unsigned |
state | |
|
) |
| | [virtual] |
- Parameters:
-
| 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.
- Returns:
- true to stop other handlers from being invoked for the event. false to propagate the event further.
Reimplemented from gccv::Client.
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::OnDrag |
( |
gccv::ItemClient * |
client, |
|
|
double |
x, |
|
|
double |
y, |
|
|
unsigned |
state | |
|
) |
| | [virtual] |
- Parameters:
-
| 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.
- Returns:
- true to stop other handlers from being invoked for the event. false to propagate the event further.
Reimplemented from gccv::Client.
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.
bool gcp::View::OnLeaveNotify |
( |
unsigned |
state |
) |
[virtual] |
- Parameters:
-
| state | the GdkModifierType value for the event. |
Called when the mouse leaves the Canvas.
- Returns:
- true to stop other handlers from being invoked for the event. false to propagate the event further.
Reimplemented from gccv::Client.
bool gcp::View::OnMotion |
( |
gccv::ItemClient * |
client, |
|
|
double |
x, |
|
|
double |
y, |
|
|
unsigned |
state | |
|
) |
| | [virtual] |
- Parameters:
-
| 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 | |
|
) |
| | |
- 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: