00001
00002
00003 #ifndef _LIBGNOMECANVASMM_CANVAS_H
00004 #define _LIBGNOMECANVASMM_CANVAS_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <libgnomecanvas/gnome-canvas.h>
00035 #include <libgnomecanvasmm/affinetrans.h>
00036 #include <gtkmm/layout.h>
00037 #include <gdkmm/color.h>
00038
00039
00040 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00041 typedef struct _GnomeCanvas GnomeCanvas;
00042 typedef struct _GnomeCanvasClass GnomeCanvasClass;
00043 #endif
00044
00045
00046 namespace Gnome
00047 {
00048
00049 namespace Canvas
00050 { class Canvas_Class; }
00051
00052 }
00053 namespace Gnome
00054 {
00055
00056 namespace Canvas
00057 {
00058
00059 class Item;
00060 class Group;
00061
00068 class Canvas : public Gtk::Layout
00069 {
00070 public:
00071 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00072 typedef Canvas CppObjectType;
00073 typedef Canvas_Class CppClassType;
00074 typedef GnomeCanvas BaseObjectType;
00075 typedef GnomeCanvasClass BaseClassType;
00076 #endif
00077
00078 virtual ~Canvas();
00079
00080 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00081
00082 protected:
00083 friend class Canvas_Class;
00084 static CppClassType canvas_class_;
00085
00086
00087 Canvas(const Canvas&);
00088 Canvas& operator=(const Canvas&);
00089
00090 protected:
00091 explicit Canvas(const Glib::ConstructParams& construct_params);
00092 explicit Canvas(GnomeCanvas* castitem);
00093
00094 #endif
00095
00096 public:
00097 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00098 static GType get_type() G_GNUC_CONST;
00099 static GType get_base_type() G_GNUC_CONST;
00100 #endif
00101
00103 GnomeCanvas* gobj() { return reinterpret_cast<GnomeCanvas*>(gobject_); }
00104
00106 const GnomeCanvas* gobj() const { return reinterpret_cast<GnomeCanvas*>(gobject_); }
00107
00108
00109 public:
00110
00111
00112 protected:
00113
00114
00115
00116 virtual void on_draw_background(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
00117 virtual void on_render_background(GnomeCanvasBuf* buf);
00118
00119
00120 private:
00121
00122 public:
00123 Canvas();
00124
00125
00126
00127
00128
00129
00133 Group* root() const;
00134
00135
00136
00145 void set_scroll_region(double x1, double y1, double x2, double y2);
00146
00147
00148
00155 void get_scroll_region(double& x1, double& y1, double& x2, double& y2) const;
00156
00157
00165 void set_center_scroll_region(bool center);
00166
00167
00172 bool get_center_scroll_region() const;
00173
00174
00175
00176
00189 void set_pixels_per_unit(double n = 1.0);
00190
00191
00192
00193
00194
00195
00196
00197
00205 void scroll_to(int x, int y);
00206
00207
00208
00214 void get_scroll_offsets(int& cx, int& cy) const;
00215
00216
00217
00218
00219
00225 void update_now();
00226
00227
00228
00229
00230
00231
00232
00240 Item* get_item_at(double x, double y) const;
00241
00242
00243
00244
00245
00246
00256 void request_redraw(int x1, int y1, int x2, int y2);
00257
00258
00265 void request_redraw(ArtUta* uta);
00266
00267 Art::AffineTrans w2c_affine() const;
00268
00269
00270
00271
00272
00273
00274
00281 void w2c(double wx, double wy, int& cx, int& cy) const;
00282
00290 void w2c(double wx, double wy, double& cx, double& cy) const;
00291
00292
00293
00300 void c2w(int cx, int cy, double& wx, double& wy) const;
00301
00302
00303
00304
00305
00314 void window_to_world (double winx,double winy, double& worldx,double& worldy) const;
00315
00316
00317
00318
00319
00326 void world_to_window (double worldx, double worldy, double& winx, double& winy) const;
00327
00328
00329 bool get_color(const Glib::ustring& spec, Gdk::Color& color) const;
00330
00331
00332
00333
00339 gulong get_color_pixel(guint rgba) const;
00340
00346 void set_stipple_origin(const Glib::RefPtr<Gdk::GC>& gc);
00347
00354 void set_dither(Gdk::RgbDither dither);
00355
00359 Gdk::RgbDither get_dither() const;
00360
00361
00362
00363
00369 void update_svp(ArtSVP** p_svp, ArtSVP* new_svp);
00370
00377 void update_svp_clip(ArtSVP** p_svp, ArtSVP* new_svp, ArtSVP* clip_svp);
00378
00379
00380
00381
00382 double get_pixels_per_unit() const;
00383
00384
00385
00386
00387
00388 Glib::SignalProxy5< void,const Glib::RefPtr<Gdk::Drawable>&,int,int,int,int > signal_draw_background();
00389
00390
00391
00392
00393
00394
00395
00396 Glib::SignalProxy1< void,GnomeCanvasBuf* > signal_render_background();
00397
00398
00399 virtual void request_update_vfunc();
00400
00401
00408 Glib::PropertyProxy_ReadOnly<bool> property_aa() const;
00409
00410
00411 };
00412
00413
00414
00415 class CanvasAA : public Canvas
00416 {
00417 public:
00418 CanvasAA();
00419 virtual ~CanvasAA();
00420 };
00421
00422 }
00423 }
00424
00425
00426 namespace Glib
00427 {
00433 Gnome::Canvas::Canvas* wrap(GnomeCanvas* object, bool take_copy = false);
00434 }
00435
00436
00437 #endif
00438