Class Index Cross Index Namespace Index

Class Gnome::Canvas

Gnome Canvas
Contained in: Gnome
Derived from: Gtk::Layout
Derived by: Gnome::CanvasAA Gnome::IconList

#include <gtk--/canvas.h>


public function member index:

Canvas();
void c2w(int cx, int cy, double& wx, double& wy) const;
bool get_color(const Gtk::string& spec, GdkColor* color);
bool get_color(const Gtk::string& spec, Gdk_Color& color);
CanvasItem* get_item_at(double x, double y);
double get_pixels_per_unit() const;
void get_scroll_offsets(int& cx, int& cy) const;
void get_scroll_region(double& x1, double& y1, double& x2, double& y2);
static GtkType get_type();
GnomeCanvas* gtkobj();
const GnomeCanvas* gtkobj() const;
static bool isA(Gtk::Object* checkcast);
void request_redraw(int x1, int y1, int x2, int y2);
CanvasGroup* root();
void scroll_to(int x, int y);
void set_pixels_per_unit(double n=1.0);
void set_scroll_region(double x1, double y1, double x2, double y2);
void update_now();
void w2c(double wx, double wy, int& cx, int& cy) const;
void window_to_world(double winx, double winy, double& worldx, double& worldy) const;
void world_to_window(double worldx, double wolrdy, double& winx, double& winy) const;
virtual ~Canvas();
 

protected function member index:

explicit Canvas(GnomeCanvas* castitem);
void initialize_class();
 

private function member index:

Canvas(const Canvas&);
Canvas& operator =(const Canvas&);
 

Description:

Canvas functions usually operate in either World coordinates (units for the entire canvas), or Canvas coordinates (pixels starting at 0,0 in the top left). There are functions to transform from one to the other.

If you want to put Imlib image objects on the Canvas, you need to push the Imlib colormap/visual before creating the canvas, and pop it afterward.


Function Member Descriptions:

Gnome::Canvas::c2w - From Canvas to World

void c2w(int cx, int cy, double& wx, double& wy) const;

Gnome::Canvas::get_color - Parse color spec string and allocate it into the GdkColor.

bool get_color(const Gtk::string& spec, GdkColor* color);

Gnome::Canvas::get_item_at - Find an item at a location.

CanvasItem* get_item_at(double x, double y);
Looks for the item that is under the specified position, which must be specified in world coordinates. Arguments are in world coordinates. Returns 0 if no item is at that location.


Gnome::Canvas::get_pixels_per_unit - Get the pixels per unit.

double get_pixels_per_unit() const;

Gnome::Canvas::get_scroll_offsets - Scroll offsets in canvas pixel coordinates.

void get_scroll_offsets(int& cx, int& cy) const;

Gnome::Canvas::get_scroll_region - Get limits of scroll region

void get_scroll_region(double& x1, double& y1, double& x2, double& y2);

Gnome::Canvas::request_redraw - Repaint small area (internal)

void request_redraw(int x1, int y1, int x2, int y2);
Used only by item implementations. Request an eventual redraw of the region, which includes x1,y1 but not x2,y2


Gnome::Canvas::root - Get the root canvas item

CanvasGroup* root();

Gnome::Canvas::scroll_to - Shift window.

void scroll_to(int x, int y);
Makes a canvas scroll to the specified offsets, given in canvas pixel units. The canvas will adjust the view so that it is not outside the scrolling region. This function is typically not used, as it is better to hook scrollbars to the canvas layout's scrolling adjusments.


Gnome::Canvas::set_pixels_per_unit - Set the pixels/world coordinates ratio

void set_pixels_per_unit(double n=1.0);
With no arguments sets to default of 1.0.


Gnome::Canvas::set_scroll_region - Limits of scroll region

void set_scroll_region(double x1, double y1, double x2, double y2);

Gnome::Canvas::update_now - Repaint immediately, don't wait for idle loop

void update_now();
normally the canvas queues repainting and does it in an idle loop


Gnome::Canvas::w2c - Convert from World to canvas coordinates (units for the entire canvas) to Canvas coordinates (pixels starting at 0,0 in the top left of the visible area). The relationship depends on the current scroll position and the pixels_per_unit ratio (zoom factor)

void w2c(double wx, double wy, int& cx, int& cy) const;

Gnome::Canvas::window_to_world - Convert from Window coordinates to world coordinates.

void window_to_world(double winx, double winy, double& worldx, double& worldy) const;
Window coordinates are based of the widget's GdkWindow. This is fairly low-level and not generally useful.



Variable Member Descriptions: