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 #ifdef GLIBMM_VFUNCS_ENABLED
00112 #endif //GLIBMM_VFUNCS_ENABLED
00113
00114 protected:
00115
00116 #ifdef GLIBMM_VFUNCS_ENABLED
00117 #endif //GLIBMM_VFUNCS_ENABLED
00118
00119
00120 virtual void on_draw_background(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
00121 virtual void on_render_background(GnomeCanvasBuf* buf);
00122
00123
00124 private:
00125
00126 public:
00127 Canvas();
00128
00129
00130
00131
00132
00133
00137 Group* root() const;
00138
00139
00140
00149 void set_scroll_region(double x1, double y1, double x2, double y2);
00150
00151
00152
00159 void get_scroll_region(double& x1, double& y1, double& x2, double& y2) const;
00160
00161
00169 void set_center_scroll_region(bool center);
00170
00171
00176 bool get_center_scroll_region() const;
00177
00178
00179
00180
00193 void set_pixels_per_unit(double n = 1.0);
00194
00195
00196
00197
00198
00199
00200
00201
00209 void scroll_to(int x, int y);
00210
00211
00212
00218 void get_scroll_offsets(int& cx, int& cy) const;
00219
00220
00221
00222
00223
00229 void update_now();
00230
00231
00232
00233
00234
00235
00236
00244 Item* get_item_at(double x, double y) const;
00245
00246
00247
00248
00249
00250
00260 void request_redraw(int x1, int y1, int x2, int y2);
00261
00262
00269 void request_redraw(ArtUta* uta);
00270
00271 Art::AffineTrans w2c_affine() const;
00272
00273
00274
00275
00276
00277
00278
00285 void w2c(double wx, double wy, int& cx, int& cy) const;
00286
00294 void w2c(double wx, double wy, double& cx, double& cy) const;
00295
00296
00297
00304 void c2w(int cx, int cy, double& wx, double& wy) const;
00305
00306
00307
00308
00309
00318 void window_to_world (double winx,double winy, double& worldx,double& worldy) const;
00319
00320
00321
00322
00323
00330 void world_to_window (double worldx, double worldy, double& winx, double& winy) const;
00331
00332
00333 bool get_color(const Glib::ustring& spec, Gdk::Color& color) const;
00334
00335
00336
00337
00343 gulong get_color_pixel(guint rgba) const;
00344
00350 void set_stipple_origin(const Glib::RefPtr<Gdk::GC>& gc);
00351
00358 void set_dither(Gdk::RgbDither dither);
00359
00363 Gdk::RgbDither get_dither() const;
00364
00365
00366
00367
00373 void update_svp(ArtSVP** p_svp, ArtSVP* new_svp);
00374
00381 void update_svp_clip(ArtSVP** p_svp, ArtSVP* new_svp, ArtSVP* clip_svp);
00382
00383
00384
00385
00386 double get_pixels_per_unit() const;
00387
00388
00389
00390
00391
00392 Glib::SignalProxy5< void,const Glib::RefPtr<Gdk::Drawable>&,int,int,int,int > signal_draw_background();
00393
00394
00395
00396
00397
00398
00399
00400 Glib::SignalProxy1< void,GnomeCanvasBuf* > signal_render_background();
00401
00402
00403 #ifdef GLIBMM_VFUNCS_ENABLED
00404 virtual void request_update_vfunc();
00405 #endif //GLIBMM_VFUNCS_ENABLED
00406
00407
00408
00409 #ifdef GLIBMM_PROPERTIES_ENABLED
00410
00416 Glib::PropertyProxy_ReadOnly<bool> property_aa() const;
00417 #endif //#GLIBMM_PROPERTIES_ENABLED
00418
00419
00420 };
00421
00422
00423
00424 class CanvasAA : public Canvas
00425 {
00426 public:
00427 CanvasAA();
00428 virtual ~CanvasAA();
00429 };
00430
00431 }
00432 }
00433
00434
00435 namespace Glib
00436 {
00442 Gnome::Canvas::Canvas* wrap(GnomeCanvas* object, bool take_copy = false);
00443 }
00444
00445
00446 #endif
00447