From d09f6b3016bacbc2871a8946cbb24ad705076509 Mon Sep 17 00:00:00 2001 From: Taybin Rutkin Date: Fri, 13 May 2005 20:47:18 +0000 Subject: [PATCH] Initial revision git-svn-id: svn://localhost/trunk/ardour2@4 d708f5d6-7413-0410-9779-e7cbd77b26cf --- .cvsignore | 5 + COPYING | 340 + ChangeLog | 154 + DOCUMENTATION/.cvsignore | 2 + DOCUMENTATION/AUTHORS | 71 + DOCUMENTATION/AUTHORS.es | 78 + DOCUMENTATION/BUILD | 145 + DOCUMENTATION/BUILD.ru | 215 + DOCUMENTATION/CONTRIBUTORS | 61 + DOCUMENTATION/CONTRIBUTORS.es | 82 + DOCUMENTATION/FAQ | 613 ++ DOCUMENTATION/README | 101 + DOCUMENTATION/README.es | 139 + DOCUMENTATION/README.fr | 113 + DOCUMENTATION/README.it | 276 + DOCUMENTATION/README.ru | 108 + DOCUMENTATION/TODO | 232 + DOCUMENTATION/TRANSLATORS | 21 + DOCUMENTATION/ardour.1 | 71 + DOCUMENTATION/ardour.1.es | 72 + DOCUMENTATION/ardour.1.fr | 71 + DOCUMENTATION/ardour.1.ru | 84 + PACKAGER_README | 15 + README | 5 + ReleaseNotes-0.9betaX | 294 + SConstruct | 663 ++ ardour.rc.in | 136 + ardour_system.rc | 94 + libs/.cvsignore | 0 libs/cassowary/.cvsignore | 15 + libs/cassowary/ANNOUNCE | 37 + libs/cassowary/AUTHORS | 12 + libs/cassowary/COPYING | 340 + libs/cassowary/COPYING.LGPL | 444 ++ libs/cassowary/ChangeLog | 2002 +++++ libs/cassowary/ClAbstractVariable.cc | 23 + libs/cassowary/ClBug0.cc | 102 + libs/cassowary/ClBug1.cc | 21 + libs/cassowary/ClBug2.cc | 130 + libs/cassowary/ClConstraint.cc | 32 + libs/cassowary/ClDummyVariable.cc | 12 + libs/cassowary/ClFDBinaryOneWayConstraint.cc | 140 + libs/cassowary/ClFDConnectorVariable.cc | 29 + libs/cassowary/ClFDSolver.cc | 364 + libs/cassowary/ClFDVariable.cc | 27 + libs/cassowary/ClFloatVariable.cc | 25 + libs/cassowary/ClLinearExpression.cc | 473 ++ libs/cassowary/ClReader.l | 87 + libs/cassowary/ClReader.y | 154 + libs/cassowary/ClSimplexSolver.cc | 1633 ++++ libs/cassowary/ClSlackVariable.cc | 12 + libs/cassowary/ClSolver.cc | 59 + libs/cassowary/ClStrength.cc | 52 + libs/cassowary/ClSymbolicWeight.cc | 149 + libs/cassowary/ClTableau.cc | 297 + libs/cassowary/ClTests.cc | 884 ++ libs/cassowary/ClVariable.cc | 21 + libs/cassowary/IMPORTANT | 26 + libs/cassowary/INSTALL | 182 + libs/cassowary/LICENSE | 18 + libs/cassowary/Makefile.am | 32 + libs/cassowary/NEWS | 229 + libs/cassowary/README | 241 + libs/cassowary/THANKS | 30 + libs/cassowary/autogen.sh | 4 + libs/cassowary/cassowary-config | 102 + libs/cassowary/cassowary-config.in | 102 + libs/cassowary/cassowary-nofd.spec2 | 84 + libs/cassowary/cassowary-nofd.spec2.in | 84 + libs/cassowary/cassowary.spec | 78 + libs/cassowary/cassowary.spec.in | 78 + libs/cassowary/cassowary/.cvsignore | 2 + libs/cassowary/cassowary/Cassowary.h | 40 + libs/cassowary/cassowary/Cl.h | 49 + libs/cassowary/cassowary/ClAbstractVariable.h | 161 + libs/cassowary/cassowary/ClConstraint.h | 198 + libs/cassowary/cassowary/ClConstraintHash.h | 39 + libs/cassowary/cassowary/ClDummyVariable.h | 88 + libs/cassowary/cassowary/ClEditConstraint.h | 45 + .../cassowary/ClEditOrStayConstraint.h | 51 + libs/cassowary/cassowary/ClErrors.h | 179 + .../cassowary/ClFDBinaryOneWayConstraint.h | 94 + .../cassowary/ClFDConnectorVariable.h | 89 + libs/cassowary/cassowary/ClFDConstraint.h | 40 + libs/cassowary/cassowary/ClFDSolver.h | 120 + libs/cassowary/cassowary/ClFDVariable.h | 126 + libs/cassowary/cassowary/ClFloatVariable.h | 119 + libs/cassowary/cassowary/ClLinearConstraint.h | 61 + libs/cassowary/cassowary/ClLinearEquation.h | 74 + libs/cassowary/cassowary/ClLinearExpression.h | 298 + .../cassowary/ClLinearExpression_fwd.h | 26 + libs/cassowary/cassowary/ClLinearInequality.h | 167 + .../cassowary/cassowary/ClObjectiveVariable.h | 63 + libs/cassowary/cassowary/ClPoint.h | 74 + libs/cassowary/cassowary/ClReader.h | 117 + libs/cassowary/cassowary/ClSimplexSolver.h | 588 ++ libs/cassowary/cassowary/ClSlackVariable.h | 75 + libs/cassowary/cassowary/ClSolver.h | 167 + libs/cassowary/cassowary/ClStayConstraint.h | 43 + libs/cassowary/cassowary/ClStrength.h | 91 + libs/cassowary/cassowary/ClSymbolicWeight.h | 197 + libs/cassowary/cassowary/ClTableau.h | 230 + libs/cassowary/cassowary/ClTypedefs.h | 48 + libs/cassowary/cassowary/ClVariable.h | 166 + libs/cassowary/cassowary/Makefile.am | 36 + libs/cassowary/cassowary/cl_auto_ptr.h | 69 + libs/cassowary/cassowary/config-inline.h | 1 + libs/cassowary/cassowary/debug.h | 48 + libs/cassowary/cassowary/timer.h | 176 + libs/cassowary/configure.ac | 64 + libs/glibmm2/.cvsignore | 11 + libs/glibmm2/AUTHORS | 20 + libs/glibmm2/CHANGES | 33 + libs/glibmm2/COPYING | 515 ++ libs/glibmm2/ChangeLog | 998 +++ libs/glibmm2/INSTALL | 231 + libs/glibmm2/Makefile.am | 23 + libs/glibmm2/NEWS | 242 + libs/glibmm2/README | 31 + libs/glibmm2/SConscript | 19 + libs/glibmm2/autogen.sh | 18 + libs/glibmm2/configure.ac | 149 + libs/glibmm2/glibmm-2.4.pc.in | 11 + libs/glibmm2/glibmm.h | 72 + libs/glibmm2/glibmm/.cvsignore | 2 + libs/glibmm2/glibmm/Makefile.am | 96 + libs/glibmm2/glibmm/arrayhandle.h | 522 ++ libs/glibmm2/glibmm/class.cc | 116 + libs/glibmm2/glibmm/class.h | 76 + libs/glibmm2/glibmm/containerhandle_shared.h | 343 + libs/glibmm2/glibmm/containers.cc | 33 + libs/glibmm2/glibmm/containers.h | 372 + libs/glibmm2/glibmm/convert.cc | 323 + libs/glibmm2/glibmm/convert.h | 299 + libs/glibmm2/glibmm/date.cc | 348 + libs/glibmm2/glibmm/date.h | 427 + libs/glibmm2/glibmm/debug.cc | 21 + libs/glibmm2/glibmm/debug.h | 85 + libs/glibmm2/glibmm/dispatcher.cc | 442 + libs/glibmm2/glibmm/dispatcher.h | 102 + libs/glibmm2/glibmm/error.cc | 187 + libs/glibmm2/glibmm/error.h | 77 + libs/glibmm2/glibmm/exception.cc | 40 + libs/glibmm2/glibmm/exception.h | 42 + libs/glibmm2/glibmm/exceptionhandler.cc | 159 + libs/glibmm2/glibmm/exceptionhandler.h | 45 + libs/glibmm2/glibmm/fileutils.cc | 217 + libs/glibmm2/glibmm/fileutils.h | 475 ++ libs/glibmm2/glibmm/helperlist.h | 165 + libs/glibmm2/glibmm/i18n.h | 30 + libs/glibmm2/glibmm/init.cc | 34 + libs/glibmm2/glibmm/init.h | 39 + libs/glibmm2/glibmm/interface.cc | 95 + libs/glibmm2/glibmm/interface.h | 72 + libs/glibmm2/glibmm/iochannel.cc | 687 ++ libs/glibmm2/glibmm/iochannel.h | 695 ++ libs/glibmm2/glibmm/listhandle.h | 406 + libs/glibmm2/glibmm/main.cc | 986 +++ libs/glibmm2/glibmm/main.h | 697 ++ libs/glibmm2/glibmm/markup.cc | 350 + libs/glibmm2/glibmm/markup.h | 420 + libs/glibmm2/glibmm/miscutils.cc | 243 + libs/glibmm2/glibmm/miscutils.h | 272 + libs/glibmm2/glibmm/module.cc | 93 + libs/glibmm2/glibmm/module.h | 221 + libs/glibmm2/glibmm/object.cc | 312 + libs/glibmm2/glibmm/object.h | 282 + libs/glibmm2/glibmm/objectbase.cc | 271 + libs/glibmm2/glibmm/objectbase.h | 171 + libs/glibmm2/glibmm/optioncontext.cc | 141 + libs/glibmm2/glibmm/optioncontext.h | 197 + libs/glibmm2/glibmm/optionentry.cc | 149 + libs/glibmm2/glibmm/optionentry.h | 108 + libs/glibmm2/glibmm/optiongroup.cc | 453 ++ libs/glibmm2/glibmm/optiongroup.h | 141 + libs/glibmm2/glibmm/pattern.cc | 66 + libs/glibmm2/glibmm/pattern.h | 69 + libs/glibmm2/glibmm/private/convert_p.h | 6 + libs/glibmm2/glibmm/private/date_p.h | 6 + libs/glibmm2/glibmm/private/fileutils_p.h | 6 + libs/glibmm2/glibmm/private/interface_p.h | 24 + libs/glibmm2/glibmm/private/iochannel_p.h | 6 + libs/glibmm2/glibmm/private/markup_p.h | 6 + libs/glibmm2/glibmm/private/module_p.h | 6 + libs/glibmm2/glibmm/private/object_p.h | 28 + libs/glibmm2/glibmm/private/optioncontext_p.h | 6 + libs/glibmm2/glibmm/private/optionentry_p.h | 6 + libs/glibmm2/glibmm/private/optiongroup_p.h | 6 + libs/glibmm2/glibmm/private/shell_p.h | 6 + libs/glibmm2/glibmm/private/spawn_p.h | 6 + libs/glibmm2/glibmm/private/thread_p.h | 6 + libs/glibmm2/glibmm/private/unicode_p.h | 6 + libs/glibmm2/glibmm/property.cc | 198 + libs/glibmm2/glibmm/property.h | 171 + libs/glibmm2/glibmm/propertyproxy.cc | 24 + libs/glibmm2/glibmm/propertyproxy.h | 163 + libs/glibmm2/glibmm/propertyproxy_base.cc | 151 + libs/glibmm2/glibmm/propertyproxy_base.h | 84 + libs/glibmm2/glibmm/quark.cc | 66 + libs/glibmm2/glibmm/quark.h | 88 + libs/glibmm2/glibmm/random.cc | 76 + libs/glibmm2/glibmm/random.h | 73 + libs/glibmm2/glibmm/refptr.h | 318 + libs/glibmm2/glibmm/sarray.h | 108 + libs/glibmm2/glibmm/shell.cc | 93 + libs/glibmm2/glibmm/shell.h | 123 + libs/glibmm2/glibmm/signalproxy.cc | 105 + libs/glibmm2/glibmm/signalproxy.h | 394 + .../glibmm/signalproxy_connectionnode.cc | 94 + .../glibmm/signalproxy_connectionnode.h | 70 + libs/glibmm2/glibmm/slisthandle.h | 405 + libs/glibmm2/glibmm/spawn.cc | 311 + libs/glibmm2/glibmm/spawn.h | 203 + libs/glibmm2/glibmm/streamiochannel.cc | 188 + libs/glibmm2/glibmm/streamiochannel.h | 67 + libs/glibmm2/glibmm/stringutils.cc | 117 + libs/glibmm2/glibmm/stringutils.h | 184 + libs/glibmm2/glibmm/thread.cc | 399 + libs/glibmm2/glibmm/thread.h | 1082 +++ libs/glibmm2/glibmm/threadpool.cc | 245 + libs/glibmm2/glibmm/threadpool.h | 183 + libs/glibmm2/glibmm/timer.cc | 72 + libs/glibmm2/glibmm/timer.h | 79 + libs/glibmm2/glibmm/timeval.cc | 120 + libs/glibmm2/glibmm/timeval.h | 233 + libs/glibmm2/glibmm/unicode.cc | 33 + libs/glibmm2/glibmm/unicode.h | 311 + libs/glibmm2/glibmm/ustring.cc | 1207 +++ libs/glibmm2/glibmm/ustring.h | 997 +++ libs/glibmm2/glibmm/utility.cc | 40 + libs/glibmm2/glibmm/utility.h | 119 + libs/glibmm2/glibmm/value.cc | 242 + libs/glibmm2/glibmm/value.h | 319 + libs/glibmm2/glibmm/value_basictypes.cc | 336 + libs/glibmm2/glibmm/value_basictypes.h | 271 + libs/glibmm2/glibmm/value_custom.cc | 145 + libs/glibmm2/glibmm/value_custom.h | 289 + libs/glibmm2/glibmm/wrap.cc | 161 + libs/glibmm2/glibmm/wrap.h | 118 + libs/glibmm2/glibmm/wrap_init.cc | 73 + libs/glibmm2/glibmm/wrap_init.h | 38 + libs/glibmm2/glibmmconfig.h.in | 85 + libs/glibmm2/scripts/.cvsignore | 5 + libs/glibmm2/scripts/cxx.m4 | 364 + libs/glibmm2/scripts/cxx_std.m4 | 195 + libs/glibmm2/scripts/macros.m4 | 134 + libs/gtkmm2/AUTHORS | 20 + libs/gtkmm2/CHANGES | 88 + libs/gtkmm2/COPYING | 515 ++ libs/gtkmm2/ChangeLog | 2390 ++++++ libs/gtkmm2/atk/SConscript | 10 + libs/gtkmm2/atk/atkmm.h | 42 + libs/gtkmm2/atk/atkmm/action.cc | 481 ++ libs/gtkmm2/atk/atkmm/action.h | 193 + libs/gtkmm2/atk/atkmm/component.cc | 892 +++ libs/gtkmm2/atk/atkmm/component.h | 331 + libs/gtkmm2/atk/atkmm/document.cc | 246 + libs/gtkmm2/atk/atkmm/document.h | 145 + libs/gtkmm2/atk/atkmm/editabletext.cc | 506 ++ libs/gtkmm2/atk/atkmm/editabletext.h | 193 + libs/gtkmm2/atk/atkmm/hyperlink.cc | 681 ++ libs/gtkmm2/atk/atkmm/hyperlink.h | 252 + libs/gtkmm2/atk/atkmm/hypertext.cc | 396 + libs/gtkmm2/atk/atkmm/hypertext.h | 167 + libs/gtkmm2/atk/atkmm/image.cc | 349 + libs/gtkmm2/atk/atkmm/image.h | 173 + libs/gtkmm2/atk/atkmm/implementor.cc | 175 + libs/gtkmm2/atk/atkmm/implementor.h | 127 + libs/gtkmm2/atk/atkmm/init.cc | 34 + libs/gtkmm2/atk/atkmm/init.h | 40 + libs/gtkmm2/atk/atkmm/noopobject.cc | 132 + libs/gtkmm2/atk/atkmm/noopobject.h | 143 + libs/gtkmm2/atk/atkmm/object.cc | 834 ++ libs/gtkmm2/atk/atkmm/object.h | 570 ++ libs/gtkmm2/atk/atkmm/objectaccessible.cc | 165 + libs/gtkmm2/atk/atkmm/objectaccessible.h | 145 + libs/gtkmm2/atk/atkmm/private/action_p.h | 47 + libs/gtkmm2/atk/atkmm/private/component_p.h | 54 + libs/gtkmm2/atk/atkmm/private/document_p.h | 43 + .../gtkmm2/atk/atkmm/private/editabletext_p.h | 47 + libs/gtkmm2/atk/atkmm/private/hyperlink_p.h | 54 + libs/gtkmm2/atk/atkmm/private/hypertext_p.h | 45 + libs/gtkmm2/atk/atkmm/private/image_p.h | 45 + libs/gtkmm2/atk/atkmm/private/implementor_p.h | 41 + libs/gtkmm2/atk/atkmm/private/noopobject_p.h | 44 + libs/gtkmm2/atk/atkmm/private/object_p.h | 50 + .../atk/atkmm/private/objectaccessible_p.h | 44 + libs/gtkmm2/atk/atkmm/private/relation_p.h | 44 + libs/gtkmm2/atk/atkmm/private/relationset_p.h | 44 + libs/gtkmm2/atk/atkmm/private/selection_p.h | 49 + libs/gtkmm2/atk/atkmm/private/stateset_p.h | 44 + .../atk/atkmm/private/streamablecontent_p.h | 44 + libs/gtkmm2/atk/atkmm/private/table_p.h | 77 + libs/gtkmm2/atk/atkmm/private/text_p.h | 61 + libs/gtkmm2/atk/atkmm/private/value_p.h | 44 + libs/gtkmm2/atk/atkmm/relation.cc | 177 + libs/gtkmm2/atk/atkmm/relation.h | 187 + libs/gtkmm2/atk/atkmm/relationset.cc | 181 + libs/gtkmm2/atk/atkmm/relationset.h | 171 + libs/gtkmm2/atk/atkmm/selection.cc | 596 ++ libs/gtkmm2/atk/atkmm/selection.h | 208 + libs/gtkmm2/atk/atkmm/stateset.cc | 200 + libs/gtkmm2/atk/atkmm/stateset.h | 247 + libs/gtkmm2/atk/atkmm/streamablecontent.cc | 306 + libs/gtkmm2/atk/atkmm/streamablecontent.h | 153 + libs/gtkmm2/atk/atkmm/table.cc | 2394 ++++++ libs/gtkmm2/atk/atkmm/table.h | 427 + libs/gtkmm2/atk/atkmm/text.cc | 1563 ++++ libs/gtkmm2/atk/atkmm/text.h | 687 ++ libs/gtkmm2/atk/atkmm/value.cc | 340 + libs/gtkmm2/atk/atkmm/value.h | 157 + libs/gtkmm2/atk/atkmm/wrap_init.cc | 91 + libs/gtkmm2/atk/atkmm/wrap_init.h | 32 + libs/gtkmm2/gdk/.DS_Store | Bin 0 -> 6148 bytes libs/gtkmm2/gdk/SConscript | 10 + libs/gtkmm2/gdk/gdkmm.h | 48 + libs/gtkmm2/gdk/gdkmm/bitmap.cc | 71 + libs/gtkmm2/gdk/gdkmm/bitmap.h | 79 + libs/gtkmm2/gdk/gdkmm/color.cc | 297 + libs/gtkmm2/gdk/gdkmm/color.h | 274 + libs/gtkmm2/gdk/gdkmm/colormap.cc | 209 + libs/gtkmm2/gdk/gdkmm/colormap.h | 227 + libs/gtkmm2/gdk/gdkmm/cursor.cc | 161 + libs/gtkmm2/gdk/gdkmm/cursor.h | 251 + libs/gtkmm2/gdk/gdkmm/device.cc | 204 + libs/gtkmm2/gdk/gdkmm/device.h | 254 + libs/gtkmm2/gdk/gdkmm/display.cc | 596 ++ libs/gtkmm2/gdk/gdkmm/display.h | 635 ++ libs/gtkmm2/gdk/gdkmm/displaymanager.cc | 265 + libs/gtkmm2/gdk/gdkmm/displaymanager.h | 186 + libs/gtkmm2/gdk/gdkmm/dragcontext.cc | 310 + libs/gtkmm2/gdk/gdkmm/dragcontext.h | 369 + libs/gtkmm2/gdk/gdkmm/drawable.cc | 369 + libs/gtkmm2/gdk/gdkmm/drawable.h | 601 ++ libs/gtkmm2/gdk/gdkmm/event.cc | 223 + libs/gtkmm2/gdk/gdkmm/event.h | 398 + libs/gtkmm2/gdk/gdkmm/gc.cc | 326 + libs/gtkmm2/gdk/gdkmm/gc.h | 617 ++ libs/gtkmm2/gdk/gdkmm/general.cc | 54 + libs/gtkmm2/gdk/gdkmm/general.h | 37 + libs/gtkmm2/gdk/gdkmm/image.cc | 250 + libs/gtkmm2/gdk/gdkmm/image.h | 231 + libs/gtkmm2/gdk/gdkmm/list.h | 157 + libs/gtkmm2/gdk/gdkmm/pixbuf.cc | 503 ++ libs/gtkmm2/gdk/gdkmm/pixbuf.h | 884 ++ libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc | 172 + libs/gtkmm2/gdk/gdkmm/pixbufanimation.h | 194 + libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc | 123 + libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h | 120 + libs/gtkmm2/gdk/gdkmm/pixbufformat.cc | 118 + libs/gtkmm2/gdk/gdkmm/pixbufformat.h | 150 + libs/gtkmm2/gdk/gdkmm/pixbufloader.cc | 465 ++ libs/gtkmm2/gdk/gdkmm/pixbufloader.h | 269 + libs/gtkmm2/gdk/gdkmm/pixmap.cc | 320 + libs/gtkmm2/gdk/gdkmm/pixmap.h | 202 + libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h | 7 + libs/gtkmm2/gdk/gdkmm/private/color_p.h | 6 + libs/gtkmm2/gdk/gdkmm/private/colormap_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/cursor_p.h | 7 + libs/gtkmm2/gdk/gdkmm/private/device_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/display_p.h | 45 + .../gdk/gdkmm/private/displaymanager_p.h | 45 + libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/drawable_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/event_p.h | 6 + libs/gtkmm2/gdk/gdkmm/private/gc_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/image_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h | 44 + .../gdk/gdkmm/private/pixbufanimation_p.h | 44 + .../gdk/gdkmm/private/pixbufanimationiter_p.h | 44 + .../gtkmm2/gdk/gdkmm/private/pixbufformat_p.h | 6 + .../gtkmm2/gdk/gdkmm/private/pixbufloader_p.h | 47 + libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h | 6 + libs/gtkmm2/gdk/gdkmm/private/region_p.h | 6 + libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h | 6 + libs/gtkmm2/gdk/gdkmm/private/screen_p.h | 45 + libs/gtkmm2/gdk/gdkmm/private/types_p.h | 6 + libs/gtkmm2/gdk/gdkmm/private/visual_p.h | 44 + libs/gtkmm2/gdk/gdkmm/private/window_p.h | 44 + libs/gtkmm2/gdk/gdkmm/rectangle.cc | 160 + libs/gtkmm2/gdk/gdkmm/rectangle.h | 113 + libs/gtkmm2/gdk/gdkmm/region.cc | 226 + libs/gtkmm2/gdk/gdkmm/region.h | 234 + libs/gtkmm2/gdk/gdkmm/rgb.cc | 43 + libs/gtkmm2/gdk/gdkmm/rgb.h | 55 + libs/gtkmm2/gdk/gdkmm/rgbcmap.cc | 72 + libs/gtkmm2/gdk/gdkmm/rgbcmap.h | 82 + libs/gtkmm2/gdk/gdkmm/screen.cc | 416 + libs/gtkmm2/gdk/gdkmm/screen.h | 423 + libs/gtkmm2/gdk/gdkmm/types.cc | 116 + libs/gtkmm2/gdk/gdkmm/types.h | 370 + libs/gtkmm2/gdk/gdkmm/visual.cc | 226 + libs/gtkmm2/gdk/gdkmm/visual.h | 253 + libs/gtkmm2/gdk/gdkmm/window.cc | 769 ++ libs/gtkmm2/gdk/gdkmm/window.h | 1906 +++++ libs/gtkmm2/gdk/gdkmm/wrap_init.cc | 135 + libs/gtkmm2/gdk/gdkmm/wrap_init.h | 32 + libs/gtkmm2/gdk/gdkmmconfig.h | 8 + libs/gtkmm2/gtk/SConscript | 10 + libs/gtkmm2/gtk/gtkmm.h | 156 + libs/gtkmm2/gtk/gtkmm/aboutdialog.cc | 477 ++ libs/gtkmm2/gtk/gtkmm/aboutdialog.h | 591 ++ libs/gtkmm2/gtk/gtkmm/accelgroup.cc | 347 + libs/gtkmm2/gtk/gtkmm/accelgroup.h | 249 + libs/gtkmm2/gtk/gtkmm/accelkey.cc | 93 + libs/gtkmm2/gtk/gtkmm/accelkey.h | 94 + libs/gtkmm2/gtk/gtkmm/accellabel.cc | 188 + libs/gtkmm2/gtk/gtkmm/accellabel.h | 182 + libs/gtkmm2/gtk/gtkmm/accelmap.cc | 70 + libs/gtkmm2/gtk/gtkmm/accelmap.h | 129 + libs/gtkmm2/gtk/gtkmm/action.cc | 639 ++ libs/gtkmm2/gtk/gtkmm/action.h | 532 ++ libs/gtkmm2/gtk/gtkmm/actiongroup.cc | 419 + libs/gtkmm2/gtk/gtkmm/actiongroup.h | 250 + libs/gtkmm2/gtk/gtkmm/adjustment.cc | 343 + libs/gtkmm2/gtk/gtkmm/adjustment.h | 236 + libs/gtkmm2/gtk/gtkmm/alignment.cc | 243 + libs/gtkmm2/gtk/gtkmm/alignment.h | 318 + libs/gtkmm2/gtk/gtkmm/arrow.cc | 177 + libs/gtkmm2/gtk/gtkmm/arrow.h | 177 + libs/gtkmm2/gtk/gtkmm/aspectframe.cc | 187 + libs/gtkmm2/gtk/gtkmm/aspectframe.h | 242 + libs/gtkmm2/gtk/gtkmm/base.h | 53 + libs/gtkmm2/gtk/gtkmm/bin.cc | 242 + libs/gtkmm2/gtk/gtkmm/bin.h | 211 + libs/gtkmm2/gtk/gtkmm/box.cc | 572 ++ libs/gtkmm2/gtk/gtkmm/box.h | 587 ++ libs/gtkmm2/gtk/gtkmm/button.cc | 682 ++ libs/gtkmm2/gtk/gtkmm/button.h | 432 + libs/gtkmm2/gtk/gtkmm/buttonbox.cc | 389 + libs/gtkmm2/gtk/gtkmm/buttonbox.h | 361 + libs/gtkmm2/gtk/gtkmm/calendar.cc | 605 ++ libs/gtkmm2/gtk/gtkmm/calendar.h | 273 + libs/gtkmm2/gtk/gtkmm/celleditable.cc | 307 + libs/gtkmm2/gtk/gtkmm/celleditable.h | 158 + libs/gtkmm2/gtk/gtkmm/celllayout.cc | 519 ++ libs/gtkmm2/gtk/gtkmm/celllayout.h | 226 + libs/gtkmm2/gtk/gtkmm/cellrenderer.cc | 638 ++ libs/gtkmm2/gtk/gtkmm/cellrenderer.h | 610 ++ .../gtk/gtkmm/cellrenderer_generation.cc | 52 + .../gtk/gtkmm/cellrenderer_generation.h | 62 + libs/gtkmm2/gtk/gtkmm/cellrenderercombo.cc | 170 + libs/gtkmm2/gtk/gtkmm/cellrenderercombo.h | 180 + libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.cc | 199 + libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.h | 226 + libs/gtkmm2/gtk/gtkmm/cellrendererprogress.cc | 161 + libs/gtkmm2/gtk/gtkmm/cellrendererprogress.h | 152 + libs/gtkmm2/gtk/gtkmm/cellrenderertext.cc | 624 ++ libs/gtkmm2/gtk/gtkmm/cellrenderertext.h | 769 ++ libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.cc | 273 + libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.h | 206 + libs/gtkmm2/gtk/gtkmm/cellview.cc | 199 + libs/gtkmm2/gtk/gtkmm/cellview.h | 210 + libs/gtkmm2/gtk/gtkmm/checkbutton.cc | 186 + libs/gtkmm2/gtk/gtkmm/checkbutton.h | 151 + libs/gtkmm2/gtk/gtkmm/checkmenuitem.cc | 317 + libs/gtkmm2/gtk/gtkmm/checkmenuitem.h | 237 + libs/gtkmm2/gtk/gtkmm/clipboard.cc | 584 ++ libs/gtkmm2/gtk/gtkmm/clipboard.h | 489 ++ libs/gtkmm2/gtk/gtkmm/colorbutton.cc | 287 + libs/gtkmm2/gtk/gtkmm/colorbutton.h | 277 + libs/gtkmm2/gtk/gtkmm/colorselection.cc | 538 ++ libs/gtkmm2/gtk/gtkmm/colorselection.h | 362 + libs/gtkmm2/gtk/gtkmm/combo.cc | 993 +++ libs/gtkmm2/gtk/gtkmm/combo.h | 545 ++ libs/gtkmm2/gtk/gtkmm/combobox.cc | 452 ++ libs/gtkmm2/gtk/gtkmm/combobox.h | 492 ++ libs/gtkmm2/gtk/gtkmm/comboboxentry.cc | 176 + libs/gtkmm2/gtk/gtkmm/comboboxentry.h | 183 + libs/gtkmm2/gtk/gtkmm/comboboxentrytext.cc | 134 + libs/gtkmm2/gtk/gtkmm/comboboxentrytext.h | 89 + libs/gtkmm2/gtk/gtkmm/comboboxtext.cc | 138 + libs/gtkmm2/gtk/gtkmm/comboboxtext.h | 92 + libs/gtkmm2/gtk/gtkmm/container.cc | 945 +++ libs/gtkmm2/gtk/gtkmm/container.h | 446 ++ libs/gtkmm2/gtk/gtkmm/curve.cc | 378 + libs/gtkmm2/gtk/gtkmm/curve.h | 303 + libs/gtkmm2/gtk/gtkmm/dialog.cc | 331 + libs/gtkmm2/gtk/gtkmm/dialog.h | 346 + libs/gtkmm2/gtk/gtkmm/drawingarea.cc | 129 + libs/gtkmm2/gtk/gtkmm/drawingarea.h | 120 + libs/gtkmm2/gtk/gtkmm/editable.cc | 770 ++ libs/gtkmm2/gtk/gtkmm/editable.h | 190 + libs/gtkmm2/gtk/gtkmm/entry.cc | 598 ++ libs/gtkmm2/gtk/gtkmm/entry.h | 524 ++ libs/gtkmm2/gtk/gtkmm/entrycompletion.cc | 611 ++ libs/gtkmm2/gtk/gtkmm/entrycompletion.h | 323 + libs/gtkmm2/gtk/gtkmm/enums.cc | 283 + libs/gtkmm2/gtk/gtkmm/enums.h | 1422 ++++ libs/gtkmm2/gtk/gtkmm/eventbox.cc | 170 + libs/gtkmm2/gtk/gtkmm/eventbox.h | 232 + libs/gtkmm2/gtk/gtkmm/expander.cc | 266 + libs/gtkmm2/gtk/gtkmm/expander.h | 362 + libs/gtkmm2/gtk/gtkmm/filechooser.cc | 581 ++ libs/gtkmm2/gtk/gtkmm/filechooser.h | 935 +++ libs/gtkmm2/gtk/gtkmm/filechooserbutton.cc | 203 + libs/gtkmm2/gtk/gtkmm/filechooserbutton.h | 234 + libs/gtkmm2/gtk/gtkmm/filechooserdialog.cc | 158 + libs/gtkmm2/gtk/gtkmm/filechooserdialog.h | 129 + libs/gtkmm2/gtk/gtkmm/filechooserwidget.cc | 150 + libs/gtkmm2/gtk/gtkmm/filechooserwidget.h | 140 + libs/gtkmm2/gtk/gtkmm/filefilter.cc | 240 + libs/gtkmm2/gtk/gtkmm/filefilter.h | 264 + libs/gtkmm2/gtk/gtkmm/fileselection.cc | 324 + libs/gtkmm2/gtk/gtkmm/fileselection.h | 270 + libs/gtkmm2/gtk/gtkmm/fixed.cc | 153 + libs/gtkmm2/gtk/gtkmm/fixed.h | 149 + libs/gtkmm2/gtk/gtkmm/fontbutton.cc | 324 + libs/gtkmm2/gtk/gtkmm/fontbutton.h | 311 + libs/gtkmm2/gtk/gtkmm/fontselection.cc | 401 + libs/gtkmm2/gtk/gtkmm/fontselection.h | 292 + libs/gtkmm2/gtk/gtkmm/frame.cc | 292 + libs/gtkmm2/gtk/gtkmm/frame.h | 305 + libs/gtkmm2/gtk/gtkmm/handlebox.cc | 419 + libs/gtkmm2/gtk/gtkmm/handlebox.h | 220 + libs/gtkmm2/gtk/gtkmm/iconfactory.cc | 189 + libs/gtkmm2/gtk/gtkmm/iconfactory.h | 160 + libs/gtkmm2/gtk/gtkmm/iconinfo.cc | 177 + libs/gtkmm2/gtk/gtkmm/iconinfo.h | 227 + libs/gtkmm2/gtk/gtkmm/iconset.cc | 146 + libs/gtkmm2/gtk/gtkmm/iconset.h | 188 + libs/gtkmm2/gtk/gtkmm/iconsource.cc | 208 + libs/gtkmm2/gtk/gtkmm/iconsource.h | 288 + libs/gtkmm2/gtk/gtkmm/icontheme.cc | 327 + libs/gtkmm2/gtk/gtkmm/icontheme.h | 394 + libs/gtkmm2/gtk/gtkmm/iconview.cc | 695 ++ libs/gtkmm2/gtk/gtkmm/iconview.h | 596 ++ libs/gtkmm2/gtk/gtkmm/image.cc | 446 ++ libs/gtkmm2/gtk/gtkmm/image.h | 454 ++ libs/gtkmm2/gtk/gtkmm/imagemenuitem.cc | 192 + libs/gtkmm2/gtk/gtkmm/imagemenuitem.h | 149 + libs/gtkmm2/gtk/gtkmm/inputdialog.cc | 386 + libs/gtkmm2/gtk/gtkmm/inputdialog.h | 155 + libs/gtkmm2/gtk/gtkmm/invisible.cc | 167 + libs/gtkmm2/gtk/gtkmm/invisible.h | 142 + libs/gtkmm2/gtk/gtkmm/item.cc | 321 + libs/gtkmm2/gtk/gtkmm/item.h | 145 + libs/gtkmm2/gtk/gtkmm/label.cc | 603 ++ libs/gtkmm2/gtk/gtkmm/label.h | 742 ++ libs/gtkmm2/gtk/gtkmm/layout.cc | 371 + libs/gtkmm2/gtk/gtkmm/layout.h | 300 + libs/gtkmm2/gtk/gtkmm/liststore.cc | 264 + libs/gtkmm2/gtk/gtkmm/liststore.h | 246 + libs/gtkmm2/gtk/gtkmm/main.cc | 538 ++ libs/gtkmm2/gtk/gtkmm/main.h | 284 + libs/gtkmm2/gtk/gtkmm/menu.cc | 348 + libs/gtkmm2/gtk/gtkmm/menu.h | 304 + libs/gtkmm2/gtk/gtkmm/menu_elems.cc | 286 + libs/gtkmm2/gtk/gtkmm/menu_elems.h | 266 + libs/gtkmm2/gtk/gtkmm/menubar.cc | 147 + libs/gtkmm2/gtk/gtkmm/menubar.h | 128 + libs/gtkmm2/gtk/gtkmm/menuitem.cc | 552 ++ libs/gtkmm2/gtk/gtkmm/menuitem.h | 233 + libs/gtkmm2/gtk/gtkmm/menushell.cc | 492 ++ libs/gtkmm2/gtk/gtkmm/menushell.h | 288 + libs/gtkmm2/gtk/gtkmm/menutoolbutton.cc | 247 + libs/gtkmm2/gtk/gtkmm/menutoolbutton.h | 196 + libs/gtkmm2/gtk/gtkmm/messagedialog.cc | 189 + libs/gtkmm2/gtk/gtkmm/messagedialog.h | 228 + libs/gtkmm2/gtk/gtkmm/misc.cc | 200 + libs/gtkmm2/gtk/gtkmm/misc.h | 212 + libs/gtkmm2/gtk/gtkmm/notebook.cc | 910 +++ libs/gtkmm2/gtk/gtkmm/notebook.h | 903 +++ libs/gtkmm2/gtk/gtkmm/object.cc | 407 + libs/gtkmm2/gtk/gtkmm/object.h | 168 + libs/gtkmm2/gtk/gtkmm/optionmenu.cc | 252 + libs/gtkmm2/gtk/gtkmm/optionmenu.h | 153 + libs/gtkmm2/gtk/gtkmm/paned.cc | 419 + libs/gtkmm2/gtk/gtkmm/paned.h | 417 + libs/gtkmm2/gtk/gtkmm/plug.cc | 217 + libs/gtkmm2/gtk/gtkmm/plug.h | 132 + libs/gtkmm2/gtk/gtkmm/private/aboutdialog_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/accelgroup_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/accellabel_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/action_p.h | 49 + libs/gtkmm2/gtk/gtkmm/private/actiongroup_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/adjustment_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/alignment_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/arrow_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/aspectframe_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/bin_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/box_p.h | 118 + libs/gtkmm2/gtk/gtkmm/private/button_p.h | 50 + libs/gtkmm2/gtk/gtkmm/private/buttonbox_p.h | 118 + libs/gtkmm2/gtk/gtkmm/private/calendar_p.h | 51 + .../gtkmm2/gtk/gtkmm/private/celleditable_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/celllayout_p.h | 47 + .../gtkmm2/gtk/gtkmm/private/cellrenderer_p.h | 50 + .../gtk/gtkmm/private/cellrenderercombo_p.h | 44 + .../gtk/gtkmm/private/cellrendererpixbuf_p.h | 44 + .../gtkmm/private/cellrendererprogress_p.h | 44 + .../gtk/gtkmm/private/cellrenderertext_p.h | 45 + .../gtk/gtkmm/private/cellrenderertoggle_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/cellview_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/checkbutton_p.h | 45 + .../gtk/gtkmm/private/checkmenuitem_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/clipboard_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/colorbutton_p.h | 45 + .../gtk/gtkmm/private/colorselection_p.h | 83 + libs/gtkmm2/gtk/gtkmm/private/combo_p.h | 124 + libs/gtkmm2/gtk/gtkmm/private/combobox_p.h | 45 + .../gtk/gtkmm/private/comboboxentry_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/container_p.h | 55 + libs/gtkmm2/gtk/gtkmm/private/curve_p.h | 83 + libs/gtkmm2/gtk/gtkmm/private/dialog_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/drawingarea_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/editable_p.h | 51 + libs/gtkmm2/gtk/gtkmm/private/entry_p.h | 47 + .../gtk/gtkmm/private/entrycompletion_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/enums_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/eventbox_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/expander_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/filechooser_p.h | 41 + .../gtk/gtkmm/private/filechooserbutton_p.h | 44 + .../gtk/gtkmm/private/filechooserdialog_p.h | 44 + .../gtk/gtkmm/private/filechooserwidget_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/filefilter_p.h | 44 + .../gtk/gtkmm/private/fileselection_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/fixed_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/fontbutton_p.h | 45 + .../gtk/gtkmm/private/fontselection_p.h | 82 + libs/gtkmm2/gtk/gtkmm/private/frame_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/handlebox_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/iconfactory_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/iconinfo_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/iconset_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/iconsource_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/icontheme_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/iconview_p.h | 47 + libs/gtkmm2/gtk/gtkmm/private/image_p.h | 44 + .../gtk/gtkmm/private/imagemenuitem_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/inputdialog_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/invisible_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/item_p.h | 47 + libs/gtkmm2/gtk/gtkmm/private/label_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/layout_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/liststore_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/main_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/menu_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/menubar_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/menuitem_p.h | 48 + libs/gtkmm2/gtk/gtkmm/private/menushell_p.h | 50 + .../gtk/gtkmm/private/menutoolbutton_p.h | 45 + .../gtk/gtkmm/private/messagedialog_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/misc_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/notebook_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/object_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/optionmenu_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/paned_p.h | 118 + libs/gtkmm2/gtk/gtkmm/private/plug_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/progressbar_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/radioaction_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/radiobutton_p.h | 45 + .../gtk/gtkmm/private/radiomenuitem_p.h | 45 + .../gtk/gtkmm/private/radiotoolbutton_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/range_p.h | 48 + libs/gtkmm2/gtk/gtkmm/private/rc_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/ruler_p.h | 120 + libs/gtkmm2/gtk/gtkmm/private/scale_p.h | 120 + libs/gtkmm2/gtk/gtkmm/private/scrollbar_p.h | 118 + .../gtk/gtkmm/private/scrolledwindow_p.h | 44 + .../gtk/gtkmm/private/selectiondata_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/separator_p.h | 118 + .../gtk/gtkmm/private/separatormenuitem_p.h | 44 + .../gtk/gtkmm/private/separatortoolitem_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/settings_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/sizegroup_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/socket_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/spinbutton_p.h | 47 + libs/gtkmm2/gtk/gtkmm/private/statusbar_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/stockitem_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/style_p.h | 75 + libs/gtkmm2/gtk/gtkmm/private/table_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/targetlist_p.h | 6 + .../gtk/gtkmm/private/tearoffmenuitem_p.h | 44 + .../gtk/gtkmm/private/textattributes_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/textbuffer_p.h | 56 + .../gtk/gtkmm/private/textchildanchor_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/textiter_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/textmark_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/texttag_p.h | 46 + .../gtkmm2/gtk/gtkmm/private/texttagtable_p.h | 47 + libs/gtkmm2/gtk/gtkmm/private/textview_p.h | 48 + .../gtkmm2/gtk/gtkmm/private/toggleaction_p.h | 45 + .../gtkmm2/gtk/gtkmm/private/togglebutton_p.h | 45 + .../gtk/gtkmm/private/toggletoolbutton_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/toolbar_p.h | 47 + libs/gtkmm2/gtk/gtkmm/private/toolbutton_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/toolitem_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/tooltips_p.h | 44 + .../gtkmm2/gtk/gtkmm/private/treedragdest_p.h | 43 + .../gtk/gtkmm/private/treedragsource_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/treeiter_p.h | 6 + libs/gtkmm2/gtk/gtkmm/private/treemodel_p.h | 60 + .../gtk/gtkmm/private/treemodelfilter_p.h | 44 + .../gtk/gtkmm/private/treemodelsort_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/treepath_p.h | 6 + .../gtk/gtkmm/private/treerowreference_p.h | 6 + .../gtk/gtkmm/private/treeselection_p.h | 45 + .../gtkmm2/gtk/gtkmm/private/treesortable_p.h | 48 + libs/gtkmm2/gtk/gtkmm/private/treestore_p.h | 44 + libs/gtkmm2/gtk/gtkmm/private/treeview_p.h | 52 + .../gtk/gtkmm/private/treeviewcolumn_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/uimanager_p.h | 46 + libs/gtkmm2/gtk/gtkmm/private/viewport_p.h | 45 + libs/gtkmm2/gtk/gtkmm/private/widget_p.h | 107 + libs/gtkmm2/gtk/gtkmm/private/window_p.h | 84 + libs/gtkmm2/gtk/gtkmm/progressbar.cc | 249 + libs/gtkmm2/gtk/gtkmm/progressbar.h | 361 + libs/gtkmm2/gtk/gtkmm/radioaction.cc | 274 + libs/gtkmm2/gtk/gtkmm/radioaction.h | 169 + libs/gtkmm2/gtk/gtkmm/radiobutton.cc | 236 + libs/gtkmm2/gtk/gtkmm/radiobutton.h | 151 + libs/gtkmm2/gtk/gtkmm/radiobuttongroup.cc | 86 + libs/gtkmm2/gtk/gtkmm/radiobuttongroup.h | 80 + libs/gtkmm2/gtk/gtkmm/radiomenuitem.cc | 228 + libs/gtkmm2/gtk/gtkmm/radiomenuitem.h | 145 + libs/gtkmm2/gtk/gtkmm/radiotoolbutton.cc | 183 + libs/gtkmm2/gtk/gtkmm/radiotoolbutton.h | 195 + libs/gtkmm2/gtk/gtkmm/range.cc | 554 ++ libs/gtkmm2/gtk/gtkmm/range.h | 282 + libs/gtkmm2/gtk/gtkmm/rc.cc | 357 + libs/gtkmm2/gtk/gtkmm/rc.h | 352 + libs/gtkmm2/gtk/gtkmm/ruler.cc | 506 ++ libs/gtkmm2/gtk/gtkmm/ruler.h | 403 + libs/gtkmm2/gtk/gtkmm/scale.cc | 640 ++ libs/gtkmm2/gtk/gtkmm/scale.h | 460 ++ libs/gtkmm2/gtk/gtkmm/scrollbar.cc | 341 + libs/gtkmm2/gtk/gtkmm/scrollbar.h | 307 + libs/gtkmm2/gtk/gtkmm/scrolledwindow.cc | 323 + libs/gtkmm2/gtk/gtkmm/scrolledwindow.h | 298 + libs/gtkmm2/gtk/gtkmm/selectiondata.cc | 261 + libs/gtkmm2/gtk/gtkmm/selectiondata.h | 253 + .../gtkmm2/gtk/gtkmm/selectiondata_private.cc | 40 + libs/gtkmm2/gtk/gtkmm/selectiondata_private.h | 49 + libs/gtkmm2/gtk/gtkmm/separator.cc | 317 + libs/gtkmm2/gtk/gtkmm/separator.h | 286 + libs/gtkmm2/gtk/gtkmm/separatormenuitem.cc | 129 + libs/gtkmm2/gtk/gtkmm/separatormenuitem.h | 121 + libs/gtkmm2/gtk/gtkmm/separatortoolitem.cc | 134 + libs/gtkmm2/gtk/gtkmm/separatortoolitem.h | 125 + libs/gtkmm2/gtk/gtkmm/settings.cc | 380 + libs/gtkmm2/gtk/gtkmm/settings.h | 515 ++ libs/gtkmm2/gtk/gtkmm/sizegroup.cc | 179 + libs/gtkmm2/gtk/gtkmm/sizegroup.h | 207 + libs/gtkmm2/gtk/gtkmm/socket.cc | 308 + libs/gtkmm2/gtk/gtkmm/socket.h | 200 + libs/gtkmm2/gtk/gtkmm/spinbutton.cc | 638 ++ libs/gtkmm2/gtk/gtkmm/spinbutton.h | 503 ++ libs/gtkmm2/gtk/gtkmm/statusbar.cc | 338 + libs/gtkmm2/gtk/gtkmm/statusbar.h | 163 + libs/gtkmm2/gtk/gtkmm/stock.cc | 160 + libs/gtkmm2/gtk/gtkmm/stock.h | 166 + libs/gtkmm2/gtk/gtkmm/stockid.cc | 80 + libs/gtkmm2/gtk/gtkmm/stockid.h | 97 + libs/gtkmm2/gtk/gtkmm/stockitem.cc | 166 + libs/gtkmm2/gtk/gtkmm/stockitem.h | 103 + libs/gtkmm2/gtk/gtkmm/style.cc | 2208 +++++ libs/gtkmm2/gtk/gtkmm/style.h | 786 ++ libs/gtkmm2/gtk/gtkmm/table.cc | 406 + libs/gtkmm2/gtk/gtkmm/table.h | 379 + libs/gtkmm2/gtk/gtkmm/targetentry.cc | 113 + libs/gtkmm2/gtk/gtkmm/targetentry.h | 97 + libs/gtkmm2/gtk/gtkmm/targetlist.cc | 129 + libs/gtkmm2/gtk/gtkmm/targetlist.h | 97 + libs/gtkmm2/gtk/gtkmm/tearoffmenuitem.cc | 138 + libs/gtkmm2/gtk/gtkmm/tearoffmenuitem.h | 124 + libs/gtkmm2/gtk/gtkmm/textattributes.cc | 103 + libs/gtkmm2/gtk/gtkmm/textattributes.h | 114 + libs/gtkmm2/gtk/gtkmm/textbuffer.cc | 1664 ++++ libs/gtkmm2/gtk/gtkmm/textbuffer.h | 844 ++ libs/gtkmm2/gtk/gtkmm/textchildanchor.cc | 151 + libs/gtkmm2/gtk/gtkmm/textchildanchor.h | 159 + libs/gtkmm2/gtk/gtkmm/textiter.cc | 617 ++ libs/gtkmm2/gtk/gtkmm/textiter.h | 1210 +++ libs/gtkmm2/gtk/gtkmm/textmark.cc | 187 + libs/gtkmm2/gtk/gtkmm/textmark.h | 197 + libs/gtkmm2/gtk/gtkmm/texttag.cc | 889 +++ libs/gtkmm2/gtk/gtkmm/texttag.h | 1158 +++ libs/gtkmm2/gtk/gtkmm/texttagtable.cc | 466 ++ libs/gtkmm2/gtk/gtkmm/texttagtable.h | 186 + libs/gtkmm2/gtk/gtkmm/textview.cc | 920 +++ libs/gtkmm2/gtk/gtkmm/textview.h | 960 +++ libs/gtkmm2/gtk/gtkmm/toggleaction.cc | 257 + libs/gtkmm2/gtk/gtkmm/toggleaction.h | 184 + libs/gtkmm2/gtk/gtkmm/togglebutton.cc | 267 + libs/gtkmm2/gtk/gtkmm/togglebutton.h | 235 + libs/gtkmm2/gtk/gtkmm/toggletoolbutton.cc | 226 + libs/gtkmm2/gtk/gtkmm/toggletoolbutton.h | 170 + libs/gtkmm2/gtk/gtkmm/toolbar.cc | 609 ++ libs/gtkmm2/gtk/gtkmm/toolbar.h | 370 + libs/gtkmm2/gtk/gtkmm/toolbutton.cc | 327 + libs/gtkmm2/gtk/gtkmm/toolbutton.h | 346 + libs/gtkmm2/gtk/gtkmm/toolitem.cc | 517 ++ libs/gtkmm2/gtk/gtkmm/toolitem.h | 442 + libs/gtkmm2/gtk/gtkmm/tooltips.cc | 171 + libs/gtkmm2/gtk/gtkmm/tooltips.h | 145 + libs/gtkmm2/gtk/gtkmm/treedragdest.cc | 244 + libs/gtkmm2/gtk/gtkmm/treedragdest.h | 161 + libs/gtkmm2/gtk/gtkmm/treedragsource.cc | 309 + libs/gtkmm2/gtk/gtkmm/treedragsource.h | 171 + libs/gtkmm2/gtk/gtkmm/treeiter.cc | 395 + libs/gtkmm2/gtk/gtkmm/treeiter.h | 517 ++ libs/gtkmm2/gtk/gtkmm/treemodel.cc | 1612 ++++ libs/gtkmm2/gtk/gtkmm/treemodel.h | 597 ++ libs/gtkmm2/gtk/gtkmm/treemodelcolumn.cc | 68 + libs/gtkmm2/gtk/gtkmm/treemodelcolumn.h | 145 + libs/gtkmm2/gtk/gtkmm/treemodelfilter.cc | 374 + libs/gtkmm2/gtk/gtkmm/treemodelfilter.h | 303 + libs/gtkmm2/gtk/gtkmm/treemodelsort.cc | 230 + libs/gtkmm2/gtk/gtkmm/treemodelsort.h | 208 + libs/gtkmm2/gtk/gtkmm/treepath.cc | 319 + libs/gtkmm2/gtk/gtkmm/treepath.h | 402 + libs/gtkmm2/gtk/gtkmm/treerowreference.cc | 128 + libs/gtkmm2/gtk/gtkmm/treerowreference.h | 138 + libs/gtkmm2/gtk/gtkmm/treeselection.cc | 454 ++ libs/gtkmm2/gtk/gtkmm/treeselection.h | 370 + libs/gtkmm2/gtk/gtkmm/treesortable.cc | 606 ++ libs/gtkmm2/gtk/gtkmm/treesortable.h | 238 + libs/gtkmm2/gtk/gtkmm/treestore.cc | 283 + libs/gtkmm2/gtk/gtkmm/treestore.h | 276 + libs/gtkmm2/gtk/gtkmm/treeview.cc | 1727 ++++ libs/gtkmm2/gtk/gtkmm/treeview.h | 1774 +++++ libs/gtkmm2/gtk/gtkmm/treeview_private.cc | 94 + libs/gtkmm2/gtk/gtkmm/treeview_private.h | 77 + libs/gtkmm2/gtk/gtkmm/treeviewcolumn.cc | 663 ++ libs/gtkmm2/gtk/gtkmm/treeviewcolumn.h | 868 ++ libs/gtkmm2/gtk/gtkmm/uimanager.cc | 581 ++ libs/gtkmm2/gtk/gtkmm/uimanager.h | 505 ++ libs/gtkmm2/gtk/gtkmm/viewport.cc | 297 + libs/gtkmm2/gtk/gtkmm/viewport.h | 231 + libs/gtkmm2/gtk/gtkmm/widget.cc | 7088 +++++++++++++++++ libs/gtkmm2/gtk/gtkmm/widget.h | 2666 +++++++ libs/gtkmm2/gtk/gtkmm/window.cc | 1242 +++ libs/gtkmm2/gtk/gtkmm/window.h | 1637 ++++ libs/gtkmm2/gtk/gtkmm/wrap_init.cc | 740 ++ libs/gtkmm2/gtk/gtkmm/wrap_init.h | 32 + libs/gtkmm2/gtk/gtkmmconfig.h | 42 + libs/gtkmm2/pango/SConscript | 11 + libs/gtkmm2/pango/pangomm.h | 41 + libs/gtkmm2/pango/pangomm/attributes.cc | 534 ++ libs/gtkmm2/pango/pangomm/attributes.h | 669 ++ libs/gtkmm2/pango/pangomm/attriter.cc | 180 + libs/gtkmm2/pango/pangomm/attriter.h | 147 + libs/gtkmm2/pango/pangomm/attrlist.cc | 161 + libs/gtkmm2/pango/pangomm/attrlist.h | 182 + libs/gtkmm2/pango/pangomm/color.cc | 124 + libs/gtkmm2/pango/pangomm/color.h | 138 + libs/gtkmm2/pango/pangomm/context.cc | 239 + libs/gtkmm2/pango/pangomm/context.h | 349 + libs/gtkmm2/pango/pangomm/coverage.cc | 151 + libs/gtkmm2/pango/pangomm/coverage.h | 169 + libs/gtkmm2/pango/pangomm/font.cc | 169 + libs/gtkmm2/pango/pangomm/font.h | 194 + libs/gtkmm2/pango/pangomm/fontdescription.cc | 252 + libs/gtkmm2/pango/pangomm/fontdescription.h | 529 ++ libs/gtkmm2/pango/pangomm/fontface.cc | 148 + libs/gtkmm2/pango/pangomm/fontface.h | 151 + libs/gtkmm2/pango/pangomm/fontfamily.cc | 149 + libs/gtkmm2/pango/pangomm/fontfamily.h | 171 + libs/gtkmm2/pango/pangomm/fontmap.cc | 153 + libs/gtkmm2/pango/pangomm/fontmap.h | 153 + libs/gtkmm2/pango/pangomm/fontmetrics.cc | 143 + libs/gtkmm2/pango/pangomm/fontmetrics.h | 187 + libs/gtkmm2/pango/pangomm/fontset.cc | 166 + libs/gtkmm2/pango/pangomm/fontset.h | 154 + libs/gtkmm2/pango/pangomm/glyph.cc | 145 + libs/gtkmm2/pango/pangomm/glyph.h | 222 + libs/gtkmm2/pango/pangomm/glyphstring.cc | 186 + libs/gtkmm2/pango/pangomm/glyphstring.h | 223 + libs/gtkmm2/pango/pangomm/init.cc | 34 + libs/gtkmm2/pango/pangomm/init.h | 40 + libs/gtkmm2/pango/pangomm/item.cc | 201 + libs/gtkmm2/pango/pangomm/item.h | 225 + libs/gtkmm2/pango/pangomm/language.cc | 158 + libs/gtkmm2/pango/pangomm/language.h | 245 + libs/gtkmm2/pango/pangomm/layout.cc | 451 ++ libs/gtkmm2/pango/pangomm/layout.h | 687 ++ libs/gtkmm2/pango/pangomm/layoutiter.cc | 206 + libs/gtkmm2/pango/pangomm/layoutiter.h | 235 + libs/gtkmm2/pango/pangomm/layoutline.cc | 197 + libs/gtkmm2/pango/pangomm/layoutline.h | 222 + libs/gtkmm2/pango/pangomm/layoutrun.cc | 79 + libs/gtkmm2/pango/pangomm/layoutrun.h | 92 + .../pango/pangomm/private/attributes_p.h | 6 + .../gtkmm2/pango/pangomm/private/attriter_p.h | 6 + .../gtkmm2/pango/pangomm/private/attrlist_p.h | 6 + libs/gtkmm2/pango/pangomm/private/color_p.h | 6 + libs/gtkmm2/pango/pangomm/private/context_p.h | 44 + .../gtkmm2/pango/pangomm/private/coverage_p.h | 6 + libs/gtkmm2/pango/pangomm/private/font_p.h | 44 + .../pango/pangomm/private/fontdescription_p.h | 6 + .../gtkmm2/pango/pangomm/private/fontface_p.h | 44 + .../pango/pangomm/private/fontfamily_p.h | 44 + libs/gtkmm2/pango/pangomm/private/fontmap_p.h | 44 + .../pango/pangomm/private/fontmetrics_p.h | 6 + libs/gtkmm2/pango/pangomm/private/fontset_p.h | 44 + libs/gtkmm2/pango/pangomm/private/glyph_p.h | 6 + .../pango/pangomm/private/glyphstring_p.h | 6 + libs/gtkmm2/pango/pangomm/private/item_p.h | 6 + .../gtkmm2/pango/pangomm/private/language_p.h | 6 + libs/gtkmm2/pango/pangomm/private/layout_p.h | 44 + .../pango/pangomm/private/layoutiter_p.h | 6 + .../pango/pangomm/private/layoutline_p.h | 6 + .../pango/pangomm/private/layoutrun_p.h | 6 + .../pango/pangomm/private/rectangle_p.h | 6 + .../gtkmm2/pango/pangomm/private/renderer_p.h | 44 + .../gtkmm2/pango/pangomm/private/tabarray_p.h | 6 + libs/gtkmm2/pango/pangomm/rectangle.cc | 84 + libs/gtkmm2/pango/pangomm/rectangle.h | 163 + libs/gtkmm2/pango/pangomm/renderer.cc | 203 + libs/gtkmm2/pango/pangomm/renderer.h | 322 + libs/gtkmm2/pango/pangomm/tabarray.cc | 181 + libs/gtkmm2/pango/pangomm/tabarray.h | 195 + libs/gtkmm2/pango/pangomm/types.h | 34 + libs/gtkmm2/pango/pangomm/wrap_init.cc | 100 + libs/gtkmm2/pango/pangomm/wrap_init.h | 32 + libs/gtkmm2ext/.cvsignore | 5 + libs/gtkmm2ext/AUTHORS | 2 + libs/gtkmm2ext/COPYING | 340 + libs/gtkmm2ext/ChangeLog | 0 libs/gtkmm2ext/NEWS | 0 libs/gtkmm2ext/README | 0 libs/gtkmm2ext/SConscript | 74 + libs/gtkmm2ext/auto_spin.cc | 262 + libs/gtkmm2ext/barcontroller.cc | 497 ++ libs/gtkmm2ext/bindable_button.cc | 155 + libs/gtkmm2ext/choice.cc | 97 + libs/gtkmm2ext/click_box.cc | 125 + libs/gtkmm2ext/controller.cc | 92 + libs/gtkmm2ext/fastmeter.cc | 291 + libs/gtkmm2ext/gettext.h | 82 + libs/gtkmm2ext/gtk_ui.cc | 823 ++ libs/gtkmm2ext/gtkmm2ext-config.in | 232 + libs/gtkmm2ext/gtkmm2ext/.cvsignore | 1 + libs/gtkmm2ext/gtkmm2ext/auto_spin.h | 71 + libs/gtkmm2ext/gtkmm2ext/barcontroller.h | 113 + libs/gtkmm2ext/gtkmm2ext/bindable_button.h | 77 + libs/gtkmm2ext/gtkmm2ext/choice.h | 44 + libs/gtkmm2ext/gtkmm2ext/click_box.h | 61 + libs/gtkmm2ext/gtkmm2ext/controller.h | 59 + libs/gtkmm2ext/gtkmm2ext/doi.h | 37 + libs/gtkmm2ext/gtkmm2ext/fastmeter.h | 85 + libs/gtkmm2ext/gtkmm2ext/gtk_ui.h | 219 + libs/gtkmm2ext/gtkmm2ext/gtkutils.h | 30 + libs/gtkmm2ext/gtkmm2ext/hexentry.h | 59 + libs/gtkmm2ext/gtkmm2ext/idle_adjustment.h | 26 + libs/gtkmm2ext/gtkmm2ext/pix.h | 87 + libs/gtkmm2ext/gtkmm2ext/pixscroller.h | 47 + libs/gtkmm2ext/gtkmm2ext/popup.h | 57 + libs/gtkmm2ext/gtkmm2ext/prompter.h | 86 + libs/gtkmm2ext/gtkmm2ext/selector.h | 103 + libs/gtkmm2ext/gtkmm2ext/slider_controller.h | 98 + libs/gtkmm2ext/gtkmm2ext/stop_signal.h | 14 + libs/gtkmm2ext/gtkmm2ext/tearoff.h | 63 + libs/gtkmm2ext/gtkmm2ext/textviewer.h | 58 + libs/gtkmm2ext/gtkmm2ext/utils.h | 41 + libs/gtkmm2ext/gtkutils.cc | 41 + libs/gtkmm2ext/hexentry.cc | 111 + libs/gtkmm2ext/i18n.h | 11 + libs/gtkmm2ext/idle_adjustment.cc | 54 + libs/gtkmm2ext/libgtkmm2ext.pc.in | 11 + libs/gtkmm2ext/libgtkmm2ext.spec.in | 68 + libs/gtkmm2ext/pix.cc | 231 + libs/gtkmm2ext/pixscroller.cc | 248 + libs/gtkmm2ext/po/el_GR.po | 79 + libs/gtkmm2ext/po/es_ES.po | 78 + libs/gtkmm2ext/po/pt_BR.po | 79 + libs/gtkmm2ext/po/ru_RU.po | 78 + libs/gtkmm2ext/popup.cc | 134 + libs/gtkmm2ext/prompter.cc | 118 + libs/gtkmm2ext/selector.cc | 238 + libs/gtkmm2ext/slider_controller.cc | 183 + libs/gtkmm2ext/tearoff.cc | 164 + libs/gtkmm2ext/textviewer.cc | 127 + libs/gtkmm2ext/utils.cc | 47 + libs/libgnomecanvasmm/.DS_Store | Bin 0 -> 6148 bytes libs/libgnomecanvasmm/AUTHORS | 40 + libs/libgnomecanvasmm/COPYING | 515 ++ libs/libgnomecanvasmm/ChangeLog | 556 ++ libs/libgnomecanvasmm/NEWS | 54 + libs/libgnomecanvasmm/README | 1 + libs/libgnomecanvasmm/SConscript | 10 + libs/libgnomecanvasmm/TODO | 8 + libs/libgnomecanvasmm/libgnomecanvasmm.h | 45 + .../libgnomecanvasmm/.DS_Store | Bin 0 -> 15364 bytes .../libgnomecanvasmm/affinetrans.cc | 234 + .../libgnomecanvasmm/affinetrans.h | 119 + .../libgnomecanvasmm/bpath.cc | 156 + .../libgnomecanvasmm/libgnomecanvasmm/bpath.h | 148 + .../libgnomecanvasmm/canvas.cc | 533 ++ .../libgnomecanvasmm/canvas.h | 443 ++ .../libgnomecanvasmm/ellipse.cc | 147 + .../libgnomecanvasmm/ellipse.h | 130 + .../libgnomecanvasmm/group.cc | 170 + .../libgnomecanvasmm/libgnomecanvasmm/group.h | 164 + .../libgnomecanvasmm/libgnomecanvasmm/init.cc | 37 + libs/libgnomecanvasmm/libgnomecanvasmm/init.h | 37 + .../libgnomecanvasmm/libgnomecanvasmm/item.cc | 908 +++ libs/libgnomecanvasmm/libgnomecanvasmm/item.h | 370 + .../libgnomecanvasmm/libgnomecanvasmm/line.cc | 388 + libs/libgnomecanvasmm/libgnomecanvasmm/line.h | 461 ++ .../libgnomecanvasmm/path-def.cc | 249 + .../libgnomecanvasmm/path-def.h | 284 + .../libgnomecanvasmm/pixbuf.cc | 277 + .../libgnomecanvasmm/pixbuf.h | 321 + .../libgnomecanvasmm/point.cc | 117 + .../libgnomecanvasmm/libgnomecanvasmm/point.h | 74 + .../libgnomecanvasmm/polygon.cc | 156 + .../libgnomecanvasmm/polygon.h | 144 + .../libgnomecanvasmm/private/bpath_p.h | 49 + .../libgnomecanvasmm/private/canvas_p.h | 52 + .../libgnomecanvasmm/private/ellipse_p.h | 49 + .../libgnomecanvasmm/private/group_p.h | 49 + .../libgnomecanvasmm/private/item_p.h | 60 + .../libgnomecanvasmm/private/line_p.h | 49 + .../libgnomecanvasmm/private/path-def_p.h | 6 + .../libgnomecanvasmm/private/pixbuf_p.h | 49 + .../libgnomecanvasmm/private/polygon_p.h | 49 + .../libgnomecanvasmm/private/rect-ellipse_p.h | 49 + .../libgnomecanvasmm/private/rect_p.h | 49 + .../libgnomecanvasmm/private/rich-text_p.h | 50 + .../libgnomecanvasmm/private/shape_p.h | 49 + .../libgnomecanvasmm/private/text_p.h | 49 + .../libgnomecanvasmm/private/widget_p.h | 49 + .../libgnomecanvasmm/properties.cc | 238 + .../libgnomecanvasmm/properties.h | 248 + .../libgnomecanvasmm/rect-ellipse.cc | 180 + .../libgnomecanvasmm/rect-ellipse.h | 196 + .../libgnomecanvasmm/libgnomecanvasmm/rect.cc | 146 + libs/libgnomecanvasmm/libgnomecanvasmm/rect.h | 132 + .../libgnomecanvasmm/rich-text.cc | 475 ++ .../libgnomecanvasmm/rich-text.h | 472 ++ .../libgnomecanvasmm/shape.cc | 272 + .../libgnomecanvasmm/libgnomecanvasmm/shape.h | 368 + .../libgnomecanvasmm/libgnomecanvasmm/text.cc | 557 ++ libs/libgnomecanvasmm/libgnomecanvasmm/text.h | 788 ++ .../libgnomecanvasmm/widget.cc | 220 + .../libgnomecanvasmm/widget.h | 244 + .../libgnomecanvasmm/wrap_init.cc | 116 + .../libgnomecanvasmm/wrap_init.h | 36 + .../libgnomecanvasmm/libgnomecanvasmmconfig.h | 11 + libs/midi++2/.cvsignore | 3 + libs/midi++2/AUTHORS | 0 libs/midi++2/COPYING | 340 + libs/midi++2/ChangeLog | 9 + libs/midi++2/NEWS | 0 libs/midi++2/README | 0 libs/midi++2/SConscript | 48 + libs/midi++2/alsa_sequencer_midiport.cc | 156 + libs/midi++2/coremidi_midiport.cc | 144 + libs/midi++2/fd_midiport.cc | 181 + libs/midi++2/fifomidi.cc | 44 + libs/midi++2/libmidi++.pc.in | 11 + libs/midi++2/libmidi++.spec.in | 71 + libs/midi++2/midi++/.DS_Store | Bin 0 -> 6148 bytes libs/midi++2/midi++/.cvsignore | 1 + libs/midi++2/midi++/alsa_rawmidi.h | 43 + libs/midi++2/midi++/alsa_sequencer.h | 63 + libs/midi++2/midi++/channel.h | 161 + libs/midi++2/midi++/controllable.h | 92 + libs/midi++2/midi++/coremidi_midiport.h | 67 + libs/midi++2/midi++/factory.h | 40 + libs/midi++2/midi++/fd_midiport.h | 94 + libs/midi++2/midi++/fifomidi.h | 47 + libs/midi++2/midi++/manager.h | 88 + libs/midi++2/midi++/mmc.h | 261 + libs/midi++2/midi++/nullmidi.h | 62 + libs/midi++2/midi++/parser.h | 189 + libs/midi++2/midi++/port.h | 147 + libs/midi++2/midi++/port_request.h | 60 + libs/midi++2/midi++/types.h | 69 + libs/midi++2/midi.cc | 170 + libs/midi++2/midichannel.cc | 304 + libs/midi++2/midicontrollable.cc | 325 + libs/midi++2/midifactory.cc | 95 + libs/midi++2/midimanager.cc | 374 + libs/midi++2/midiparser.cc | 800 ++ libs/midi++2/midiport.cc | 131 + libs/midi++2/miditrace.cc | 64 + libs/midi++2/mmc.cc | 577 ++ libs/midi++2/mmctest.cc | 112 + libs/midi++2/mtc.cc | 329 + libs/midi++2/port_request.cc | 80 + libs/pbd3/.cvsignore | 3 + libs/pbd3/AUTHORS | 0 libs/pbd3/COPYING | 340 + libs/pbd3/ChangeLog | 6 + libs/pbd3/NEWS | 0 libs/pbd3/README | 0 libs/pbd3/SConscript | 44 + libs/pbd3/basename.cc | 47 + libs/pbd3/dirname.cc | 51 + libs/pbd3/dmalloc.cc | 102 + libs/pbd3/ftw.cc | 220 + libs/pbd3/libpbd.pc.in | 11 + libs/pbd3/libpbd.spec.in | 70 + libs/pbd3/mountpoint.cc | 113 + libs/pbd3/pathscanner.cc | 201 + libs/pbd3/pbd-config.in | 232 + libs/pbd3/pbd/.DS_Store | Bin 0 -> 6148 bytes libs/pbd3/pbd/.cvsignore | 1 + libs/pbd3/pbd/abstract_ui.h | 67 + libs/pbd3/pbd/atomic.h | 1232 +++ libs/pbd3/pbd/basename.h | 15 + libs/pbd3/pbd/compose.h | 393 + libs/pbd3/pbd/datum.h | 57 + libs/pbd3/pbd/dirname.h | 11 + libs/pbd3/pbd/ellipsoid.h | 74 + libs/pbd3/pbd/error.h | 30 + libs/pbd3/pbd/failed_constructor.h | 11 + libs/pbd3/pbd/fastlog.h | 38 + libs/pbd3/pbd/foreach.h | 42 + libs/pbd3/pbd/forkexec.h | 9 + libs/pbd3/pbd/ftw.h | 106 + libs/pbd3/pbd/irix_platform.h | 20 + libs/pbd3/pbd/linux_platform.h | 41 + libs/pbd3/pbd/lock_free_fifo.h | 86 + libs/pbd3/pbd/lockmonitor.h | 194 + libs/pbd3/pbd/mountpoint.h | 28 + libs/pbd3/pbd/pathscanner.h | 66 + libs/pbd3/pbd/platform.h | 45 + libs/pbd3/pbd/platform_factory.h | 12 + libs/pbd3/pbd/pool.h | 74 + libs/pbd3/pbd/position.h | 38 + libs/pbd3/pbd/precision_timer.h | 61 + libs/pbd3/pbd/pthread_spinlock.h | 29 + libs/pbd3/pbd/pthread_utils.h | 21 + libs/pbd3/pbd/rcpointer.h | 61 + libs/pbd3/pbd/receiver.h | 50 + libs/pbd3/pbd/relation.h | 35 + libs/pbd3/pbd/restartable_rw.h | 7 + libs/pbd3/pbd/ringbuffer.h | 283 + libs/pbd3/pbd/ringbufferNPT.h | 272 + libs/pbd3/pbd/rt.h | 25 + libs/pbd3/pbd/rtthread.h | 30 + libs/pbd3/pbd/scale.h | 53 + libs/pbd3/pbd/selectable.h | 102 + libs/pbd3/pbd/solaris_platform.h | 41 + libs/pbd3/pbd/stl_delete.h | 89 + libs/pbd3/pbd/stl_functors.h | 93 + libs/pbd3/pbd/strsplit.h | 9 + libs/pbd3/pbd/strsub.h | 25 + libs/pbd3/pbd/textreceiver.h | 44 + libs/pbd3/pbd/thread.h | 127 + libs/pbd3/pbd/thrown_error.h | 39 + libs/pbd3/pbd/touchable.h | 89 + libs/pbd3/pbd/transmitter.h | 109 + libs/pbd3/pbd/types.h | 32 + libs/pbd3/pbd/undo.h | 96 + libs/pbd3/pbd/unescape.h | 6 + libs/pbd3/pbd/xml++.h | 127 + libs/pbd3/pool.cc | 135 + libs/pbd3/pthread_utils.cc | 133 + libs/pbd3/receiver.cc | 58 + libs/pbd3/strsplit.cc | 41 + libs/pbd3/textreceiver.cc | 66 + libs/pbd3/transmitter.cc | 115 + libs/pbd3/undo.cc | 144 + libs/pbd3/unescape.cc | 137 + libs/pbd3/xml++.cc | 416 + libs/sigc++2/.cvsignore | 18 + libs/sigc++2/AUTHORS | 8 + libs/sigc++2/COPYING | 515 ++ libs/sigc++2/ChangeLog | 1249 +++ libs/sigc++2/INSTALL | 229 + libs/sigc++2/Makefile.am | 30 + libs/sigc++2/NEWS | 232 + libs/sigc++2/README | 72 + libs/sigc++2/SConscript | 13 + libs/sigc++2/TODO | 66 + libs/sigc++2/autogen.sh | 18 + libs/sigc++2/configure.ac | 64 + libs/sigc++2/libsigc++-2.0.spec.in | 91 + libs/sigc++2/scripts/cxx.m4 | 94 + libs/sigc++2/scripts/libtool.m4 | 5767 ++++++++++++++ libs/sigc++2/scripts/ltoptions.m4 | 358 + libs/sigc++2/scripts/ltsugar.m4 | 115 + libs/sigc++2/scripts/ltversion.m4 | 15 + libs/sigc++2/sigc++-2.0.pc.in | 10 + libs/sigc++2/sigc++/.cvsignore | 3 + libs/sigc++2/sigc++/Makefile.am | 96 + libs/sigc++2/sigc++/adaptors/adaptor_trait.h | 362 + libs/sigc++2/sigc++/adaptors/adaptors.h | 32 + libs/sigc++2/sigc++/adaptors/bind.h | 2262 ++++++ libs/sigc++2/sigc++/adaptors/bind_return.h | 204 + libs/sigc++2/sigc++/adaptors/compose.h | 294 + .../sigc++/adaptors/deduce_result_type.h | 121 + .../sigc++2/sigc++/adaptors/exception_catch.h | 319 + libs/sigc++2/sigc++/adaptors/hide.h | 1063 +++ libs/sigc++2/sigc++/adaptors/lambda/base.h | 392 + libs/sigc++2/sigc++/adaptors/lambda/group.h | 734 ++ libs/sigc++2/sigc++/adaptors/lambda/lambda.cc | 15 + libs/sigc++2/sigc++/adaptors/lambda/lambda.h | 28 + .../sigc++2/sigc++/adaptors/lambda/operator.h | 1697 ++++ libs/sigc++2/sigc++/adaptors/lambda/select.h | 346 + libs/sigc++2/sigc++/adaptors/retype.h | 1247 +++ libs/sigc++2/sigc++/adaptors/retype_return.h | 308 + libs/sigc++2/sigc++/bind.h | 65 + libs/sigc++2/sigc++/bind_return.h | 34 + libs/sigc++2/sigc++/class_slot.h | 568 ++ libs/sigc++2/sigc++/compatibility.h | 42 + libs/sigc++2/sigc++/connection.cc | 111 + libs/sigc++2/sigc++/connection.h | 154 + libs/sigc++2/sigc++/functors/functor_trait.h | 307 + libs/sigc++2/sigc++/functors/functors.h | 27 + libs/sigc++2/sigc++/functors/mem_fun.h | 5976 ++++++++++++++ libs/sigc++2/sigc++/functors/ptr_fun.h | 542 ++ libs/sigc++2/sigc++/functors/slot.cc | 25 + libs/sigc++2/sigc++/functors/slot.h | 1263 +++ libs/sigc++2/sigc++/functors/slot_base.cc | 165 + libs/sigc++2/sigc++/functors/slot_base.h | 319 + libs/sigc++2/sigc++/hide.h | 105 + libs/sigc++2/sigc++/method_slot.h | 387 + libs/sigc++2/sigc++/object.h | 35 + libs/sigc++2/sigc++/object_slot.h | 536 ++ libs/sigc++2/sigc++/reference_wrapper.h | 118 + libs/sigc++2/sigc++/retype.h | 321 + libs/sigc++2/sigc++/retype_return.h | 35 + libs/sigc++2/sigc++/sigc++.h | 30 + libs/sigc++2/sigc++/signal.cc | 25 + libs/sigc++2/sigc++/signal.h | 3188 ++++++++ libs/sigc++2/sigc++/signal_base.cc | 151 + libs/sigc++2/sigc++/signal_base.h | 261 + libs/sigc++2/sigc++/slot.h | 614 ++ libs/sigc++2/sigc++/trackable.cc | 124 + libs/sigc++2/sigc++/trackable.h | 148 + libs/sigc++2/sigc++/type_traits.h | 121 + libs/sigc++2/sigc++/visit_each.h | 128 + libs/sigc++2/sigc++config.h.in | 10 + templates/.cvsignore | 2 + templates/16 Tracks.template | 260 + templates/2 Track.template | 92 + templates/32 Tracks.template | 356 + templates/4 Tracks.template | 116 + templates/8 Tracks.template | 164 + templates/SConscript | 9 + tools/.cvsignore | 3 + tools/bug_tool/.cvsignore | 3 + tools/bug_tool/ClientCookie/.cvsignore | 3 + tools/bug_tool/ClientCookie/_ClientCookie.py | 1833 +++++ tools/bug_tool/ClientCookie/_Debug.py | 9 + tools/bug_tool/ClientCookie/_HeadersUtil.py | 224 + tools/bug_tool/ClientCookie/_MSIECookieJar.py | 377 + .../ClientCookie/_MozillaCookieJar.py | 171 + tools/bug_tool/ClientCookie/_Util.py | 459 ++ tools/bug_tool/ClientCookie/__init__.py | 49 + .../bug_tool/ClientCookie/_urllib2_support.py | 713 ++ tools/bug_tool/ClientForm.py | 2699 +++++++ tools/bug_tool/ardour_bugs | 349 + tools/config.guess | 1409 ++++ tools/jacktest.c | 205 + 1253 files changed, 292928 insertions(+) create mode 100644 .cvsignore create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 DOCUMENTATION/.cvsignore create mode 100644 DOCUMENTATION/AUTHORS create mode 100644 DOCUMENTATION/AUTHORS.es create mode 100644 DOCUMENTATION/BUILD create mode 100644 DOCUMENTATION/BUILD.ru create mode 100644 DOCUMENTATION/CONTRIBUTORS create mode 100644 DOCUMENTATION/CONTRIBUTORS.es create mode 100644 DOCUMENTATION/FAQ create mode 100644 DOCUMENTATION/README create mode 100644 DOCUMENTATION/README.es create mode 100644 DOCUMENTATION/README.fr create mode 100644 DOCUMENTATION/README.it create mode 100644 DOCUMENTATION/README.ru create mode 100644 DOCUMENTATION/TODO create mode 100644 DOCUMENTATION/TRANSLATORS create mode 100644 DOCUMENTATION/ardour.1 create mode 100644 DOCUMENTATION/ardour.1.es create mode 100644 DOCUMENTATION/ardour.1.fr create mode 100644 DOCUMENTATION/ardour.1.ru create mode 100644 PACKAGER_README create mode 100644 README create mode 100644 ReleaseNotes-0.9betaX create mode 100644 SConstruct create mode 100644 ardour.rc.in create mode 100644 ardour_system.rc create mode 100644 libs/.cvsignore create mode 100644 libs/cassowary/.cvsignore create mode 100644 libs/cassowary/ANNOUNCE create mode 100644 libs/cassowary/AUTHORS create mode 100644 libs/cassowary/COPYING create mode 100644 libs/cassowary/COPYING.LGPL create mode 100644 libs/cassowary/ChangeLog create mode 100644 libs/cassowary/ClAbstractVariable.cc create mode 100644 libs/cassowary/ClBug0.cc create mode 100644 libs/cassowary/ClBug1.cc create mode 100644 libs/cassowary/ClBug2.cc create mode 100644 libs/cassowary/ClConstraint.cc create mode 100644 libs/cassowary/ClDummyVariable.cc create mode 100644 libs/cassowary/ClFDBinaryOneWayConstraint.cc create mode 100644 libs/cassowary/ClFDConnectorVariable.cc create mode 100644 libs/cassowary/ClFDSolver.cc create mode 100644 libs/cassowary/ClFDVariable.cc create mode 100644 libs/cassowary/ClFloatVariable.cc create mode 100644 libs/cassowary/ClLinearExpression.cc create mode 100644 libs/cassowary/ClReader.l create mode 100644 libs/cassowary/ClReader.y create mode 100644 libs/cassowary/ClSimplexSolver.cc create mode 100644 libs/cassowary/ClSlackVariable.cc create mode 100644 libs/cassowary/ClSolver.cc create mode 100644 libs/cassowary/ClStrength.cc create mode 100644 libs/cassowary/ClSymbolicWeight.cc create mode 100644 libs/cassowary/ClTableau.cc create mode 100644 libs/cassowary/ClTests.cc create mode 100644 libs/cassowary/ClVariable.cc create mode 100644 libs/cassowary/IMPORTANT create mode 100644 libs/cassowary/INSTALL create mode 100644 libs/cassowary/LICENSE create mode 100644 libs/cassowary/Makefile.am create mode 100644 libs/cassowary/NEWS create mode 100644 libs/cassowary/README create mode 100644 libs/cassowary/THANKS create mode 100644 libs/cassowary/autogen.sh create mode 100755 libs/cassowary/cassowary-config create mode 100755 libs/cassowary/cassowary-config.in create mode 100644 libs/cassowary/cassowary-nofd.spec2 create mode 100644 libs/cassowary/cassowary-nofd.spec2.in create mode 100644 libs/cassowary/cassowary.spec create mode 100644 libs/cassowary/cassowary.spec.in create mode 100644 libs/cassowary/cassowary/.cvsignore create mode 100644 libs/cassowary/cassowary/Cassowary.h create mode 100644 libs/cassowary/cassowary/Cl.h create mode 100644 libs/cassowary/cassowary/ClAbstractVariable.h create mode 100644 libs/cassowary/cassowary/ClConstraint.h create mode 100644 libs/cassowary/cassowary/ClConstraintHash.h create mode 100644 libs/cassowary/cassowary/ClDummyVariable.h create mode 100644 libs/cassowary/cassowary/ClEditConstraint.h create mode 100644 libs/cassowary/cassowary/ClEditOrStayConstraint.h create mode 100644 libs/cassowary/cassowary/ClErrors.h create mode 100644 libs/cassowary/cassowary/ClFDBinaryOneWayConstraint.h create mode 100644 libs/cassowary/cassowary/ClFDConnectorVariable.h create mode 100644 libs/cassowary/cassowary/ClFDConstraint.h create mode 100644 libs/cassowary/cassowary/ClFDSolver.h create mode 100644 libs/cassowary/cassowary/ClFDVariable.h create mode 100644 libs/cassowary/cassowary/ClFloatVariable.h create mode 100644 libs/cassowary/cassowary/ClLinearConstraint.h create mode 100644 libs/cassowary/cassowary/ClLinearEquation.h create mode 100644 libs/cassowary/cassowary/ClLinearExpression.h create mode 100644 libs/cassowary/cassowary/ClLinearExpression_fwd.h create mode 100644 libs/cassowary/cassowary/ClLinearInequality.h create mode 100644 libs/cassowary/cassowary/ClObjectiveVariable.h create mode 100644 libs/cassowary/cassowary/ClPoint.h create mode 100644 libs/cassowary/cassowary/ClReader.h create mode 100644 libs/cassowary/cassowary/ClSimplexSolver.h create mode 100644 libs/cassowary/cassowary/ClSlackVariable.h create mode 100644 libs/cassowary/cassowary/ClSolver.h create mode 100644 libs/cassowary/cassowary/ClStayConstraint.h create mode 100644 libs/cassowary/cassowary/ClStrength.h create mode 100644 libs/cassowary/cassowary/ClSymbolicWeight.h create mode 100644 libs/cassowary/cassowary/ClTableau.h create mode 100644 libs/cassowary/cassowary/ClTypedefs.h create mode 100644 libs/cassowary/cassowary/ClVariable.h create mode 100644 libs/cassowary/cassowary/Makefile.am create mode 100644 libs/cassowary/cassowary/cl_auto_ptr.h create mode 100644 libs/cassowary/cassowary/config-inline.h create mode 100644 libs/cassowary/cassowary/debug.h create mode 100644 libs/cassowary/cassowary/timer.h create mode 100644 libs/cassowary/configure.ac create mode 100644 libs/glibmm2/.cvsignore create mode 100644 libs/glibmm2/AUTHORS create mode 100644 libs/glibmm2/CHANGES create mode 100644 libs/glibmm2/COPYING create mode 100644 libs/glibmm2/ChangeLog create mode 100644 libs/glibmm2/INSTALL create mode 100644 libs/glibmm2/Makefile.am create mode 100644 libs/glibmm2/NEWS create mode 100644 libs/glibmm2/README create mode 100644 libs/glibmm2/SConscript create mode 100755 libs/glibmm2/autogen.sh create mode 100644 libs/glibmm2/configure.ac create mode 100644 libs/glibmm2/glibmm-2.4.pc.in create mode 100644 libs/glibmm2/glibmm.h create mode 100644 libs/glibmm2/glibmm/.cvsignore create mode 100644 libs/glibmm2/glibmm/Makefile.am create mode 100644 libs/glibmm2/glibmm/arrayhandle.h create mode 100644 libs/glibmm2/glibmm/class.cc create mode 100644 libs/glibmm2/glibmm/class.h create mode 100644 libs/glibmm2/glibmm/containerhandle_shared.h create mode 100644 libs/glibmm2/glibmm/containers.cc create mode 100644 libs/glibmm2/glibmm/containers.h create mode 100644 libs/glibmm2/glibmm/convert.cc create mode 100644 libs/glibmm2/glibmm/convert.h create mode 100644 libs/glibmm2/glibmm/date.cc create mode 100644 libs/glibmm2/glibmm/date.h create mode 100644 libs/glibmm2/glibmm/debug.cc create mode 100644 libs/glibmm2/glibmm/debug.h create mode 100644 libs/glibmm2/glibmm/dispatcher.cc create mode 100644 libs/glibmm2/glibmm/dispatcher.h create mode 100644 libs/glibmm2/glibmm/error.cc create mode 100644 libs/glibmm2/glibmm/error.h create mode 100644 libs/glibmm2/glibmm/exception.cc create mode 100644 libs/glibmm2/glibmm/exception.h create mode 100644 libs/glibmm2/glibmm/exceptionhandler.cc create mode 100644 libs/glibmm2/glibmm/exceptionhandler.h create mode 100644 libs/glibmm2/glibmm/fileutils.cc create mode 100644 libs/glibmm2/glibmm/fileutils.h create mode 100644 libs/glibmm2/glibmm/helperlist.h create mode 100644 libs/glibmm2/glibmm/i18n.h create mode 100644 libs/glibmm2/glibmm/init.cc create mode 100644 libs/glibmm2/glibmm/init.h create mode 100644 libs/glibmm2/glibmm/interface.cc create mode 100644 libs/glibmm2/glibmm/interface.h create mode 100644 libs/glibmm2/glibmm/iochannel.cc create mode 100644 libs/glibmm2/glibmm/iochannel.h create mode 100644 libs/glibmm2/glibmm/listhandle.h create mode 100644 libs/glibmm2/glibmm/main.cc create mode 100644 libs/glibmm2/glibmm/main.h create mode 100644 libs/glibmm2/glibmm/markup.cc create mode 100644 libs/glibmm2/glibmm/markup.h create mode 100644 libs/glibmm2/glibmm/miscutils.cc create mode 100644 libs/glibmm2/glibmm/miscutils.h create mode 100644 libs/glibmm2/glibmm/module.cc create mode 100644 libs/glibmm2/glibmm/module.h create mode 100644 libs/glibmm2/glibmm/object.cc create mode 100644 libs/glibmm2/glibmm/object.h create mode 100644 libs/glibmm2/glibmm/objectbase.cc create mode 100644 libs/glibmm2/glibmm/objectbase.h create mode 100644 libs/glibmm2/glibmm/optioncontext.cc create mode 100644 libs/glibmm2/glibmm/optioncontext.h create mode 100644 libs/glibmm2/glibmm/optionentry.cc create mode 100644 libs/glibmm2/glibmm/optionentry.h create mode 100644 libs/glibmm2/glibmm/optiongroup.cc create mode 100644 libs/glibmm2/glibmm/optiongroup.h create mode 100644 libs/glibmm2/glibmm/pattern.cc create mode 100644 libs/glibmm2/glibmm/pattern.h create mode 100644 libs/glibmm2/glibmm/private/convert_p.h create mode 100644 libs/glibmm2/glibmm/private/date_p.h create mode 100644 libs/glibmm2/glibmm/private/fileutils_p.h create mode 100644 libs/glibmm2/glibmm/private/interface_p.h create mode 100644 libs/glibmm2/glibmm/private/iochannel_p.h create mode 100644 libs/glibmm2/glibmm/private/markup_p.h create mode 100644 libs/glibmm2/glibmm/private/module_p.h create mode 100644 libs/glibmm2/glibmm/private/object_p.h create mode 100644 libs/glibmm2/glibmm/private/optioncontext_p.h create mode 100644 libs/glibmm2/glibmm/private/optionentry_p.h create mode 100644 libs/glibmm2/glibmm/private/optiongroup_p.h create mode 100644 libs/glibmm2/glibmm/private/shell_p.h create mode 100644 libs/glibmm2/glibmm/private/spawn_p.h create mode 100644 libs/glibmm2/glibmm/private/thread_p.h create mode 100644 libs/glibmm2/glibmm/private/unicode_p.h create mode 100644 libs/glibmm2/glibmm/property.cc create mode 100644 libs/glibmm2/glibmm/property.h create mode 100644 libs/glibmm2/glibmm/propertyproxy.cc create mode 100644 libs/glibmm2/glibmm/propertyproxy.h create mode 100644 libs/glibmm2/glibmm/propertyproxy_base.cc create mode 100644 libs/glibmm2/glibmm/propertyproxy_base.h create mode 100644 libs/glibmm2/glibmm/quark.cc create mode 100644 libs/glibmm2/glibmm/quark.h create mode 100644 libs/glibmm2/glibmm/random.cc create mode 100644 libs/glibmm2/glibmm/random.h create mode 100644 libs/glibmm2/glibmm/refptr.h create mode 100644 libs/glibmm2/glibmm/sarray.h create mode 100644 libs/glibmm2/glibmm/shell.cc create mode 100644 libs/glibmm2/glibmm/shell.h create mode 100644 libs/glibmm2/glibmm/signalproxy.cc create mode 100644 libs/glibmm2/glibmm/signalproxy.h create mode 100644 libs/glibmm2/glibmm/signalproxy_connectionnode.cc create mode 100644 libs/glibmm2/glibmm/signalproxy_connectionnode.h create mode 100644 libs/glibmm2/glibmm/slisthandle.h create mode 100644 libs/glibmm2/glibmm/spawn.cc create mode 100644 libs/glibmm2/glibmm/spawn.h create mode 100644 libs/glibmm2/glibmm/streamiochannel.cc create mode 100644 libs/glibmm2/glibmm/streamiochannel.h create mode 100644 libs/glibmm2/glibmm/stringutils.cc create mode 100644 libs/glibmm2/glibmm/stringutils.h create mode 100644 libs/glibmm2/glibmm/thread.cc create mode 100644 libs/glibmm2/glibmm/thread.h create mode 100644 libs/glibmm2/glibmm/threadpool.cc create mode 100644 libs/glibmm2/glibmm/threadpool.h create mode 100644 libs/glibmm2/glibmm/timer.cc create mode 100644 libs/glibmm2/glibmm/timer.h create mode 100644 libs/glibmm2/glibmm/timeval.cc create mode 100644 libs/glibmm2/glibmm/timeval.h create mode 100644 libs/glibmm2/glibmm/unicode.cc create mode 100644 libs/glibmm2/glibmm/unicode.h create mode 100644 libs/glibmm2/glibmm/ustring.cc create mode 100644 libs/glibmm2/glibmm/ustring.h create mode 100644 libs/glibmm2/glibmm/utility.cc create mode 100644 libs/glibmm2/glibmm/utility.h create mode 100644 libs/glibmm2/glibmm/value.cc create mode 100644 libs/glibmm2/glibmm/value.h create mode 100644 libs/glibmm2/glibmm/value_basictypes.cc create mode 100644 libs/glibmm2/glibmm/value_basictypes.h create mode 100644 libs/glibmm2/glibmm/value_custom.cc create mode 100644 libs/glibmm2/glibmm/value_custom.h create mode 100644 libs/glibmm2/glibmm/wrap.cc create mode 100644 libs/glibmm2/glibmm/wrap.h create mode 100644 libs/glibmm2/glibmm/wrap_init.cc create mode 100644 libs/glibmm2/glibmm/wrap_init.h create mode 100644 libs/glibmm2/glibmmconfig.h.in create mode 100644 libs/glibmm2/scripts/.cvsignore create mode 100644 libs/glibmm2/scripts/cxx.m4 create mode 100644 libs/glibmm2/scripts/cxx_std.m4 create mode 100644 libs/glibmm2/scripts/macros.m4 create mode 100644 libs/gtkmm2/AUTHORS create mode 100644 libs/gtkmm2/CHANGES create mode 100644 libs/gtkmm2/COPYING create mode 100644 libs/gtkmm2/ChangeLog create mode 100644 libs/gtkmm2/atk/SConscript create mode 100644 libs/gtkmm2/atk/atkmm.h create mode 100644 libs/gtkmm2/atk/atkmm/action.cc create mode 100644 libs/gtkmm2/atk/atkmm/action.h create mode 100644 libs/gtkmm2/atk/atkmm/component.cc create mode 100644 libs/gtkmm2/atk/atkmm/component.h create mode 100644 libs/gtkmm2/atk/atkmm/document.cc create mode 100644 libs/gtkmm2/atk/atkmm/document.h create mode 100644 libs/gtkmm2/atk/atkmm/editabletext.cc create mode 100644 libs/gtkmm2/atk/atkmm/editabletext.h create mode 100644 libs/gtkmm2/atk/atkmm/hyperlink.cc create mode 100644 libs/gtkmm2/atk/atkmm/hyperlink.h create mode 100644 libs/gtkmm2/atk/atkmm/hypertext.cc create mode 100644 libs/gtkmm2/atk/atkmm/hypertext.h create mode 100644 libs/gtkmm2/atk/atkmm/image.cc create mode 100644 libs/gtkmm2/atk/atkmm/image.h create mode 100644 libs/gtkmm2/atk/atkmm/implementor.cc create mode 100644 libs/gtkmm2/atk/atkmm/implementor.h create mode 100644 libs/gtkmm2/atk/atkmm/init.cc create mode 100644 libs/gtkmm2/atk/atkmm/init.h create mode 100644 libs/gtkmm2/atk/atkmm/noopobject.cc create mode 100644 libs/gtkmm2/atk/atkmm/noopobject.h create mode 100644 libs/gtkmm2/atk/atkmm/object.cc create mode 100644 libs/gtkmm2/atk/atkmm/object.h create mode 100644 libs/gtkmm2/atk/atkmm/objectaccessible.cc create mode 100644 libs/gtkmm2/atk/atkmm/objectaccessible.h create mode 100644 libs/gtkmm2/atk/atkmm/private/action_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/component_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/document_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/editabletext_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/hyperlink_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/hypertext_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/image_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/implementor_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/noopobject_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/object_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/objectaccessible_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/relation_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/relationset_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/selection_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/stateset_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/streamablecontent_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/table_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/text_p.h create mode 100644 libs/gtkmm2/atk/atkmm/private/value_p.h create mode 100644 libs/gtkmm2/atk/atkmm/relation.cc create mode 100644 libs/gtkmm2/atk/atkmm/relation.h create mode 100644 libs/gtkmm2/atk/atkmm/relationset.cc create mode 100644 libs/gtkmm2/atk/atkmm/relationset.h create mode 100644 libs/gtkmm2/atk/atkmm/selection.cc create mode 100644 libs/gtkmm2/atk/atkmm/selection.h create mode 100644 libs/gtkmm2/atk/atkmm/stateset.cc create mode 100644 libs/gtkmm2/atk/atkmm/stateset.h create mode 100644 libs/gtkmm2/atk/atkmm/streamablecontent.cc create mode 100644 libs/gtkmm2/atk/atkmm/streamablecontent.h create mode 100644 libs/gtkmm2/atk/atkmm/table.cc create mode 100644 libs/gtkmm2/atk/atkmm/table.h create mode 100644 libs/gtkmm2/atk/atkmm/text.cc create mode 100644 libs/gtkmm2/atk/atkmm/text.h create mode 100644 libs/gtkmm2/atk/atkmm/value.cc create mode 100644 libs/gtkmm2/atk/atkmm/value.h create mode 100644 libs/gtkmm2/atk/atkmm/wrap_init.cc create mode 100644 libs/gtkmm2/atk/atkmm/wrap_init.h create mode 100644 libs/gtkmm2/gdk/.DS_Store create mode 100644 libs/gtkmm2/gdk/SConscript create mode 100644 libs/gtkmm2/gdk/gdkmm.h create mode 100644 libs/gtkmm2/gdk/gdkmm/bitmap.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/bitmap.h create mode 100644 libs/gtkmm2/gdk/gdkmm/color.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/color.h create mode 100644 libs/gtkmm2/gdk/gdkmm/colormap.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/colormap.h create mode 100644 libs/gtkmm2/gdk/gdkmm/cursor.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/cursor.h create mode 100644 libs/gtkmm2/gdk/gdkmm/device.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/device.h create mode 100644 libs/gtkmm2/gdk/gdkmm/display.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/display.h create mode 100644 libs/gtkmm2/gdk/gdkmm/displaymanager.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/displaymanager.h create mode 100644 libs/gtkmm2/gdk/gdkmm/dragcontext.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/dragcontext.h create mode 100644 libs/gtkmm2/gdk/gdkmm/drawable.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/drawable.h create mode 100644 libs/gtkmm2/gdk/gdkmm/event.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/event.h create mode 100644 libs/gtkmm2/gdk/gdkmm/gc.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/gc.h create mode 100644 libs/gtkmm2/gdk/gdkmm/general.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/general.h create mode 100644 libs/gtkmm2/gdk/gdkmm/image.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/image.h create mode 100644 libs/gtkmm2/gdk/gdkmm/list.h create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbuf.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbuf.h create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufanimation.h create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufformat.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufformat.h create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufloader.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/pixbufloader.h create mode 100644 libs/gtkmm2/gdk/gdkmm/pixmap.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/pixmap.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/color_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/colormap_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/cursor_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/device_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/display_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/drawable_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/event_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/gc_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/image_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/region_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/screen_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/types_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/visual_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/private/window_p.h create mode 100644 libs/gtkmm2/gdk/gdkmm/rectangle.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/rectangle.h create mode 100644 libs/gtkmm2/gdk/gdkmm/region.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/region.h create mode 100644 libs/gtkmm2/gdk/gdkmm/rgb.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/rgb.h create mode 100644 libs/gtkmm2/gdk/gdkmm/rgbcmap.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/rgbcmap.h create mode 100644 libs/gtkmm2/gdk/gdkmm/screen.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/screen.h create mode 100644 libs/gtkmm2/gdk/gdkmm/types.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/types.h create mode 100644 libs/gtkmm2/gdk/gdkmm/visual.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/visual.h create mode 100644 libs/gtkmm2/gdk/gdkmm/window.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/window.h create mode 100644 libs/gtkmm2/gdk/gdkmm/wrap_init.cc create mode 100644 libs/gtkmm2/gdk/gdkmm/wrap_init.h create mode 100644 libs/gtkmm2/gdk/gdkmmconfig.h create mode 100644 libs/gtkmm2/gtk/SConscript create mode 100644 libs/gtkmm2/gtk/gtkmm.h create mode 100644 libs/gtkmm2/gtk/gtkmm/aboutdialog.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/aboutdialog.h create mode 100644 libs/gtkmm2/gtk/gtkmm/accelgroup.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/accelgroup.h create mode 100644 libs/gtkmm2/gtk/gtkmm/accelkey.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/accelkey.h create mode 100644 libs/gtkmm2/gtk/gtkmm/accellabel.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/accellabel.h create mode 100644 libs/gtkmm2/gtk/gtkmm/accelmap.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/accelmap.h create mode 100644 libs/gtkmm2/gtk/gtkmm/action.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/action.h create mode 100644 libs/gtkmm2/gtk/gtkmm/actiongroup.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/actiongroup.h create mode 100644 libs/gtkmm2/gtk/gtkmm/adjustment.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/adjustment.h create mode 100644 libs/gtkmm2/gtk/gtkmm/alignment.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/alignment.h create mode 100644 libs/gtkmm2/gtk/gtkmm/arrow.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/arrow.h create mode 100644 libs/gtkmm2/gtk/gtkmm/aspectframe.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/aspectframe.h create mode 100644 libs/gtkmm2/gtk/gtkmm/base.h create mode 100644 libs/gtkmm2/gtk/gtkmm/bin.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/bin.h create mode 100644 libs/gtkmm2/gtk/gtkmm/box.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/box.h create mode 100644 libs/gtkmm2/gtk/gtkmm/button.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/button.h create mode 100644 libs/gtkmm2/gtk/gtkmm/buttonbox.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/buttonbox.h create mode 100644 libs/gtkmm2/gtk/gtkmm/calendar.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/calendar.h create mode 100644 libs/gtkmm2/gtk/gtkmm/celleditable.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/celleditable.h create mode 100644 libs/gtkmm2/gtk/gtkmm/celllayout.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/celllayout.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderer.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderer.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderercombo.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderercombo.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrendererprogress.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrendererprogress.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderertext.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderertext.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.h create mode 100644 libs/gtkmm2/gtk/gtkmm/cellview.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/cellview.h create mode 100644 libs/gtkmm2/gtk/gtkmm/checkbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/checkbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/checkmenuitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/checkmenuitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/clipboard.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/clipboard.h create mode 100644 libs/gtkmm2/gtk/gtkmm/colorbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/colorbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/colorselection.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/colorselection.h create mode 100644 libs/gtkmm2/gtk/gtkmm/combo.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/combo.h create mode 100644 libs/gtkmm2/gtk/gtkmm/combobox.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/combobox.h create mode 100644 libs/gtkmm2/gtk/gtkmm/comboboxentry.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/comboboxentry.h create mode 100644 libs/gtkmm2/gtk/gtkmm/comboboxentrytext.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/comboboxentrytext.h create mode 100644 libs/gtkmm2/gtk/gtkmm/comboboxtext.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/comboboxtext.h create mode 100644 libs/gtkmm2/gtk/gtkmm/container.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/container.h create mode 100644 libs/gtkmm2/gtk/gtkmm/curve.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/curve.h create mode 100644 libs/gtkmm2/gtk/gtkmm/dialog.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/dialog.h create mode 100644 libs/gtkmm2/gtk/gtkmm/drawingarea.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/drawingarea.h create mode 100644 libs/gtkmm2/gtk/gtkmm/editable.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/editable.h create mode 100644 libs/gtkmm2/gtk/gtkmm/entry.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/entry.h create mode 100644 libs/gtkmm2/gtk/gtkmm/entrycompletion.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/entrycompletion.h create mode 100644 libs/gtkmm2/gtk/gtkmm/enums.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/enums.h create mode 100644 libs/gtkmm2/gtk/gtkmm/eventbox.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/eventbox.h create mode 100644 libs/gtkmm2/gtk/gtkmm/expander.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/expander.h create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooser.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooser.h create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooserbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooserbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooserdialog.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooserdialog.h create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooserwidget.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/filechooserwidget.h create mode 100644 libs/gtkmm2/gtk/gtkmm/filefilter.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/filefilter.h create mode 100644 libs/gtkmm2/gtk/gtkmm/fileselection.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/fileselection.h create mode 100644 libs/gtkmm2/gtk/gtkmm/fixed.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/fixed.h create mode 100644 libs/gtkmm2/gtk/gtkmm/fontbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/fontbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/fontselection.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/fontselection.h create mode 100644 libs/gtkmm2/gtk/gtkmm/frame.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/frame.h create mode 100644 libs/gtkmm2/gtk/gtkmm/handlebox.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/handlebox.h create mode 100644 libs/gtkmm2/gtk/gtkmm/iconfactory.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/iconfactory.h create mode 100644 libs/gtkmm2/gtk/gtkmm/iconinfo.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/iconinfo.h create mode 100644 libs/gtkmm2/gtk/gtkmm/iconset.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/iconset.h create mode 100644 libs/gtkmm2/gtk/gtkmm/iconsource.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/iconsource.h create mode 100644 libs/gtkmm2/gtk/gtkmm/icontheme.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/icontheme.h create mode 100644 libs/gtkmm2/gtk/gtkmm/iconview.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/iconview.h create mode 100644 libs/gtkmm2/gtk/gtkmm/image.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/image.h create mode 100644 libs/gtkmm2/gtk/gtkmm/imagemenuitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/imagemenuitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/inputdialog.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/inputdialog.h create mode 100644 libs/gtkmm2/gtk/gtkmm/invisible.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/invisible.h create mode 100644 libs/gtkmm2/gtk/gtkmm/item.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/item.h create mode 100644 libs/gtkmm2/gtk/gtkmm/label.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/label.h create mode 100644 libs/gtkmm2/gtk/gtkmm/layout.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/layout.h create mode 100644 libs/gtkmm2/gtk/gtkmm/liststore.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/liststore.h create mode 100644 libs/gtkmm2/gtk/gtkmm/main.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/main.h create mode 100644 libs/gtkmm2/gtk/gtkmm/menu.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/menu.h create mode 100644 libs/gtkmm2/gtk/gtkmm/menu_elems.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/menu_elems.h create mode 100644 libs/gtkmm2/gtk/gtkmm/menubar.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/menubar.h create mode 100644 libs/gtkmm2/gtk/gtkmm/menuitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/menuitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/menushell.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/menushell.h create mode 100644 libs/gtkmm2/gtk/gtkmm/menutoolbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/menutoolbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/messagedialog.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/messagedialog.h create mode 100644 libs/gtkmm2/gtk/gtkmm/misc.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/misc.h create mode 100644 libs/gtkmm2/gtk/gtkmm/notebook.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/notebook.h create mode 100644 libs/gtkmm2/gtk/gtkmm/object.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/object.h create mode 100644 libs/gtkmm2/gtk/gtkmm/optionmenu.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/optionmenu.h create mode 100644 libs/gtkmm2/gtk/gtkmm/paned.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/paned.h create mode 100644 libs/gtkmm2/gtk/gtkmm/plug.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/plug.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/aboutdialog_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/accelgroup_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/accellabel_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/action_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/actiongroup_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/adjustment_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/alignment_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/arrow_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/aspectframe_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/bin_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/box_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/button_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/buttonbox_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/calendar_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/celleditable_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/celllayout_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellrenderer_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellrenderercombo_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellrendererpixbuf_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellrendererprogress_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellrenderertext_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellrenderertoggle_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/cellview_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/checkbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/checkmenuitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/clipboard_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/colorbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/colorselection_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/combo_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/combobox_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/comboboxentry_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/container_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/curve_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/dialog_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/drawingarea_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/editable_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/entry_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/entrycompletion_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/enums_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/eventbox_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/expander_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/filechooser_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/filechooserbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/filechooserdialog_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/filechooserwidget_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/filefilter_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/fileselection_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/fixed_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/fontbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/fontselection_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/frame_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/handlebox_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/iconfactory_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/iconinfo_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/iconset_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/iconsource_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/icontheme_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/iconview_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/image_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/imagemenuitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/inputdialog_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/invisible_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/item_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/label_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/layout_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/liststore_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/main_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/menu_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/menubar_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/menuitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/menushell_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/menutoolbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/messagedialog_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/misc_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/notebook_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/object_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/optionmenu_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/paned_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/plug_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/progressbar_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/radioaction_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/radiobutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/radiomenuitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/radiotoolbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/range_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/rc_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/ruler_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/scale_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/scrollbar_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/scrolledwindow_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/selectiondata_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/separator_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/separatormenuitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/separatortoolitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/settings_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/sizegroup_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/socket_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/spinbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/statusbar_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/stockitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/style_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/table_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/targetlist_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/tearoffmenuitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/textattributes_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/textbuffer_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/textchildanchor_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/textiter_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/textmark_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/texttag_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/texttagtable_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/textview_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/toggleaction_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/togglebutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/toggletoolbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/toolbar_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/toolbutton_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/toolitem_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/tooltips_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treedragdest_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treedragsource_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treeiter_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treemodel_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treemodelfilter_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treemodelsort_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treepath_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treerowreference_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treeselection_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treesortable_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treestore_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treeview_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/treeviewcolumn_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/uimanager_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/viewport_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/widget_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/private/window_p.h create mode 100644 libs/gtkmm2/gtk/gtkmm/progressbar.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/progressbar.h create mode 100644 libs/gtkmm2/gtk/gtkmm/radioaction.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/radioaction.h create mode 100644 libs/gtkmm2/gtk/gtkmm/radiobutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/radiobutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/radiobuttongroup.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/radiobuttongroup.h create mode 100644 libs/gtkmm2/gtk/gtkmm/radiomenuitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/radiomenuitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/radiotoolbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/radiotoolbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/range.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/range.h create mode 100644 libs/gtkmm2/gtk/gtkmm/rc.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/rc.h create mode 100644 libs/gtkmm2/gtk/gtkmm/ruler.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/ruler.h create mode 100644 libs/gtkmm2/gtk/gtkmm/scale.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/scale.h create mode 100644 libs/gtkmm2/gtk/gtkmm/scrollbar.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/scrollbar.h create mode 100644 libs/gtkmm2/gtk/gtkmm/scrolledwindow.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/scrolledwindow.h create mode 100644 libs/gtkmm2/gtk/gtkmm/selectiondata.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/selectiondata.h create mode 100644 libs/gtkmm2/gtk/gtkmm/selectiondata_private.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/selectiondata_private.h create mode 100644 libs/gtkmm2/gtk/gtkmm/separator.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/separator.h create mode 100644 libs/gtkmm2/gtk/gtkmm/separatormenuitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/separatormenuitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/separatortoolitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/separatortoolitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/settings.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/settings.h create mode 100644 libs/gtkmm2/gtk/gtkmm/sizegroup.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/sizegroup.h create mode 100644 libs/gtkmm2/gtk/gtkmm/socket.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/socket.h create mode 100644 libs/gtkmm2/gtk/gtkmm/spinbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/spinbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/statusbar.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/statusbar.h create mode 100644 libs/gtkmm2/gtk/gtkmm/stock.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/stock.h create mode 100644 libs/gtkmm2/gtk/gtkmm/stockid.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/stockid.h create mode 100644 libs/gtkmm2/gtk/gtkmm/stockitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/stockitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/style.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/style.h create mode 100644 libs/gtkmm2/gtk/gtkmm/table.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/table.h create mode 100644 libs/gtkmm2/gtk/gtkmm/targetentry.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/targetentry.h create mode 100644 libs/gtkmm2/gtk/gtkmm/targetlist.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/targetlist.h create mode 100644 libs/gtkmm2/gtk/gtkmm/tearoffmenuitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/tearoffmenuitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/textattributes.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/textattributes.h create mode 100644 libs/gtkmm2/gtk/gtkmm/textbuffer.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/textbuffer.h create mode 100644 libs/gtkmm2/gtk/gtkmm/textchildanchor.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/textchildanchor.h create mode 100644 libs/gtkmm2/gtk/gtkmm/textiter.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/textiter.h create mode 100644 libs/gtkmm2/gtk/gtkmm/textmark.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/textmark.h create mode 100644 libs/gtkmm2/gtk/gtkmm/texttag.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/texttag.h create mode 100644 libs/gtkmm2/gtk/gtkmm/texttagtable.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/texttagtable.h create mode 100644 libs/gtkmm2/gtk/gtkmm/textview.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/textview.h create mode 100644 libs/gtkmm2/gtk/gtkmm/toggleaction.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/toggleaction.h create mode 100644 libs/gtkmm2/gtk/gtkmm/togglebutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/togglebutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/toggletoolbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/toggletoolbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/toolbar.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/toolbar.h create mode 100644 libs/gtkmm2/gtk/gtkmm/toolbutton.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/toolbutton.h create mode 100644 libs/gtkmm2/gtk/gtkmm/toolitem.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/toolitem.h create mode 100644 libs/gtkmm2/gtk/gtkmm/tooltips.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/tooltips.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treedragdest.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treedragdest.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treedragsource.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treedragsource.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treeiter.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treeiter.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodel.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodel.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodelcolumn.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodelcolumn.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodelfilter.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodelfilter.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodelsort.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treemodelsort.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treepath.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treepath.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treerowreference.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treerowreference.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treeselection.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treeselection.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treesortable.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treesortable.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treestore.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treestore.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treeview.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treeview.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treeview_private.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treeview_private.h create mode 100644 libs/gtkmm2/gtk/gtkmm/treeviewcolumn.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/treeviewcolumn.h create mode 100644 libs/gtkmm2/gtk/gtkmm/uimanager.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/uimanager.h create mode 100644 libs/gtkmm2/gtk/gtkmm/viewport.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/viewport.h create mode 100644 libs/gtkmm2/gtk/gtkmm/widget.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/widget.h create mode 100644 libs/gtkmm2/gtk/gtkmm/window.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/window.h create mode 100644 libs/gtkmm2/gtk/gtkmm/wrap_init.cc create mode 100644 libs/gtkmm2/gtk/gtkmm/wrap_init.h create mode 100644 libs/gtkmm2/gtk/gtkmmconfig.h create mode 100644 libs/gtkmm2/pango/SConscript create mode 100644 libs/gtkmm2/pango/pangomm.h create mode 100644 libs/gtkmm2/pango/pangomm/attributes.cc create mode 100644 libs/gtkmm2/pango/pangomm/attributes.h create mode 100644 libs/gtkmm2/pango/pangomm/attriter.cc create mode 100644 libs/gtkmm2/pango/pangomm/attriter.h create mode 100644 libs/gtkmm2/pango/pangomm/attrlist.cc create mode 100644 libs/gtkmm2/pango/pangomm/attrlist.h create mode 100644 libs/gtkmm2/pango/pangomm/color.cc create mode 100644 libs/gtkmm2/pango/pangomm/color.h create mode 100644 libs/gtkmm2/pango/pangomm/context.cc create mode 100644 libs/gtkmm2/pango/pangomm/context.h create mode 100644 libs/gtkmm2/pango/pangomm/coverage.cc create mode 100644 libs/gtkmm2/pango/pangomm/coverage.h create mode 100644 libs/gtkmm2/pango/pangomm/font.cc create mode 100644 libs/gtkmm2/pango/pangomm/font.h create mode 100644 libs/gtkmm2/pango/pangomm/fontdescription.cc create mode 100644 libs/gtkmm2/pango/pangomm/fontdescription.h create mode 100644 libs/gtkmm2/pango/pangomm/fontface.cc create mode 100644 libs/gtkmm2/pango/pangomm/fontface.h create mode 100644 libs/gtkmm2/pango/pangomm/fontfamily.cc create mode 100644 libs/gtkmm2/pango/pangomm/fontfamily.h create mode 100644 libs/gtkmm2/pango/pangomm/fontmap.cc create mode 100644 libs/gtkmm2/pango/pangomm/fontmap.h create mode 100644 libs/gtkmm2/pango/pangomm/fontmetrics.cc create mode 100644 libs/gtkmm2/pango/pangomm/fontmetrics.h create mode 100644 libs/gtkmm2/pango/pangomm/fontset.cc create mode 100644 libs/gtkmm2/pango/pangomm/fontset.h create mode 100644 libs/gtkmm2/pango/pangomm/glyph.cc create mode 100644 libs/gtkmm2/pango/pangomm/glyph.h create mode 100644 libs/gtkmm2/pango/pangomm/glyphstring.cc create mode 100644 libs/gtkmm2/pango/pangomm/glyphstring.h create mode 100644 libs/gtkmm2/pango/pangomm/init.cc create mode 100644 libs/gtkmm2/pango/pangomm/init.h create mode 100644 libs/gtkmm2/pango/pangomm/item.cc create mode 100644 libs/gtkmm2/pango/pangomm/item.h create mode 100644 libs/gtkmm2/pango/pangomm/language.cc create mode 100644 libs/gtkmm2/pango/pangomm/language.h create mode 100644 libs/gtkmm2/pango/pangomm/layout.cc create mode 100644 libs/gtkmm2/pango/pangomm/layout.h create mode 100644 libs/gtkmm2/pango/pangomm/layoutiter.cc create mode 100644 libs/gtkmm2/pango/pangomm/layoutiter.h create mode 100644 libs/gtkmm2/pango/pangomm/layoutline.cc create mode 100644 libs/gtkmm2/pango/pangomm/layoutline.h create mode 100644 libs/gtkmm2/pango/pangomm/layoutrun.cc create mode 100644 libs/gtkmm2/pango/pangomm/layoutrun.h create mode 100644 libs/gtkmm2/pango/pangomm/private/attributes_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/attriter_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/attrlist_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/color_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/context_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/coverage_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/font_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/fontdescription_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/fontface_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/fontfamily_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/fontmap_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/fontmetrics_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/fontset_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/glyph_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/glyphstring_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/item_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/language_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/layout_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/layoutiter_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/layoutline_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/layoutrun_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/rectangle_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/renderer_p.h create mode 100644 libs/gtkmm2/pango/pangomm/private/tabarray_p.h create mode 100644 libs/gtkmm2/pango/pangomm/rectangle.cc create mode 100644 libs/gtkmm2/pango/pangomm/rectangle.h create mode 100644 libs/gtkmm2/pango/pangomm/renderer.cc create mode 100644 libs/gtkmm2/pango/pangomm/renderer.h create mode 100644 libs/gtkmm2/pango/pangomm/tabarray.cc create mode 100644 libs/gtkmm2/pango/pangomm/tabarray.h create mode 100644 libs/gtkmm2/pango/pangomm/types.h create mode 100644 libs/gtkmm2/pango/pangomm/wrap_init.cc create mode 100644 libs/gtkmm2/pango/pangomm/wrap_init.h create mode 100644 libs/gtkmm2ext/.cvsignore create mode 100644 libs/gtkmm2ext/AUTHORS create mode 100644 libs/gtkmm2ext/COPYING create mode 100644 libs/gtkmm2ext/ChangeLog create mode 100644 libs/gtkmm2ext/NEWS create mode 100644 libs/gtkmm2ext/README create mode 100644 libs/gtkmm2ext/SConscript create mode 100644 libs/gtkmm2ext/auto_spin.cc create mode 100644 libs/gtkmm2ext/barcontroller.cc create mode 100644 libs/gtkmm2ext/bindable_button.cc create mode 100644 libs/gtkmm2ext/choice.cc create mode 100644 libs/gtkmm2ext/click_box.cc create mode 100644 libs/gtkmm2ext/controller.cc create mode 100644 libs/gtkmm2ext/fastmeter.cc create mode 100644 libs/gtkmm2ext/gettext.h create mode 100644 libs/gtkmm2ext/gtk_ui.cc create mode 100644 libs/gtkmm2ext/gtkmm2ext-config.in create mode 100644 libs/gtkmm2ext/gtkmm2ext/.cvsignore create mode 100644 libs/gtkmm2ext/gtkmm2ext/auto_spin.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/barcontroller.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/bindable_button.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/choice.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/click_box.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/controller.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/doi.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/fastmeter.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/gtk_ui.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/gtkutils.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/hexentry.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/idle_adjustment.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/pix.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/pixscroller.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/popup.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/prompter.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/selector.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/slider_controller.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/stop_signal.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/tearoff.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/textviewer.h create mode 100644 libs/gtkmm2ext/gtkmm2ext/utils.h create mode 100644 libs/gtkmm2ext/gtkutils.cc create mode 100644 libs/gtkmm2ext/hexentry.cc create mode 100644 libs/gtkmm2ext/i18n.h create mode 100644 libs/gtkmm2ext/idle_adjustment.cc create mode 100644 libs/gtkmm2ext/libgtkmm2ext.pc.in create mode 100644 libs/gtkmm2ext/libgtkmm2ext.spec.in create mode 100644 libs/gtkmm2ext/pix.cc create mode 100644 libs/gtkmm2ext/pixscroller.cc create mode 100644 libs/gtkmm2ext/po/el_GR.po create mode 100644 libs/gtkmm2ext/po/es_ES.po create mode 100644 libs/gtkmm2ext/po/pt_BR.po create mode 100644 libs/gtkmm2ext/po/ru_RU.po create mode 100644 libs/gtkmm2ext/popup.cc create mode 100644 libs/gtkmm2ext/prompter.cc create mode 100644 libs/gtkmm2ext/selector.cc create mode 100644 libs/gtkmm2ext/slider_controller.cc create mode 100644 libs/gtkmm2ext/tearoff.cc create mode 100644 libs/gtkmm2ext/textviewer.cc create mode 100644 libs/gtkmm2ext/utils.cc create mode 100644 libs/libgnomecanvasmm/.DS_Store create mode 100644 libs/libgnomecanvasmm/AUTHORS create mode 100644 libs/libgnomecanvasmm/COPYING create mode 100644 libs/libgnomecanvasmm/ChangeLog create mode 100644 libs/libgnomecanvasmm/NEWS create mode 100644 libs/libgnomecanvasmm/README create mode 100644 libs/libgnomecanvasmm/SConscript create mode 100644 libs/libgnomecanvasmm/TODO create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/.DS_Store create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/affinetrans.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/affinetrans.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/bpath.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/bpath.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/canvas.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/canvas.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/ellipse.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/ellipse.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/group.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/group.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/init.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/init.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/item.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/item.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/line.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/line.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/path-def.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/path-def.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/pixbuf.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/pixbuf.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/point.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/point.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/polygon.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/polygon.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/bpath_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/canvas_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/ellipse_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/group_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/item_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/line_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/path-def_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/pixbuf_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/polygon_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/rect-ellipse_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/rect_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/rich-text_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/shape_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/text_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/private/widget_p.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/properties.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/properties.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/rect-ellipse.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/rect-ellipse.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/rect.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/rect.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/rich-text.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/rich-text.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/shape.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/shape.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/text.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/text.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/widget.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/widget.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/wrap_init.cc create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmm/wrap_init.h create mode 100644 libs/libgnomecanvasmm/libgnomecanvasmmconfig.h create mode 100644 libs/midi++2/.cvsignore create mode 100644 libs/midi++2/AUTHORS create mode 100644 libs/midi++2/COPYING create mode 100644 libs/midi++2/ChangeLog create mode 100644 libs/midi++2/NEWS create mode 100644 libs/midi++2/README create mode 100644 libs/midi++2/SConscript create mode 100644 libs/midi++2/alsa_sequencer_midiport.cc create mode 100644 libs/midi++2/coremidi_midiport.cc create mode 100644 libs/midi++2/fd_midiport.cc create mode 100644 libs/midi++2/fifomidi.cc create mode 100644 libs/midi++2/libmidi++.pc.in create mode 100644 libs/midi++2/libmidi++.spec.in create mode 100644 libs/midi++2/midi++/.DS_Store create mode 100644 libs/midi++2/midi++/.cvsignore create mode 100644 libs/midi++2/midi++/alsa_rawmidi.h create mode 100644 libs/midi++2/midi++/alsa_sequencer.h create mode 100644 libs/midi++2/midi++/channel.h create mode 100644 libs/midi++2/midi++/controllable.h create mode 100644 libs/midi++2/midi++/coremidi_midiport.h create mode 100644 libs/midi++2/midi++/factory.h create mode 100644 libs/midi++2/midi++/fd_midiport.h create mode 100644 libs/midi++2/midi++/fifomidi.h create mode 100644 libs/midi++2/midi++/manager.h create mode 100644 libs/midi++2/midi++/mmc.h create mode 100644 libs/midi++2/midi++/nullmidi.h create mode 100644 libs/midi++2/midi++/parser.h create mode 100644 libs/midi++2/midi++/port.h create mode 100644 libs/midi++2/midi++/port_request.h create mode 100644 libs/midi++2/midi++/types.h create mode 100644 libs/midi++2/midi.cc create mode 100644 libs/midi++2/midichannel.cc create mode 100644 libs/midi++2/midicontrollable.cc create mode 100644 libs/midi++2/midifactory.cc create mode 100644 libs/midi++2/midimanager.cc create mode 100644 libs/midi++2/midiparser.cc create mode 100644 libs/midi++2/midiport.cc create mode 100644 libs/midi++2/miditrace.cc create mode 100644 libs/midi++2/mmc.cc create mode 100644 libs/midi++2/mmctest.cc create mode 100644 libs/midi++2/mtc.cc create mode 100644 libs/midi++2/port_request.cc create mode 100644 libs/pbd3/.cvsignore create mode 100644 libs/pbd3/AUTHORS create mode 100644 libs/pbd3/COPYING create mode 100644 libs/pbd3/ChangeLog create mode 100644 libs/pbd3/NEWS create mode 100644 libs/pbd3/README create mode 100644 libs/pbd3/SConscript create mode 100644 libs/pbd3/basename.cc create mode 100644 libs/pbd3/dirname.cc create mode 100644 libs/pbd3/dmalloc.cc create mode 100644 libs/pbd3/ftw.cc create mode 100644 libs/pbd3/libpbd.pc.in create mode 100644 libs/pbd3/libpbd.spec.in create mode 100644 libs/pbd3/mountpoint.cc create mode 100644 libs/pbd3/pathscanner.cc create mode 100644 libs/pbd3/pbd-config.in create mode 100644 libs/pbd3/pbd/.DS_Store create mode 100644 libs/pbd3/pbd/.cvsignore create mode 100644 libs/pbd3/pbd/abstract_ui.h create mode 100644 libs/pbd3/pbd/atomic.h create mode 100644 libs/pbd3/pbd/basename.h create mode 100644 libs/pbd3/pbd/compose.h create mode 100644 libs/pbd3/pbd/datum.h create mode 100644 libs/pbd3/pbd/dirname.h create mode 100644 libs/pbd3/pbd/ellipsoid.h create mode 100644 libs/pbd3/pbd/error.h create mode 100644 libs/pbd3/pbd/failed_constructor.h create mode 100644 libs/pbd3/pbd/fastlog.h create mode 100644 libs/pbd3/pbd/foreach.h create mode 100644 libs/pbd3/pbd/forkexec.h create mode 100644 libs/pbd3/pbd/ftw.h create mode 100644 libs/pbd3/pbd/irix_platform.h create mode 100644 libs/pbd3/pbd/linux_platform.h create mode 100644 libs/pbd3/pbd/lock_free_fifo.h create mode 100644 libs/pbd3/pbd/lockmonitor.h create mode 100644 libs/pbd3/pbd/mountpoint.h create mode 100644 libs/pbd3/pbd/pathscanner.h create mode 100644 libs/pbd3/pbd/platform.h create mode 100644 libs/pbd3/pbd/platform_factory.h create mode 100644 libs/pbd3/pbd/pool.h create mode 100644 libs/pbd3/pbd/position.h create mode 100644 libs/pbd3/pbd/precision_timer.h create mode 100644 libs/pbd3/pbd/pthread_spinlock.h create mode 100644 libs/pbd3/pbd/pthread_utils.h create mode 100644 libs/pbd3/pbd/rcpointer.h create mode 100644 libs/pbd3/pbd/receiver.h create mode 100644 libs/pbd3/pbd/relation.h create mode 100644 libs/pbd3/pbd/restartable_rw.h create mode 100644 libs/pbd3/pbd/ringbuffer.h create mode 100644 libs/pbd3/pbd/ringbufferNPT.h create mode 100644 libs/pbd3/pbd/rt.h create mode 100644 libs/pbd3/pbd/rtthread.h create mode 100644 libs/pbd3/pbd/scale.h create mode 100644 libs/pbd3/pbd/selectable.h create mode 100644 libs/pbd3/pbd/solaris_platform.h create mode 100644 libs/pbd3/pbd/stl_delete.h create mode 100644 libs/pbd3/pbd/stl_functors.h create mode 100644 libs/pbd3/pbd/strsplit.h create mode 100644 libs/pbd3/pbd/strsub.h create mode 100644 libs/pbd3/pbd/textreceiver.h create mode 100644 libs/pbd3/pbd/thread.h create mode 100644 libs/pbd3/pbd/thrown_error.h create mode 100644 libs/pbd3/pbd/touchable.h create mode 100644 libs/pbd3/pbd/transmitter.h create mode 100644 libs/pbd3/pbd/types.h create mode 100644 libs/pbd3/pbd/undo.h create mode 100644 libs/pbd3/pbd/unescape.h create mode 100644 libs/pbd3/pbd/xml++.h create mode 100644 libs/pbd3/pool.cc create mode 100644 libs/pbd3/pthread_utils.cc create mode 100644 libs/pbd3/receiver.cc create mode 100644 libs/pbd3/strsplit.cc create mode 100644 libs/pbd3/textreceiver.cc create mode 100644 libs/pbd3/transmitter.cc create mode 100644 libs/pbd3/undo.cc create mode 100644 libs/pbd3/unescape.cc create mode 100644 libs/pbd3/xml++.cc create mode 100644 libs/sigc++2/.cvsignore create mode 100644 libs/sigc++2/AUTHORS create mode 100644 libs/sigc++2/COPYING create mode 100644 libs/sigc++2/ChangeLog create mode 100644 libs/sigc++2/INSTALL create mode 100644 libs/sigc++2/Makefile.am create mode 100644 libs/sigc++2/NEWS create mode 100644 libs/sigc++2/README create mode 100644 libs/sigc++2/SConscript create mode 100644 libs/sigc++2/TODO create mode 100755 libs/sigc++2/autogen.sh create mode 100644 libs/sigc++2/configure.ac create mode 100644 libs/sigc++2/libsigc++-2.0.spec.in create mode 100644 libs/sigc++2/scripts/cxx.m4 create mode 100644 libs/sigc++2/scripts/libtool.m4 create mode 100644 libs/sigc++2/scripts/ltoptions.m4 create mode 100644 libs/sigc++2/scripts/ltsugar.m4 create mode 100644 libs/sigc++2/scripts/ltversion.m4 create mode 100644 libs/sigc++2/sigc++-2.0.pc.in create mode 100644 libs/sigc++2/sigc++/.cvsignore create mode 100644 libs/sigc++2/sigc++/Makefile.am create mode 100644 libs/sigc++2/sigc++/adaptors/adaptor_trait.h create mode 100644 libs/sigc++2/sigc++/adaptors/adaptors.h create mode 100644 libs/sigc++2/sigc++/adaptors/bind.h create mode 100644 libs/sigc++2/sigc++/adaptors/bind_return.h create mode 100644 libs/sigc++2/sigc++/adaptors/compose.h create mode 100644 libs/sigc++2/sigc++/adaptors/deduce_result_type.h create mode 100644 libs/sigc++2/sigc++/adaptors/exception_catch.h create mode 100644 libs/sigc++2/sigc++/adaptors/hide.h create mode 100644 libs/sigc++2/sigc++/adaptors/lambda/base.h create mode 100644 libs/sigc++2/sigc++/adaptors/lambda/group.h create mode 100644 libs/sigc++2/sigc++/adaptors/lambda/lambda.cc create mode 100644 libs/sigc++2/sigc++/adaptors/lambda/lambda.h create mode 100644 libs/sigc++2/sigc++/adaptors/lambda/operator.h create mode 100644 libs/sigc++2/sigc++/adaptors/lambda/select.h create mode 100644 libs/sigc++2/sigc++/adaptors/retype.h create mode 100644 libs/sigc++2/sigc++/adaptors/retype_return.h create mode 100644 libs/sigc++2/sigc++/bind.h create mode 100644 libs/sigc++2/sigc++/bind_return.h create mode 100644 libs/sigc++2/sigc++/class_slot.h create mode 100644 libs/sigc++2/sigc++/compatibility.h create mode 100644 libs/sigc++2/sigc++/connection.cc create mode 100644 libs/sigc++2/sigc++/connection.h create mode 100644 libs/sigc++2/sigc++/functors/functor_trait.h create mode 100644 libs/sigc++2/sigc++/functors/functors.h create mode 100644 libs/sigc++2/sigc++/functors/mem_fun.h create mode 100644 libs/sigc++2/sigc++/functors/ptr_fun.h create mode 100644 libs/sigc++2/sigc++/functors/slot.cc create mode 100644 libs/sigc++2/sigc++/functors/slot.h create mode 100644 libs/sigc++2/sigc++/functors/slot_base.cc create mode 100644 libs/sigc++2/sigc++/functors/slot_base.h create mode 100644 libs/sigc++2/sigc++/hide.h create mode 100644 libs/sigc++2/sigc++/method_slot.h create mode 100644 libs/sigc++2/sigc++/object.h create mode 100644 libs/sigc++2/sigc++/object_slot.h create mode 100644 libs/sigc++2/sigc++/reference_wrapper.h create mode 100644 libs/sigc++2/sigc++/retype.h create mode 100644 libs/sigc++2/sigc++/retype_return.h create mode 100644 libs/sigc++2/sigc++/sigc++.h create mode 100644 libs/sigc++2/sigc++/signal.cc create mode 100644 libs/sigc++2/sigc++/signal.h create mode 100644 libs/sigc++2/sigc++/signal_base.cc create mode 100644 libs/sigc++2/sigc++/signal_base.h create mode 100644 libs/sigc++2/sigc++/slot.h create mode 100644 libs/sigc++2/sigc++/trackable.cc create mode 100644 libs/sigc++2/sigc++/trackable.h create mode 100644 libs/sigc++2/sigc++/type_traits.h create mode 100644 libs/sigc++2/sigc++/visit_each.h create mode 100644 libs/sigc++2/sigc++config.h.in create mode 100644 templates/.cvsignore create mode 100644 templates/16 Tracks.template create mode 100644 templates/2 Track.template create mode 100644 templates/32 Tracks.template create mode 100644 templates/4 Tracks.template create mode 100644 templates/8 Tracks.template create mode 100644 templates/SConscript create mode 100644 tools/.cvsignore create mode 100644 tools/bug_tool/.cvsignore create mode 100644 tools/bug_tool/ClientCookie/.cvsignore create mode 100644 tools/bug_tool/ClientCookie/_ClientCookie.py create mode 100644 tools/bug_tool/ClientCookie/_Debug.py create mode 100644 tools/bug_tool/ClientCookie/_HeadersUtil.py create mode 100644 tools/bug_tool/ClientCookie/_MSIECookieJar.py create mode 100644 tools/bug_tool/ClientCookie/_MozillaCookieJar.py create mode 100644 tools/bug_tool/ClientCookie/_Util.py create mode 100644 tools/bug_tool/ClientCookie/__init__.py create mode 100644 tools/bug_tool/ClientCookie/_urllib2_support.py create mode 100644 tools/bug_tool/ClientForm.py create mode 100755 tools/bug_tool/ardour_bugs create mode 100755 tools/config.guess create mode 100644 tools/jacktest.c diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000000..0cc8a576e3 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,5 @@ +.sconf_temp +.sconsign.dblite +ardour.rc +config.log +scache.conf diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..d60c31a97a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000..8f9fd94808 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,154 @@ +2001-10-27 Paul Davis + + * gtk_ardour/editor_ops.cc (ensure_selection): fixed selection + start not-assigned error in ensure_selection(). + +2001-10-26 Paul Davis + + * gtk_ardour/editor.cc (Editor): use scroll timeut whenever the + editor is active, instead of stopping and starting it. + +2001-10-23 Paul Davis + + * gtk_ardour/mixer_strip.cc (update_diskstream_display): + rationalize rec_enable button handling to be equivalent to same + code elswhere. + + * gtk_ardour/trackview.cc (record_enable_blink): add rec enable button + + * gtk_ardour/ardour_ui.cc (start_clocking): use SigC::Signals for + Clock and Blink updates + + * gtk_ardour/marker.cc (set_position): fixed persistent error in + marker location, caused by not taking the shift into account + whenever the position was reset. + + * gtk_ardour/editor.cc (initialize_canvas): make the playhead + cursor sit above the edit cursor. + +2001-10-20 Paul Davis + + * gtk_ardour/editor_ops.cc (ensure_selection): make + add_location_from_selection work again (now ensure_selection() + works again). + + * ardour_ui.rc: added styles for new rulers. + + * gtk_ardour/regionview.cc (move_to): make gain control points be + rects + +2001-10-19 Paul Davis + + * gtk_ardour/regionview.cc (ControlPoint): change colors of gain curves + + * massively split up editor code to try to produce more + rapidly-compilable compilation units. + +2001-10-17 Paul Davis + + * gtk_ardour/editor_mouse.cc (start_grab): clean up start grab + code, and make playhead cursor grab stop the transport, restarting + it again when done. + + * gtk_ardour/ardour_ui.cc (add_diskstream): try to make recorder + window the correct size. + + +2001-10-13 Paul Davis + + * gtk_ardour/diskstream_ui.cc (DiskStream_UI): make sure that all + input buttons are the same width, regardless of their label contents. + +2001-10-05 Paul Davis + + * gtk_ardour/editor_mouse.cc (button_release_handler): button2 on + a RegionItem always mutes/unmutes/raises/lowers, regardless of + mouse mode. + +2001-10-04 Paul Davis + + * gtk_ardour/editor_mouse.cc (region_drag_motion_callback): edit + clock reflect region sync point rather than cursor during drag. + (button_release_handler): button press/release on cursors + + markers always initiate a grab, regardless of mouse mode. + + * gtk_ardour/editor.cc (track_canvas_allocate): return the edit + cursor to a full height line. + + * gtk_ardour/grouped_buttons.cc (GroupedButtons): backpedalled + from this being a GTK widget to just a C++ object that manipulates + a set of buttons. + + * gtk_ardour/trackview.cc (set_height): put edit controls in their + own event window so that we can control color, etc. + + * gtk_ardour/canvas-simplerect.c (gtk_canvas_simplerect_render): + don't draw vertical lines at end of box (kludge!) + + * gtk_ardour/editor.cc (add_region_to_region_display): copy + Regions before putting them in the Region list. this prevents + playlist-edits from altering the state of the "original". + +2001-10-03 Paul Davis + + * gtk_ardour/editor_ops.cc (split_region): operate only on the + uppermost region, not all those stacked at this location. + +2001-09-30 Paul Davis + + * gtk_ardour/editor_mouse.cc (start_grab): don't raise the grabbed + item to the top of the canvas stack. it must already have been + visible, so don't do this - it confuses regionview stacking. + +2001-09-28 Paul Davis + + * gtk_ardour/marker.cc (Marker): center marker shape on the actual + location; use frame position rather than canvas position in API. + + * gtk_ardour/streamview.cc (StreamView): add a simplerect to show + the edge of the track *and* to help us get canvas events for the + track in areas where there is no region. + + * gtk_ardour/editor_ops.cc (soundfile_chosen_for_insert): make + insert_sndfile() work again, including a working ensure_cursor() + + * gtk_ardour/marker.cc (Marker): add black outline around marker shapes + +2001-09-27 Paul Davis + + * gtk_ardour/editor_ops.cc: implement partial support for nudge variations + + * gtk_ardour/editor_mouse.cc (start_selection): add initial + support for mouse-based selection. + + * gtk_ardour/editor.cc (Editor): add support for GUI control of + edit groups. + + * gtk_ardour/editor_keys.cc (install_keybindings): add KP_{6,4} + since we don't get KP_{Right,Left} by default. + + * gtk_ardour/ardour_ui.cc (add_diskstream): put recorder stuff + (meters, etc) in a separate window. + + * gtk_ardour/plugin_ui.cc (build_control_ui): fix problem with + destructor logic that caused double destruction of + ControlUIs. also use Gtk-- functions for PluginUIadjustment. + +2001-09-26 Paul Davis + + * gtk_ardour/editor_keys.cc (install_keybindings): added some + more keybindings for the editor. + +2001-09-25 Paul Davis + + * gtk_ardour/editor_mouse.cc (region_drag_motion_callback): fixed + segv caused by referencing a null drag_info.last_trackview + pointer. this occured when the mouse moved into an area where + no trackview was, and then back again. + + * gtk_ardour/marker.cc: added initial support for Canvas-based markers + + * gtk_ardour/keyboard_target.cc (translate_key_name): + differentiate between Alt and Meta, and Alt(R|L) and Meta(R|L) + + diff --git a/DOCUMENTATION/.cvsignore b/DOCUMENTATION/.cvsignore new file mode 100644 index 0000000000..3dda72986f --- /dev/null +++ b/DOCUMENTATION/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/DOCUMENTATION/AUTHORS b/DOCUMENTATION/AUTHORS new file mode 100644 index 0000000000..32763d5eec --- /dev/null +++ b/DOCUMENTATION/AUTHORS @@ -0,0 +1,71 @@ +Paul Davis (Philadelphia, PA) was and is the primary author of Ardour. + +Taybin Rutkin (New York, NY) has contributed lots of code, and was +particularly responsible for the use of XML in the state persistence +aspect of the program. He also (re)wrote the soundfile library code to +use LRDF. In addition he was responsible for the integration of the +gettext system and the compose() templates that make Ardour's +internationalization possible. He has consistently made suggestions +that resulted in significantly more elegant code and design. Taybin +also set up and oversees the Mantis bug reporting system used by all +of us, and tends to take on "infrastructure" issues such as the switch +to SCons as the build system. + +Jesse Chappell (Washington, DC) keeps on making major contributions to +Ardour. It almost seems pointless to list the things he has worked on +because there is so much of it. They include being able to handle +multichannel tracks, a major change in the program's design and +capabilities, and many additions/improvements to the GTK GUI, +including mouse zoom mode and the route params editor. Jesse was the +first person to just "walk in" and understand the Ardour codebase. + +Marcus Andersson (Karlstad, Sweden) contributed a number of useful +patches and worked on the dB-related issues in the gain stages and +metering, other numeric computations, and much useful debugging, bug +reporting and analysis. + +Jeremy Hall (Sterling, VA) contributed several patches and worked +intensively on ksi_ardour, the keystroke-based-interface to libardour +designed for sight-impaired and GUI-averse users. + +Steve Harris (Southampton, UK) contributed code to handle speed-based +interpolation, an area I did not want to get my head around, as well +as dithering, panning, metering and other DSP-centric issues. He also +wrote the LRDF library used by Ardour's soundfile library code, not to +mention dozens of LADSPA plugins that make Ardour a genuinely useful +tool. + +Tim Mayberry (Brisbane, Australia) did lots and lots and lots of work +on mouse-driven editing. + +Nick Mainsbridge is responsible for many +improvements to the rulers, and several other tweaks. + +Colin Law wrote the code that supports Ardour's integration with +the CMT Animatics engine. He was also very involved in refactoring the +GUI code design to support different kinds of tracks, thus laying the +groundwork for extending ardour's domain to include MIDI and video. + +Gerard van Dongen (Rotterdam, Netherlands) has done a set of scattered +but critical work with a vague focus on the mouse. He has made some +particularly important fixes to the incredibly hairy code that draws +automation curves. Gerard also helped out with a workshop on Ardour +held at the Dutch Electronic Arts Festival, Rotterdam, in November +2004. + +Smaller (but not necessarily minor) patches were received from the +following people: + + Mark Stewart + Sam Chessman (Reston, VA) + Jack O'Quin (Austin, TX) + Matt Krai + Ben Bell + Thomas Charbonnel (Lyon, France) + Robert Jordens + Christopher George + Rob Holland + Joshua Leachman + Sampo Savolainen + Per Sigmond + \ No newline at end of file diff --git a/DOCUMENTATION/AUTHORS.es b/DOCUMENTATION/AUTHORS.es new file mode 100644 index 0000000000..93f16773c1 --- /dev/null +++ b/DOCUMENTATION/AUTHORS.es @@ -0,0 +1,78 @@ +Paul Davis (de Philadelphia, PA) fue y es el principal autor de Ardour. + +Taybin Rutkin (de New York, NY) ha contribuido grandes cantidades de +codigo y fue particularmente responsable por el uso de XML en el +aspecto de persistencia de estado del programa. Tambien escribio y +reescribio el codigo relativo a la libreria soundfile (archivo de +sonido) para que use LRDF. Ademas fue responsable por la integracion +del sistema gettext y los esquemas compose() que hacen posible la +internacionalizacion de Ardour. Ha hecho constantes sugerencias las +cuales resultaron en codigo y disenio significativamente mas elegantes. +Taybin tambien configuro y administra el sistema Mantis de reporte de +bugs (errores de codigo) usado por todos nosotros. + +Jesse Chappell (de Washington, DC) continua haciendo grandes +contribuciones a Ardour, particularmente en el hecho de que Ardour sea +capaz de manejar pistas multicanal, un cambio mayor en el disenio del +programa y capacidades. Tambien hizo muchos agregados y mejoras a la +interfaz visual de GTK, incluyendo el modo de zoom mediante mouse y el +editor de parametros de ruteo. Jessie fue la primera persona en "pasar" +y entender las bases del codigo de Ardour. + +Marcus Andersson (de Karlstad, Sweden) contribuyo un numero de patches +(actualizaciones) utiles y trabajo con los problemas relacionados a "dB" +en las etapas de gain (volumen) y vumetros, otras computaciones numericas +y muy util debugging, reporte de bugs y analisis. + +Jeremy Hall (de Sterling, VA) contribuyo varios patches y trabajo +intensamente con ksi_ardour, que es la interfase basada en teclas de la +libreria libardour diseniada para no videntes y amantes de lineas de +comando (consolas). + +Steve Harris (de Southampton, UK) contribuyo codigo para manejar +interpolacion basada en velocidad, un area en la cual no me queria meter, +asi como dithering, balance, vumetros y otros temas relacionados con +procesamiento de senial. Tambien escribio la libreria LRDF usada por +el codigo de Ardour de la libreria soundfile, sin mencionar docenas +de plugins LADSPA que hacen a Ardour una herramienta genuinamente util. + +Tim Mayberry (de Brisbane, Australia) hizo mucho, mucho, mucho trabajo +en cuanto a edicion basada en mouse. + +Nick Mainsbridge es responsable de muchas +mejoras a los medidores/lineas/referencias de tiempo. + +Colin Law <> escribio el codigo que soporta la integracion de Ardour +al sistema de Animatics CMT. Tambien se ocupo en el redisenio del codigo +de la interfase visual para soportar diferentes tipos de pistas. + +Mas pequenios (preo no necesariamente menores) patches fueron recividos +de las siguientes personas: + + Mark Stewart + Sam Chessman (Reston, VA) + Jack O'Quin (Austin, TX) + Matt Krai + Ben Bell + Gerard vanDongen (Rotterdam, Netherlands) + Thomas Charbonnel (Lyon, France) + Robert Jordens + + + + + + + + +Nota de Traduccion (Spanish Translation Note) +--------------------------------------------- +#Nota del tipeo:la letra pronunciada ENIE aparece en este archivo +#como ni (letra "n" y letra "i") para mayor compatibilidad con todos +#los visores de texto. +#Asi mismo no se han aplicado las tildes(acentos). +#Estos no son errores de tipeo. Si llegara a encontrar algun otro error +#en cualquiera de los archivos con extension ".es" por favor +#hagamelo saber a alexkrohn@fastmail.fm +# Muchas gracias +# Alex \ No newline at end of file diff --git a/DOCUMENTATION/BUILD b/DOCUMENTATION/BUILD new file mode 100644 index 0000000000..010e097e74 --- /dev/null +++ b/DOCUMENTATION/BUILD @@ -0,0 +1,145 @@ + HOW TO BUILD ARDOUR FROM SOURCE + ------------------------------- + +Please: before you do anything else, take a moment to go and join the +ardour-dev mailing list (members only). It is very important that the +community of people using, testing and developing this software are on +the list, and I will NOT deal with questions relating to Ardour's +compilation or bugs that are not sent to that list. See +http://ardour.org/ for details on joining the mailing list. + +You can also get in touch with developers and users on IRC. Joining +#ardour at irc.freenode.net. The core developers and several key users +hang out here on IRC, at pretty much any hour of the night or day. + +*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + + Full information on building Ardour can be found at: + + http://ardour.org/building.php + + Information has been left in this file for those who do not have + network access but is not guaranteed to be accurate or up to date. + +*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + + +COMPILING +------------ + +Please ensure that before attempting to compile Ardour, you have +installed: + +* Tools: + + gcc/g++ 3.x or above + scons 0.96 or above + gettext 0.12.1 or above + pkgconfig 0.8.0 or above + http://www.freedesktop.org/software/pkgconfig/ + + lex and yacc are also required. + any verison of bison >= 1.35 should work fine. + +* Libraries: + +Recommended versions, where applicable, are shown under the general +requirement. + + JACK 0.99.50 (CVS or snapshot release) (http://jackit.sourceforge.net) + + libxml2 2.5.X (http://xmlsoft.org/) + + libart_lgpl 2.3.X + + - available as part of gnome-libs, which you may already + have on your system. + + - also available via download from GNOME source FTP sites. + - see ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html + and then follow to sources/libart_lgpl + + glib 1.2 (http://www.gtk.org) + glib-1.2.8 (included with most distributions) + + GTK+ 1.2 (http://www.gtk.org) + gtk+-1.2.8 (included with most distributions) + + libsndfile (http://www.mega-nerd.com/libsndfile/) + libsndfile-1.0 or higher + + libsamplerate (http://www.mega-nerd.com/SRC/) + libsamplerate 0.0.13 or higher + + the LADSPA SDK (http://www.ladspa.org/) + (See below) + + raptor (http://librdf.org/raptor/) + + lrdf (needs raptor) (http://plugin.org.uk/lrdf/) + liblrdf 0.4.0 or higher (earlier versions will + causes crashes when using plugin presets) + +Getting LADSPA +--------------- + +The Linux Audio Developers Simple Plugin API (LADSPA) really only +consists of a header file, which is already included in the Ardour +source tree. + +However, you may want the plugins that come the "full" LADSPA "SDK", +so go ahead and download the whole package (it's not big) from +www.ladspa.org. + +I would also recommend getting Steve Harris' excellent set of LADSPA +plugins from http://plugin.org.uk/. They make Ardour into a truly +useful application. Other LADSPA plugins will be appearing - be sure +to watch the Linux Audio Development mailing list for announcements. + +2A) COMPILING FROM CVS +--------------------- + +Checkout the source from Ardour CVS (the `%' here is meant to be your +shell prompt): + +% cd /usr/local/src # just an example, it can be anywhere +% cvs -d:pserver:anoncvs@ardour.org:/cvsroot/ardour login + # you will need to contact + # paul at linuxaudiosystems dot com + # to get the passphrase. See + # http://ardour.org/download.html + # for details on why this is. +% cvs -d:pserver:anoncvs@ardour.org:/cvsroot/ardour -z3 co ardour + +2B) COMPILING FROM A TARBALL +---------------------------- + +As usual, fetch and unpack the tarball. The directory it creates, +ardour-, is referred to below as "$AD". + +3) HOW TO COMPILE +----------------- + +We use the wonderful scons build system, which is started by just typing: + + scons + +in the top level directory of the ardour source tree. + +To speed things up, on a uniprocessor system, use "scons -j2", and on +an SMP system try "scons -j3", which will do a parallel build +(constructing more than one thing at a time). + +If you want to build ardour so that it can be debugged, you may wish +to use the DEBUG=yes option. Without it, ardour is built with +extreme optimization turned on and the result cannot be debugged +effectively. + +If you don't want the installation to happen in the "usual place", add +a PREFIX=/my/preferred/prefix option to scons. + +Compilation takes a while. Running with scons -j3 on a dual PII-450, +the entire build takes about 20 minutes, about the same time with +scons -j2 on 2.6GHz P4. + +Other scons options can be discovered using "scons --help" diff --git a/DOCUMENTATION/BUILD.ru b/DOCUMENTATION/BUILD.ru new file mode 100644 index 0000000000..a620209735 --- /dev/null +++ b/DOCUMENTATION/BUILD.ru @@ -0,0 +1,215 @@ + ëáë óïâòáôø ARDOUR éú éóèïäîùè ôåëóôï÷ + -------------------------------------- + +ðÏÖÁÌÕÊÓÔÁ ×ÎÉÍÁÎÉÅ: ÐÒÅÖÄÅ ÞÅÍ ÐÒÉÓÔÕÐÉÔØ Ë ÒÁÂÏÔÅ Ó Ardour, ÎÁÊÄÉÔÅ +×ÒÅÍÑ ÞÔÏÂÙ ÐÏÄÐÉÓÁÔØÓÑ ÎÁ ÓÐÉÓÏË ÒÁÓÓÙÌËÉ ÒÁÚÒÁÂÏÔÞÉËÏ×. üÔÏ ÏÞÅÎØ +×ÁÖÎÏ, ÐÏÔÏÍÕ ÞÔÏ ÓÏÏÂÝÅÓÔ×Ï ÌÀÄÅÊ, ÉÓÐÏÌØÚÕÀÝÉÈ, ÔÅÓÔÉÒÕÀÝÉÈ É +ÒÁÚÒÁÂÁÔÙ×ÁÀÝÉÈ Ardour, ÏÂÝÁÀÔÓÑ × ÜÔÏÍ ÓÐÉÓËÅ ÒÁÓÓÙÌËÉ, É Ñ îå âõäõ +ÏÔ×ÅÞÁÔØ ÎÁ ×ÏÐÒÏÓÙ ÏÔÎÏÓÉÔÅÌØÎÏ ÓÂÏÒËÉ ÉÌÉ ÏÛÉÂÏË × ÒÁÂÏÔÅ Ardour, +ÅÓÌÉ ÏÎÉ ÎÅ ÂÕÄÕÔ ÚÁÄÁÎÙ × ÜÔÏÍ ÓÐÉÓËÅ. ðÏÄÒÏÂÎÅÅ Ï ÜÔÏÍ ÞÉÔÁÊÔÅ ÎÁ +ÓÔÒÁÎÉÃÅ http://ardour.sf.net/ ÉÌÉ http://ardour.org/, ÇÄÅ ÕËÁÚÁÎÏ +ËÁË ÐÏÄÐÉÓÁÔØÓÑ ÎÁ ÓÐÉÓÏË ÒÁÓÓÙÌËÉ. + +üÔÏÔ ÄÏËÕÍÅÎÔ ÎÁÐÉÓÁÎ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÅÊ, ÈÏÒÏÛÏ ÚÎÁÀÝÉÈ ÐÒÏÃÅÓÓ ÓÂÏÒËÉ +ÐÒÏÇÒÁÍÍÎÏÇÏ ÏÂÅÓÐÅÞÅÎÉÑ ÉÚ ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÁËÅÔÏ× +GNU automake É autoconf. åÓÌÉ ÷Ù ÎÅ ÚÎÁËÏÍÙ Ó ÜÔÉÍ, ÔÏÇÄÁ ×ÏÚÍÏÖÎÏ ×ÁÍ +ÐÒÉÄ£ÔÓÑ ÐÏÄÏÖÄÁÔØ ÄÏ ÔÅÈ ÐÏÒ, ÐÏËÁ ÎÅ ÐÏÑ×ÑÔÓÑ ÒÅÌÉÚÙ Ardour, ÎÅ ÔÒÅÂÕÀÝÉÅ +ÓÂÏÒËÉ ÉÚ ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× (binary releases). + +1) ðòá÷éìøîïå éóðïìøúï÷áîéå GNU AUTOCONF +---------------------------------------- + +GNU autoconf ×ÅÓØÍÁ ÍÏÝÎÁÑ ÓÉÓÔÅÍÁ, ÏÄÎÁËÏ Õ ÎÅ£ ÉÍÅÅÔÓÑ ËÁË ÍÉÎÉÍÕÍ +ÏÄÉÎ ÓÕÝÅÓÔ×ÅÎÎÙÊ ÎÅÄÏÓÔÁÔÏË. ðÏ ÕÍÏÌÞÁÎÉÀ autoconf (aclocal) ×ÅÄ£Ô +ÐÏÉÓË ÔÒÅÂÕÅÍÙÈ ÆÁÊÌÏ× ÔÏÌØËÏ × ïäîïí ËÁÔÁÌÏÇÅ. üÔÏ ÎÏÒÍÁÌØÎÏ ÒÁÂÏÔÁÅÔ, +ËÒÏÍÅ ÓÌÕÞÁÅ×, ËÏÇÄÁ × ÓÉÓÔÅÍÅ ÕÓÔÁÎÏ×ÌÅÎÙ ÄÒÕÇÉÅ ÐÁËÅÔÙ, ÒÁÚÍÅÝÁÀÝÉÅ +Ó×ÏÉ ÆÁÊÌÙ autoconf ÉÌÉ × ËÁÔÁÌÏÇÅ /usr/local/lib/share/aclocal, +ÉÌÉ /usr/lib/share/aclocal. + +÷ ÒÅÚÕÌØÔÁÔÅ, autoconf ÞÁÓÔÏ ÎÅ ÍÏÖÅÔ ÎÁÊÔÉ ÆÁÊÌÙ, ÔÒÅÂÕÅÍÙÅ ÄÌÑ ÓÂÏÒËÉ +Ardour, Ë ÔÏÍÕ ÖÅ Õ ÍÎÏÇÉÈ ÐÏÌØÚÏ×ÁÔÅÌÅÊ ÏÄÎÏ×ÒÅÍÅÎÎÏ ÉÍÅÀÔÓÑ ËÏÐÉÉ +ÂÉÂÌÉÏÔÅË, ÕÓÔÁÎÏ×ÌÅÎÎÙÈ ÒÁÚÎÙÍÉ ÓÐÏÓÏÂÁÍÉ: ÉÚ ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× (ÆÁÊÌÙ +autoconf ÏÂÙÞÎÏ ÎÁÈÏÄÑÔÓÑ × ËÁÔÁÌÏÇÅ /usr/local/lib...) É ÉÚ ÓÏÂÒÁÎÎÙÈ +ÐÁËÅÔÏ× (× ÜÔÏÍ ÓÌÕÞÁÅ ÆÁÊÌÙ ÒÁÓÐÏÌÁÇÁÀÔÓÑ × ËÁÔÁÌÏÇÅ /usr/lib...). + +òÅËÏÍÅÎÄÕÅÔÓÑ ÕËÁÚÁÔØ ÒÁÓÐÏÌÏÖÅÎÉÅ ËÁÔÁÌÏÇÏ× autoconf ÐÕÔÅÍ ÏÐÒÅÄÅÌÅÎÉÑ +× ÐÅÒÅÍÅÎÎÏÊ ACLOCAL_FLAGS ×ÓÅÈ ÐÕÔÅÊ ÐÏÉÓËÁ. +óÎÁÞÁÌÁ ÎÁÊÄÉÔÅ ×ÓÅ aclocal ÄÉÒÅËÔÏÒÉÉ: + $ locate /aclocal/ +É ÐÒÏ×ÅÒØÔÅ (ÎÁÊÄÉÔÅ) ×ÓÅ ËÁÔÁÌÏÇÉ, ÓÏÄÅÒÖÁÝÉÅ ÆÁÊÌÙ Ó ÒÁÓÛÉÒÅÎÉÅÍ ".m4" . +úÁÔÅÍ ÚÁÄÁÊÔÅ ÐÅÒÅÍÅÎÎÕÀ ÏËÒÕÖÅÎÉÑ ACLOCAL_FLAGS, ËÁË ÕËÁÚÁÎÏ ÎÉÖÅ +(× ËÁÞÅÓÔ×Å ÐÒÉÍÅÒÁ): + + export ACLOCAL_FLAGS="-I /usr/share/aclocal -I /usr/local/share/aclocal -I /opt/gnome/share/aclocal" + +÷Ù ÍÏÖÅÔÅ ÄÏÂÁ×ÉÔØ ÜÔÕ ÓÔÒÏËÕ × ÆÁÊÌÙ .bashrc ÉÌÉ .profile × ×ÁÛÅÍ ÄÏÍÁÛÎÅÍ +ËÁÔÁÌÏÇÅ, ÏÎÁ ÂÕÄÅÔ ÉÓÐÏÌÎÑÔØÓÑ ËÁÖÄÙÊ ÒÁÚ ÐÒÉ ×ÈÏÄÅ × ÓÉÓÔÅÍÕ. + +----- +çÒÕÂÏÅ É ÍÅÎÅÅ ÄÅÌÉËÁÔÎÏÅ ÒÅÛÅÎÉÅ, ÏÐÉÓÁÎÎÏÅ ÎÉÖÅ, ÐÏÄÒÁÚÕÍÅ×ÁÅÔ ÓÌÉÑÎÉÅ +×ÓÅÈ ÄÉÒÅËÔÏÒÉÊ aclocal. üÔÏ ÎÅ ÍÏÖÅÔ ÂÙÔØ ÒÅËÏÍÅÎÄÏ×ÁÎÏ, ÈÏÔÑ ÜÔÏÔ +×ÁÒÉÁÎÔ ÔÁËÖÅ ÒÁÂÏÔÁÅÔ. + +ðÏÖÁÌÕÊÓÔÁ, ÐÒÏ×ÅÒØÔÅ ÓÏÄÅÒÖÉÍÏÅ ÏÂÅÉÈ ÄÉÒÅËÔÏÒÉÊ ÐÅÒÅÄ ÔÅÍ ËÁË ÄÅÌÁÔØ +"ÓÌÉÑÎÉÅ", ÞÔÏÂÙ ÓÌÕÞÁÊÎÏ ÎÅ ÓÔÅÒÅÔØ ËÏÒÒÅËÔÎÕÀ ×ÅÒÓÉÀ ËÏÐÉÊ ÆÁÊÌÏ× +autoconf: + + * åÓÌÉ Õ ×ÁÓ ÅÓÔØ ÏÂÁ ËÁÔÁÌÏÇÁ: + + cd /usr/lib/share/aclocal + cp *.m4 /usr/local/lib/share/aclocal + cd .. + rm -rf aclocal + ln -s /usr/local/lib/share/aclocal . + + * åÓÌÉ ÉÍÅÅÔÓÑ ÔÏÌØËÏ /usr/lib/share/aclocal + + cd /usr/local/lib + ln -s /usr/lib/share/aclocal . + +÷ ÎÅËÏÔÏÒÙÅ ÄÉÓÔÒÉÂÕÔÉ×ÁÈ linux aclocal ÎÁÈÏÄÉÔÓÑ × ÒÁÚÌÉÞÎÙÈ ÍÅÓÔÁÈ. + + +2. ëïíðéìñãéñ +------------- + +ðÅÒÅÄ ÔÅÍ ËÁË ËÏÍÐÉÌÉÒÏ×ÁÔØ Ardour ÕÂÅÄÉÔÅÓØ, ÞÔÏ Õ ×ÁÓ ÕÓÔÁÎÏ×ÌÅÎÙ +ÓÌÅÄÕÀÝÉÅ ËÏÍÐÏÎÅÎÔÙ: + +* ðÒÏÇÒÁÍÍÙ É ÕÔÉÌÉÔÙ: + + gcc/g++ ×ÅÒÓÉÉ 2.95.3 ÉÌÉ ×ÙÛÅ (gcc/g++ 3.x works also) + autoconf 2.52 ÉÌÉ ×ÙÛÅ + automake 1.5 ÉÌÉ ×ÙÛÅ + libtool 1.4.2 ÉÌÉ ×ÙÛÅ + gettext 0.11.5 ÉÌÉ ×ÙÛÅ + pkgconfig 0.8.0 ÉÌÉ ×ÙÛÅ + http://www.freedesktop.org/software/pkgconfig/ + ÔÒÅÂÕÀÔÓÑ ÔÁËÖÅ lex É yacc. + ÌÀÂÁÑ ×ÅÒÓÉÑ bison >= 1.35 ÄÏÌÖÎÁ ÒÁÂÏÔÁÔØ. + +* âÉÂÌÉÏÔÅËÉ: + +òÅËÏÍÅÎÄÕÅÍÙÅ ×ÅÒÓÉÉ, ËÏÔÏÒÙÅ ÄÏÌÖÎÙ ÒÁÂÏÔÁÔØ, ÐÏËÁÚÁÎÙ ÎÉÖÅ. + + ALSA 0.9.X (CVS ÉÌÉ ÔÅËÕÝÉÊ ÒÅÌÉÚ) (http://www.alsa-project.org) + + JACK (http://jackit.sourceforge.net) + + libxml2 2.5.X (http://xmlsoft.org/) + + libart_lgpl 2.3.X + + - ÏÂÙÞÎÏ Ñ×ÌÑÅÔÓÑ ÞÁÓÔØÀ gnome-libs, ËÏÔÏÒÙÅ ËÁË ÐÒÁ×ÉÌÏ + ÕÖÅ ÕÓÔÁÎÏ×ÌÅÎÙ + + - × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ×Ù ÍÏÖÅÔÅ ÚÁÇÒÕÚÉÔØ ÂÉÂÌÉÏÔÅËÕ Ó FTP-ÓÁÊÔÁ + ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× GNOME. + - ÓÍ. ftp://ftp.gnome.org/pub/GNOME/MIRRORS.html + É ÉÝÉÔÅ × sources/libart_lgpl + + glib 1.2 (http://www.gtk.org) + glib-1.2.8 (×ËÌÀÞÅÎÏ × ÂÏÌØÛÉÎÓÔ×Ï ÄÉÓÔÒÉÂÕÔÉ×Ï×) + + GTK+ 1.2 (http://www.gtk.org) + gtk+-1.2.8 (×ËÌÀÞÅÎÏ × ÂÏÌØÛÉÎÓÔ×Ï ÄÉÓÔÒÉÂÕÔÉ×Ï×) + + libsndfile (http://www.zip.com.au/~erikd/libsndfile) + libsndfile-1.0 ÉÌÉ ×ÙÛÅ + + libsamplerate (http://www.mega-nerd.com/SRC/) + libsamplerate 0.0.13 ÉÌÉ ×ÙÛÅ + + the LADSPA SDK (http://www.ladspa.org/) + (ÓÍ. ÎÉÖÅ) + + raptor (http://www.redland.opensource.ac.uk/raptor/) + + lrdf (needs raptor) (http://plugin.org.uk/lrdf/) + liblrdf 0.4.0 ÉÌÉ ×ÙÛÅ + +õÓÔÁÎÏ×ËÁ LADSPA +---------------- + +óÅÇÏÄÎÑ ÏÐÉÓÁÎÉÅ ÉÎÔÅÒÆÅÊÓÁ Linux Audio Developers Simple Plugin API +(LADSPA) ÓÏÄÅÒÖÉÔ ÔÏÌØËÏ ÚÁÇÏÌÏ×ÏÞÎÙÊ ÆÁÊÌ (header file), ËÏÔÏÒÙÊ +ÕÖÅ ×ËÌÀÞ£Î × ÄÅÒÅ×Ï ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× Ardour. + +ôÅÍ ÎÅ ÍÅÎÅÅ, ×Ù ÍÏÖÅÔÅ ÚÁÈÏÔÅÔØ ÕÓÔÁÎÏ×ÉÔØ É ÍÏÄÕÌÉ LADSPA plugins, +ËÏÔÏÒÙÅ ×ÈÏÄÑÔ × ÓÏÓÔÁ× ÐÏÌÎÏÇÏ ÐÁËÅÔÁ LADSPA SDK. åÇÏ ÍÏÖÎÏ ÎÁÊÔÉ É +ÚÁÇÒÕÚÉÔØ (ÒÁÚÍÅÒ ÐÁËÅÔÁ ÎÅÂÏÌØÛÏÊ) ÐÏ ÁÄÒÅÓÕ www.ladspa.org. + +ôÁËÖÅ, Ñ ÒÅËÏÍÅÎÄÕÀ ÚÁÇÒÕÚÉÔØ ÐÒÅËÒÁÓÎÙÊ ÎÁÂÏÒ ÍÏÄÕÌÅÊ (plugins) LADSPA +ÏÔ Steve Harris Ó ÓÁÊÔÁ http://plugin.org.uk/. üÔÏ ÎÁÍÎÏÇÏ ÐÏ×ÙÓÉÔ +ÐÏÌÅÚÎÙÅ ×ÏÚÍÏÖÎÏÓÔÉ Ardour. óÏ ×ÒÅÍÅÎÅÍ ÐÏÑ×ÑÔÓÑ É ÄÒÕÇÉÅ ÍÏÄÕÌÉ LADSPA, +ÞÔÏÂÙ ÂÙÔØ × ËÕÒÓÅ - ÓÌÅÄÉÔÅ ÚÁ ÁÎÏÎÓÁÍÉ × ÓÐÉÓËÅ ÒÁÓÓÙÌËÉ Linux Audio +Development. + +2A) ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ ÉÚ CVS +------------------------- + +úÁÇÒÕÚÉÔÅ ÉÌÉ ÏÂÎÏ×ÉÔÅ ÄÅÒÅ×Ï ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× Ardour ÉÚ CVS. (÷ ÐÒÉ×ÅÄ£ÎÎÏÍ +ÎÉÖÅ ÐÒÉÍÅÒÅ ÓÉÍ×ÏÌ '%' ÏÚÎÁÞÁÅÔ ÐÒÉÇÌÁÛÅÎÉÅ ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ): + +% cd /usr/local/src # × ËÁÞÅÓÔ×Å ÐÒÉÍÅÒÁ, ×Ù ÍÏÖÅÔÅ ÓÄÅÌÁÔØ ÜÔÏ ÇÄÅ + ÐÏÖÅÌÁÅÔÅ +% cvs -d:pserver:anoncvs@ardour.org:/cvsroot/ardour login + # (ÎÁÖÍÉÔÅ Enter/Return ËÏÇÄÁ ÐÏÑ×ÉÔÓÑ ÐÒÉÇÌÁÛÅÎÉÅ + Ë ××ÏÄÕ ÐÁÒÏÌÑ) +% cvs -d:pserver:anoncvs@ardour.org:/cvsroot/ardour -z3 co ardour + +2A.1) þåí òáúìéþáàôóñ óðïóïâù óâïòëé éú CVS ? +--------------------------------------------- +éÔÁË, ×ÁÍ ÎÕÖÎÏ ÒÅÛÉÔØ, Ñ×ÌÑÅÔÅÓØ ÌÉ ×Ù ÒÁÚÒÁÂÏÔÞÉËÏÍ ardour ÉÌÉ +ÐÏÌØÚÏ×ÁÔÅÌÅÍ. åÓÌÉ ×Ù ÏÔÎÏÓÉÔÅ ÓÅÂÑ Ë ÐÅÒ×ÙÍ ÉÚ ÐÅÒÅÞÉÓÌÅÎÎÙÈ, ÔÏ ×ÏÚÍÏÖÎÏ +ÕÓËÏÒÉÔØ ÒÁÂÏÔÕ, ÓÏÂÒÁ× ÂÉÂÌÉÏÔÅËÕ libardour ËÁË ÒÁÚÄÅÌÑÅÍÕÀ. üÔÏ ÐÏÚ×ÏÌÉÔ +ÉÚÂÁ×ÉÔØÓÑ ÏÔ ÐÅÒÅÌÉÎËÏ×ËÉ ÐÏÓÌÅ ËÁÖÄÏÇÏ ×ÎÅÓÅÎÉÑ ÉÚÍÅÎÅÎÉÊ × ÜÔÕ ÂÉÂÌÉÏÔÅËÕ. +åÓÌÉ ×Ù ÐÒÏÓÔÏ ÐÏÌØÚÏ×ÁÔÅÌØ, ÜÔÏÔ ÛÁÇ ÌÉÛØ ÏÓÌÏÖÎÉÔ ×ÁÍ ÖÉÚÎØ. éÔÁË, +ÅÓÌÉ ×Ù ÒÁÚÒÁÂÏÔÞÉË, ÔÏÇÄÁ ×ÙÐÏÌÎÉÔÅ ÓÌÅÄÕÀÝÕÀ ËÏÍÁÎÄÕ: + + touch ardour/libs/ardour/BUILD_FOR_DEVELOPMENT + +ôÅÐÅÒØ ÂÉÂÌÉÏÔÅËÁ libardour ÂÕÄÅÔ ÓËÏÍÐÉÌÉÒÏ×ÁÎÁ ËÁË ÒÁÚÄÅÌÑÅÍÁÑ (shared). +ôÁËÖÅ ×Ù ÄÏÌÖÎÙ ÉÓÐÏÌØÚÏ×ÁÔØ ËÌÀÞ --enable-development-build × ËÏÍÁÎÄÅ +configure. + +2A.2) ðïäçïôï÷ëá ë óâïòëå éú éóèïäîùè ôåëóôï÷ +--------------------------------------------- + +óÏÚÄÁÊÔÅ autoconf/automake ÆÁÊÌÙ: + +% cd ardour +% sh autogen.sh + +ôÅÐÅÒØ ÐÅÒÅÈÏÄÉÍ Ë ÐÕÎËÔÕ 3. + +2B) óâïòëá éú áòèé÷á éóèïäîùè ôåëóôï÷ (tar.gz) +---------------------------------------------- + +÷Ó£ ËÁË ÏÂÙÞÎÏ, ÚÁÇÒÕÚÉÔÅ É ÒÁÓÐÁËÕÊÔÅ ÁÒÈÉ×. æÁÊÌÙ ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× +ÂÕÄÕÔ ÎÁÈÏÄÉÔØÓÑ × ËÁÔÁÌÏÇÅ Ó ÉÍÅÎÅÍ ardour-<ÎÏÍÅÒ ×ÅÒÓÉÉ>. + +3) ëáë óëïíðéìéòï÷áôø +--------------------- + + ./configure (Ó ÌÀÂÙÍÉ ÏÐÃÉÑÍÉ ËÏÔÏÒÙÅ ÐÏÖÅÌÁÅÔÅ) + make + make install + +åÓÌÉ ×Ù Ñ×ÌÑÅÔÅÓØ ÒÁÚÒÁÂÏÔÞÉËÏÍ É ÎÁÍÅÒÅ×ÁÅÔÅÓØ ÐÏÒÁÂÏÔÁÔØ ÎÁÄ libardour, +ÉÓÐÏÌØÚÕÊÔÅ ÏÐÃÉÀ --enable-development-build, ËÏÔÏÒÁÑ ×ËÌÀÞÁÅÔ ÄÉÎÁÍÉÞÅÓËÕÀ +ÌÉÎËÏ×ËÕ ardour É ÅÇÏ ÂÉÂÌÉÏÔÅË. üÔÏ ÐÏÚ×ÏÌÉÔ ÓÜËÏÎÏÍÉÔØ ×ÒÅÍÑ, ÔÁË ËÁË +ÐÏÚ×ÏÌÉÔ ÉÚÂÅÖÁÔØ ÍÅÄÌÅÎÎÏÊ ÐÒÏÃÅÄÕÒÙ ÓÔÁÔÉÞÅÓËÏÊ ÌÉÎËÏ×ËÉ ËÁÖÄÙÊ ÒÁÚ, ËÁË +×Ù ÐÏÍÅÎÑÅÔÅ ÞÔÏ-ÌÉÂÏ × libardour. + +åÓÌÉ ×Ù ÈÏÔÉÔÅ ÓËÏÍÐÉÌÉÒÏ×ÁÔØ Ardour ÔÁË, ÞÔÏÂÙ × ÄÁÌØÎÅÊÛÅÍ ÅÇÏ ÍÏÖÎÏ +ÂÙÌÏ ÚÁÐÕÓÔÉÔØ × ÏÔÌÁÄÞÉËÅ, ÉÓÐÏÌØÚÕÊÔÅ ÏÐÃÉÀ --disable-optimize. +÷ ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ Ardour ÂÕÄÅÔ ÓÏÂÒÁÎ Ó ÍÁËÓÉÍÁÌØÎÏÊ ÏÐÔÉÍÉÚÁÃÉÅÊ, +ÞÔÏ ÐÏÍÅÛÁÅÔ ÜÆÆÅËÔÉ×ÎÏÊ ÏÔÌÁÄËÅ. + +ëÁË ÏÂÙÞÎÏ × ËÏÍÁÎÄÅ ./configure ×Ù ÍÏÖÅÔÅ ÉÓÐÏÌØÚÏ×ÁÔØ ÏÐÃÉÉ --prefix +É --sysconfdir, ÞÔÏÂÙ ÉÚÍÅÎÉÔØ ÒÁÓÐÏÌÏÖÅÎÉÅ ÆÁÊÌÏ× ÐÒÏÇÒÁÍÍÙ. ïÎÉ ÂÕÄÕÔ +ÐÏÍÅÝÅÎÙ ÐÏ ÕËÁÚÁÎÎÙÍ ÐÕÔÑÍ ËÏÍÁÎÄÏÊ "make install". + +ëÏÍÐÉÌÉÒÏ×ÁÎÉÅ ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× ÍÏÖÅÔ ÚÁÎÑÔØ ÎÅËÏÔÏÒÏÅ ×ÒÅÍÑ. ë ÐÒÉÍÅÒÕ, +Ó ËÌÀÞÏÍ - j3 ÎÁ ÓÉÓÔÅÍÅ dual PII-450 ÚÁÎÉÍÁÅÔ ÏËÏÌÏ 20 ÍÉÎÕÔ. diff --git a/DOCUMENTATION/CONTRIBUTORS b/DOCUMENTATION/CONTRIBUTORS new file mode 100644 index 0000000000..6e6fa2697a --- /dev/null +++ b/DOCUMENTATION/CONTRIBUTORS @@ -0,0 +1,61 @@ +In addition to those listed in the AUTHORS file, the following people +are among those who offered financial support, design insights and +ideas, encouragement, feedback, bug reports and much more during +Ardour's pre-release development. They generally suffered from days of +frustration, and withstood hundreds of CVS revisions without +complaint. + +No thanks or praise is sufficient for their contributions to Ardour. + +(in no particular order) + +Joe Hartley +Marek Peteraj +Ryan Gallagher +Rob Holland +Jan Depner +Bryan Koschmann +Patrick Shirkey +Rob Fell +Ant +Chris Ross +Joshua Pritikin +Rohan Drape +Johan De Groote +Bob Ham + +I would particularly like to recognize: + +Frank Carmickle + - first financial supporter of Ardour, + instigator of ardour/ksi. + +Ron Parker (Minneapolis, MN) + - first user of Ardour in a commercial studio, + financial contributor, major initiator of + MTC and MMC functionality. + +DuWayne Holsbeck + - an early financial and infrastructure sponsor + +Havoc Pennington & Owen Taylor + - provided much assistance in understanding, diagnosing and + cajoling GTK+. + +Tom Pincince (Shasta, CA) + - provided continuous, excellent design insights and + rationalizations, as well as info on the operation of some + existing DAW's. + +I would also like to thank Jim Hamilton of Rittenhouse Recording, +Philadelphia, for the partnership, friendship and foresight he showed +in allowing me to use the studio as the development basis for +Ardour. I met Jim playing a jazz drumkit at a fundraiser to celebrate +the 30th anniversary of our children's nursery school. Since then, he +has continued to open my eyes to both music itself, the process of +making music, and the life of a working musician. Jim's the best and +most inventive percussionist I have ever seen, and one of the best +I've ever heard. He has always believed in the social and philosphical +implications of Ardour, and his support and interest have been vital +in Ardour's development. Although as of this writing, Rittenhouse +Recording is not running Ardour, its only a matter of time! diff --git a/DOCUMENTATION/CONTRIBUTORS.es b/DOCUMENTATION/CONTRIBUTORS.es new file mode 100644 index 0000000000..73c49c8469 --- /dev/null +++ b/DOCUMENTATION/CONTRIBUTORS.es @@ -0,0 +1,82 @@ +Ademas de aquellos que aparecen mencionados en el archivo AUTHORS.es, +las siguientes personas estan entre aquellas que ofrecieron soporte +financiero, observaciones de disenio e ideas, animo, aportes, reportes +de bugs (errores en codigo) y mucho mas durante el desarrollo del +pre lanzamiento de Ardour. Generalmente, ellos sufrieron de dias de +frustracion y soportaron cientas de revisiones de CVS sin quejas. + +Ninguna plegaria o agradecimiento posible es suficiente por sus +contribuciones a Ardour. + +(en ningun orden en particular) + +Joe Hartley +Marek Peteraj +Ryan Gallagher +Rob Holland +Jan Depner +Bryan Koschmann +Patrick Shirkey +Rob Fell +Ant +Chris Ross +Joshua Pritikin +Rohan Drape +Johan De Groote +Bob Ham + +Quisiera destacar particularmente a: + +Frank Carmickle + - primer brinadador de soporte financiero a Ardour, + instigador de ardour/ksi. + +Ron Parker (de Minneapolis, MN) + - primer usuario de Ardour en un estudio comercial, + contribuidor financiero, iniciador mayor de + funcionalidad MTC and MMC. + +DuWayne Holsbeck + - dominio de disenio de sponsors linuxaudiosystems.com , + configuro la base de datos bugzilla y mas. + +Havoc Pennington & Owen Taylor + - brindaron mucha asistencia en cuanto a comprension, + diagnostico y simplificacion de GTK+. + +Tom Pincince (de Shasta, CA) + - contribuyo continuas y exceles observaciones de disenio y + racionalizaciones, asi como informacion acerca de + estaciones de trabajo de audio digital existentes. + +Tambien quisiera agradecer a Jim Hamilton de Rittenhouse Recording, +Philadelphia, for el companierismo, amistad y vision que demostro +al permitirme usar el estudio como base de desarrollo para Ardour. +Conoci a Jim tocando percusion jazz en un evento de recaudacion de +fondos para celebrar el 30imo aniversario de la guarderia escolar de +nuestros hijos. Desde entonces me ha abierto los ojos a ambos, la musica +misma, el proceso de hacer musica y la vida de un musico trabajando. +Jim es el mejor y mas inventivo percusionista que haya visto, y uno +de los mejores que he oido. El siempre ha creido en las implicaciones +filosoficas y sociales de Ardoury su soporte e interes han sido vitales +en el desarrollo de Ardour. Es solo cuestion de tiempo hasta que +Rittenhouse Recording use Ardour. + + + + + + + + +Nota de Traduccion (Spanish Translation Note) +--------------------------------------------- +#Nota del tipeo:la letra pronunciada ENIE aparece en este archivo +#como ni (letra "n" y letra "i") para mayor compatibilidad con todos +#los visores de texto. +#Asi mismo no se han aplicado las tildes(acentos). +#Estos no son errores de tipeo. Si llegara a encontrar algun otro error +#en cualquiera de los archivos con extension ".es" por favor +#hagamelo saber a alexkrohn@fastmail.fm +# Muchas gracias +# Alex \ No newline at end of file diff --git a/DOCUMENTATION/FAQ b/DOCUMENTATION/FAQ new file mode 100644 index 0000000000..6ac38e8f2f --- /dev/null +++ b/DOCUMENTATION/FAQ @@ -0,0 +1,613 @@ +The Ardour FAQ +January 23, 2004 + +--Problems-- +1.1. Why can't I get configure to run when ... +1.2. I'm getting syntax errors during build. +1.3. I get the warning: "Gtk-WARNING **: Unable to locate image file in +1.4. What's an xrun? +1.5. The region area overlaps the buttons in the editor. +1.6. Ardour keeps freezing. Here's the strace... +1.7. What is "ardev" and why is it a shell script? +1.8. How do I debug this thing? +1.9. I want Ardour to run faster. + +--Features-- +2.1. Are plugins supported? +2.2. Are VST plugins supported? +2.3. Does Ardour run on non-Linux systems? +2.4. Ardour needs to have this feature now. +2.5. Why doesn't Ardour support MP3s? +2.6. Does Ardour support MIDI? +2.7. What soundfile formats are supported? +2.8. Can I use multiple cards? +2.9. How do I save captures across partitions? + +--Usability-- +3.1. How do I pan stereo outputs? +3.2. Where's the patch bay? +3.3. How do I do stuff? + +--Misc-- +4.1. What's the deal with JACK, LAAGA, and Audioengine? +4.2. Is Ardour internationalized? +4.3. How do I get support? +4.4. Well, where's the manual? +4.5. Why are all these libraries included? I already have ... +4.6. Why not another frontend to libardour? Why not QT? + +-------------------------------------------------------------------------------- + +--Problems-- +1.1. Why can't I get configure to run when ... + +You can only run configure at the top level of the Ardour source +tree. You don't want to know why this is true. Don't try to work +around it. + +1.2. I'm getting syntax errors during build. + +This probably means that you are using an out of date library. Or you +might be using a very new library that has changed its API. Check the +version number. If it is lower than what is listed in the BUILD file, +update your library. If it is higher than what is listed in the BUILD file, +email the mailing list. Note that you have to be a member of the mailing +list to send mail to it, which is done to prevent the list from receiving +much spam. + +1.3. I get the warning: "Gtk-WARNING **: Unable to locate image file in + pixmap_path: "set-next-button.xpm" + +The most common cause of this error is simply that you have not set +the pixmap pathname correctly. It can be specified in the Ardour +config file. See the BUILD file. + +1.4. What's an xrun? + +It's a generic term used to describe a situation where the software +did not keep up with the hardware, either by feeding it data, or by +collecting data from it. It generally means that you're having +trouble with latency. This can be caused by several factors. You +could have a misconfigured system, you might be trying to do to much, +or both. + +If you're haven't read http://www.linuxdj.com/audio/lad/resourceslatency.php3, +then your system is probably misconfigured. + +If you are running many many tracks, with multiple LADSPA plugins, then it +is possible that your system just can't keep up with what you want to do. +Either simplify your music, or upgrade your machine. A dual processor does +wonders. + +You can test your setup with the latencytest tool, available at +http://www.linuxdj.com . + +Jan Depner's HOWTO is loaded with latency tuning tips for Ardour: +http://myweb.cableone.net/eviltwin69/ALSA_JACK_ARDOUR.html + +1.5. The region area overlaps the buttons in the editor. + +Make sure that you are using the appropriate font size for your monitor's +resolution. If you are running at 1024x768 or below, you should use the +75dpi package, not the 100dpi. This is usually set in /etc/X11/XF86Config. + +1.6. Ardour keeps freezing. Here's the strace... + +The results from strace aren't very useful. To provide helpful information +to the developers, run Ardour under gdb. If you don't know how to use +gdb, this isn't the time to learn. If you do know how to use gdb, read +section 1.8. + +1.7. What is "ardev" and why is it a shell script? + +This is only applicable if configure was run with --enable-development-build. + +To speed up the process of developing Ardour, we do not statically +link Ardour and its library, libardour. Instead, we use dynamic +linking, which allows the developers to avoid the (very) long +relinking step when they make certain kinds of changes to libardour. + +This means that the executable image for Ardour relies on the system +being able to find libardour whenever you start it. Rather than leave +this to chance and/or the whims of your system adminstrator (probably +yourself), we instead use a short shell script to make sure that the +connection between the two of them can be established. + +This has almost zero impact on any aspect of Ardour's operation. The +only noticeable effect is that it makes debugging slightly more +difficult. See 1.8 for more on this. + +1.8. How do I debug this thing? + ++-------------------------------------------------------------------------+ +| NOTE: Newer versions of gdb and/or glibc and/or the kernel have broken +| gdb in a critical way that make it impossible to run ardour. The gdb +| development group claim to have fixed this, but on many +| distributions, the version that is provided is still broken. +| +| Under such circumstances, you will have to get a core dump from +| ardour, and then use gdb to analyse the core dump, rather than +| using gdb as a "live tool". +| +| Many distributions set the default core dump size to 0, to prevent +| core dumps completely. So the first step is to do enter this +| at your shell prompt (in a terminal window): +| +| ulimit -c 9999999999 +| +| Then run ardour in whatever way causes a crash. after the crash +| you should find a file called "core" in your working directory. +| then run: +| +| gdb ardour core +| +| When the gdb> prompt appears, type +| +| backtrace +| +| Collect the output, and file it as an attachment to a Mantis +| bug report at http://ardour.org/mantis +| +| Thanks for helping to improve Ardour. ++------------------------------------------------------------------------+ + +A) How to start gdb .... + +A1) IF YOU DID NOT USE --enable-development-build + +You can use gdb the usual way: + + % cd /where/you/built/ardour + % gdb ardour + + +A2) IF YOU USE --enable-development-build + +The first and most basic thing you need to know is how to invoke +gdb. Because of the dynamic linking between Ardour and its library you +can't just invoke Ardour and get it to work. Besides, "ardour" itself +is a shell script (see 1.10 for more on this). So, what you need to do +is to invoke gdb with LD_LIBRARY_PATH set to point to the place where +libardour is installed, and use the name of actual executable image. + +If you installed in the default location, this command will invoke gdb +correctly: + + env LD_LIBRARY_PATH=/usr/local/lib/ardour gdb /usr/local/lib/ardour/ardourx + +If you used a --prefix argument during the build process so that +Ardour would be installed somewhere other than under /usr/local, then +replace /usr/local in the command above with whatever "prefix" you +used. + +You could easily make the above a shell alias or a 1 line shell script +if you think you'll be debugging Ardour with gdb a lot. + +A3) ABOUT LADSPA PLUGINS AND GDB + +Moving all your LADSPA plugins out of the way will make gdb very much +quicker to start. For example, if you normally keep them in +/usr/local/lib/ladspa, you could do something like: + + mkdir /usr/local/lib/LADSPA + mv /usr/local/lib/ladpsa/* /usr/local/lib/LADSPA + +gdb doesn't do very well when forced to handle dozens of dynamically +loaded objects, as typically happens with LADSPA plugins. + +It might be easier to redefine LADSPA_PATH to a dummy path. + +B) What to do with gdb + +When Ardour has crashed or is "stuck", issue the following command +to gdb (you will need to use Ctrl-C if its "stuck" to get back to the +gdb command prompt): + + thread apply all bt + +collect the output from this, and then go to + + http://ardour.org/mantis + +and file a new bug report with the output attached. This will allow +us to get the most out of your misfortune. + +If you compiled ardour from source and want to be even more helpful, +recompile it after running + + ./configure --disable-optimize + +at the top level. This will make the debugging output more useful. + +1.9. I want Ardour to run faster. + +The --enable-optimize flag is enabled by default which turns +on compiler features that can make Ardour run up to 50% faster. +If you downloaded Ardour as a binary package, it should have been +compiled with that flag already. + +--Features-- +2.1. Are plugins supported? + +LADSPA plugins are supported. To use them, click the middle mouse +button in the top box at the top of the mixerstrip you wish to have a +plugin for. This opens up a window which lists all the plugins. Double +click on the one you wish to use. In the mixer window, click on the +plugin to toggle it on and off, option-click to edit its values, or +shift-click to remove it. + +2.2. Are VST plugins supported? + +There are several issues here: + +1) Generic VST support + + Many people have asked about VST support within Ardour. Work has been + done on this, but there are both license issues and technical + ones. The licensing issues seem relatively easy to resolve. + + On the technical front, given that the goal is to not require VST + developers to build new native Linux versions of their plugins, the + most promising approach involves using Wine to support native + Windows VST plugins. It is already possible to run most VST plugins as + JACK clients and thus use them as inserts with Ardour, but the process + of doing so is not what most users would term "convenient". + + However, Wine cannot currently be used within a complex + multithreaded application. The Wine development team are working on + this, and as a rough guess, I'd expect progress within about 6 months + (i.e end of 2003). At that time, it will be possible to use most VST + plugins that have their own GUI ("editor") from within Ardour. + + However, initially, this functionality will be available only as + part of a for-cost distribution of Ardour. + +2) Specific plugins + + a) executable format issues + + Plugins are pieces of executable code. The format used for + the files that store this code is different under windows + and macos than it is for linux. Some people have managed + to find workarounds for this --- there are reports of people + running windows-derived buzz plugins under linux, but nobody + has looked into trying it with vst plugins. + + Linux also runs on a lot more hardware than windows or MacOS. + We assume that when you say linux, you mean "linux on an intel + compatible processor", but keep in mind that to most of us, + linux means more than that --- it includes the PPC, Sparc, Alpha, + ARM, MIPS and many other chip architectures. Of that list, + only PPC has any VST plugin support at all. + + This problem would go away if a VST plugin was available as source + code, but to my knowledge, only 1 is (freeverb). + + b) OS dependency issues + + Most VST plugin writers do not follow Steinberg's design advice, + and write plugins that have operating system dependencies. As + a result, even if you could find a way to actually use, say, + a windows-format VST plugin on Linux on an Intel machine, the + plugin would contain calls to operating system services that + don't exist (in the same way) under Linux. + +So, the basic answer is "no". I am an active member of the VST-plugins +mailing list, and I try to encourage people who write free plugins to +make their source code available so that we can use it under Linux, as +well as reminding people to try to avoid operating system dependencies +in their plugins. I think this mostly falls on deaf ears. + +2.3. Does Ardour run on non-Linux systems? + +Ardour depends on the JACK system to access the sound hardware. Jack +has (as of this writing) support for Linux, Solaris, and MacOSX. There +have not been any reports of running Ardour on any platforms besides Linux +though. + +In addition, Ardour has abstracted the JACK dependency, so it can be ported +to use another sound library. But at the time, it only uses the JACK +library. The JACK website is http://jackit.sf.net/. + +2.4. Ardour needs to have this feature now. + +Paul accepts donations through his paypal account. The feature will +(probably) be added more quickly if you pay him. Contact him first. + +2.5. Why doesn't Ardour support MP3s? + +Ardour is meant for serious audio work. MP3 is a lossy format +unsuitable for this. Ardour does export sessions to wav format, which +is trivial to convert to MP3. + +2.6. Does Ardour support MIDI? + +Ardour currently supports MIDI in the sense of: + + * functioning as a MIDI Timecode master (it generates MTC) + * functioning as a MIDI Timecode slave (experimental; send reports!) + * understanding MIDI Machine Control + * allowing the user to bind GUI controls (sliders, etc.) to + MIDI Continuous Controller and NoteOn/NoteOff messages + +It does not offer any facilities for editing or arranging or recording +or playing MIDI data. There has been talk of integrating Midi +Mountain, an excellent midi editor. There hasn't been any progress in +this direction lately, mostly due to other areas that need to be fixed +up. It's not a trivial affair if the integration is going to proceed +in a way leaves the result feeling "natural". + +2.7. What soundfile formats are supported? + +It depends on what version of libsndfile is installed. This link lists the +latest formats: http://www.mega-nerd.com/libsndfile/#Features + +Please note that Ardour requires the 1.x series of libsndfile. + +2.8. Can I use multiple cards? + +In a word: maybe. + +The sync issues that arise even between the same make and model of a card +aren't worth the effort of fixing. If you want to have more than two +channels, buy a professional card. + +On the other hand, if you already have two professional cards with word-sync, +you might be able to get them to work. This is several layers removed from +Ardour; the proper place to ask for help is at http://www.alsa-project.org . + +There is more information at http://www.linuxdj.com/audio/quality/#multi + +2.9. How do I save captures across partitions? + +Ardour lets you specify multiple directories to save captured audio +in. In the options editor, in the session path box, specify the full +paths of the directories you wish to use, seperated by colons (:). +These can be on different partitions or even different disks. Using +this "software RAID"-like setup can greatly increase your disk +bandwidth. + +--Usability-- +3.1. How do I pan stereo outputs? + +Panning works over JACK ports. So even if you have two outputs +connected to one port, Ardour doesn't consider this to be stereo. You +need to make sure that you have two ports, and then add one (or more) +destination to each port. + +You need to think of the ports as if they were physical sockets to +which you can connect as many plugs as you want. A single port means +mono, even though you can send the signal to many different +places. Two ports means stereo, even though the right and left signals +can each go to any number of different places. + +3.2. Where's the patch bay? + +There is no separate dedicated patch bay. Patch bay functionality +is integral to the mixer. The mixer can have any number of inputs, +any number of busses, etc. In other words, it *is* the patchbay. + +3.3. How do I do stuff? + +Region Dragging (object mode) +----------------------------- + + click-drag => moves region + shift-click-drag => moves region with time position held constant + (i.e. across tracks) + ctl-click-drag => moves a copy of the region + ctl-shift-click-drag => time-constrained movement of a copy of the + region + snapmod-click-drag => ignores current snap setting + +Region Alignment (clicks without motion) +---------------- + + [ all alignment uses: + + 1) current region selection, if it exists + 2) else the edit cursor + ] + + ctl-click => aligns start of region + ctl-shift-click => aligns end of region + ctl-alt-click => aligns sync point of region + +Marks +----- + + click in tempo track to create a new tempo mark + click in meter track to create a new meter mark + click in marker track to create a new marker + regular edit op for tempo/meter allows editing + regular delete op for all markers (except initial + tempo/meter markers) + snapmod-click-drag to move a marker while ignoring + current snap mode + +Editing +------- + + default is ctl-button3 click + + +Deletion +-------- + + default is shift-button3 click + +Context Menu +------------ + + button3 click + +Snap Modifier +------------- + + default is mod3 (typically meta/windows/start key). using + ctl or shift or alt will cause problems. you can also + use combinations, but again, combinations using ctl and shift + will cause problems. mod3 or mod4 are probably your best + choices. + +Selection (RANGE MODE required) +--------- + + click on a region => make a region selection + shift-click on a region => add region to region selection + click-drag => make a range selection + shift-click-drag => add to range selection + ctrl-click-drag => move selection + +Separation +---------- + + in range mode: + + a) make a single range selection + + then, to split existing region apart + + b) right click => Selection => Separate region + + OR, to creates a new region without splitting original + + b) switch to object mode + c) click on selection and drag + + +solo/mute/rec-enable +-------------------- + + to toggle solo/mute/RE for EVERYTHING: + + ctl-shift-click on a solo/mute/RE button + + to solo/mute/RE mix group (when group is not active) + + ctl-click on solo/mute button + + to toggle solo-safe status (which appears to not work + correctly right now) + + shift-click on solo button + + to momentarily engage solo while pressing a mouse button + + use button2 instead of button1 + + +gain sliders +------------ + + shift-click to reset to 0dB + ctl-click-drag for finer scale + ctl-alt-click-drag for even finer scale + +panners +------- + + (stereo): shift-click to reset to center + +--Misc-- +4.1. What's the deal with JACK? + +JACK is the Jack Audio Connection Kit. There is a basic problem with +audio+MIDI apps on Linux at this time: they are not able to exchange +data with each other in situations where low latency is a system goal. +There are systems (aRts, MidiShare, parts of alsa-lib) that allow data +sharing, but not when the latencies get down below 20ms. + +JACK is an API that solves this problem. Also, and quite importantly, +JACK drastically simplifies the programming of audio applications. +Applications that use JACK do not need to know anything about audio +hardware. They do not interact with it directly in any way +whatsoever. All they do is provide a few callbacks to the server they +connect with; the primary callback is responsible for producing and/or +consuming a specified amount of data whenever it is called. This is a +'callback' model, and is extremely different from ALSA, OSS, and +several other audio APIs. It is, however, very similar to Apple's +CoreAudio, Steinberg's ASIO, the PortAudio library, and most plugin +APIs. See http://jackit.sf.net/ + +4.2. Is Ardour internationalized? +Parts of Ardour are. Work is ongoing to fully internationlize Ardour. If +you speak a language besides English, feel free to volunteer to help +translate. + +These languages have translations: + +gtk-ardour: +French, German, Italian, Portuguese, Brazilian Portuguese, and Russian + +libardour: +Italian + +4.3. How do I get support? + +Ardour is a volunteer project. There is no one devoted to providing +support. However, there is a members only mailing list where someone +might answer your question. You can join at Ardour's website: + + http://ardour.org/ + +There is also the IRC #ardour channel on the FreeNode network. + +Alternatively, you can pay Paul for specific support. Check with him +for hourly rates. + +4.4. Well, where's the manual? + +Currently, the existing documentation is sparse. You might want to check out +the Protools reference; Ardour is rather similar to it. Also, Paul wants +users to be able to complete the Mackie HDR tutorial using Ardour; so that +is another manual to check out. Both are available online from +DigiDesign and Mackie. + +There is the begining of a manual in Ardour's manual directory. Feel +free to create your own HOWTOs, tips and tricks sheets, tutorials, or +whatever you feel like adding. + +A couple people have written some documentation to get people started with +Ardour. It is available at http://www.djcj.org/LAU/ardour/ + +4.5. Why are all these libraries included? I already have ... + +Yes, we know that it's quite likely that you already have gtkmm or +sigc++ installed on your machine, let alone others. There +are 2 problems. + +Ardour requires either the latest version of these libraries or even a +version with a patch that has not yet been incorporated into a release +of the library. Rather than require you to get the library source, +patch it, recompile and install it, Ardour keeps its own copy, builds +a static, private version of the library and links against it. That +way, we don't have to worry about crashes caused by you having the +wrong version of the library. + +The second problem is more general. C++ does not yet have a unified +"Application Binary Interface", even on a single process +architecture+OS combination. This is unlikely to ever change (it was +encouraged by the inventor of C++). This means that libraries compiled +with one compiler are not always compatible with applications compiled +with another compiler. By "another compiler", we can mean something as +subtle as a different version of g++. Worse, because many C++ +libraries feature inlined code, we even need to be sure you compile +against exactly the same version of the library as other parts of +Ardour will use. Even worse, there are compile time flags you or +someone else could give to a C++ compiler that would make the library +incompatible in subtle ways with code compiled with different flags. + +After a year of trying to address these problems "the normal way", the +Ardour team gave up and decided to include every necessary library +that is written in C++ and/or has patches required. You may not like +this very much, but trust us, you would like the alternative even +less. + +4.6. Why not another frontend to libardour? Why not QT? + +The GTK+ frontend to libardour is almost 7 times the size of libardour. GUIs +for these sort of programs are very large and detail orientated. It would be +a waste of time to try to reimplement Ardour with another widget set. This is +also why there won't be a native port of Ardour to MacOS X. diff --git a/DOCUMENTATION/README b/DOCUMENTATION/README new file mode 100644 index 0000000000..b1e85b4d37 --- /dev/null +++ b/DOCUMENTATION/README @@ -0,0 +1,101 @@ + ARDOUR README + + Paul Davis June 2003 + +Welcome to Ardour. This program is still very much under development, +but has now reached the stage where it will be productive and useful +to have other people testing it out and perhaps (hopefully!) fixing +bugs and adding features. + +**** SECURITY ******************************************************* + +To run Ardour with the lowest latencies, it's necessary to use POSIX +Real-Time Scheduling as well as locking all the memory it uses into +physical RAM. These requirements can only be met if Ardour is run with +root priviledges. + +On the other hand, things are not so bad. If you don't attempt to +install it setuid root (which actually won't work anyway), then +someone needs to have gained root access in order to run it like this. +If they already have root access, Ardour is the least of your +problems. So relax. We'll use capabilities once Linux kernels start +arriving with them enabled, though this won't help too much with +security, since the relevant capabilities would still allow a wiley +cracker to do anything at all. + +Alternatively, you can choose to run Ardour without RT scheduling, and +then there's no concern at all. It just won't be useful in low latency +situations, which are desirable in most studio environments. Note that +this is not so important if you have audio hardware that is capable of +doing "hardware monitoring" - in this case, a lack of low latency will +simply make response to Ardour's UI controls a little sluggish, but +monitoring during capture will be excellent. + +**** HARDWARE COMPATIBILITY ***************************************** + +Ardour uses JACK for all its audio I/O, thus providing seamless +connections to both audio hardware and other applications. Its really +not the right place to discuss JACK, but in case you are wondering: + +Although JACK uses the ALSA 0.9.0 API, it exercises this API in a way +that no other application to date has done, and it also tries to use +certain hardware features that again, no other existing applications +use. As a result, although complete portability to all ALSA supported +h/w is an eventual and very achievable goal, there may be issues +surrounding h/w compatibility. Please remember that my primary goal +with JACK is to build a professional audio system, and with Ardour, a +professional digital audio workstation. If they happen to be useful +for people with 2/4 channel cards, then great, but it's not my own +primary focus. + +One other important issue is that your audio interface must support +full duplex i/o with the same sample format for both capture and +playback. This means, for example, that the SoundBlaster AWE cannot +be used with JACK in full duplex mode - it only supports full duplex +i/o if one of the two directions (capture or playback) is 8 bit and +the other is 16. Very few cards have this kind of limitation, and if +they do, they typically are not suitable for use with applications +like JACK or Ardour for other reasons. + +To date, JACK has been run with: + + RME Hammerfall (Digi9652) (26 channels in, 26 channels out) + RME Hammerfall DSP (hdsp) (26 channels in, 26 channels out) + RME Hammerfall Light (Digi9636) (18 channels in, 18 channels out) + Midiman Delta series (ice1712 chipset) (12 channels in, 10 channels out) + + Various consumer grade audio interfaces, typically with 2 channels + in, 2/4 channels out, including: + + Hoontech 4Dwave-NX (Trident chipset) + Ensoniq 5880 + Soundblaster 32 + Soundblaster 64 + Creative SBLive64 + +and many more. + +So, basically, it appears to work for just about all ALSA supported +cards, which is the goal. + +********************************************************************** + +BUG REPORTING +------------- + +Bugs should be reported to http://ardour.org/mantis/ . They are more +likely to be remembered and dealt with there. Please check the existing bugs +to make sure it has not already been reported and/or fixed in CVS. + +COMPILING ARDOUR +---------------- +Please see the file "BUILD". + +RUNNING ARDOUR +-------------- + +NOTE: You must have a running JACK server before starting Ardour. + ----------------------------------------------------------- + +Typing "ardour" will hopefully have some effect. "ardour --help" lists +available options. diff --git a/DOCUMENTATION/README.es b/DOCUMENTATION/README.es new file mode 100644 index 0000000000..bc29f64608 --- /dev/null +++ b/DOCUMENTATION/README.es @@ -0,0 +1,139 @@ + ARDOUR README.es + + Paul Davis June 2003 + +Bienvenido a Ardour. Este programa aun esta bajo desarrollo, +pero ha llegado a un estado en el cual es productivo y util tener +a otras personas probandolo y tal vez (con suerte!) arreglando errores +y agregando nuevas caracteristicas. + +**** SEGURIDAD ******************************************************* + +Para ejecutar Ardour con la mas baja latencia posible, es necesario usar +POSIX Real-Time Scheduling (tiempo Real) como tambien bloquear toda la +memoria que usa en la memoria fisica de la RAM. Estos requerimientos solo +se pueden cumplir si Ardour es ejecutado con privilegios de usuario root. + +Por otro lado, esto no es tan malo. Si no planea instalar a Ardour +usando el comando "setuid root"(lo cual no funcionaria de todas formas), +entonces alguna persona que use su estacion de trabajo debera tener +que haber "ganado" privilegios de acceso root para hacerlo funcionar +de esa forma.Si esa otra persona ya tiene acceso de tipo root, Ardour +es la menor de sus preocupaciones. Asi que, relajese. Usaremos +capabilities (privilegios root) una vez que los Kernels de Linux empiecen +a aparecer con estas ya activadas, aunque esto no ayudara mucho a la +seguridad, ya que las mencionadas "capabilities" habilitarian a cualquier +hacker astatuto a hacer lo que quiciera. + +Alternativamente, usted puede elegir ejecutar a Ardour sin Scheduling +de Tiempo Real, lo cual no es tan terrible. Simplemente no va a ser util +en situaciones que demandan baja latencia, las cuales son deseables en +la mayoria de los ambientes de estudios. +Note que esto pierde importancia en el caso que usted disponga de +hardware de audio capaz de hacer "monitorizacion por hardware". Esto +hace recaer gran parte del peso de procesamiento sobre el dispositivo +de audio y no sobre el CPU como es el caso de la "monitorizacion por +software". En el caso de monitorizacion por hardware, la falta de baja +latencia hara que los controles de la interfaz visual de Ardour +reaccionen con menos fluidez, sin embargo la monitorizacion durante la +captura sera excelente. + +**** COMPATIBILIDAD DE HARDWARE ************************************* + +Ardour usa JACK para todo el manejo de entradas y salidas de audio, +lo cual provee conecciones directas al hardware de audio y a otras +aplicaciones compatibles con JACK. Este no es el lugar mas apropiado +para discutir acerca de JACK, pero en caso de que se estubiera +preguntando: + +Aunque JACK usa la libreria ALSA 0.9.0, JACK la aprovecha de una forma +que ninguna otra aplicacion lo ha hecho hasta ahora y, tambien intenta +usar ciertas caracteristicas de hardware que nuevamente, ninguna de las +actuales aplicaciones usa. Como resultado, aunque una completa +portabilidad a todo el hardware soportado por ALSA es un objetivo +eventualmente realizable, puede ser que nazcan problemas relacionados +con la compatibildad de hardware. Por favor recuerde que mi objetivo +principal con JCK es el de crear un sistema profesional de audio y, con +Ardour, una estacion de trabajo de audio digital profesional. Si estos +terminan siendo utiles para personas con placas de 2/4 canales, muy bien, +pero ese no es mi foco de interes principal. + +Otro punto importante es que su dispositivo de sonido debe soportar +full duplex de entrada/salida (reproduccion y grabacion simultaneas) +con el mismo formato para la captura y la reproduccion (no se puede +usar una frecuencia de muestreo de 44.1 khz para reproducir y una +de 48khz para grabar, ambas deben ser iguales, lo mismo sucede para +la resolucion en bits. Esto significa, por ejemplo, que la placa +SoundBlaster AWE no puede ser usada con JACK en modo full duplex. +-Esta placa solo soporta fullduplex si una de las dos (grabacion o +reproduccion) usa 8 bits y la otra 16 bits. +Este tipo de limitacion existe solo en algunas placas y, de ser asi +no son adecuadas para el uso en aplicaciones como JACK y ARDOUR por +otras razones. + +Hasta la fecha, JACK fue probado con las siguientes interfaces de audio: + + RME Hammerfall (Digi9652) (26 channels in, 26 channels out) + RME Hammerfall DSP (hdsp) (26 channels in, 26 channels out) + RME Hammerfall Light (Digi9636) (18 channels in, 18 channels out) + Midiman Delta series (ice1712 chipset) (12 channels in, 10 channels out) + + Varios chips de sonido de nivel de consumidor (relativamente baratas), + tipicamente con 2 canales de entrada y 2/4 de salida,incluyendo: + + Hoontech 4Dwave-NX (chipset Trident) + Ensoniq 5880 + Soundblaster 32 + Soundblaster 64 + Creative SBLive64 + +y muchas mas. + +Asi que, basicamente, parece funcionar con practicamente todas aquellas +placas que son soportadas por ALSA, lo cual es el objetivo. + +********************************************************************** + +REPORTES DE ERRORES EN CODIGO (BUGS) +------------------------------------- + +Los bugs deben ser reportados a http://ardour.org/mantis/ . Es mas probable +que estos sean recordados y analizados alli. Por favor, chequee alli la lista +de bugs ya reportados para asegurarse que el que usted encontro no haya sido +reportado aun o haya sido resuelto en CVS. + +PARA COMPILAR ARDOUR +-------------------- +Vea el archivo "BUILD" (por ahora en ingles, espaniol mas adelante). + +EJECUTANDO ARDOUR +----------------- + +NOTA: Debe haber ya un server JACK corriendo antes de ejecutar Ardour + --------------------------------------------------------------- + +* Escribiendo ardour en una consola y presionando ENTER o INTRO deberia iniciar + el programa. + +* "ardour --help" muestra las opciones disponibles desde la linea de comando + + + + + + + + + +Nota de Traduccion (Spanish Translation Note) +--------------------------------------------- +#Nota del tipeo:la letra pronunciada ENIE aparece en este archivo +#como ni (letra "n" y letra "i") para mayor compatibilidad con todos +#los visores de texto. +#Asi mismo no se han aplicado las tildes(acentos). +#Estos no son errores de tipeo. Si llegara a encontrar algun otro error +#en cualquiera de los archivos con extension ".es" por favor +#hagamelo saber a alexkrohn@fastmail.fm +# Muchas gracias +# Alex + diff --git a/DOCUMENTATION/README.fr b/DOCUMENTATION/README.fr new file mode 100644 index 0000000000..eba5aafd54 --- /dev/null +++ b/DOCUMENTATION/README.fr @@ -0,0 +1,113 @@ + ARDOUR -- LISEZ-MOI + + Paul Davis Juin 2003 + +Bienvenue sur Ardour. Ce programme est encore en cours de développement, +mais a atteint un état où il peut être utile et productif afin que +d'autres personnes puissent le tester et peut-être (je l'espère !) corriger +les bogues et ajouter des fonctionnalités. + +**** SÉCURITÉ ******************************************************* + +Afin d'utiliser Ardour avec un temps de latence le plus bas possible, +il est nécessaire d'utiliser l'ordonnancement temps réel POSIX ainsi +que de verrouiller toute la mémoire qu'il utilise en mémoire vive physique. +Ces pré requis ne peuvent être atteint que lorsque Ardour est lancé +avec les privilèges du super-utilisateur (root). + +D'un autre côté, ce n'est pas si grave que ça. Si vous n'essayez pas +de l'installer en setuid root (ce qui ne marchera pas de toute façon), +alors les utilisateurs devront avoir obtenu l'accès root pour pouvoir le +lancer comme cela. S'ils ont déjà l'accès root, Ardour est bien le dernier +de vos problèmes. Donc tranquillisez-vous. Nous utiliserons les "capacités" +(capabilities en anglais, NdT) quand les noyaux Linux arriverons avec +leur support activé, bien que les capacités en question autoriserons +toujours un cracker mal intentionné à faire à peu près n'importe quoi. + +L'alternative est de lancer Ardour sans ordonnancement temps-réel, dans +ce cas, il n'y a plus de souci. Ardour ne sera juste plus très utile +dans des conditions de faible latence, ce qui est désirable dans la +plupart des environnements de studio. Notez que cela n'est pas si important +lorsque vous avez du matériel audio qui est capable de faire du +"monitoring matériel" -- dans ce cas, un temps de latence trop important +provoquera juste des temps de réponse un peu longs pour l'interface +utilisateur d'Ardour, mais le monitoring pendant l'enregistrement +sera excellent. + + +**** COMPATIBILITÉ MATÉRIELLE ***************************************** + +Ardour utilise JACK pour toutes ses entrés/sorties audio, fournissant +ainsi des connexions transparentes au matériel audio ainsi qu'à d'autres +applications. Cela n'est pas du tout l'endroit pour parler de JACK, +mais dans le cas où vous vous poseriez la question : + +Bien que JACK utilise l'API (Application Programming Interface, NdT) ALSA +0.9.0, il utilise cette API d'une manière que nulle autre application +ne l'a jamais fait jusqu'à présent, et essaie aussi d'utiliser certaines +possibilités matérielles qui également n'ont jamais été employées par +d'autres applications. En conséquence, bien que la portabilité complète de +tout matériel supporté par ALSA est un objectif très atteignable, il peut +y avoir des problèmes concernant la compatibilité matérielle. Veuillez +garder en mémoire que le but principal avec JACK est d'obtenir +un système audio professionnel, et avec Ardour, d'obtenir une station +de travail audio-numérique professionnelle. S'ils parviennent à être +utilisés par des gens avec des cartes audio ayant 2/4 canaux, génial, +mais ce n'est pas ma priorité. + +Un autre problème important est que votre interface audio doit supporter +l'entrée/sortie en mode full duplex avec le même format d'échantillonage +pour l'enregistrement que pour la restitution. Cela veut dire, par exemple, +que la SoundBlaster AWE ne peut être utilisée par JACK en mode full duplex +-- elle supporte seulement l'entrée/sortie en full duplex si l'une des +deux directions (enregistrement ou restitution) est en 8 bits et + que l'autre est en 16 bits. Très peu de cartes ont cette limitation, + et si c'est le cas, elles ne sont de toute façon pas adéquates pour des +utilisations avec des applications telles que JACK ou Ardour pour d'autres +raisons. + +À ce jour, JACK a été utilisé avec : + + RME Hammerfall (Digi9652) (26 canaux en entrée, 26 canaux en sortie) + RME Hammerfall DSP (hdsp) (26 canaux en entrée, 26 canaux en sortie) + RME Hammerfall Light (Digi9636) (18 canaux en entrée, 18 canaux en sortie) + Midiman Delta series (ice1712 chipset) (12 canaux en entrée, 10 canaux en sortie) + +Diverses interface audio grand public, généralement avec deux canaux d'entrée, deux +canaux de sortie, incluant : + + Hoontech 4Dwave-NX (Trident chipset) + Ensoniq 5880 + Soundblaster 32 + Soundblaster 64 + Creative SBLive64 + +et bien d'autres. + +Donc, pour résumer, il semble fonctionner pour toute carte supporté par ALSA, ce qui +est le but. + +********************************************************************** + +RAPPORT DE BOGUES +----------------- + +Les bogues doivent être rapportés sur http://ardour.org/mantis/. Ils seront +certainement plus à même d'être conservés et traités à cet endroit. Veuillez +consulter les bogues existant afin d'être sûr que le votre n'a pas déjà été +rapporté et/ou corrigé dans le CVS. + + +COMPILER ARDOUR +--------------- +Veuillez consulter le fichier "BUILD". + + +LANCER ARDOUR +------------- + +NOTE : Vous devez avoir un serveur JACK lancé avant de lancer Ardour. + -------------------------------------------------------------- + +Taper "ardour" devrait sans doute avoir quelque effet. "ardour --help" liste +les options disponibles. diff --git a/DOCUMENTATION/README.it b/DOCUMENTATION/README.it new file mode 100644 index 0000000000..8a2111fb9c --- /dev/null +++ b/DOCUMENTATION/README.it @@ -0,0 +1,276 @@ + ARDOUR README.it + + Paul Davis June 2003 + Italian Traslation by Vieri Verze August 2002 + Update by Filippo Pappalardo December 2003 + +Benvenuti in Ardour. Sebbene questo programma sia ancora in via di +sviluppo, e` pronto a rendervi produttivi, permettervi di testarlo +e (si spera!) risolvere i bug e aggiungere nuove caratteristiche. + +**** SICUREZZA ******************************************************* + +Per eseguire Ardour con la latenza piu` bassa e` necessario usare il +POSIX Real-Time Scheduling e disporre di tutta la memoria di cui ha +bisogno sotto forma di RAM fisica. Queste richieste possono essere +soddisfatte soltanto se Ardour viene eseguito con i privilegi di root. + +D'altra parte non tutto il male viene per nuocere. Se non installate +Ardour con setuid root (che comunque non funziona), gli altri avranno +bisogno dei privilegi di root per eseguirlo. Se li hanno Ardour e` il +vostro ultimo problema. Quindi rilassatevi. Implementeremo le +capabilities non appena il kernel le supportera`, benche` questo non +aiuti molto la sicurezza, dal momento che un cracker intelligente +potra` comunque fare di tutto. + +In alternativa, potete scegliere di esguire Ardour senza il RT +scheduling e non avrete nessun problema. Non sara` molto utile nelle +situazioni in cui e` necessaria una bassa latenza. Praticamente nella +maggior parte dei casi. Ricordatevi che tutto questo e` irrilevante se +possedete una scheda audio capace di fare "hardware monitoring". +In questo caso una latenza piu` alta rendera` un po` lenti i controlli +della UI di Ardour, mentre il monitoring durante la capture saranno +eccellenti. + +**** COMPATIBILITA` HARDWARE ***************************************** + +Ardour usa il server audio JACK per tutte le operazioni di I/O. In +questo modo fornisce un impareggiabile sistema di comunicazione con il +substrato hardware audio e le altre applicazioni. Non è certamente +questo il luogo per discutere di JACK, ma se vi state chiedendo: + +JACK usa le ALSA 0.9.0 API. La particolarita` e` che le sfrutta in +un modo completamente nuovo soprattutto per quanto riguarda l' uso +dell' hardware. Come risultato, benche` il totale supporto delle +periferiche h/w da parte di ALSA sia un successo facilmente ottenibile, +potrebbero esserci problemi concernenti la compatiblita` h/w. Bisogna +tenere presente che il mio scopo principale e` di creare con JACK un +sistem audio professionale, e con Ardour un sistema professionale di +HDR. Se puo` essere utile a utenti con schede a 2/4 canali, ben venga, +ma ricordate che questo non e` l' interesse primo. + +Un altro aspetto importante e` che la vostra interfaccia audio deve +supportare l' I/O in full duplex nello stesso formato sia in registrazione +che suonando. Significa, per esempio, che una Soundblaster AWE non +potra` essere usata con JACK in modalita` full duplex, a meno che una +delle due direzioni (registrazione o playback) e` a 8 bit e l' altra a 16. +Sono poche le schede che hanno questo tipo di limitazione, e non sono +generalmente adatte ad essere usate con JACK e Ardour per altri motivi. + +Ad oggi, Ardour ha girato con: + + RME Hammerfall (Digi9652) (26 canali in, 26 canali out) + RME Hammerfall Light (Digi9636) (18 canali in, 18 canali out) + Midiman Delta series (ice1712 chipset) (12 canali in, 10 canali out) + + Diverse interfacce di fascia consumer, solitamente a 2 canali in, + 2/4 canali out, incluse: + + Hoontech 4Dwave-NX (Trident chipset) + Ensoniq 5880 + Soundblaster 32 + Soundblaster 64 + Creative SBLive64 + +Al momento sembra funzionare con tutte le schede supportate da ALSA, +che e` l'obiettivo proposto. + +**** SEGNALARE UN BUG ************************************************ + +I bug vanno segnalati ad http://ardour.org/mantis/ . Dove è +probabile che vengano presi in considerazione e trattati. Prima di +segnalare un bug è opportuno accertarsi che non sia gia` stato +segnalato e/o eliminato in cvs. + +**** COMPILAZIONE E INSTALLAZIONE ************************************ + +1) GNU AUTOCONF RATIONALIZATION +------------------------------- + +GNU autoconf e` un sistema intelligente, ma ha una grande lacuna. +Di default, autoconf (adesso aclocal) controlla UNA sola directory +alla ricerca dei file di cui ha bisogno. Sarebbe OK se non venissero +installati altri pacchetti che qualche volta mettono i loro file di +autoconf in /usr/local/lib/share/aclocal e altre volte in +/usr/lib/share/aclocal. + +Succede che autoconf non riesce a trovare i file di cui ha bisogno per +costruire Ardour, dal momento che molta gente ha una moltitudine di +librerie installate dalla distribuzione (i file di autoconf finiscono +in /usr/local/lib...) e dai pacchetti pre-costruiti (in questo caso i +pacchetti finiscono solitamente in /usr/lib...). + +Per la vostra tranquillita`, vi raccomando di eseguire i seguenti passi +da root. Controllate i contenuti di entrambe le direcroty prima di +eseguire questi comandi in modo da non cancellare accidentalmente la +corretta versione di un file autoconf: + + * Se avete esntrambe le directory: + + cd /usr/lib/share/aclocal + cp *.m4 /usr/local/lib/share/aclocal + cd .. + rm -rf aclocal + ln -s /usr/local/lib/share/aclocal . + + * Se avete solo /usr/lib/share/aclocal + + cd /usr/local/lib + ln -s /usr/lib/share/aclocal . + +Alcune distribuzioni hanno aclocal in altre directory. YMMV. + +2. COMPILARE +------------ + +Prima di compilare Ardour, accertatevi di avere installato: + +* Strumenti: + + gcc/g++ 2.95.3 o superiore (funziona anche gcc/g++ 3.x) + autoconf 2.52 o superiore + automake 1.5 o superiore + libtool 1.4.2 o superiore + gettext 0.11.5 o superiore + pkgconfig 0.8.0 o superiore + http://www.freedesktop.org/software/pkgconfig/ + + sono necessari anche lex e yacc + andra` bene qualsiasi versione di bison >= 1.35 + +* Librerie: + +Le versioni raccomandate, quando necessario, sono presenti sotto le +versioni generiche. + + ALSA 0.9.X (CVS o snapshot release) (http://www.alsa-project.org) + + JACK (http://jackit.sourceforge.net) + + libxml2 2.5.X (http://xmlsoft.org/) + + libart_lgpl 2.3.X + + - available as part of gnome-libs, which you may already + have on your system. + + - also available via download from GNOME source FTP sites. + - see ftp://ftp.gnome.org/pub/GNOME/MIRRORS.htmland then + follow to sources/libart_lgpl + + glib 1.2 (http://www.gtk.org) + glib-1.2.8 (inclusa nella maggior parte delle distribuzioni) + + GTK+ 1.2 (http://www.gtk.org) + gtk+-1.2.8 (inclusa nella maggior parte delle distribuzioni) + + libsndfile (http://www.zip.com.au/~erikd/libsndfile) + libsndfile-0.0-28 + + libsamplerate (http://www.mega-nerd.com/SRC/) + libsamplerate 0.0.13 o superiore + + the LADSPA SDK (http://www.ladspa.org/) + (Guardate sotto) + + raptor (http://www.redland.opensource.ac.uk/raptor/) + + lrdf (richiede raptor) (http://plugin.org.uk/lrdf/) + liblrdf 0.3.1 or higher + +Ottenere LADSPA + +Nota: La Linux Audio Developers Simple Plugin API (LADSPA) consiste +in realta` di un semplice file header, già incluso nei sorgenti di +Ardour + +Vorrete usare anche i suoi plugins, percui andate oltre e scaricate +l' intero pacchetto (non e` grande), da www.ladspa.org. + +Vi raccomando di scaricare un eccelente set di plugins per LADSPA, +programmati da Steve Harris. Il link e` http://plugin.org.uk/. +Trasformeranno Ardour in una appicazione vermante utile. Altri plugins +di LADSPA sono in programmazione percui tenete d' occhio la Linux +Audio Development mailing list. + +2A) COMPILARE DA CVS +--------------------- + +Posizionatevi nel path in cui volete copiare i CVS di Ardour (la '%' +e` il vostro shell prompt): + +% cd /usr/local/src # e` un esempio, potete scegliere un path qualsiasi +% cvs -d:pserver:anoncvs@ardour.org:/cvsroot/ardour login + # (premete enter/return quando vi sara` chiesta + la password) +% cvs -d:pserver:anoncvs@ardour.org:/cvsroot/ardour -z3 co ardour + +2A.1) CHE TIPO DI COMPILAZIONE? +-------------------------------- + +Il prossimo passo è quello di decidere se si vuole una installazione per +sviluppatori o per semplici utenti. Se siete sviluppatori, potrebbe essere +una buona idea compilare libardour come libreria condivisa, cosi` da evitare +di collegare l'eseguibile ogni volta che cambiate versione di libreria. +Se siete semplici utenti, questo renderebbe solo la vita più difficile. +In caso siate sviluppatori dunque eseguite: + + touch ardour/libs/ardour/BUILD_FOR_DEVELOPMENT + +Questo fara` si` che libardour sia compilata come libreria condivisa. Dovreste +conseguentemente passare il parametro --enable-development-build a configure. + +2A.2) PREPARARE IL SISTEMA PER LA COMPILAZIONE +---------------------------------------------- + +Ora costruite i file autoconf/automake: + +% cd ardour +% sh autogen.sh + +Andate al passo 3. + +2B) COMPILARE DA UN TARBALL +--------------------------- + +Come al solito: prelevate e scompattate il tarball. La directory creata, +ardour-, e` chiamata piu` sotto "$AD". + +3) COME COMPILARE +----------------- + + ./configure (con tutte i parametri che vorrete passare) + make + make install + +Se siete uno sviluppatore che intende lavorare su libardour, potreste +voler usare il parametro --enable-development-build, che colleghera` +dinamicamente l'eseguibile a libardour, risparmiando molto tempo +nell'evitare un collegamento statico da effettuare ogni volta che si +operano cambiamenti su libardour. + +Se volete compilare ardour in modo che possiate farne il `debugging`, +dovreste usare anche il parametro --disable-optimize. Senza questo +Ardour viene compilato con ottimizzazioni estreme ed il risultato non +può essere oggetto di `debugging` in modo efficace. + +Come tutti gli script di configurazione, se non volete che +l' installazione avvenga ne "solito posto", aggiungete un --prefix al +comando ./configure. Potreste anche considerare di aggiungere un +parametro --sysconfdir, dal momento che `make install` tenterà di +installare tutti i file di configurazione in un percorso che tiene +conti di questo parametro. + +La compilazione ci mette un po`. Eseguendo make -j3 su un dual PII-450 +l'intero processo impiega circa 10-15 minuti. + +4. ESEGUIRE ARDOUR +------------------ + +NOTA: Dovete prima di tutto eseguire il server JACK. + ---------------------------------------------- + + +Se avete eseguito "make install", allora potete digitare "ardour" e +qualcosa succedera`. Col comando "ardour --help" otterrete una +lista delle possibili opzioni. diff --git a/DOCUMENTATION/README.ru b/DOCUMENTATION/README.ru new file mode 100644 index 0000000000..fe5697535e --- /dev/null +++ b/DOCUMENTATION/README.ru @@ -0,0 +1,108 @@ + ARDOUR README.ru + + Paul Davis June 2003 + Russian translation by Igor Blinov November 2003 + +÷ÁÓ ÐÒÉ×ÅÔÓÔ×ÕÅÔ Ardour. üÔÁ ÐÒÏÇÒÁÍÍÁ ÎÁÈÏÄÉÔÓÑ × ÓÔÁÄÉÉ ÒÁÚÒÁÂÏÔËÉ, +ÎÏ ÕÖÅ ÍÏÖÅÔ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ ÎÁ ÐÒÁËÔÉËÅ, Ë ÔÏÍÕ ÖÅ ÐÏÌÅÚÎÏ ËÏÇÄÁ +ÄÒÕÇÉÅ ÌÀÄÉ ÔÅÓÔÉÒÕÀÔ Å£, ÅÓÌÉ ÓÌÕÞÁÅÔÓÑ (ÐÏÞÔÉ Õ×ÅÒÅÎ!) ÉÓÐÒÁ×ÌÑÀÔ +ÏÛÉÂËÉ É ÒÁÓÛÉÒÑÀÔ ÆÕÎËÃÉÏÎÁÌØÎÙÅ ×ÏÚÍÏÖÎÏÓÔÉ. + +**** âåúïðáóîïóôø *************************************************** + +òÁÂÏÔÁ Ardour ÔÒÅÂÕÅÔ ÍÉÎÉÍÁÌØÎÏÅ ×ÒÅÍÑ ÒÅÁËÃÉÉ ÎÁ ÓÏÂÙÔÉÑ (low latency), +ÞÔÏ ÔÒÅÂÕÅÔ ÉÓÐÏÌØÚÏ×ÁÎÉÑ POSIX-ÐÏÄÓÉÓÔÅÍÙ ÒÅÁÌØÎÏÇÏ ×ÒÅÍÅÎÉ (POSIX +Real-Time Scheduling) É ×ÄÏÂÁ×ÏË ÂÌÏËÉÒÕÅÔ ×ÓÀ ÉÓÐÏÌØÚÕÅÍÕÀ ÐÁÍÑÔØ +× ïúõ (RAM). üÔÉ ÔÒÅÂÏ×ÁÎÉÑ ×ÙÐÏÌÎÉÍÙ, ÔÏÌØËÏ ÅÓÌÉ Ardour ÚÁÐÕÝÅÎ Ó +ÐÒÉ×ÉÌÅÇÉÑÍÉ ÐÏÌØÚÏ×ÁÔÅÌÑ root. + +ó ÄÒÕÇÏÊ ÓÔÏÒÏÎÙ ×Ó£ ÎÅ ÔÁË ÕÖ É ÐÌÏÈÏ. åÓÌÉ ×Ù ÎÅ ÍÏÖÅÔÅ ÕÓÔÁÎÏ×ÉÔØ +ÆÌÁÇ setuid root (ËÏÔÏÒÙÊ ÐÏÍÏÇÁÅÔ ÎÅ ×Ï ×ÓÅÈ ÓÌÕÞÁÑÈ), ÔÏÇÄÁ +ÎÅÏÂÈÏÄÉÍÏ ÐÏ×ÙÓÉÔØ Ó×ÏÉ ÐÒÉ×ÉÌÅÇÉÉ ÄÏ root ÄÌÑ ÔÏÇÏ, ÞÔÏÂÙ Ó ÜÔÉÍÉ +ÐÒÁ×ÁÍÉ ÚÁÐÕÓÔÉÔØ Ardour. åÓÌÉ ×Ù ÕÖÅ ÉÍÅÅÔÅ ÄÏÓÔÕÐ ËÁË ÐÏÌØÚÏ×ÁÔÅÌØ +root, × ÔÁËÏÍ ÓÌÕÞÁÅ ÚÁÐÕÓË Ardour ÂÕÄÅÔ ÎÁÉÍÅÎØÛÅÊ ÐÒÏÂÌÅÍÏÊ. éÔÁË. +÷ ÒÁÂÏÔÅ ÉÓÐÏÌØÚÕÀÔÓÑ ÎÅËÏÔÏÒÙÅ ×ÏÚÍÏÖÎÏÓÔÉ ÑÄÒÁ linux, ËÏÔÏÒÙÅ ÎÅ +ÓÐÏÓÏÂÓÔ×ÕÅÔ ÂÅÚÏÐÁÓÎÏÓÔÉ, ÔÁË ËÁË ÏÎÉ ÍÏÇÕÔ ÐÏÍÏÞØ ÚÌÏÕÍÙÛÌÅÎÎÉËÕ +× ÅÇÏ ÐÌÁÎÁÈ. + +÷ ÄÒÕÇÏÍ ×ÁÒÉÁÎÔÅ ×Ù ÍÏÖÅÔÅ ÚÁÐÕÓÔÉÔØ Ardour ÂÅÚ ÐÒÉÏÒÉÔÅÔÁ ÒÅÁÌØÎÏÇÏ +×ÒÅÍÅÎÉ É ÚÁÂÙÔØ ÐÒÏ ÓËÁÚÁÎÎÏÅ ×ÙÛÅ. ïÄÎÁËÏ, ÜÔÏ ÎÅÕÄÏÂÎÏ ÄÌÑ ÓÉÔÕÁÃÉÊ, +× ËÏÔÏÒÙÈ ÔÒÅÂÕÅÔÓÑ ÍÁÌÏÅ ×ÒÅÍÑ ÚÁÄÅÒÖËÉ ÓÉÇÎÁÌÁ, ÞÔÏ ÖÅÌÁÔÅÌØÎÏ × ÏÂÙÞÎÏÊ +ÓÔÕÄÉÊÎÏÊ ÒÁÂÏÔÅ. úÁÍÅÞÕ, ÞÔÏ ÜÔÏ ÎÅ ÔÁË ×ÁÖÎÏ, ÅÓÌÉ ×ÁÛÅ ÁÐÐÁÒÁÔÎÏÅ +ÏÂÅÓÐÅÞÅÎÉÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ ÆÕÎËÃÉÀ "hardware monitoring" - × ÜÔÏÍ ÓÌÕÞÁÅ +×ÏÚÒÏÓÛÁÑ ÚÁÄÅÒÖËÁ ÓÉÇÎÁÌÁ Õ×ÅÌÉÞÉ×ÁÅÔ ×ÒÅÍÑ ÒÅÁËÃÉÉ ÐÒÉ ×ÏÚÄÅÊÓÔ×ÉÉ +ÎÁ ÕÐÒÁ×ÌÑÀÝÉÅ ÜÌÅÍÅÎÔÙ ÇÒÁÆÉÞÅÓËÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Ardour, ÚÁÔÏ ËÏÎÔÒÏÌØ +(ÍÏÎÉÔÏÒÉÎÇ) ÓÉÇÎÁÌÁ × ÐÒÏÃÅÓÓÅ ÚÁÐÉÓÉ ÂÕÄÅÔ ÚÁÍÅÞÁÔÅÌØÎÙÍ. + +**** ôòåâï÷áîéñ ë áððáòáôõòå **************************************** + +Ardour × Ó×ÏÅÊ ÒÁÂÏÔÅ ÄÌÑ ××ÏÄÁ/×Ù×ÏÄÁ ÁÕÄÉÏÄÁÎÎÙÈ ÉÓÐÏÌØÚÕÅÔ JACK, +ËÏÔÏÒÙÊ ÏÂÅÓÐÅÞÉ×ÁÅÔ ÉÄÅÁÌØÎÏÅ ÐÏÄËÌÀÞÅÎÉÅ ÐÒÉÌÏÖÅÎÉÊ Ë ÒÅÓÕÒÓÁÍ +ÁÐÐÁÒÁÔÕÒÙ ÄÌÑ ÒÁÂÏÔÙ ÓÏ Ú×ÕËÏÍ. íÙ ÎÅ ÂÕÄÅÍ ÚÄÅÓØ ÏÂÓÕÖÄÁÔØ JACK, +ÎÏ ÓËÁÚÁÎÎÏÅ ÎÉÖÅ ÐÏÚ×ÏÌÉÔ ÉÚÂÅÖÁÔØ ÎÅÄÏÒÁÚÕÍÅÎÉÊ: + +îÅÓÍÏÔÒÑ ÎÁ ÔÏ, ÞÔÏ JACK ÒÁÂÏÔÁÅÔ ÞÅÒÅÚ ALSA 0.9.0 API, ÏÎ ÉÓÐÏÌØÚÕÅÔ +ÅÇÏ ÔÁËÉÍ ÏÂÒÁÚÏÍ, ÞÔÏ ÄÒÕÇÉÅ ÐÒÉÌÏÖÅÎÉÑ × ÜÔÏÔ ÍÏÍÅÎÔ ÎÅ ÍÏÇÕÔ +ÒÁÂÏÔÁÔØ Ó ÎÉÍ, Ë ÔÏÍÕ ÖÅ ÚÁÄÅÊÓÔ×ÕÀÔÓÑ ÎÅËÏÔÏÒÙÅ ÏÓÏÂÅÎÎÏÓÔÉ +ÁÐÐÁÒÁÔÕÒÙ, ÎÅÉÓÐÏÌØÚÕÅÍÙÅ ÄÒÕÇÉÍÉ ÐÒÉÌÏÖÅÎÉÑÍÉ. ðÏÌÎÁÑ ÓÏ×ÍÅÓÔÉÍÏÓÔØ +ÓÏ ×ÓÅÍÉ Ú×ÕËÏ×ÙÍÉ ËÁÒÔÁÍÉ, ÐÏÄÄÅÒÖÉ×ÁÅÍÙÍÉ ALSA, Ñ×ÌÑÅÔÓÑ ÄÏÓÔÉÖÉÍÏÊ +É ÏÞÅÎØ ÖÅÌÁÔÅÌØÎÏÊ ÃÅÌØÀ. óÌÅÄÓÔ×ÉÅÍ ÜÔÏÇÏ ÍÏÖÅÔ Ñ×ÉÔØÓÑ ÐÏÄÄÅÒÖËÁ +ÏÂÏÒÕÄÏ×ÁÎÉÑ Ó ×ÏÚÍÏÖÎÏÓÔÑÍÉ ÏËÒÕÖÁÀÝÅÇÏ Ú×ÕËÁ (surround sound). +ïÄÎÁËÏ, ÍÏÑ ÏÓÎÏ×ÎÁÑ ÃÅÌØ - ÜÔÏ ÐÏÓÔÒÏÅÎÉÅ ÎÁ ÏÓÎÏ×Å JACK +ÐÒÏÆÅÓÓÉÏÎÁÌØÎÏÇÏ Ú×ÕËÏ×ÏÇÏ ÓÅÒ×ÅÒÁ Ó Ardour × ËÁÞÅÓÔ×Å ÎÅ ÍÅÎÅÅ +ÐÒÏÆÅÓÓÉÏÎÁÌØÎÏÊ Ú×ÕËÏÚÁÐÉÓÙ×ÁÀÝÅÊ ÓÉÓÔÅÍÙ (HDR). åÓÌÉ ÜÔÏ ÏËÁÖÅÔÓÑ +ÐÏÌÅÚÎÙÍ ÄÌÑ ×ÌÁÄÅÌØÃÅ× ÏÂÙÞÎÙÈ 2/4 ËÁÎÁÌØÎÙÈ Ú×ÕËÏ×ÙÈ ËÁÒÔ, ÔÏ ÜÔÏ +×ÅÌÉËÏÌÅÐÎÏ, ÎÏ Ñ ÎÅ ÚÁÏÓÔÒÑÀ ×ÎÉÍÁÎÉÅ ÎÁ ÜÔÏÍ. + +óÌÅÄÕÀÝÉÍ ×ÁÖÎÙÍ ÍÏÍÅÎÔÏÍ Ñ×ÌÑÅÔÓÑ ÔÏ, ÞÔÏ ×ÁÛÁ Ú×ÕËÏ×ÁÑ ËÁÒÔÁ ÄÏÌÖÎÁ +ÐÏÄÄÅÒÖÉ×ÁÔØ ÐÏÌÎÏÄÕÐÌÅËÓÎÙÊ ÒÅÖÉÍ ÒÁÂÏÔÙ, ÐÒÉÞ£Í ÏÄÎÏ×ÒÅÍÅÎÎÏ × ÏÄÎÏÍ +ÆÏÒÍÁÔÅ ÁÕÄÉÏÄÁÎÎÙÈ, ËÁË ÎÁ ××ÏÄ, ÔÁË É ÎÁ ×Ù×ÏÄ. ôÁË, Ë ÐÒÉÍÅÒÕ, ËÁÒÔÁ +SoundBlaster AWE ÎÅ ÍÏÖÅÔ ÉÓÐÏÌØÚÏ×ÁÔØÓÑ Ó JACK × ÐÏÌÎÏÄÕÐÌÅËÓÎÏÍ +ÒÅÖÉÍÅ - ÅÀ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ ÔÏÌØËÏ ÔÁËÏÊ ÐÏÌÎÏÄÕÐÌÅËÓÎÙÊ ÒÅÖÉÍ, × ËÏÔÏÒÏÍ +ÏÄÎÏ ÉÚ Ä×ÕÈ ÎÁÐÒÁ×ÌÅÎÉÊ (ÚÁÐÉÓØ ÉÌÉ ×ÏÓÐÒÏÉÚ×ÅÄÅÎÉÅ ÓÉÇÎÁÌÁ) ÒÁÂÏÔÁÅÔ +× ÆÏÒÍÁÔÅ 8 ÂÉÔ ÄÁÎÎÙÈ, Á ÄÒÕÇÏÅ × ÆÏÒÍÁÔÅ 16 ÂÉÔ. ïÞÅÎØ ÎÅÍÎÏÇÉÅ ËÁÒÔÙ +ÉÍÅÀÔ ÜÔÏ ÏÇÒÁÎÉÞÅÎÉÅ, É × ÜÔÏÍ ÓÌÕÞÁÅ ÏÎÉ ÏÂÙÞÎÏ ÎÅ ÐÏÄÈÏÄÑÔ ÄÌÑ ÒÁÂÏÔÙ +Ó ÔÁËÉÍÉ ÐÒÉÌÏÖÅÎÉÑÍÉ ËÁË JACK ÉÌÉ Ardour. + +îÁ ÓÅÇÏÄÎÑÛÎÉÊ ÄÅÎØ, JACK ÒÁÂÏÔÁÅÔ ÓÏ ÓÌÅÄÕÀÝÉÍÉ Ú×ÕËÏ×ÙÍÉ ËÁÒÔÁÍÉ: + + RME Hammerfall (Digi9652) (26 ×ÈÏÄÏ×, 26 ×ÙÈÏÄÏ×) + RME Hammerfall Light (Digi9636) (18 ×ÈÏÄÏ×, 18 ×ÙÈÏÄÏ×) + Midiman Delta series (ice1712 chipset) (12 ×ÈÏÄÏ×, 10 ×ÙÈÏÄÏ×) + + ÛÉÒÏËÏ ÒÁÓÐÒÏÓÔÒÁΣÎÎÙÅ Ú×ÕËÏ×ÙÅ ËÁÒÔÙ, ÏÂÙÞÎÏ 2 ×ÈÏÄÎÙÈ ËÁÎÁÌÁ, + 2/4 ×ÙÈÏÄÎÙÈ ËÁÎÁÌÁ, ×ËÌÀÞÁÑ: + + Hoontech 4Dwave-NX (Trident chipset) + Ensoniq 5880 + Soundblaster 32 + Soundblaster 64 + Creative SBLive64 + +É ÍÎÏÇÉÅ ÄÒÕÇÉÅ. + +÷ÐÏÓÌÅÄÓÔ×ÉÉ ÏÎ ÂÕÄÅÔ ÒÁÂÏÔÁÔØ ÓÏ ×ÓÅÍÉ Ú×ÕËÏ×ÙÍÉ ËÁÒÔÁÍÉ, ÐÏÄÄÅÒÖÉ×ÁÅÍÙÍÉ +ALSA. üÔÏ ÏÄÎÏ ÉÚ ÎÁÐÒÁ×ÌÅÎÉÊ ÒÁÚÒÁÂÏÔËÉ. + +********************************************************************** + +óïïâýåîéñ ïâ ïûéâëáè +-------------------- + +þÔÏÂÙ ÓÏÏÂÝÉÔØ Ï ÏÂÎÁÒÕÖÅÎÙÈ ×ÁÍÉ ÏÛÉÂËÁÈ × ÒÁÂÏÔÅ ÐÒÏÇÒÁÍÍÙ ×ÏÓÐÏÌØÚÕÊÔÅÓØ +ÓÓÙÌËÏÊ http://ardour.org/mantis/ . ÷ÏÚÍÏÖÎÏ Ï ÎÉÈ ÂÙÌÏ ÓÏÏÂÝÅÎÏ ÒÁÎÅÅ. +ðÏÖÁÌÕÊÓÔÁ, ÐÒÏ×ÅÒØÔÅ ÓÕÝÅÓÔ×ÕÀÝÉÅ ÓÏÏÂÝÅÎÉÑ, ÞÔÏÂÙ ÕÂÅÄÉÔØÓÑ × ÔÏÍ, ÞÔÏ +Ï ÏÂÎÁÒÕÖÅÎÎÏÊ ×ÁÍÉ ÏÛÉÂËÅ ÕÖÅ ÎÅ ÓÏÏÂÝÁÌÏÓØ É/ÉÌÉ ÏÎÁ ÎÅ ÉÓÐÒÁ×ÌÅÎÁ × CVS. + +óâïòëá ARDOUR +------------- +ðÏÄÒÏÂÎÏÅ ÏÐÉÓÁÎÉÅ × ÆÁÊÌÅ "BUILD". + +úáðõóë ARDOUR +------------- + +úáíåþáîéå: ÷Ù ÄÏÌÖÎÙ ÚÁÐÕÓÔÉÔØ JACK ÓÅÒ×ÅÒ ÐÒÅÖÄÅ, ÞÅÍ ÏÔËÒÏÅÔÅ Ardour. + ------------------------------------------------------------ +åÓÌÉ ×Ù ×ÙÐÏÌÎÉÌÉ ËÏÍÁÎÄÕ "make install", ÔÏÇÄÁ ÎÁÂÒÁ× ÎÁ ËÌÁ×ÉÁÔÕÒÅ +"ardour" ÐÏÌÕÞÉÔÅ ÖÅÌÁÅÍÙÊ ÒÅÚÕÌØÔÁÔ. "ardour --help" ×Ù×ÏÄÉÔ ÓÐÉÓÏË +ÄÏÓÔÕÐÎÙÈ ËÌÀÞÅÊ ÐÒÏÇÒÁÍÍÙ. diff --git a/DOCUMENTATION/TODO b/DOCUMENTATION/TODO new file mode 100644 index 0000000000..6fbbdb9d98 --- /dev/null +++ b/DOCUMENTATION/TODO @@ -0,0 +1,232 @@ +ARDOUR TO-DO: $Id$ +---------------------------------------------------------------------- + +ITEMS REQUIRED FOR 1.0 +---------------------- + +* Automation + - must be able to apply a fade to a selected range +* Drag handles for region/xfade curves + +* ensure I/O port is selected in connection dialog +* add a small buffer near the left edge of the editor canvas to + make mouse operations near that edge easier to get right +* context menus everywhere + - edit groups + - mix groups + - track lists + - region list + - click button + + (miscellany) + +* propagate name changes to equivalent regions in region list +* destroy region removes equivalent regions from region list +* fix edit group visibility toggle + +META ITEMS +---------- + +* there must be a manual + +POST 1.0 WORK +------------- +* make region state of a playlist be position,length,layer, and save + that for BoundsChange or Layer change. +* automation modes (from protools): + - relative trim + - etc. +* 2-step file expunge +* allow sends/inserts and perhaps plugins to be named +* popup a big panner +* mix groups (adding new kinds of relationships to the groups, as per + old ideas from tom pincince) +* add meter range control +* change meter tap point +* cassowary-based constraints for edit groups +* serializing the edit history (i have a plan for this now) +* gtk2 port +* like, totally rock, dude. +* make rulers reorderable +* set of useful click sounds +* use snapshot mechanism to provide persistent undo/redo + - needs better integration of automation state + into session state. +* duplicate-with-gap +* panner multichannel backend code +* select new port display when its created +* copy/paste io configurations +* Better temporal navigation +* new region via plugin. +* digital input trim. +* possibly allow metering max-level adjustment at run-time +* use multi-loop-take ala Samplitude/PT +* song mode autonames for locate points + intro, verse1, verse N, chorus, bridge, outro/tag +* different clock display modes: + elapsed + remaining + time since location start + time till location end +* handle missing audio sources when loading +* option/action to snap selection to zero crossings +* pitch shift? + +- Some global solo routing buttons and a sine/noise generator to + test all the connections. Possibly a talkback input and + control. Pretty much like the equivalent strip on a analog + console. + +WAITING FOR GTK+/gtkmm 2.0: +--------------------------- +general gtkmmext::ui solution to delete_event in recursive Gtk::Main::run() +float<->ulong conversion in a GtkAdjustment (GTK2 uses doubles) + * fix the problems caused by range (float) limits on Locations. +figure out how to get frames/timebars to extend to max_frames. + +UNDO ITEMS +---------- +track height? +capture? +I/O connection state, etc. + +BUGS +---- + +initial Tempo marker can be dragged +duplicate region names can be created automatically + +THREAD QUESTIONS +---------------- + - which thread should: + - change playlists on a diskstream? + - change diskstreams on a track? (we don't support that in the UI) + + - can we reliably construct a copy of the RT state, instead of + using locks everywhere? + +NOTES FROM THE MAILING LISTS +---------------------------- + +-- gerard -- + +Region gain has some bugs. They dissappear when trimming. Don't always +playback correctly. + +I had some strange things with a chunk where the last region seemed to use +the audio file as a peakfile. It played back correctly, but it showed up +frames_per_peak too large. + +-- gerard2 --- + +Automation. +I see that automation editing is in the TODO. How about the whole deal: +Changing it during aplay. relative or absolute, latch (is that the word) or +momentary override etc +Is this for >1.0 ? It is not that important for me but maybe for some +folks... + +Better metering configurability. Post/pre etc. + +Gui interface consistency. + +more keyboard shortcuts for f.i. (are they hard to add?): + -arrow keys to move selection from region to region + -seperate region. This one can be the same for split region, if there is + a range selected seperate, if not split. + + +Should playhead also snap to grid? + +Adding/removing snapshots through snapshot pane. + +I would prefer to move the pre and post roll adjustments to the options +menu, and have a start/end/duration of selection clocks. + +A way to deal with misbehaving plugins. They shouldn't be able to freeze +ardour. + +What is the current (and planned) edit-group functionality? It doesn't seem +to much. + +----- + +make use of transients a run-time option +panning for export + +mute automation event + +region length/end editor clocks don't modify position + +should we allow N-channels regions to be inserted into non-N-channel routes? + +auto-crossfades are unreliable/hard to predict/confusing +reset declick curves when doing a region copy (only if auto-crossfading?) + +audio clock editing + - make drag work again + - use tick field + +post fader plug/inserts get into a very inconsistent state wrt active/not active +mixer strip widths are not persistent across state save/restore +automation-read updates in mixer-strip in editor +don't initiate MIDI binding if there is no MMC control +export to audiofile + - exports tracks not marked for export (?) + - contains clicks/pops even with no SRC/dither (FIXED?) + +timefx region length error (check back with audacity crew) +send gain control is clicky. +some regionview names don't seem sensitive to canvas events +splice mode needs to work correctly all the time, at the right times +removing a port then adding a new one can cause duplicate names +plugin automation buttons don't update from a plugin signal +how to handle multichannel selections +apparently selected location on startup of locations window, or + when creating new location from selection is *not* selected +source/region naming/region list display + +LONG TERM CHECKING +------------------ +RT-ness of all RT-thread STL usage + +GUI DETAILS +----------- +Use mouse wheel events (button4/5) +Remove regions from region list +Some location window ops need dbl click, some don't + + +CHROME +------ +make prompters look nicer still. +make ladspa plugin selector look nicer +don't popup "no group" when there are no groups (mixer strip). +fix bug in Gtkmmext with wrapping on Gtkmmext::ClickBox +make region editors look nicer +region editor audition button doesn't pop up after audition is finished +allow same color for all streamviews + +AUDIO STREAM +------------ + +[ These are JACK TODO's ] + +* need to ensure that cards like the Hammerfall are really set + to the correct sample rate when connected to an external + clock source. +* ::connect_to_session() should indicate a problem if the + sample rate is wrong .... + +MIDI Machine Control +----------------------- + +* handle stupid Mackie TC buttons +* send MMC rec-enable messages +* allow control (MMC/Local) selection to work +* make sure that MMC ID works + +EDITOR, etc. +------------ + +* "use location to define selection" diff --git a/DOCUMENTATION/TRANSLATORS b/DOCUMENTATION/TRANSLATORS new file mode 100644 index 0000000000..5d54a48ecb --- /dev/null +++ b/DOCUMENTATION/TRANSLATORS @@ -0,0 +1,21 @@ +If you would like to see Ardour in your native langauge, please contact +the Ardour development mailing list. It's members only, but can be joined +at http://ardour.org. + +Many thanks to these translators for making Ardour available in other +languages: + +French: Alain Fréhel + +German: Karsten Petersen + +Italian: Filippo Pappalardo + +Portuguese: Rui Nuno Capela + +Brazilian Portuguese: Alexander da Franca Fernandes + Chris Ross + +Russian: Igor Blinov + +Spanish: Alex Krohn diff --git a/DOCUMENTATION/ardour.1 b/DOCUMENTATION/ardour.1 new file mode 100644 index 0000000000..52b9b1c3c4 --- /dev/null +++ b/DOCUMENTATION/ardour.1 @@ -0,0 +1,71 @@ +.TH ARDOUR 1 2002-12-29 +.SH NAME +ardour \- a digital audio workstation +.SH SYNOPSIS +ardour +.B \-b +.RB [ \-U +.IR file ] +.RI [ session ] +.br +ardour +.B \-\-help +.SH DESCRIPTION +Ardour is a multichannel hard disk recorder (HDR) and digital audio +workstation (DAW). +It is capable of simultaneous recording 24 or more channels of 32 bit audio at +48kHz. +Ardour is intended to function as a "professional" HDR system, replacing +dedicated hardware solutions such as the Mackie HDR, the Tascam 2424 and more +traditional tape systems like the Alesis ADAT series. +It is also intended to provide the same or better functionality as software +systems such as ProTools, Samplitude, Logic Audio, Nuendo and Cubase VST (we +acknowledge these and all other names as trademarks of their respective +owners). +It supports MIDI Machine Control, and so can be controlled from any MMC +controller, such as the Mackie Digital 8 Bus mixer and many other modern +digital mixers. +.SH OPTIONS +.TP +.B \-b +Print all possible keyboard binding names. +.TP +.B \-U +Specify the path to the GTK RC file to use. +The provided one is called +.B ardour_ui.rc +and lives in the top level Ardour source directory. +This file controls all color and font use within Ardour. +Ardour will run without it, but its appearance is, uhm, ugly. +.TP +.B \-\-help +Displays the help message. +.SH FILES +.TP +.B ardour.rc +Defaults and startup settings for Ardour. +.TP +.B ardour_ui.rc +Definitions for the Ardour interface. +.SH ENVIRONMENT +.TP +.B ARDOUR_RC +Path to ardour.rc. +.TP +.B ARDOUR_SYSTEM_RC +Path to the ardour_system.rc +.TP +.B LADSPA_PATH +Path to LADSPA plugins. +.SH BUGS +Yes. +.SH AUTHOR +Paul Davis. +Do +.I not +contact him directly. +Instead, +contact him at . +You can subscribe here: +.br +http://lists.ardour.org/listinfo.cgi/ardour-dev-ardour.org diff --git a/DOCUMENTATION/ardour.1.es b/DOCUMENTATION/ardour.1.es new file mode 100644 index 0000000000..d58a037df4 --- /dev/null +++ b/DOCUMENTATION/ardour.1.es @@ -0,0 +1,72 @@ +.TH ARDOUR 1 2002-12-29 +.SH NOMBRE +ardour \- una estación de trabajo de audio digital +.SH SINOPSIS +ardour +.B \-b +.RB [ \-U +.IR archivo ] +.RI [ sesión ] +.br +ardour +.B \-\-help +.SH DESCRIPCIÓN +Ardour graba multiples canales simultáneos a disco rigido (HDR) y es una +estación de trabajo de audio digital (DAW). +Es capaz de grabar 24 o mas canales simultáneamente con calidad de audio +de 32 bit y a 48khz. +La inteción de Ardour es funcionar como un sistema HDR "profesional", +reemplazando soluciones de hardware dedicado como la Mackie HDR, el +Tascam 2424 y otros sistemas tradicionales que emplean cinta como la +linea de ADATs de Alesis. +Tambien se busca igualar o mejorar la funcionalidad de sistemas +basados en software como ProTools, Samplitude, Logic Audio, +Nuendo y Cubase VST (reconocemos a estos y a todos los nombres ya +mencionados, como marcas registradas de sus respectivos dueños). +Ardour soporta Control de Maquina MIDI, por lo que puede ser controlado +desde cualquier controladora MMC, como la "Mackie Digital 8 Bus Mixer" +y otros mixers digitales modernos. +.SH OPCIONES +.TP +.B \-b +Muestra todos los comandos asignables a teclas del teclado. +.TP +.B \-U +Especifica el archivo de interface visual. +El que viene provisto por Ardour se llama +.B ardour_ui.rc +y se lo puede encontrar en el primer nivel de la carpeta del código de Ardour. +Este archivo controla todos los colores y fuentes usados por Ardour. +Ardour funcionará sin este, pero se verá, uhm, feo. +.TP +.B \-\-help +Muestra el mensaje de ayuda. +.SH ARCHIVOS +.TP +.B ardour.rc +Configuraciones preestablecidas y de inicio de Ardour. +.TP +.B ardour_ui.rc +Configuraciones de la interface visual de Ardour. +.SH VARIABLES +.TP +.B ARDOUR_RC +Ubicación del archivo ardour.rc. +.TP +.B ARDOUR_SYSTEM_RC +Ubicación del archivo ardour_system.rc. +.TP +.B LADSPA_PATH +Ubicación de plugins LADSPA. +.SH BUGS (Errores en el codigo) +Si. +.SH AUTOR +Paul Davis. +.I No +intente +contactarlo directamente. +En cambio, +mande un email a . +Usted puede suscribirse a: +.br +http://lists.ardour.org/listinfo.cgi/ardour-dev-ardour.org diff --git a/DOCUMENTATION/ardour.1.fr b/DOCUMENTATION/ardour.1.fr new file mode 100644 index 0000000000..368cb81919 --- /dev/null +++ b/DOCUMENTATION/ardour.1.fr @@ -0,0 +1,71 @@ +.TH ARDOUR 1 2002-12-29 +.SH NOM +ardour \- une station de travail audio-numérique +.SH SYNOPSIS +ardour +.B \-b +.RB [ \-U +.IR fichier ] +.RI [ session ] +.br +ardour +.B \-\-help +.SH DESCRIPTION +Ardour est un enregistreur sur disque dur multi-canaux (HDR) et une station de +travail audio-numérique (DAW). +Il est capable d'enregistrer simultanément 24 ou plus canaux audio 32 bits à +48 kHz. +Ardour a pour vocation de fonctionner comme un enregistreur sur disque dur +"professionnel", en remplacement de solutions matérielles dédiées comme le +Mackie HDR, le Tascam 2424 et les plus traditionnels système à bande tels que +la série Alesis ADAT. +Il est aussi conçu pour procurer les mêmes ou de meilleures fonctionnalités +que des systèmes logiciels comme ProTools, Samplitude, Logic Audio, Nuendo et +Cubase VST (nous reconnaissons ces marques comme marques déposées appartenant +à leurs propriétaires respectifs). +Il supporte MIDI Machine Control, et peut ainsi être contrôlé depuis +n'importe quel contrôleur MMC, comme le Mackie Digital 8 Bus mixer et de nombreux autres mélangeurs audio-numériques modernes. +.SH OPTIONS +.TP +.B \-b +Affiche tous les noms des codes clavier possibles. +.TP +.B \-U +Indiquer le chemin vers le fichier GTK RC à utiliser. +Le fichier fourni s'appelle +.B ardour_ui.rc +et se trouve dans la racine du répertoire du code source d'Ardour. +Ce fichier gère l'utilisation de toutes les couleurs et polices de caractère +dans Ardour. +Ardour fonctionnera sans, mais son aspect sera, disons, affreux. +.TP +.B \-\-help +Affiche le message d'aide. +.SH FICHIERS +.TP +.B ardour.rc +Paramètre par défaut et de démarrage d'Ardour. +.TP +.B ardour_ui.rc +Définitions pour l'interface d'Ardour. +.SH ENVIRONNEMENT +.TP +.B ARDOUR_RC +Chemin vers ardour.rc. +.TP +.B ARDOUR_SYSTEM_RC +Chemin vers ardour_system.rc +.TP +.B LADSPA_PATH +Chemin vers les greffons LADSPA. +.SH BOGUES +Oui. +.SH AUTEUR +Paul Davis. +Ne +.I pas +le contacter directement. +Contactez-le plutôt à . +Vous pouvez vous inscrire ici : +.br +http://lists.ardour.org/listinfo.cgi/ardour-dev-ardour.org diff --git a/DOCUMENTATION/ardour.1.ru b/DOCUMENTATION/ardour.1.ru new file mode 100644 index 0000000000..06ab1146f5 --- /dev/null +++ b/DOCUMENTATION/ardour.1.ru @@ -0,0 +1,84 @@ +.TH "ARDOUR" "1" "2004-05-10" "" "" +.SH "éíñ" +ardour \- ÒÁÂÏÞÁÑ ÓÔÁÎÃÉÑ ÄÌÑ ÃÉÆÒÏ×ÏÊ ÏÂÒÁÂÏÔËÉ Ú×ÕËÁ +.SH "ïâúïò" +ardour +.B \-b +.RB [ \-U +.I R ÆÁÊÌ ] +.RI [ ÓÅÓÓÉÑ ] +.br +ardour +.B \-\-help +.SH "ïðéóáîéå" +Ardour \- ÜÔÏ ÐÒÏÇÒÁÍÍÁ ÄÌÑ ÍÎÏÇÏËÁÎÁÌØÎÏÊ ÚÁÐÉÓÉ ÎÁ Ö£ÓÔËÉÊ ÄÉÓË +(hard disk recorder \- HDR) É ÏÄÎÏ×ÒÅÍÅÎÎÏ ÒÅÄÁËÔÏÒ ÄÌÑ ÃÉÆÒÏ×ÏÊ ÏÂÒÁÂÏÔËÉ Ú×ÕËÁ +(digital audio workstation \- DAW). +.br +ïÎ ÓÐÏÓÏÂÅÎ ÚÁÐÉÓÙ×ÁÔØ ÏÄÎÏ×ÒÅÍÅÎÎÏ ÄÏ 24 ÉÌÉ ÂÏÌÅÅ ËÁÎÁÌÏ× 32\-ÂÉÔÎÙÈ +ÁÕÄÉÏÄÁÎÎÙÈ Ó ÞÁÓÔÏÔÏÊ ÄÉÓËÒÅÔÉÚÁÃÉÉ 48 ËçÃ. +Ardour ÎÁÃÅÌÅÎ ÒÁÂÏÔÁÔØ ËÁË "ÐÒÏÆÅÓÓÉÏÎÁÌØÎÁÑ" HDR\-ÓÉÓÔÅÍÁ, ÓÐÏÓÏÂÎÁÑ +ÚÁÍÅÎÉÔØ ÔÁËÉÅ ÁÐÐÁÒÁÔÎÙÅ ÒÅÛÅÎÉÑ ËÁË Mackie HDR, Tascam 2424 É ÍÎÏÇÉÅ +ÔÒÁÄÉÃÉÏÎÎÙÅ ÓÉÓÔÅÍÙ ÚÁÐÉÓÉ ÎÁ ÍÁÇÎÉÔÎÕÀ ÌÅÎÔÕ, ÎÁÐÒÉÍÅÒ ÓÅÒÉÀ Alesis ADAT. +ôÁËÖÅ ÐÒÅÓÌÅÄÕÅÔÓÑ ÃÅÌØ ÏÂÅÓÐÅÞÉÔØ ÆÕÎËÃÉÏÎÁÌØÎÏÓÔØ ÁÎÁÌÏÇÉÞÎÕÀ ÉÌÉ ÄÁÖÅ ÂÏÌØÛÕÀ +ÐÏ ÓÒÁ×ÎÅÎÉÀ Ó ÔÁËÉÍÉ ÐÒÏÇÒÁÍÍÎÙÍÉ ÐÒÏÄÕËÔÁÍÉ ËÁË ProTools, Samplitude, Logic Audio, +Nuendo and Cubase VST (ÍÙ ÐÒÉÚÎÁ£Í, ÞÔÏ ÜÔÉ É ÄÒÕÇÉÅ ÎÁÉÍÅÎÏ×ÁÎÉÑ Ñ×ÌÑÀÔÓÑ +ÔÏÒÇÏ×ÙÍÉ ÍÁÒËÁÍÉ, ËÏÔÏÒÙÅ ÐÒÉÎÁÄÌÅÖÁÔ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÍ ÏÂÌÁÄÁÔÅÌÑÍ). +.br +éÍÅÅÔÓÑ ÐÏÄÄÅÒÖËÁ MIDI Machine Control (MMC), × ÔÏÍ ÞÉÓÌÅ ×ÏÚÍÏÖÎÏ É +ÕÐÒÁ×ÌÅÎÉÅ ÏÔ ÌÀÂÏÇÏ MMC\-ËÏÎÔÒÏÌÌÅÒÁ, ÎÁÐÒÉÍÅÒ, ÔÁËÏÇÏ ËÁË ÍÉËÛÅÒ Mackie Digital +8 Bus ÉÌÉ ÌÀÂÏÇÏ ÄÒÕÇÏÇÏ ÓÏ×ÒÅÍÅÎÎÏÇÏ ÍÉËÛÅÒÁ. +.SH "ëìàþé ëïíáîäîïê óôòïëé" +.TP +.B \-b, \-\-bindings +÷Ù×ÅÓÔÉ ÓÐÉÓÏË ÄÏÓÔÕÐÎÙÈ "ÇÏÒÑÞÉÈ" ËÌÁ×ÉÛ. +.TP +.B \-n, \-\-no\-splash +îÅ ×Ù×ÏÄÉÔØ ÚÁÓÔÁ×ËÕ. +.TP +.B \-U, \-\-ui\-rcfile ÐÕÔØ +õËÁÚÁÔØ ÐÕÔØ Ë ÆÁÊÌÕ ÏÐÉÓÁÎÉÑ ÇÒÁÆÉÞÅÓËÏÇÏ ÉÎÔÅÒÆÅÊÓÁ (GTK RC). +÷ Î£Í ÏÐÒÅÄÅÌÅÎÙ ×ÓÅ ÛÒÉÆÔÙ É Ã×ÅÔÁ ÜÌÅÍÅÎÔÏ× ÉÎÔÅÒÆÅÊÓÁ Ardour. +æÁÊÌ ÄÏÌÖÅÎ ÉÍÅÎÏ×ÁÔØÓÑ ËÁË +.B ardour_ui.rc +, ÅÇÏ ÛÁÂÌÏÎ ÎÁÈÏÄÉÔÓÑ × ËÏÒÎÅ×ÏÍ ËÁÔÁÌÏÇÅ ÉÓÈÏÄÎÙÈ ÔÅËÓÔÏ× Ardour. +Ardour ÍÏÖÎÏ ÚÁÐÕÓÔÉÔØ É ÂÅÚ ÎÅÇÏ, ÎÏ ×ÎÅÛÎÉÊ ×ÉÄ ÉÎÔÅÒÆÅÊÓÁ ÂÕÄÅÔ ÂÅÚÏÂÒÁÚÎÙÍ. +.TP +.B \-c, \-\-jack\-client\-name ÉÍÑ +éÓÐÏÌØÚÏ×ÁÔØ ÄÒÕÇÏÅ ÉÍÑ jack\-ËÌÉÅÎÔÁ, ardour ÐÏ ÕÍÏÌÞÁÎÉÀ. +.TP +.B \-v, \-\-version +éÎÆÏÒÍÁÃÉÑ Ï ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ. +.TP +.B \-h, \-\-help +ðÏËÁÚÁÔØ ÓÐÒÁ×ËÕ. +.SH "æáêìù" +.TP +.B ardour.rc +îÁÓÔÒÏÊËÉ ÐÏ ÕÍÏÌÞÁÎÉÀ É ÕÓÔÁÎÏ×ËÉ "ÇÏÒÑÞÉÈ" ËÌÁ×ÉÛ ÄÌÑ Ardour. +.TP +.B ardour_ui.rc +ïÐÉÓÁÎÉÅ ÐÏÌØÚÏ×ÁÔÅÌØÓËÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Ardour. +.SH "ïëòõöåîéå" +.TP +.B ARDOUR_RC +ðÕÔØ Ë ÆÁÊÌÕ ardour.rc. +.TP +.B ARDOUR_SYSTEM_RC +ðÕÔØ Ë ÆÁÊÌÕ ardour_system.rc +.TP +.B LADSPA_PATH +ðÕÔØ Ë ÍÏÄÕÌÑÍ (ÐÌÁÇÉÎÁÍ) LADSPA. +.SH "ïûéâëé ÷ ðòïçòáííå" +äÁ, ÉÍÅÀÔÓÑ. +.SH "á÷ôïò" +Paul Davis (ðÏÌ äÜ×ÉÓ). +ðÏÖÁÌÕÊÓÔÁ, +.I ÎÅ ÏÂÒÁÝÁÊÔÅÓØ +Ë ÎÅÍÕ ÎÁÐÒÑÍÕÀ. +ó×ÑÚÁÔØÓÑ Ó ÎÉÍ É ÄÒÕÇÉÍÉ ÒÁÚÒÁÂÏÔÞÉËÁÍÉ ÍÏÖÎÏ ÏÔÐÒÁ×É× ÓÏÏÂÝÅÎÉÅ × ÓÐÉÓÏË ÒÁÓÓÙÌËÉ, +. +.br +÷Ù ÍÏÖÅÔÅ ÐÏÄÐÉÓÁÔØÓÑ ÎÁ ÎÅÇÏ ÐÏ ÁÄÒÅÓÕ: +.br +http://lists.ardour.org/listinfo.cgi/ardour-dev-ardour.org diff --git a/PACKAGER_README b/PACKAGER_README new file mode 100644 index 0000000000..36017496be --- /dev/null +++ b/PACKAGER_README @@ -0,0 +1,15 @@ +(1) VST SUPPORT + +You may not distribute binaries of Ardour with VST support. Doing so +is a violation of the license agreement for the Steinberg VST SDK. If +you are found to be distributing such binaries, you risk both +prosecution by Steinberg and public humiliation by me. + +This is not my choice, and as soon as Steinberg change their +licensing, which they have indicated they will do, this policy (and +file) will be removed. + +(2) STANDARD TEMPLATES + +The templates in ./templates are intended for installation in +$prefix/share/ardour/templates. diff --git a/README b/README new file mode 100644 index 0000000000..62de1c1ae3 --- /dev/null +++ b/README @@ -0,0 +1,5 @@ +Please see the DOCUMENTATION directory. + +If you plan to compile ardour from scratch, BUILD is required reading. + + diff --git a/ReleaseNotes-0.9betaX b/ReleaseNotes-0.9betaX new file mode 100644 index 0000000000..358c1317c4 --- /dev/null +++ b/ReleaseNotes-0.9betaX @@ -0,0 +1,294 @@ + + RELEASE NOTES + *************** + +>>>> 0.9beta13 + +beta13 is mostly bug fixes and a few new features over beta12. + +>>> 0.9beta12 + +Welcome to the 0.9beta12 release of Ardour. We are now moving ever +closer to a 1.0 release. This release includes an incredible number of +changes and improvements since beta11. We expect some instabilities +compared to beta11 to remain - please test, collect debug traces, +etc. etc. + + +++++ FIRST IMPORTANT NOTICE +++++ + +Although beta12 will load sessions created by earlier versions of +Ardour, if it is allowed to save a session at any time, that session +will immediately be INCOMPATIBLE WITH ALL PRIOR VERSIONS OF ARDOUR. + +If you have important sessions, you are advised to back up the session +state files (generally called /.ardour). + +I repeat: if you care about being able to use prior versions of Ardour +on your existing sessions, you MUST BACKUP YOUR SESSION STATE FILES. + +Please rest assured that after 1.0 appears, no incompatibility, +forward or backwards, will be tolerated in any future version. + + +++++ SECOND IMPORTANT NOTICE +++++ + +Why the change in the session files? At some point as work on beta12 +was in progress, we realized that Ardour's panning model was +fundamentally broken. Not just the mathematics of the pan law, but the +actual software architecture of panning. Fixing this has required a +massive set of changes to Ardour's basic data flow and a lot of subtle +and not-so-subtle changes to a lot of code. On the plus side, we now +have a completely modular panning architecture that will make it +trivial, mostly, to use plugins for panning in the future. + + ++++++ THIRD IMPORTANT NOTICE ++++++ + +ardour/ksi is no longer built by default. The changes to libardour are +massive and widespread, and I do not have the resources to spend time +getting ardour/ksi to catch up with them. I will reenable default +building if and when ardour/ksi compiles again. I wish I could spend +time on this, but the work is just too much at a time when I +desperately need to get Ardour to a reasonable 1.0 release. + + +++++ FOURTH IMPORTANT NOTICE +++++ + +This version of ardour will NOT compile with gcc 2.95. we are now +using the standard C++ class "stringstream", which has no support in +gcc2.95. i will accept patches that attempt to use the gcc class +"strstream", but i am not willing to spend time on this myself. + + + Changes since 0.9beta11 + ------------------------ + +A) PANNING + + * panning control is per-stream + code is now supporting the notion of the "number of active + streams" within various parts of a signal processing + "route". this is different and orthogonal from the number of + inputs and outputs the route has. if you put a 1in/2out + plugin into a 1in/1out route (which arguably should not be + possible), then before the plugin there is 1 active stream, + and afterwards there are 2. + + * panner linkage + - panners for all streams/channels can be moved + together or in opposing motion. + + * new "bar controllers" for controlling panning to + a stereo output, 1 per data stream + * dbl-click on the bar controller to get numerical + entry, then Return or Tab to get back + to graphics. + +B) AUTOMATION + ---------- + + * gain and pan automation now totally separated + - you can playback pan automation while + doing touch automation on gain. + * if playing automation, and playhead goes past + the last control point, value remains + at that level. + * one button for gain automation state and one for + pan automation state per mixer strip + * ignore the automation mode for now + * touch automation for panning now works. + * hide all automation control points, display them + only as mouse pointer moves through them + * automation values reflected after transport stop + or locate if automation is not off, or when + automation is turned on. + +C) PLUGIN GUIs + ----------- + * use bar controllers (see Panning above) instead of sliders + +D) OTHER MAJOR FUNCTIONALITY + ------------------- + + * initial support for win32/x86 VST plugins as native objects + in Ardour + + * Added exclusive solo operation (ctrl-alt click on solo button) + which sets that track to be the only soloed track. it has a + momentary counterpart (ctrl-alt middle-click) which temporarily + exclusively solos the track while the mouse button is pressed. + BTW, middle-clicking mute buttons is momentary mute as well. + + * Added seamless looping. this can be enabled in the options editor + (misc tab). why is this an option you ask? well, our current + looping scheme simply does a transport reposition at the end of the + loop, and while completely sample accurate, there can be a time gap + between the end of the loop and the beginning. This happens due to + the slow-sync jack transport system, to allow all clients to + reposition in sync (including ardour). However, if you need truly + seamless looping with no gap, you can enable this option which will do + it within ardour only -- you must disable ardour as the jack + transport/time master for it to work. In the near future, the Jack + transport system may acquire a notion of looping, and at that time, + seamless may be used at any time. + + Note that for full compatibility with other transport aware apps, the + normal (non-seamless) looping with ardour as jack transport master is + required and is still quite usable, so don't be discouraged from using it. + + * drag-n-drop from a file manager implemented for + placing audio files into audio tracks + + * LADSPA Presets are now saved in RDF format in + ~/.ladspa/rdf/ardour-presets.n3. Ardour will also + read any other RDF files saved in that location. + + * region list redesigned + + * mouse wheel events now scroll canvas, not change mouse mode + + * always store to current snapshot file, do not make read-only + anymore (might cause problems on older sessions with + snapshots if editing the snapshot) + + * mouse shuttle mode (the return of "scrub") + a new widget replaces the ffwd/rev buttons to provide + continuous speed control in forward and reverse directions. + + * Added option to update actively recording regions with waveforms. + Much cooler than just the pink boxes, eh? On by default, you + can turn it back to the plain pink boxes from the display tab + of the options window. + +B) MINOR IMPROVEMENTS + BUG FIXES + ------------------------------ + + * correct handling of JACK transport API when transport master + * improved handling of SMPTE timecode + - SMPTE frames-per-second can be edited from the options editor + - SMPTE offset (what absolute time with respect to audio frame + zero is SMPTE 0:0:0:0) can be edited from the options + editor + - correct drop frame calculations + * fix for "Destroy Last Capture" bug, plus a correction for + a thinko that caused a segv if DLC done twice between + captures. + * recent session dialog doesn't have "subtrees" for sessions + with just a single state (snapshot) + * xfade editor changes + - "shade under line" + - fix left offset of wave display + * buttons/arrows on editor vertical scrollbar now work + * template selector hidden in new session dialog if the user + has no templates + * fix problem with exporting caused by JACK transport fixes + * MMC buttton relabelled "External MIDI Control", and moved + to MIDI tab of Options editor, along with "Send MMC" + * Better implemented the momentary mute and solo operations so that + the previous state is restored on mouse-release. + * added "lock", "unlock", "normalize", "reverse" to region context + menu + * add new operation to return captured regions to their "captured" + location (does not work for embedded/imported regions). the + operation is in the region context menu as "Original position". + * fixes for region naming when handling external audio files + * redesign new session dialog to use a tabbed notebook + * make sure option editor's "follow playhead" button is in-sync + with follow playhead setting + * fix long-standing bug with MIDI request pool running out of + memory. + * fix export of 100% zeroes in 32 bit integer sample files + * added MMC command when in master MMC mode for transport + startup (Deferred Play) + * correct design flaw in creating regions from session file. + (fixes some odd behaviour when undoing close to + start of working on a session, because regions did + not have the correct history set up) + * limited shuttle speed when mouse departs the control box. + * keep JACK shutdown/kick message on top of editor window + * use "e" and "p" to position edit/playhead wherever mouse is + * fixes for transport button madness + * fix for autoloop indicator region visibility + * made the horizontal scrollbar be a standard one + * included new fader pixmaps from ryan (precursor to new theme) + * ExportDialog saves Track information. It doesn't restore it yet though. + * LRDF enumerations are displayed in a combo box in the PluginUI. + * Updated gtk-ardour Russian translation and added new libardour Russian translation. + * Recent Sessions dialog doesn't display sessions that have been deleted. + * Trying to sample a file in the AudioLibrary that has been moved or deleted won't crash. + * fix catastrophic, stupid, unbelievable and just plain ridiculous + bug in editor constructor that left edit_cursor and + playhead_cursor with random values when Editor::set_state() + was called. + * move "optimization flags" setting into a global autoconf file, + and call AM_OPT_FLAGS from most configure scripts + * increase size of UI request pool + * increase size of UI request ringbuffer + * finally get all tracks connected to ins+outs + when using "auto-connect" options. + (previously only the first N tracks + would be connected, where N was the + number of physical i/o's on + your audio interface) + * prevent GTK from loading its default + RC files at all costs. + * fix gcc 3.3 "bug" in libsoundtouch + * start to use the new BarController widget in plugin GUIs + * fixed the declick on transport stop. yes, it probably never + worked, which is why you heard clicks on stopping. this also + fixes the problem where plugins are interrupted briefly on stop... + now reverb tails are undisturbed on transport stop. + * Audition port names are looked up at runtime. + * Library UI uses the new jftw in libpbd. + * The plugin selector is now sortable by clicking on the different column + titles. + * "stop at session end" option is now saved + * "splash/about window" design changes - unfinished, and wow is it + ugly. but its also more flexible, and i'll finish it RSN. + * several dialog windows forced to float over the editor + * "wait for loading" message removed + * when adding multiple tracks, GUI runs between each track + (causes ugly flashing of mixer window, however) + * Select context menu now contains + "Select all in track" + "Select all" + "Invert in track" + "Invert all" + (invert is known not to work on automation tracks) + * incorrect handling of stereo streams through routes fixed. + * check for adequate version of JACK + * fix recursive call to DiskStream::set_name() that caused a crash + when renaming a track + * fix PortInsert to do a pure wire-level copy - no gain, no pan + * count cycles for plugins + * make sends meter correctly + * clean up (longstanding) late initialization of several variables + (thanks valgrind!) + * convert error log to popup messages, mostly + * run Gtk::Main event loop while embedding/linking an external file + (and use the "watch/wait" cursor too) + * add a half-working detent for panner bar controllers + * try to improve operation of gain/pan automation buttons + * Added spanish translation. Thank you Alex Krohn. + * change pan line colors + * fix display of slide/splice mode + * clicks on track canvas views do not select track + * pack IO CLists in IOSelector in a scrolled window (needs theme name) + * select next IO port after making connection to current one + (speeds and smooths UI interaction when doing IO setup) + * Added spanish translation of ardour.1. + * test plugin configuration and display a dialog if its incorrect + (even when loading ... work in progress) + * Added russian translation of man page. + * Added valgrind shortcut for ardour into gtk_ardour. (arval). + * correct problem with lack of playback in rec-enabled + tracks when not using s/w monitoring + * apply gain to s/w monitored rec-enabled tracks + * fix nasty thread synchronization bug related to + allocation+use of session-wide pan automation + buffers + * provide (not very good) warning if rec-enable attempt + made on a track with no input connections + * more tooltips + * pan muting via context menu + * fix potential segfault in ::~Session caused by + double delete of playlists + * MIDI control for panning added back (untested) + diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000000..a06f6fad02 --- /dev/null +++ b/SConstruct @@ -0,0 +1,663 @@ +import os +import sys +import re +import shutil +import glob +import errno +import time +import SCons.Node.FS + +SConsignFile() +EnsureSConsVersion(0, 96) + +version = '1.9beta1' + +subst_dict = { } + +# +# Command-line options +# + +opts = Options('scache.conf') +opts.AddOptions( + BoolOption('ALTIVEC', 'Compile using Altivec instructions', 0), + ('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''), + BoolOption('DEBIAN', 'Debian build options (no internal versions of 3rd party libraries)', 0), + BoolOption('DEBUG', 'Set to build with debugging information and no optimizations', 0), + PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'), + BoolOption('DEVBUILD', 'Use shared libardour (developers only)', 0), + BoolOption('NLS', 'Set to turn on i18n support', 1), + BoolOption('NOARCH', 'Do not use architecture-specific compilation flags', 0), + PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'), + BoolOption('VST', 'Compile with support for VST', 0), + BoolOption('VERSIONED', 'Add version information to ardour/gtk executable name inside the build directory', 0) + ) + + +#---------------------------------------------------------------------- +# a handy helper that provides a way to merge compile/link information +# from multiple different "environments" +#---------------------------------------------------------------------- +# +class LibraryInfo(Environment): + def __init__(self,*args,**kw): + Environment.__init__ (self,*args,**kw) + + def Merge (self,others): + for other in others: + self.Append (LIBS = other.get ('LIBS',[])) + self.Append (LIBPATH = other.get ('LIBPATH', [])) + self.Append (CPPPATH = other.get('CPPPATH', [])) + self.Append (LINKFLAGS = other.get('LINKFLAGS', [])) + + +env = LibraryInfo (options = opts, + CPPPATH = [ '.' ], + VERSION = version, + TARBALL='ardour-' + version + '.tar.bz2', + DISTFILES = [ ], + DISTTREE = '#ardour-' + version, + DISTCHECKDIR = '#ardour-' + version + '/check' + ) + + +#---------------------------------------------------------------------- +# Builders +#---------------------------------------------------------------------- + +# Handy subst-in-file builder +# + +def do_subst_in_file(targetfile, sourcefile, dict): + """Replace all instances of the keys of dict with their values. + For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'}, + then all instances of %VERSION% in the file will be replaced with 1.2345 etc. + """ + try: + f = open(sourcefile, 'rb') + contents = f.read() + f.close() + except: + raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile + for (k,v) in dict.items(): + contents = re.sub(k, v, contents) + try: + f = open(targetfile, 'wb') + f.write(contents) + f.close() + except: + raise SCons.Errors.UserError, "Can't write target file %s"%targetfile + return 0 # success + +def subst_in_file(target, source, env): + if not env.has_key('SUBST_DICT'): + raise SCons.Errors.UserError, "SubstInFile requires SUBST_DICT to be set." + d = dict(env['SUBST_DICT']) # copy it + for (k,v) in d.items(): + if callable(v): + d[k] = env.subst(v()) + elif SCons.Util.is_String(v): + d[k]=env.subst(v) + else: + raise SCons.Errors.UserError, "SubstInFile: key %s: %s must be a string or callable"%(k, repr(v)) + for (t,s) in zip(target, source): + return do_subst_in_file(str(t), str(s), d) + +def subst_in_file_string(target, source, env): + """This is what gets printed on the console.""" + return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t)) + for (t,s) in zip(target, source)]) + +def subst_emitter(target, source, env): + """Add dependency from substituted SUBST_DICT to target. + Returns original target, source tuple unchanged. + """ + d = env['SUBST_DICT'].copy() # copy it + for (k,v) in d.items(): + if callable(v): + d[k] = env.subst(v()) + elif SCons.Util.is_String(v): + d[k]=env.subst(v) + Depends(target, SCons.Node.Python.Value(d)) + # Depends(target, source) # this doesn't help the install-sapphire-linux.sh problem + return target, source + +subst_action = Action (subst_in_file, subst_in_file_string) +env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter) + +# +# internationalization +# + +# po_helper +# +# this is not a builder. we can't list the .po files as a target, +# because then scons -c will remove them (even Precious doesn't alter +# this). this function is called whenever a .mo file is being +# built, and will conditionally update the .po file if necessary. +# + +def po_helper(po,pot): + args = [ 'msgmerge', + '--update', + po, + pot, + ] + print 'Updating ' + po + return os.spawnvp (os.P_WAIT, 'msgmerge', args) + +# mo_builder: builder function for (binary) message catalogs (.mo) +# +# first source: .po file +# second source: .pot file +# + +def mo_builder(target,source,env): + po_helper (source[0].get_path(), source[1].get_path()) + args = [ 'msgfmt', + '-c', + '-o', + target[0].get_path(), + source[0].get_path() + ] + return os.spawnvp (os.P_WAIT, 'msgfmt', args) + +mo_bld = Builder (action = mo_builder) +env.Append(BUILDERS = {'MoBuild' : mo_bld}) + +# pot_builder: builder function for message templates (.pot) +# +# source: list of C/C++ etc. files to extract messages from +# + +def pot_builder(target,source,env): + args = [ 'xgettext', + '--keyword=_', + '--keyword=N_', + '--from-code=UTF-8', + '-o', target[0].get_path(), + "--default-domain=" + env['PACKAGE'], + '--copyright-holder="Paul Davis"' ] + args += [ src.get_path() for src in source ] + + return os.spawnvp (os.P_WAIT, 'xgettext', args) + +pot_bld = Builder (action = pot_builder) +env.Append(BUILDERS = {'PotBuild' : pot_bld}) + +# +# utility function, not a builder +# + +def i18n (buildenv, sources, installenv): + domain = buildenv['PACKAGE'] + potfile = buildenv['POTFILE'] + + installenv.Alias ('potupdate', buildenv.PotBuild (potfile, sources)) + + p_oze = [ os.path.basename (po) for po in glob.glob ('po/*.po') ] + languages = [ po.replace ('.po', '') for po in p_oze ] + m_oze = [ po.replace (".po", ".mo") for po in p_oze ] + + for mo in m_oze[:]: + po = 'po/' + mo.replace (".mo", ".po") + installenv.Alias ('install', buildenv.MoBuild (mo, [ po, potfile ])) + + for lang in languages[:]: + modir = (os.path.join (install_prefix, 'share/locale/' + lang + '/LC_MESSAGES/')) + moname = domain + '.mo' + installenv.Alias('install', installenv.InstallAs (os.path.join (modir, moname), lang + '.mo')) + +# +# A generic builder for version.cc files +# +# note: requires that DOMAIN, MAJOR, MINOR, MICRO are set in the construction environment +# note: assumes one source files, the header that declares the version variables +# +def version_builder (target, source, env): + text = "int " + env['DOMAIN'] + "_major_version = " + str (env['MAJOR']) + ";\n" + text += "int " + env['DOMAIN'] + "_minor_version = " + str (env['MINOR']) + ";\n" + text += "int " + env['DOMAIN'] + "_micro_version = " + str (env['MICRO']) + ";\n" + + try: + o = file (target[0].get_path(), 'w') + o.write (text) + o.close (); + except IOError: + print "Could not open", target[0].get_path(), " for writing\n" + sys.exit (-1) + + text = "#ifndef __" + env['DOMAIN'] + "_version_h__\n"; + text += "#define __" + env['DOMAIN'] + "_version_h__\n"; + text += "extern int " + env['DOMAIN'] + "_major_version;\n" + text += "extern int " + env['DOMAIN'] + "_minor_version;\n" + text += "extern int " + env['DOMAIN'] + "_micro_version;\n" + text += "#endif /* __" + env['DOMAIN'] + "_version_h__ */\n"; + + try: + o = file (target[1].get_path(), 'w') + o.write (text) + o.close (); + except IOError: + print "Could not open", target[1].get_path(), " for writing\n" + sys.exit (-1) + + return None + +version_bld = Builder (action = version_builder) +env.Append (BUILDERS = {'VersionBuild' : version_bld}) + +# +# a builder that makes a hard link from the 'source' executable to a name with +# a "build ID" based on the most recent CVS activity that might be reasonably +# related to version activity. this relies on the idea that the SConscript +# file that builds the executable is updated with new version info and committed +# to the source code repository whenever things change. +# + +def versioned_builder(target,source,env): + # build ID is composed of a representation of the date of the last CVS transaction + # for this (SConscript) file + + try: + o = file (source[0].get_dir().get_path() + '/CVS/Entries', "r") + except IOError: + print "Could not CVS/Entries for reading" + return -1 + + last_date = "" + lines = o.readlines() + for line in lines: + if line[0:12] == '/SConscript/': + parts = line.split ("/") + last_date = parts[3] + break + o.close () + + if last_date == "": + print "No SConscript CVS update info found - versioned executable cannot be built" + return -1 + + tag = time.strftime ('%Y%M%d%H%m', time.strptime (last_date)); + print "The current build ID is " + tag + + tagged_executable = source[0].get_path() + '-' + tag + + if os.path.exists (tagged_executable): + print "Replacing existing executable with the same build tag." + os.unlink (tagged_executable) + + return os.link (source[0].get_path(), tagged_executable) + +verbuild = Builder (action = versioned_builder) +env.Append (BUILDERS = {'VersionedExecutable' : verbuild}) + +# +# source tar file builder +# + +def distcopy (target, source, env): + treedir = str (target[0]) + + try: + os.mkdir (treedir) + except OSError, (errnum, strerror): + if errnum != errno.EEXIST: + print 'mkdir ', treedir, ':', strerror + + cmd = 'tar cf - ' + # + # we don't know what characters might be in the file names + # so quote them all before passing them to the shell + # + all_files = ([ str(s) for s in source ]) + cmd += " ".join ([ "'%s'" % quoted for quoted in all_files]) + cmd += ' | (cd ' + treedir + ' && tar xf -)' + p = os.popen (cmd) + return p.close (); + +def tarballer (target, source, env): + cmd = 'tar -jcf ' + str (target[0]) + ' ' + str(source[0]) + " --exclude '*~'" + print 'running ', cmd, ' ... ' + p = os.popen (cmd) + return p.close () + +dist_bld = Builder (action = distcopy, + target_factory = SCons.Node.FS.default_fs.Entry, + source_factory = SCons.Node.FS.default_fs.Entry, + multi = 1) + +tarball_bld = Builder (action = tarballer, + target_factory = SCons.Node.FS.default_fs.Entry, + source_factory = SCons.Node.FS.default_fs.Entry) + +env.Append (BUILDERS = {'Distribute' : dist_bld}) +env.Append (BUILDERS = {'Tarball' : tarball_bld}) + +# ---------------------------------------------------------------------- +# Construction environment setup +# ---------------------------------------------------------------------- + +libraries = { } + +libraries['core'] = LibraryInfo (CPPPATH = [ '#libs']) + +libraries['sndfile'] = LibraryInfo() +libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile') + +libraries['lrdf'] = LibraryInfo() +libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf') + +libraries['raptor'] = LibraryInfo() +libraries['raptor'].ParseConfig('pkg-config --cflags --libs raptor') + +libraries['samplerate'] = LibraryInfo() +libraries['samplerate'].ParseConfig('pkg-config --cflags --libs samplerate') + +libraries['jack'] = LibraryInfo() +libraries['jack'].ParseConfig('pkg-config --cflags --libs jack') + +libraries['xml'] = LibraryInfo() +libraries['xml'].ParseConfig('pkg-config --cflags --libs libxml-2.0') + +libraries['glib2'] = LibraryInfo() +libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0') +libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0') +libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gmodule-2.0') + +libraries['gtk2'] = LibraryInfo() +libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0') + +libraries['pango'] = LibraryInfo() +libraries['pango'].ParseConfig ('pkg-config --cflags --libs pango') + +libraries['libgnomecanvas2'] = LibraryInfo() +libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomecanvas-2.0') + +libraries['ardour2'] = LibraryInfo (LIBS='ardour2', LIBPATH='#libs/ardour2', CPPPATH='#libs/ardour2') +libraries['midi++2'] = LibraryInfo (LIBS='midi++', LIBPATH='#libs/midi++2', CPPPATH='#libs/midi++2') +libraries['pbd3'] = LibraryInfo (LIBS='pbd', LIBPATH='#libs/pbd3', CPPPATH='#libs/pbd3') +libraries['gtkmm2ext'] = LibraryInfo (LIBS='gtkmm2ext', LIBPATH='#libs/gtkmm2ext', CPPPATH='#libs/gtkmm2ext') + +libraries['fst'] = LibraryInfo() +if env['VST']: + libraries['fst'].ParseConfig('pkg-config --cflags --libs libfst') + +# +# Audio/MIDI library (needed for MIDI, since audio is all handled via JACK) +# + +conf = Configure(env) + +if conf.CheckCHeader('alsa/asoundlib.h'): + libraries['sysmidi'] = LibraryInfo (LIBS='asound') + env['SYSMIDI'] = 'ALSA Sequencer' + subst_dict['%MIDITAG%'] = "seq" + subst_dict['%MIDITYPE%'] = "alsa/sequencer" +elif conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'): + # this line is needed because scons can't handle -framework in ParseConfig() yet. + libraries['sysmidi'] = LibraryInfo (LINKFLAGS= '-framework CoreMIDI -framework CoreFoundation -framework CoreAudio -framework CoreServices -framework AudioUnit') + env['SYSMIDI'] = 'CoreMIDI' + subst_dict['%MIDITAG%'] = "coremidi" + subst_dict['%MIDITYPE%'] = "coremidi" + +env = conf.Finish() + +if env['DEBIAN']: + + libraries['soundtouch'] = LibraryInfo(LIBS='SoundTouch') + + coredirs = [ + 'templates' + ] + + subdirs2 = [ + 'libs/pbd3', + 'libs/midi++2', + ] + + gtk2_subdirs = [ + 'libs/gtkmm2ext', + ] + +else: + + libraries['sigc2'] = LibraryInfo(LIBS='sigc++2', + LIBPATH='#libs/sigc++2', + CPPPATH='#libs/sigc++2') + libraries['glibmm2'] = LibraryInfo(LIBS='glibmm2', + LIBPATH='#libs/glibmm2', + CPPPATH='#libs/glibmm2') + libraries['pangomm'] = LibraryInfo(LIBS='pangomm', + LIBPATH='#libs/gtkmm2/pango', + CPPPATH='#libs/gtkmm2/pango') + libraries['atkmm'] = LibraryInfo(LIBS='atkmm', + LIBPATH='#libs/gtkmm2/atk', + CPPPATH='#libs/gtkmm2/atk') + libraries['gdkmm2'] = LibraryInfo(LIBS='gdkmm2', + LIBPATH='#libs/gtkmm2/gdk', + CPPPATH='#libs/gtkmm2/gdk') + libraries['gtkmm2'] = LibraryInfo(LIBS='gtkmm2', + LIBPATH='#libs/gtkmm2/gtk', + CPPPATH='#libs/gtkmm2/gtk') + libraries['libgnomecanvasmm'] = LibraryInfo(LIBS='libgnomecanvasmm', + LIBPATH='#libs/libgnomecanvasmm', + CPPPATH='#libs/libgnomecanvasmm') + libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch', + LIBPATH='#libs/soundtouch', + CPPPATH='#libs/soundtouch') + + coredirs = [ + 'libs/soundtouch', + 'templates' + ] + + subdirs2 = [ + 'libs/sigc++2', + 'libs/pbd3', + 'libs/midi++2', + ] + + gtk2_subdirs = [ + 'libs/glibmm2', + 'libs/gtkmm2/pango', + 'libs/gtkmm2/atk', + 'libs/gtkmm2/gdk', + 'libs/gtkmm2/gtk', + 'libs/libgnomecanvasmm', + 'libs/gtkmm2ext', + ] + +opts.Save('scache.conf', env) +Help(opts.GenerateHelpText(env)) + +if os.environ.has_key('PATH'): + env.Append(PATH = os.environ['PATH']) +if os.environ.has_key('PKG_CONFIG_PATH'): + env.Append(PKG_CONFIG_PATH = os.environ['PKG_CONFIG_PATH']) + +final_prefix = '$PREFIX' +install_prefix = '$DESTDIR/$PREFIX' + +if env['PREFIX'] == '/usr': + final_config_prefix = '/etc' +else: + final_config_prefix = env['PREFIX'] + '/etc' + +config_prefix = '$DESTDIR' + final_config_prefix + +# +# Compiler flags and other system-dependent stuff +# + +opt_flags = [] + +# guess at the platform, used to define compiler flags + +config_guess = os.popen("tools/config.guess").read()[:-1] + +config_cpu = 0; +config_arch = 1; +config_kernel = 2; +config_os = 3; +config = config_guess.split ("-") + +# +# on OS X darwinports puts things in /opt/local by default +# +if config[config_arch] == 'apple': + libraries['core'].Append (LIBPATH = [ '/opt/local/lib' ], + CPPPATH = [ '/opt/local/include' ]) + +if config[config_cpu] == 'powerpc': + # + # Apple/PowerPC optimization options + # + # -mcpu=7450 does not reliably work with gcc 3.* + # + if env['NOARCH'] == 0: + if env['ALTIVEC'] == 1: + opt_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec" ]) + else: + opt_flags.extend([ "-mcpu=750", "-mmultiple" ]) + opt_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"]) + +elif re.search ("i[0-9]86", config[config_cpu]) != None : + + if env['NOARCH'] == 0: + + if config[config_kernel] == 'linux' : + + flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1] + x86_flags = flag_line.split (": ")[1:][0].split (' ') + + if "mmx" in x86_flags: + opt_flags.append ("-mmmx") + if "sse" in x86_flags: + opt_flags.extend (["-msse", "-mfpmath=sse"]) + if "3dnow" in x86_flags: + opt_flags.append ("-m3dnow") + + if config[config_cpu] == "i586": + opt_flags.append ("-march=i586") + elif config[config_cpu] == "i686": + opt_flags.append ("-march=i686") + +# +# ARCH="..." overrides all +# + +if env['ARCH'] != '': + opt_flags = env['ARCH'].split() + +# +# prepend boiler plate optimization flags +# + +opt_flags[:0] = [ + "-O3", + "-fomit-frame-pointer", + "-ffast-math", + "-fstrength-reduce" + ] + +if env['DEBUG'] == 1: + env.Append(CCFLAGS="-g") +else: + env.Append(CCFLAGS=" ".join (opt_flags)) + +env.Append(CCFLAGS="-Wall") + +if env['VST']: + env.Append(CCFLAGS="-DVST_SUPPORT") + +# +# everybody needs this +# + +env.Merge ([ libraries['core'] ]) + +# +# i18n support +# + +conf = Configure (env) + +if env['NLS']: + if conf.CheckCHeader('libintl.h') == None: + print 'This system is not configured for internationalized applications. An english-only version will be built\n' + env['NLS'] = 0 + +env = conf.Finish() + +if env['NLS'] == 1: + env.Append(CCFLAGS="-DENABLE_NLS") + +Export('env install_prefix final_prefix config_prefix final_config_prefix libraries i18n version') + +# +# the configuration file may be system dependent +# + +conf = env.Configure () + +if conf.CheckCHeader('/System/Library/Frameworks/CoreAudio.framework/Versions/A/Headers/CoreAudio.h'): + subst_dict['%JACK_BACKEND%'] = "coreaudio:Built-in Audio:in" +else: + subst_dict['%JACK_BACKEND%'] = "alsa_pcm:playback_" + +env = conf.Finish() + +rcbuild = env.SubstInFile ('ardour.rc','ardour.rc.in', SUBST_DICT = subst_dict) + +env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour'), 'ardour_system.rc')) +env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour'), 'ardour.rc')) + +Default (rcbuild) + +# source tarball + +Precious (env['DISTTREE']) + +# +# note the special "cleanfirst" source name. this triggers removal +# of the existing disttree +# + +env.Distribute (env['DISTTREE'], + [ 'SConstruct', + 'COPYING', 'PACKAGER_README', 'README', + 'ardour.rc.in', + 'ardour_system.rc', + 'tools/config.guess' + ] + + glob.glob ('DOCUMENTATION/AUTHORS*') + + glob.glob ('DOCUMENTATION/CONTRIBUTORS*') + + glob.glob ('DOCUMENTATION/TRANSLATORS*') + + glob.glob ('DOCUMENTATION/BUILD*') + + glob.glob ('DOCUMENTATION/FAQ*') + + glob.glob ('DOCUMENTATION/README*') + ) + +srcdist = env.Tarball(env['TARBALL'], env['DISTTREE']) +env.Alias ('srctar', srcdist) +# +# don't leave the distree around +# +env.AddPreAction (env['DISTTREE'], Action ('rm -rf ' + str (File (env['DISTTREE'])))) +env.AddPostAction (srcdist, Action ('rm -rf ' + str (File (env['DISTTREE'])))) + +# +# the subdirs +# + +for subdir in coredirs: + SConscript (subdir + '/SConscript') + +for sublistdir in [subdirs2, gtk2_subdirs]: + for subdir in sublistdir: + SConscript (subdir + '/SConscript') + +# cleanup +env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log']) + diff --git a/ardour.rc.in b/ardour.rc.in new file mode 100644 index 0000000000..685bf22d86 --- /dev/null +++ b/ardour.rc.in @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ardour_system.rc b/ardour_system.rc new file mode 100644 index 0000000000..911eb60181 --- /dev/null +++ b/ardour_system.rc @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/.cvsignore b/libs/.cvsignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/cassowary/.cvsignore b/libs/cassowary/.cvsignore new file mode 100644 index 0000000000..7ac7ae08ae --- /dev/null +++ b/libs/cassowary/.cvsignore @@ -0,0 +1,15 @@ +.deps +ClReader-lex.cc +ClReader.cc +ClReader.hh +ClReader.cc.h +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.h +config.h.in +config.log +config.status +configure +stamp-h1 diff --git a/libs/cassowary/ANNOUNCE b/libs/cassowary/ANNOUNCE new file mode 100644 index 0000000000..e0137fa643 --- /dev/null +++ b/libs/cassowary/ANNOUNCE @@ -0,0 +1,37 @@ +Announcing the release of a free (for research use) constraint solver: + +Cassowary Constraint Solver for Smalltalk, C++, and Java +Version 0.60 + +Web Page: http://www.cs.washington.edu/research/constraints/cassowary +Distribution: ftp://ftp.cs.washington.edu:/pub/constraints/code/cassowary/ +Contact: cassowary@cs.washington.edu + +Greg J. Badros and +Alan Borning +University of Washington +Computer Science and Engineering +15-December-1999 + +with Constraint Drawing Applet (CDA) by Michael Noth + +Cassowary is an incremental constraint solving toolkit that efficiently +solves systems of linear equalities and inequalities. Constraints may +be either requirements or preferences. Client code specifies the +constraints to be maintained, and the solver updates the constrained +variables to have values that satisfy the constraints. + +A technical report is included in the distribution that describes the +algorithm, interface, and implementation of the Cassowary solver. +Additionally, the distribution contains toy sample applications written +in Smalltalk, C++, Java, and Python, and a more complex example Java +applet, the "Constraint Drawing Application". + +More information is available on our web page: + +http://www.cs.washington.edu/research/constraints/cassowary + +See README for more details on getting started using these packages. +See NEWS for a history of user-visible changes. +See LICENSE for legalese regarding use of this distribution. + diff --git a/libs/cassowary/AUTHORS b/libs/cassowary/AUTHORS new file mode 100644 index 0000000000..51d8592e6f --- /dev/null +++ b/libs/cassowary/AUTHORS @@ -0,0 +1,12 @@ +Cassowary Constraint Solving Toolkit was +Implemented by: + +Greg J. Badros and +Alan Borning +University of Washington +Computer Science and Engineering +Seattle, WA 98195-2350 + +with Constraint Drawing Applet (CDA) by Michael Noth + +Please send bug reports to cassowary@cs.washington.edu diff --git a/libs/cassowary/COPYING b/libs/cassowary/COPYING new file mode 100644 index 0000000000..d60c31a97a --- /dev/null +++ b/libs/cassowary/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/libs/cassowary/COPYING.LGPL b/libs/cassowary/COPYING.LGPL new file mode 100644 index 0000000000..5f66256a83 --- /dev/null +++ b/libs/cassowary/COPYING.LGPL @@ -0,0 +1,444 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to +share and change it. By contrast, the GNU General Public Licenses are +intended to guarantee your freedom to share and change free software--to +make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the Free +Software Foundation and other authors who decide to use it. You can use +it too, but we suggest you first think carefully about whether this +license or the ordinary General Public License is the better strategy to +use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish); that you receive source code or can get it if +you want it; that you can change the software and use pieces of it in +new free programs; and that you are informed that you can do these +things. + +To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for you +if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or +for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide complete +object files to the recipients, so that they can relink them with the +library after making changes to the library and recompiling it. And you +must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is +no warranty for the free library. Also, if the library is modified by +someone else and passed on, the recipients should know that what they +have is not the original version, so that the original author's +reputation will not be affected by problems that might be introduced by +others. + +Finally, software patents pose a constant threat to the existence of any +free program. We wish to make sure that a company cannot effectively +restrict the users of a free program by obtaining a restrictive license +from a patent holder. Therefore, we insist that any patent license +obtained for a version of the library must be consistent with the full +freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License. This license, the GNU Lesser General Public +License, applies to certain designated libraries, and is quite different +from the ordinary General Public License. We use this license for +certain libraries in order to permit linking those libraries into +non-free programs. + +When a program is linked with a library, whether statically or using a +shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the entire +combination fits its criteria of freedom. The Lesser General Public +License permits more lax criteria for linking other code with the +library. + +We call this license the "Lesser" General Public License because it does +Less to protect the user's freedom than the ordinary General Public +License. It also provides other free software developers Less of an +advantage over competing non-free programs. These disadvantages are the +reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + +For example, on rare occasions, there may be a special need to encourage +the widest possible use of a certain library, so that it becomes a +de-facto standard. To achieve this, non-free programs must be allowed to +use the library. A more frequent case is that a free library does the +same job as widely used non-free libraries. In this case, there is +little to gain by limiting the free library to free software only, so we +use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of free +software. For example, permission to use the GNU C Library in non-free +programs enables many more people to use the whole GNU operating system, +as well as its variant, the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is linked +with the Library has the freedom and the wherewithal to run that program +using a modified version of the Library. + +The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or other +authorized party saying it may be distributed under the terms of this +Lesser General Public License (also called "this License"). Each +licensee is addressed as "you". + +A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which +has been distributed under these terms. A "work based on the Library" +means either the Library or any derivative work under copyright law: +that is to say, a work containing the Library or a portion of it, either +verbatim or with modifications and/or translated straightforwardly into +another language. (Hereinafter, translation is included without +limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making +modifications to it. For a library, complete source code means all the +source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and +installation of the library. + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of running +a program using the Library is not restricted, and output from such a +program is covered only if its contents constitute a work based on the +Library (independent of the use of the Library in a tool for writing +it). Whether that is true depends on what the Library does and what the +program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the notices +that refer to this License and to the absence of any warranty; and +distribute a copy of this License along with the Library. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of +it, thus forming a work based on the Library, and copy and distribute +such modifications or work under the terms of Section 1 above, provided +that you also meet all of these conditions: + + a) The modified work must itself be a software library. b) You + must cause the files modified to carry prominent notices stating + that you changed the files and the date of any change. c) You + must cause the whole of the work to be licensed at no charge to + all third parties under the terms of this License. d) If a + facility in the modified Library refers to a function or a table + of data to be supplied by an application program that uses the + facility, other than as an argument passed when the facility is + invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the + Library, and can be reasonably considered independent and + separate works in themselves, then this License, and its terms, + do not apply to those sections when you distribute them as + separate works. But when you distribute the same sections as part + of a whole which is a work based on the Library, the distribution + of the whole must be on the terms of this License, whose + permissions for other licensees extend to the entire whole, and + thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or + contest your rights to work written entirely by you; rather, the + intent is to exercise the right to control the distribution of + derivative or collective works based on the Library. + + In addition, mere aggregation of another work not based on the + Library with the Library (or with a work based on the Library) on + a volume of a storage or distribution medium does not bring the + other work under the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so that +they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in these +notices. + +Once this change is made in a given copy, it is irreversible for that +copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the +Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative +of it, under Section 2) in object code or executable form under the +terms of Sections 1 and 2 above provided that you accompany it with the +complete corresponding machine-readable source code, which must be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a +designated place, then offering equivalent access to copy the source +code from the same place satisfies the requirement to distribute the +source code, even though third parties are not compelled to copy the +source along with the object code. + +5. A program that contains no derivative of any portion of the Library, +but is designed to work with the Library by being compiled or linked +with it, is called a "work that uses the Library". Such a work, in +isolation, is not a derivative work of the Library, and therefore falls +outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates +an executable that is a derivative of the Library (because it contains +portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. Section 6 +states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is +not. Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data structure +layouts and accessors, and small macros and small inline functions (ten +lines or less in length), then the use of the object file is +unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section +6. Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a +"work that uses the Library" with the Library to produce a work +containing portions of the Library, and distribute that work under terms +of your choice, provided that the terms permit modification of the work +for the customer's own use and reverse engineering for debugging such +modifications. + +You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work during +execution displays copyright notices, you must include the copyright +notice for the Library among them, as well as a reference directing the +user to the copy of this License. Also, you must do one of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in + the Library will not necessarily be able to recompile the + application to use the modified definitions.) b) Use a suitable + shared library mechanism for linking with the Library. A suitable + mechanism is one that (1) uses at run time a copy of the library + already present on the user's computer system, rather than + copying library functions into the executable, and (2) will + operate properly with a modified version of the library, if the + user installs one, as long as the modified version is + interface-compatible with the version that the work was made + with. c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials specified + in Subsection 6a, above, for a charge no more than the cost of + performing this distribution. d) If distribution of the work is + made by offering access to copy from a designated place, offer + equivalent access to copy the above specified materials from the + same place. e) Verify that the user has already received a copy + of these materials or that you have already sent this user a + copy. + +For an executable, the required form of the "work that uses the Library" +must include any data and utility programs needed for reproducing the +executable from it. However, as a special exception, the materials to be +distributed need not include anything that is normally distributed (in +either source or binary form) with the major components (compiler, +kernel, and so on) of the operating system on which the executable runs, +unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions +of other proprietary libraries that do not normally accompany the +operating system. Such a contradiction means you cannot use both them +and the Library together in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library +side-by-side in a single library together with other library facilities +not covered by this License, and distribute such a combined library, +provided that the separate distribution of the work based on the Library +and of the other library facilities is otherwise permitted, and provided +that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. b) Give prominent notice with the combined + library of the fact that part of it is a work based on the + Library, and explaining where to find the accompanying uncombined + form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the +Library except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, link with, or distribute the +Library is void, and will automatically terminate your rights under this +License. However, parties who have received copies, or rights, from you +under this License will not have their licenses terminated so long as +such parties remain in full compliance. + +9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and all +its terms and conditions for copying, distributing or modifying the +Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted +herein. You are not responsible for enforcing compliance by third +parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Library at all. For example, if a patent license would +not permit royalty-free redistribution of the Library by all those who +receive copies directly or indirectly through you, then the only way you +could satisfy both it and this License would be to refrain entirely from +distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is implemented +by public license practices. Many people have made generous +contributions to the wide range of software distributed through that +system in reliance on consistent application of that system; it is up to +the author/donor to decide if he or she is willing to distribute +software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be +a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may +add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among countries +not thus excluded. In such case, this License incorporates the +limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions +of the Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a license +version number, you may choose any version ever published by the Free +Software Foundation. + +14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free Software +Foundation; we sometimes make exceptions for this. Our decision will be +guided by the two goals of preserving the free status of all derivatives +of our free software and of promoting the sharing and reuse of software +generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE +ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH +YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF +THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR +OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS diff --git a/libs/cassowary/ChangeLog b/libs/cassowary/ChangeLog new file mode 100644 index 0000000000..be31e0e5a9 --- /dev/null +++ b/libs/cassowary/ChangeLog @@ -0,0 +1,2002 @@ +Fri Mar 18 15:41:00 2005 Taybin Rutkin + * Removed ClSet.h, ClMap.h. + * ClReader.l includes ClReader.cc.h instead of ClReader.hh. The + difference between yacc and bison. + * Various changes to fix compliation. + +Wed Jan 29 21:36:15 2003 Taybin Rutkin + * Updated to work with g++ 3.x compilers. + * More direct use of STL. + * Removed C wrappers + +Sun Mar 12 13:40:44 2000 Greg J. Badros + + * guile/cassowary_scm.cc: Give docstrings as arguments + + * guile/cl-snarf.h: Added docstring as an argument to CL_PROC to + be like the revised Scwm documentation extraction system. + +Sat Feb 12 20:34:55 2000 Greg J. Badros + + * Makefile.am: Added GTL.h.patch to EXTRA_DIST + +Sat Feb 12 20:31:47 2000 Greg J. Badros + + * c++/ClSimplexSolver.cc, c++/ClSimplexSolver.h: Drop + ExternalResetStayConstants, make ResetStayConstants() public. + Test _fResetStayConstantsAutomatically before doing so in + Resolve(). Use _fAutosolve instead of _fOptimizeAutomatically. + Drop DisplayObjective (wasn't defined anyway). Drop field + _fOptimizeAutomatically (use _fAutosolve from parent, instead). + + * guile/cassowary_scm.hpp, guile/cassowary_scm.cc: Drop extra + include of guile/gh.h + + * guile/cassowary_scm.cc: Added `cl-set-auto-solve!', + `cl-set-auto-reset-stay-constants!' + +Sat Jan 29 17:45:32 2000 Greg J. Badros + + * configure.in (CASSOWARY_VERSION): Bump to 0.55. + +Sat Jan 29 17:43:05 2000 Greg J. Badros + + * c++/ClSimplexSolver.cc (Resolve): Do not comment out + "ResetStayConstants()" as Beurivé had done. This was resulting in + quirky behaviour whereby the windows were "rubber-banding" back to + where they were at the start of an interaction (e.g., if I push a + window out of the way to the left with another window, as I move + the pushing window back to the right, the other window comes back + to the right with the pushing window). Maybe that's desirable + behaviour in some instances, but it's not the behaviour we + document and sure feels weird to me. + +Sat Jan 29 17:38:43 2000 Greg J. Badros + + * java/sym.java, java/parser.java, java/Yylex.java: Added -- these + are created by JavaCUP which I don't want to be necessary for + building. + +Mon Jan 24 09:34:20 2000 Greg J. Badros + + * c++/ClSymbolicWeight.h: Set SymbolicWeight multiplier to + 1000000, not 10000 (A.Beurivé) + + * c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc: Added + ChangeStrength, ChangeStrengthAndWeight, ChangeWeight, + DisplayObjective, ExternalResetStayConstants fns. + (RemoveConstraintInternal) Avoid picking the objective row when + removing a constraint. (Optimize) Pick any negative row to avoid + unending pivots [I think this is a work-around to avoid having to + implement Bland's anti-cycling rule... maybe I should just do + that, though]. (A.Beurivé) + +Thu Dec 16 11:12:34 1999 Greg J. Badros + + * configure.in: Version bumped to 0.54a + +Thu Dec 16 11:10:42 1999 Greg J. Badros + + * java/Makefile.am: Force prefix ordering in SUBDIRS so that "." + dir gets built before the demos subdirectory. + + * smalltalk/Makefile.am: Fix .dat file -- thanks Alan! + +Wed Dec 15 19:31:48 1999 Greg J. Badros + + * java/README: More notes re: security problems w/ Java 2. + + * java/cda/Makefile.am: Added run target to ease running it. + + * Makefile.am (EXTRA_DIST): Added c++/{config.h.in,stamp-h.in} + + * java/cda/Makefile.am (EXTRA_DIST): Clean up install of .gif + files. + + * java/Makefile.am (EXTRA_DIST): Added ClReader.{cup,lex} + + * c++/Makefile.am: Do not make symlink to cassowary; let + configure.in do that. + +Wed Dec 15 18:13:14 1999 Greg J. Badros + + * java/Makefile.am: Put SUBDIRS demo cda back in since they + compile now. + + * scripts/recreate-symlinks: Update with links to ../../EDU from + demo directories for Java code. Use ln -sf, not just ln -s, to avoid + warnings. + + * Makefile.am (EXTRA_DIST): Include scripts/recreate-symlinks + + * configure.in: Run recreate-symlinks script. + +Wed Dec 15 18:07:27 1999 Greg J. Badros + + * java/cda/Makefile.am: Put Constraint/*, Main/* files into the + distribution and build with them. + + * java/demos/*.java: Move everything into the + EDU.Washington.grad.gjb.cassowary_demos package. + + * java/cda/classes/run.html, java/demos/quaddemo.htm: Fix nl + convention, name class explicitly w/ package in front, w/o + trailing .class. + + * java/cda/**: Move everything into the + EDU.Washington.grad.noth.cda package. + +Wed Dec 15 17:21:08 1999 Greg J. Badros + + * java/Makefile.am: Build java parser. + + * java/ClParseTest.java: Added. + + * GTL.h.patch: Added -- need by gcc-2.95 when compiling GTL-0.3.1 + + * java/README: Mention java parser. + + * java/ClReader.lex, java/ClReader.cup: Cleanup, guard debug messages. + +Tue Dec 14 11:15:01 1999 Greg J. Badros + + * configure.in: Fix -fpermissive test to not check "cc" as well as + $CC. Eliminate the --enable-permissive flag since it is no longer + necessary. + +Mon Dec 13 15:56:19 1999 Greg J. Badros + + * java/Yylex.java: Added, from Will Portnoy. + + * java/ClReader.cup, java/ClReader.lex: Latest version from Will, + cleaned up line breaks, set a tab-width for Emacs. + +Mon Dec 13 15:55:59 1999 Greg J. Badros + + * c++/Makefile.am: Remove ClReader.cc -- why did I add this + before? + +Fri Dec 10 13:29:00 1999 Greg J. Badros + + * java/ClSimplexSolver.java (addLowerBound, addUpperBound): Fix + these two functions to call addConstraint before returning. + Thanks Stephen Allain for catching this! Updated exception specs + for those methods and for addBounds. + +Tue Dec 7 08:42:34 1999 Greg J. Badros + + * smalltalk/A991206.dat: New image from Alan. Include correct + version of code for "ClSimplexSolver removeConstraint:" to fix bug + when deleting constraints with weights other than 1. Also + disallow invalid comparisons between symbolic weights and floats. + Replace expressions "x clApprox: 0.0" with "x clApproxZero", which + works correctly for both symbolic weights and floats. + + * smalltalk/*.st: Added from Alan. + +Mon Nov 29 16:23:06 1999 + + * configure.in: Bump to version 0.54, added -lGTL to GTL_LIB even + when no --with-gtl option is given. No longer create README from + README.in. Added --enable-static-library option, off by default. + + * c++/Makefile.am (sources): Added ClReader.cc + + * cassowary.spec.in, cassowary-both.spec.in: No longer need the + --enable-guile-build option; it's the default now. + +Mon Nov 29 10:52:49 1999 Greg J. Badros + + * c++/Makefile.am: Added use of AM_CONDITIONAL + CL_BUILD_STATIC_LIBRARY; only buile libcassowary.a if that option + was selected. + + * guile/Makefile.am (libconstraints_la_LIBADD): Added @GTL_LIB@ to + make the guile library work with the FD-enabled version of the library. + +Sat Nov 27 16:11:10 1999 Greg J. Badros + + * configure.in: Invert sense of --enable-guile-build and call it + --disable-guile-build; build guile wrapper automatically if + guile-config works. + +Sat Nov 27 15:20:03 1999 Greg J. Badros + + * configure.in: Use an AM_CONDITIONAL for CL_BUILD_FD_SOLVER, not + an AC_DEFINE. Also, remove duplicate AC_SUBST of GTL_LIB, and fix + AM_CONDITIONAL of CL_BUILD_TESTS. + +Sat Nov 27 15:19:20 1999 Greg J. Badros + + * c++/Makefile.am: Try separating out FD stuff better, and use + CL_BUILD_FD_SOLVER AM_CONDITIONAL to control dependence on that + code. + + * c++/config.h.in: Drop CL_BUILD_FD_SOLVER; it's now an + AM_CONDITIONAL instead of a define. + +Wed Nov 24 15:40:27 1999 Greg J. Badros + + * c++/ClSimplexSolver.cc: Fix typo in a throw message. + + * c++/ClLinearInequality.h: Throw an editmisuse when a + ClLinearInequality is created w/o an inequality operator. + +Tue Nov 23 16:54:05 1999 Greg J. Badros + + * configure.in: Use guile's pkglibdir, not pkgdatadir, for + choosing cassoguiledir. + +Tue Nov 16 17:35:54 1999 Greg J. Badros + + * java/ClReader.lex, java/ClReader.cup: Added -- code by Will + Portnoy for adding a parser to the Java implementation. Untested, + and an early version that he emailed me. + +Tue Nov 16 17:34:00 1999 Greg J. Badros + + * java/ClTestColumns.java, java/ClTests.java: Put in the cassowary + package, instead of importing cassowary.*; jikes needed this + (discovered during testing of java-ml work). + +Sat Nov 13 11:43:48 1999 Greg J. Badros + + * java/Timer.java (Timer): Remove return type from Timer() + constructor (jikes caught the bug when I used this as a test case + for my java-ml work). + +Sun Oct 24 13:17:14 1999 Greg J. Badros + + * configure.in: Updated version to 0.53, generate + smalltalk/Makefile from Makefile.am. + + * NEWS: Updated for 0.53 release. + + * Makefile.am: Added smalltalk directory to SUBDIRS. + +Sat Oct 23 14:34:27 1999 Greg J. Badros + + * COPYING.GPL: Added + + * LICENSE: Added Scwm exception + + +Sat Oct 23 14:33:48 1999 Greg J. Badros + + * c++/Makefile.am: Make cassowary/ directory symlink as needed. + +Sun Oct 3 16:50:43 1999 Greg J. Badros + + * c++/ClSimplexSolver.cc: Use clvNil some places instead of NULL. + This is important for newer, pickier gcc-2.95.x. Thanks Alexandre + Duret-Lutz for the patch! + +Thu Sep 30 08:17:16 1999 Greg J. Badros + + * c++/ClFDSolver.cc: Added missing #include -- Thanks + Harry Hochheiser for bug report. + +Sun Sep 26 13:43:12 1999 Greg J. Badros + + * c++/Makefile.am (libcassowary_la_LDFLAGS): Added -version-info + flag to make libcassowary.so.0.0.1, instead of .0.0.0 + +Sun Sep 26 13:15:32 1999 Greg J. Badros + + * README, ANNOUNCE: Removed + + * README.in, ANNOUNCE.in: Added + + * configure.in: Create README, ANNOUNCE, bump to 0.52post + +Sat Sep 25 16:02:22 1999 Greg J. Badros + + * cassowary.spec.in, configure.in: Update to version 0.52. + +Fri Sep 24 18:51:42 1999 Greg J. Badros + + * configure.in: Remove first of redundant checks for HAVE_SCM_MAKE_SMOB_TYPE_MFPE. + +Mon Sep 20 13:36:45 1999 Greg J. Badros + + * guile/cassowary_scm.cc: Fix `cl-int-value' to use gh_int2scm + instead of gh_double2scm + +Sun Sep 19 14:45:59 1999 Greg J. Badros + + * c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc: Replace + _editVarMap with _editInfoList, a list. Make ClEditInfo class + contain the variable since its no longer stored as values in a + hash where the key is the variable. Drop the index from + ClEditInfo. Rename ClVarToEditInfoMap to ClEditInfoList. + +Sun Sep 19 14:44:00 1999 Greg J. Badros + + * c++/ClTests.cc (multiedit2): Added this new test to check nested + edits that share an existing variable better. This tests the fix + for the ScwmButtons auto-orientation seg-fault bug in Scwm. + + * c++/ClBug0.cc: Added comment re: new bug fix. + +Sat Sep 18 22:31:54 1999 Greg J. Badros + + * configure.in: Added GUILE_LIBS setting. + + * cassowary.spec.in: Use fake_root_for_install to get the + cassowary guile library in proper place. + + * autogen.sh: Only create symlink if not already created. + + * acconfig.h, c++/config.h.in: Added HAVE_SCM_MAKE_SMOB_TYPE_MFPE + + * README: Added note re: enable-permissive + + * guile/cassowary_scm.cc: Use new-style (guile-1.3.2 or better) + SMOBs conditioning on HAVE_SCM_MAKE_SMOB_TYPE_MFPE. + +Wed Sep 8 20:03:25 1999 Greg J. Badros + + * cassowary.spec.in: Bump to release 8 + + * cassowary-nofd.spec2.in: Bump to release 2. + +Wed Sep 8 19:43:53 1999 Greg J. Badros + + * c++/Makefile.am: Drop building of config-inline.h -- let + configure handle that-- this was causing a double-build + (!!!ugh!!!) of Cassowary when building from RPMs, e.g. + + * GTL.spec.in: Use install-strip target. + +Tue Sep 7 23:34:49 1999 Greg J. Badros + + * configure.in, Makefile.am: use cassowary-nofd.spec2.in + + * cassowary-nofd.spec2.in: Renamed from cassowary-nofd.spec.in, + since having two *.spec files in the top level upsets rpm (it cats + them together and then gets confused by the double .spec file). + + * cassowary-both.spec.in: Added-- rpm doesn't support two %build + tags (one for a subpackage), but if it did, this is what the + corresponding .spec file might look like. + +Tue Sep 7 23:02:26 1999 Greg J. Badros + + * Makefile.am: Added cassowary-nofd.spec to EXTRA_DIST, + bin_SCRIPTS = cassowary-config. Added dist-nofd target, and + supporting targets. + + * cassowary.spec.in: Bump to 7, provide virtual package, install + %{prefix}/bin/* (for cassowary-config script). + + * configure.in: Added CASSOWARY_VERSION variable, create + cassowary-config, cassowary-nofd.spec + + * cassowary-config.in, cassowary-nofd.spec.in: Added + +Mon Sep 6 21:40:58 1999 + + * cassowary.spec.in: Use install-strip target to remove debug + symbols and save disk space. Remove %{prefix}/doc/* from the + %files list as they are in the %doc listing already. + +Mon Sep 6 12:25:14 1999 Greg J. Badros + + * cassowary.spec.in: Use --host=alpha-linux on that platform + (using an %ifarch). Bump to release 6. + + * GTL.spec.in: Fix the ./configure line for alpha platform (was + missing "--" before the "prefix" option). Bump to release 2. + + * c++/ClSymbolicWeight.h, c++/ClSymbolicWeight.cc: Use int, not + unsigned, to remove ambiguity in ClSymbolicWeight constructor. + +Sat Sep 4 15:17:13 1999 Greg J. Badros + + * acconfig.h: Added NO_CC_PERMISSIVE flag. + + * autogen.sh: Added #!/bin/sh - to top. + + * configure.in: Test for g++/gcc -fpermissive flag. Hopefully + this will let it get used only where it is accepted. Some better + guile tests, too. + + * cassowary.spec.in: Use --enable-permissive flag, bump from + release 3 to 5. + +Sat Sep 4 14:44:14 1999 Greg J. Badros + + * c++/Makefile.am, guile/Makefile.am: Added CPPEXTRAFLAGS to + AM_CPPFLAGS. + + * guile/Makefile.am: Guard lib_LIBRARIES with HAVE_GUILE test so + that guile stuff is only built when GUILE is desired and we have + the libraries installed. + +Tue Aug 31 22:16:04 1999 Greg J. Badros + + * java/demos/Makefile.am, java/cda/Makefile.am, java/Makefile.am + (install-javaJAVA): Do not try to install .class files if no + HAVE_JAVA + +Tue Aug 31 21:30:24 1999 Greg J. Badros + + * cassowary.spec.in: Do not use --disable-java-build, since that + still invokes the rule which is not what I want. + + * java/demos/Makefile.am, java/cda/Makefile.am: Added bogus + classjava.stamp rule when no HAVE_JAVA to work around getting an + error when trying to run javac with no source files. + + * configure.in: Fix some HAVE_JAVA bugs. Still not perfect, but better. + +Tue Aug 31 17:07:31 1999 Greg J. Badros + + * java/demos/Makefile.am, java/cda/Makefile.am, java/Makefile.am: + Added EXTRA_DIST. + +Tue Aug 31 16:27:41 1999 Greg J. Badros + + * configure.in (HAVA_JAVA): AC_OUTPUT the java/*/Makefiles. + + * cassowary.spec.in: Use --disable-java-build ./configure option. + Bump to release 3. + + * Makefile.am: Do not conditionally do directories-- that is + really broken with automake/rpm building. + +Tue Aug 31 16:20:45 1999 Greg J. Badros + + * java/demos/Makefile.am, java/cda/Makefile.am, java/Makefile.am + (java_JAVA): Guard with if HAVE_JAVE. + +Mon Aug 30 12:03:26 1999 Greg J. Badros + + * cassowary.spec.in: Bump to release 2 + + * configure.in: Drop the java/* wrappers/* from AC_OUTPUT macro-- + this breaks java builds but make the Cassowary RPM build more + cleanly. I'm going to start making a separate cassowary-java + distribution unless I can figure out how to make automake and Java + co-exist more happily. + +Mon Aug 30 12:00:39 1999 Greg J. Badros + + * c++/ClAbstractVariable.h: #include "cl_auto_ptr.h" and use + cl_auto_ptr, not auto_ptr. + +Mon Aug 30 10:06:50 1999 Greg J. Badros + + * c++/cl_auto_ptr.h: Change the conditional inclusion sandwich to + CL_AUTO_PTR_H. Added "#define cl_auto_ptr auto_ptr" for MSVC. + +Thu Aug 26 22:42:50 1999 Greg J. Badros + + * cassowary.spec.in: Require guile 1.3.2, to be safe. Require GTL + >= 0.3.1, not gtl >= 0.3.1 (note capitalization) + +Thu Aug 26 14:12:42 1999 Greg J. Badros + + * c++/ClFDSolver.h, c++/ClCTest.c, c++/ClC.h, c++/ClC.cc, + c++/Cassowary.h, c++/ClConstraint.h: Use LONG_MIN, not MINLONG and + #include not since the latter is deprecated + (and does not work in VC++). + + * THANKS: Thank Pengling He for his VC++ bug report re: values.h + +Thu Aug 26 14:08:46 1999 Greg J. Badros + + * configure.in (GUILE_PKGDATA_DIR): Set cassoguiledir variable, + and use ${prefix} prefix of GUILE_PKGDATA_DIR to be sure that rpm + building succeeds (was failing because it was trying to write to + an absolute location that guile told it to use, instead of using + the prefix of $RPM_BUILD_ROOT). + + * c++/Makefile.am: Fix lex/yacc building dependencies. + + * guile/Makefile.am (cassoguile_LTLIBRARIES): Do not set + cassoguiledir here-- do it in configure.in instead. + +Thu Aug 26 11:02:36 1999 Greg J. Badros + + * guile/Makefile.am (EXTRA_DIST), docs/Makefile.am: Added docs to + EXTRA_DIST. + + * c++/Makefile.am: Added ClReader.l, ClReader.y to EXTRA_DIST, + remove ClReader.cc from sources. Added timer.h to + pkginclude_HEADERS. + + * Makefile.am: Update EXTRA_DIST + +Thu Aug 26 08:45:08 1999 Greg J. Badros + + * configure.in: Write cassowary.spec, GTL.spec. Bump version to + 0.51. + + * autogen.sh: Run configure, not config.status + + * VERSION, README, NEWS, ANNOUNCE: Bump to 0.51, add date, notes. + + * Makefile.am: Drop Java, Python to make easier to package. Added + EXTRA_DIST to include some doc files and the cassowary.spec file. + +Wed Aug 25 22:54:18 1999 Greg J. Badros + + * c++/Makefile.am (pkginclude_HEADERS): cl_auto_ptr.h now, not auto_ptr.h + +Mon Aug 23 21:26:31 1999 Greg J. Badros + + * ltmain.sh, ltconfig, libtool, configure: Removed -- these are + autogenerated by autogen.sh + +Mon Aug 23 21:23:53 1999 Greg J. Badros + + * c++/ClSimplexSolver.cc: Use cl_auto_ptr, not auto_ptr. + + * c++/ClAbstractVariable.h: #include , not "auto_ptr.h" + + * c++/cl_auto_ptr.h: Added -- renamed from auto_ptr.h since that + was causing some difficulties due to the standard C++ auto_ptr template. + +Mon Jul 26 10:19:35 1999 Greg Badros + + * c++/Makefile.am (libcassowary_la_SOURCES): Remove redundant + listing of ClFD* files from this target. + +Mon Jul 26 09:41:09 1999 Greg Badros + + * c++/Cl.h: Include ClConstraint.h, since cnLT, etc., need to be + defined for ClReader.y + +Mon Jul 26 09:22:11 1999 Greg Badros + + * acconfig.h, configure.in: Use CL_ prefix for BUILD_FD_SOLVER and + HAVE_GTL. + +Mon Jul 26 09:17:56 1999 Greg Badros + + * c++/config.h.in,c++/ClC.h,c++/ClC.cc,c++/Cl.h: Use CL_ prefix on + BUILD_FD_SOLVER and HAVE_GTL so that the config-inline.h gets the + right definitions. + + * c++/Makefile.am: Expanded out the sources_for_fd_solver since + the _OBJECTS make variable doesn't get expanded properly if this + step is deferred until later. This breaks builds w/o FD solver, + but I have to get Amaya working ASAP. + +Mon Jul 19 17:08:03 1999 Greg Badros + + * c++/ClSymbolicWeight.h: Increase multiplier to 10000 for + AsDouble-- works around the bug in resizing Scwm windows because + the medium stay constraints on width and height are too strong for + the strong edit constraint. + +Sun Jul 11 19:37:39 1999 Greg Badros + + * c++/ClLinearExpression.h: Remove "class" from a typedef + ClMap. Thanks Alexandre 'Pollux' Duret-Lutz + for testing against a more recent egcs (gcc-2.95) that caught this + problem. + + * configure.in: Improve checks for guile so that it uses --prefix + and --exec-prefix to --guile-prefix and --guile-exec-prefix + +Sat Jul 10 19:21:34 1999 Greg Badros + + * autogen.sh: rm libtool stuff just in case. + + * README: Updated version number, notes about building it and + needing GTL for fd solver. + + * configure.in: Added --enable-cxx-tests, --enable-fd-solver, + --with-gtl; switch --disable-java-build to --enable-java-build + + * acconfig.h, c++/config.h.in: Added HAVE_GTL, BUILD_FD_SOLVER options. + + * c++/Makefile.am: Make only the library and ClTests get built by + default (other binary test programs are each big when build -g, + and aren't useful to the end user). Use @SOURCES_FOR_FD_SOLVER@ + to permit a version of the toolkit to be build without the finite + domain subsolver. + + * c++/ClC.h, c++/ClC.cc, c++/Cl.h: Add #ifdefs for no fd subsolver. + +Fri May 7 17:02:09 1999 Greg J Badros + + * c++/ClC.cc (CL_ClvLookup): Return NULL if varmap is NULL instead + of asserting it is non-NULL + +Thu May 6 19:02:38 1999 Greg J Badros + + * c++/ClFDTests.cc: Added return type to connect1. + + * c++/ClFDSolver.cc: Return *this where missing. + + * c++/ClFDConnectorVariable.h: Reorder mem vars to match + initialization order in ctr. + + * c++/ClC.h, c++/ClC.cc: Added CL_ClvIsFD. + +Sun May 2 10:42:00 1999 Greg J Badros + + * c++/ClReader.l: Permit "_" in identifiers (needed for env + variable precondition variables). + + * c++/ClLinearInequality.h: Honour _fStrictInequality flag when + testing FIsSatisfied(). + + * c++/ClLinearConstraint.h: Added missing "void" return type for + ChangeConstant. + +Fri Apr 30 09:45:51 1999 Greg J Badros + + * c++/ClFDConnectorVariable.cc, c++/ClFDConnectorVariable.h: + Added -- support connecting the FD solver to the simplex solver + via a variable in the FD region that gets its value "copied" to a + analogous variable in the Simplex region. + + * Makefile.am: Added ClFDConnectorVariable.[ch] files. + + * c++/ClLinearConstraint.h: Added ChangeConstant() + + * c++/ClFloatVariable.h, c++/ClFDVariable.h, + c++/ClFloatVariable.cc, c++/ClFDVariable.cc, + c++/ClAbstractVariable.h: Move _pv, SetPv(), Pv() from + ClFloatVariable, ClFDVariable, into common parent + ClAbstractVariable. Drop ClFloatVariable::SetName(). + + * c++/ClFDTests.cc: Added connect1 test to test + ClFDConnectorVariable + + * c++/ClFDSolver.cc: Use 1 + value-rhs for errors to ensure that + strict inequalities behave reasonably. + +Thu Apr 29 19:29:34 1999 Greg J Badros + + * c++/ClVariable.h: Register variable in the dictionary when + initialized from a ClFDVariable*. Added const ClAbstractVariable + *operator() const. + + * c++/ClSolver.h, c++/ClSimplexSolver.h: Added _fAutosolve, + _pfnChangeClvCallback; added default ctr to initialize. Added + SolveNoException(); Moved SetAutosolve(), FIsAutosolving(), + SetChangeClvCallback() from ClSimplexSolver up to here. + + * c++/ClSolver.cc: Added PrintTo for list, operator<< + for same. + + * c++/ClSimplexSolver.cc: Test constraint with + FIsOkayForSimplexSolver() before trying to add it (avoids adding + FD constraints to the simplex solver). + s/_fOptimizeAutomatically/_fAutosolve/g + + * c++/ClParseTest.cc: Use FCanConvertCn() before trying to. + + * c++/ClFDVariable.h: Make PlfdnDomain() const and return const. + + * c++/ClFDVariable.cc: PrintOn now displays value (duh!) + + * c++/ClFDTests.cc: Use new ListPushOnto() instead of a bunch of + push_back. Added simple2, simple3. + + * c++/ClFDSolver.h, c++/ClFDSolver.cc: Added ChangeClv(), + AddConstraintInternal(), RemoveConstraintInternal(), + ListPushOnto(), fDebugFDSolve var, more debugging code. + + * c++/ClConstraint.h, c++/ClFDConstraint.h: Added + FIsOkayForSimplexSolver() returning false for FDCns, true in the + base class. + + * c++/ClFDBinaryOneWayConstraint.h, + c++/ClFDBinaryOneWayConstraint.cc: Make ctr take ClConstraint + instead of ClLinearConstraint. Added EnsurePreconditionsForCn(), + FCanConvertCn(). Throw better exceptions instead of + ExCLEditMisue-- use new ExCLTooDifficultSpecial. + + * c++/ClCTest.c: Use CL_ClvPrint instead of coding by hand. + Added CL_CldvNew() call. + + * c++/ClC.cc, c++/ClC.h: Added FDN_EOL defn, typedefs for Number, + FDNumber, CL_CldvNew(), CL_FDCanConvertCn(), CL_FDCnFromCn(), + CL_ClvPrint(). Use CL_Solver for PfnChangeClvCallback, not CL_SimplexSolver. + + * c++/ClAbstractVariable.h: Throw instead of assert(false) in base + class IsPivotable(), IsRestricted(). + +Wed Apr 28 19:38:46 1999 Greg J Badros + + * c++/ClC.cc: Added CL_FDSolverNew() + +Wed Apr 28 19:10:32 1999 Greg J Badros + + * c++/Makefile.am (INCLUDES): Include @GUILE_INCLUDES@ -- actually + done to get cassowary libraries (GJB:FIXME::) + +Wed Apr 28 18:49:51 1999 Greg J Badros + + * c++/Makefile.am: Added ClCTest to the _PROGRAMS, and use + -lstdc++ on them + + * c++/ClSolver.h: Expose Resolve() in base-class interface, along + with <<, and PrintOn. + + * c++/ClSolver.cc: Added << operator. + + * c++/ClC.h, c++/ClC.cc, c++/ClTest.c: Fixed bugs, use + CL_Solver... instead of CL_SimplexSolver... where appropriate. + +Wed Apr 28 17:15:47 1999 Greg J Badros + + * c++/ClSymbolicWeight.h: Make CLevels unsigned, not int, and + require all 3 args to the 3 double ctr to remove ambiguity. + + * c++/ClSimplexSolver.h: Check constraint before adding and throw + an error if the constraint is no good for the SimplexSolver. + + * c++/ClParseTest.cc: Don't assume a failed add is due to an + inconsistent system-- could be wrong kind of constraint was read + in. + + * c++/ClLinearInequality.h: Store the strictness of the + inequality, since other solvers may be able to use strict ones. + + * c++/ClFDSolver.cc: Fine-tune the exception objects thrown... use + the richer hierarchy. + + * c++/ClFDBinaryOneWayConstraint.c, + c++/ClFDBinaryOneWayConstraint.h: Added IsStrictInequality(), get + the direction of the inequality correct. + + * c++/ClErrors.h: Richer hierarchy of exceptions to cope with + solver limitations. + + * c++/ClConstraint.h: Added IsStrictInequality(); have + ReadOnlyVars return a const ClVarSet&, not value. + +Wed Apr 28 12:20:47 1999 Greg J Badros + + * c++/Makefile.am: Added ClFDBinaryOneWayConstraint.cc. + + * c++/ClReader.y, c++/ClReader.l: Added tokens GT, LT, and handle + them (for >, <, resp). + + * c++/ClParseTest.cc: try converting to a FD constraint, and show + what that object is. + + * c++/ClFDBinaryOneWayConstraint.h: Added ctr from a + ClLinearConstraint. Added IsInequality(). + +Wed Apr 28 12:08:16 1999 Greg J Badros + + * c++/ro-test.in: Added for testing below. + + * c++/ClFDBinaryOneWayConstraint.cc: Added -- so far just a ctr + from a ClLinearConstraint object (since the parser hands me a + constraint object that is a ClLinearConstraint object). + +Tue Apr 27 20:35:23 1999 Greg J Badros + + * c++/ClSymbolicWeight.h, c++/ClSymbolicWeight.cc: Drop default + ctr, and give default arg value to CLevels of 3. Added operator*. + + * c++/ClFDTests.cc: Better test. + + * c++/ClFDSolver.h, c++/ClFDSolver.cc: Use SymbolicWeights for + errors, so hierarchy is handled (i.e., strengths on constraints + are honoured). + + * c++/ClFDConstraint.h: Added ctr with strength, weight. + + * c++/ClFDBinaryOneWayConstraint.h: Added strength, weight + arguments to ctr. + + * c++/ClConstraint.h: Added symbolicWeight() accessor. + +Tue Apr 27 15:04:34 1999 Greg J Badros + + * c++/ClFDSolver.cc (RemoveConstraint): Fix some bugs-- handle nil + read-only variable properly, and clean up _mapVarToNode when + erasing nodes. + +Tue Apr 27 10:40:58 1999 Greg J Badros + + * c++/ClSolver.cc: Added -- wrote PrintTo, << basic impls, and + simple AddConstraint. + + * c++/QocaBench.cc, c++/ClTests.cc, c++/ClSubgraphTest.cc, + ClLeakTest.cc, ClC.cc: Use Solve(), not solve() + + * c++/ClVariable.h: Added DesiredValue, PlfdnDomain base-class + accessors, handle clvNil in PrintOn. + + * c++/Makefile.am: Added ClSolver.cc, link with -lGTL, added + missing and new .cc, .h files. + + * c++/ClTypedefs.h: added ClVarToConstraintSetMap. + + * c++/ClSolver.h: Added AddConstraint{,NoException}, + RemoveConstraint{,NoException}, Solver here to the abstract + interface, also the prototypes for the PrintTo and << on the + ClTypedefs.h types. + + * c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc: Solve(), not + solve(), move some protos in abstract base class ClSolver. + + * c++/ClLinearInequality.h: Use ClCnRelation, not + ClInequalityOperator. + + * c++/ClFDVariable.h, c++/ClFDVariable.cc: More accessors, + settors, comment-out non-initial-domain ctr. + + * c++/ClFDTests.cc: Test more. + + * c++/ClFDSolver.h, c++/ClFDSolver.cc: Almost complete, but + largely untested implementation. + + * c++/ClFDBinaryOneWayConstraint.h: Added ctrs, setters, getters. + + * c++/ClErrors.h: Fixed throw message for ExCLConstraintNotFound + to not refer to the tableau. + + * c++/ClConstraint.h: Added ClCnRelation (was ClInequalityOperator + in c++/ClLinearInequality.h) and wrote StrCnRelation for printing + it. + + * c++/Cl.h: include ClFDSolver.h + + * c++/Cassowary.h : include values.h, def FDN_NOTSET (FIXME: drop this?) + +Sun Apr 25 18:55:26 1999 Greg J Badros + + * c++/Makefile.am: Added ClFDBinaryOneWayConstraint.h, + ClFDConstraint.h to pkginclude_HEADERS. + + * c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc: Added optional + strength argument to AddPointStays, AddPointStay fns. + + * c++/ClFDVariable.h: Set _plfdnInitialDomain to avoid a warning + for now. + + * c++/ClFDBinaryOneWayConstraint.h: Added return xo to PrintOn. + + * c++/ClConstraint.h: Fix order of initializers. + + * c++/ClC.h, c++/ClC.cc: Document return value for + CL_VarMapDelete, and do proper return. + + * configure.in: Added --enable-cflags, --enable-cxxflags, + --enable-cppextraflags. Not tested yet. + +Sun Apr 25 11:46:28 1999 Greg J Badros + + * configure.in: Bump version to .50, for FD features. + +Sun Apr 25 11:37:52 1999 Greg J Badros + + * c++/Makefile.am: Comment out the Bug sources/builds, add the FD + sources. + + * c++/ClSimplexSolver.h: Inherit from ClSolver, too. Move SetPv, + Pv() out into ClSolver base class. + + * c++/ClSimplexSolver.cc, c++/Cl.h: Make szCassowaryVersion a const char *. + + * c++/ClReadery.y, c++/ClReader.l, c++/ClReader.h: Support "?" + read-only annotations, and use Constraint::AddROVars() to track + the ro vars of a constraint expression. + + * c++/ClParseTest.cc: Show whether the constraint is added + successfully or if it is inconsistent. + + * c++/ClLinearConstraint.h: Fix BUG-- super should be + ClConstraint, not ClLinearConstraint. + + * c++/ClFDVariable.cc: Use <, > to delimit FD vars, not [, ]. + + * c++/ClConstraint.h, c++/ClConstraint.cc: Added AddROVars, + FIsReadOnlyVar, ReadOnlyVars. + +Thu Apr 22 20:18:31 1999 Greg J Badros + + * c++/ClVariable.h: Added ClVariable ctr that takes a + ClFDVariable*, this ambiguates returning NULL as a ClVariable, so + may not be a good idea, but it does make it less confusing than + having another overloaded version of ClVariable's ctr. Added + IsFloatVariable, IsFDVariable fwding fns. + + * c++/ClSimplexSolver.cc: Disambiguate uses of NULL to be + (ClFloatVariable *)NULL. + + * c++/ClFloatVariable.h: Added IsFloatVariable() to return true + + * c++/ClC.h, c++/ClC.cc: Added CL_ClvLookupTrim for removing ws + around the var name. + + * c++/ClAbstractVariable.h: Make IsPivotable, IsRestricted both + assert false instead of being pure virtual -- they only need to be + overridden if we want to permit them to be called. Added + IsFloatVariable(), IsFDVariable() both returning false in this + base class. + + * c++/Cassowary.h: Added FDNumber typedef to be a long. + + * c++/Makefile.am: Added ClFDVariable.{cc,h} + + * c++/ClFDVariable.cc, c++/ClFDVariable.h: Added, copied from + ClFloatVariable and modified slightly. + +Tue Apr 20 10:18:32 1999 Greg J Badros + + * smalltalk/README: Note that smalltalk implementation is now in + the public domain. + + * README: Update to version 0.43, note about smalltalk + implementation being in public domain. + + * LICENSE: Note about not applying to smalltalk implementation + + * ANNOUNCE: Update date to today. + + * *: Changed copyright to be "Greg J. Badros and Alan Borning" + instead of "Alan Borning and Greg J. Badros". Okayed by Alan -- + to hopefully encourage more people to write me with their + questions/problems rather than Alan. + +Mon Apr 19 13:45:35 1999 Greg J Badros + + * cassowary.spec: Added --with-guile-prefix + +Mon Apr 19 13:02:46 1999 Greg J Badros + + * c++/ClReader.l: Be a bit more careful about end of string + handling in YY_INPUT-- only return result = 1 if we read a + non-null character. Call yy_flush_buffer() before throw-ing an + error, so that we start anew the next time we are asked to return + tokens for the parser. + + * c++/ClC.h, c++/ClC.cc: Added CL_SimplexSolverAddStay. (Fix typo + in .cc) + +Fri Apr 16 16:36:24 1999 Greg J Badros + + * c++/ClTests.cc, c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc, : Use "RemoveConstraintNoException", not + "removeConstraintNoException" (fix initial caps.) + + * c++/ClReader.y: Start looking for a constraint, turn on verbose + warnings and DEBUG option (still need to set cldebug = 1 in + debugger) + + * c++/ClReader.h: In operator() for the lookup proc, Return + &clvNil() if _pmapVars is still NULL + + * c++/ClC.h, c++/ClC.cc: Added CL_VariableName(..), CL_VarMapDelete(..), + CL_RemoveConstraint(..) + + +Wed Apr 14 16:56:05 1999 Greg J Badros + + * configure.in: Bump to .43. + + * c++/ClC.cc (CL_VarMapDelete, CL_VariableName): Added new functions. + + * cassowary.spec: Added, for building rpms + + * c++/gdbinit-cassowary: Added a bunch of guile debugging macros. + + * c++/Makefile.am: Added ClC.cc to libcassowary_a_SOURCES + + * c++/ClReader.y: Turn off parser debugging messages by default + + * c++/ClC.h, c++/ClC.cc: Added CL_ConstraintPrint, CL_FIsSatisfied + protos + +Wed Mar 31 17:23:18 1999 Greg J Badros + + * wrappers/Makefile.in: Rename PYTHON_HEADERS to PYTHON_HEADER_DIR + so it does not get treated specially by automake (?). + + * configure.in: Bump to .42. Added --disable-cpp-build, + --disable-java-build, and disable Python/Guile builds + automatically if directories cannot be found. Drop the + cassowary from c++/cassowary/config.h -- just use c++/config.h + + * autogen.sh: do not fail if config.status is not -x. + + * Makefile.am: Honour the HAVE_foo flags so that not all subdirs + have to be built. + +Mon Mar 29 21:01:21 1999 Greg J Badros + + * ltconfig, ltmain.sh: Added -- so libtool isn't broken in + distributions. + +Mon Mar 29 20:59:17 1999 Greg J Badros + + * configure.in: Try to undo a bash-ism. Untested on a vendor sh, + but still works with bash. + +Sat Mar 20 19:19:37 1999 Greg J Badros + + * Release v0.41. + +Sat Mar 20 19:19:13 1999 Greg J Badros + + * Added config.sub and config.guess to the repo -- they were + symlinks before which broke the distribution. + +Thu Mar 18 15:20:51 1999 Greg J Badros + + * Release v0.4. + +Thu Mar 18 14:44:39 1999 Greg J Badros + + * configure.in: Do not let config-inline.h get overwritten if it + is unchanged. Add some extra messages to tell status of + config-inline.h + +Thu Mar 18 12:59:02 1999 Greg J Badros + + * README, configure.in, wrappers/Makefile.in: Added + --with-python-headers configure option. + +Thu Mar 18 12:48:55 1999 Greg J Badros + + * README: Added notes about what to do when a subdir build fails, + suggest -k by default. + + * guile/Makefile.am (test): Added this target for easier way to + run cltests.scm. + + * guile/README: Updated with notes about how to run cltests.scm. + + * java/Makefile.in: Fix tests build rule. + +Thu Mar 18 11:42:49 1999 Greg J Badros + + * configure.in: Create config-inline.h at end of script. + + * c++/Makefile.am: Do not have rule for building config-inline.h; + let configure script do that. + +Thu Mar 18 11:05:27 1999 Greg J Badros + + * c++/*.h: Use #include config-inline.h incantation so that header + files don't include config.h (since they may be included by + another package that has its own config.h) + + * c++/*.cc: Use #include config.h as these are build-time-only + used and can thus rely on the full configure details. + +Thu Mar 18 10:57:08 1999 Greg J Badros + + * guile/cassowary_scm.hpp: Use #include config-inline.h + incantation. + + * guile/cassowary_scm.h: Drop including config.h; it's not + needed. + + * guile/cassowary_scm.cc: Use cassowary/config.h, not config.h + +Thu Mar 18 10:29:40 1999 Greg J Badros + + * c++/Makefile.am: Install config-inline.h, not config.h, and + build config-inline.h by grepping for #define CL_ in config.h. + This works around the problem caused by Scwm including Cassowary + header files which then included cassowary's config.h and + conflicted with Scwm's config.h. + +Thu Mar 18 10:11:40 1999 Greg J Badros + + * c++/test-*.cc: Only #include "Cl.h" + +Thu Mar 18 09:50:45 1999 Greg J Badros + + * wrappers/Makefile.in (clean): use rm -f so we don't get a + warning if file is missing. + +Thu Mar 18 09:49:35 1999 Greg J Badros + + * java/Makefile.in: Use JAVA_CLASS_PATH configure variable. Fix + install target to echo a message about the install happening + during the build. + +Wed Mar 17 18:54:16 1999 Greg J Badros + + * c++/Makefile.am: Use libtool, and added lib_LTLIBRARIES. Put + benchmarks, bugs, and test programs all under $libdir/cassowary. + Drop cassoincludedir, as that's just pkginclude, and use + include_HEADERS for Cl.h and ClC.h, the main top-level includes. + Also install config.h. + + * c++/Cassowary.h: #undef PACKAGE, VERSION before #including + cassowary/config.h as a cheezy workaround. (Switched from "" to + <>, and ../ to cassowary/ also). + +Wed Mar 17 18:50:49 1999 Greg J Badros + + * configure.in: Put config.h in c++/cassowary so cassowary must do + #include so there is no filename conflict + with other packages including cassowary header files (e.g., + Scwm). Added AM_PROG_LIBTOOL call. Set GUILE variables outside + of the guile-prefix ACE_ARG_PATH macro, and set GUILE_PKGDATA_DIR + use guile-config to find out where we should install the .so file. + +Wed Mar 17 18:43:08 1999 Greg J Badros + + * guile/Makefile.am: Updated to build using libtool, and to + install header files. Changes name to libconstraints.* so that + the guile module name (cassowary constraints) works out, and set + it to install in the right place. + +Wed Mar 17 18:39:13 1999 Greg J Badros + + * guile/cltests.scm: Added #! lines, change name of module to + (cassowary constraints), remove redundant `use-modules' call. + + * guile/cassowary_scm.hpp: #include + cassowary/ClLinearExpression_fwd.h, not ClLinearExpression_fwd.h + + * guile/cassowary_scm.cc: Change name of module to (cassowary + constraints). Make the init_cassowary_scm fn static. + +Wed Mar 17 07:39:10 1999 Greg J Badros + + * c++/Cassowary.h, c++/ClSimplexSolver.cc: Switch back to + including config.h (now ../config.h) from Cassowary.h, instead of + from ClSimplexSolver.cc. + +Tue Mar 16 19:56:02 1999 Greg J Badros + + * acconfig.h: Fix missing comment closer */ + + * c++/Makefile.am: Added AM_CPPFLAGS = $(CPPEXTRAFLAGS) + + * configure.in: Use config.h, not c++/config.h, and permit + --enable-warnings option to turn on compile-time warnings (uses + AM_CPPFLAGS in Makefile.am) + +Tue Mar 16 19:26:23 1999 Greg J Badros + + * configure.in, acconfig.h: Better autoconf support, including + several --enable options. Added acconfig.h to support autoheader + doing the right thing in making config.h.in. + +Tue Mar 16 19:22:50 1999 Greg J Badros + + * c++/ClSimplexSolver.cc, c++/Cassowary.h: Include "config.h" from + here, not from Cassowary.h (still not right-- problem is scwm gets + the wrong config.h. Maybe config.h should be in ..? + +Tue Mar 16 19:21:06 1999 Greg J Badros + + * java/README: Added note about common error when CLASSPATH is wrong. + +Tue Mar 16 15:51:15 1999 Greg J Badros + + * c++/Cassowary.h: #include "config.h" + + * c++/ClSimplexSolver.cc: Use VERSION to init szCassowaryVersion. + +Tue Mar 16 12:44:33 1999 Greg J Badros + + * c++/**: Updated function names to always start with an uppercase + letter (follows C++ conventions, and brings API of Cassowary and + QOCA closer together). Used scripts/convert-ids to do the + conversion, along with scripts/ids-to-upper as the list of + conversions to do. + +Wed Mar 10 15:28:33 1999 Greg J Badros + + * Release v0.32. + +Wed Mar 10 11:36:37 1999 Greg J Badros + + * **/Makefile: Removed, since these are now generated by + autoconf from Makefile.in (which itself is generated by + automake from Makefile.am [only for some directories]) + + * configure.in: + + * c++/ClBug2.cc: Added to demonstrate a bug that Anthony Beurivé + reported. + + * c++/ClSimplexSolver.cc: Fix above-mentioned bug by changing the + coefficient of the added in removeConstraintInternal. + + * c++/ClReader.l: Reset the lexer on failed id lookup. + + * c++/ClC.cc, c++/ClC.h: Added VarMap access functionality, make + CL_ParseConstraint catch exceptions and return NULL on error + parsing. + + * c++/config.h.in, c++/stamp-h.in: Added, for automake/autoconf + support. + + * c++/Makefile.am: Improve installation support, updated for + ClBug2 + + * guile/Makefile.am: Build .x using guile-snarf + + * c++/Makefile.linux: Updated for ClBug2 + + * c++/demos/DraggableBox.h: Do not return references to + ClVariable-s -- just return by value since they are a handle + class. + + * guile/Makefile.am: changed name of library to + libcassowaryguile.a from libconstraints.a + + * java/CL.h: Added a String description argument to assert() to + permit easier tracking of failures. + + * java/ClSimplexSolver.java: Fix bug that Emmanuel Pietriga + reported -- use peek() to get at top element of _stkCedns stack + when removing edit variables in removeEditVarsTo(). Added + descriptions to assert()s and to throwing of ExCLInternalError. + Have the addBounds, addUpperBound, addLowerBound functions + propagate out ExCLInternalError-s instead of catching them and + printing an error message. Added messages to all assertions. + + * java/ClLinearExpression.java: Added description to throwing of + ExCLInternalError. + + * java/ClLinearInequality.java: Added description to throwing of + ExCLInternalError. + + * java/ExCLInternalError.java: Require description of the error in + constructor. + + * java/QuadDemo.java: Use System.err when printing errors, and + print the description of the exception. + + * smalltalk/ClKernel.app: Fix bug with not using the weight of a + constraint as the negating coefficient when removing a constraint. + +Mon Mar 8 16:40:17 1999 Greg J Badros + + * Added autoconf and partial automake support. Added numerous + Makefile.am's, renamed old Makefiles to Makefile.linux (and copied + to Makefile.in when I did not write a Makefile.am). Added + configure.in. + + * guile/cassowary_scm.cc: Use ClReader.h, not creader.h (I renamed + the file) + +Fri Mar 5 16:24:05 1999 Greg J Badros + + * c++/Makefile, c++/Cl.h: Fix for renaming of creader.* -> + ClReader.*; make C libraries as part of lib, shared_lib rules. + + * c++/ClReader.*: Added, renamed from creader.h, creader.y, + creader.l + + * c++/ClTableau.h, c++/ClTableau.cc: Added + printExternalVariablesTo() fn. + + * c++/ClSimplexSolver.cc: printExternalVariablesTo in + printInternalInfo. + + * c++/ClParseTest.cc: DO not include ClReader.h-- Cl.h includes it + + * c++/ClCTest.c: Make more like a browser-related test, use new + CL_TableauPrintExternalVariables() + + * c++/ClC.h, ClC.cc: Added CL_Tableau, + CL_TableauPrintExternalVariables. Use "ends" to terminate + strstreams. Make Strong Stays use medium strength stays. Make + CL_ParseConstraint call ClsFromSz instead of parsing the char * + itself. + +Thu Mar 4 19:08:23 1999 Greg J Badros + + * c++/ClVariable.h: Add assert(pclv) before dereferencing through + ClVariable's pclv member. + + * c++/Makefile: Added DYNLINK = yes/no variable for controlling + dynamic linking more easily. + + * c++/ClSimplexSolver.h: Changed PfnChangeClvCallback to take a + ClVariable * instead of a ClVariable. This make it easier for the + C interface since it has "CLV" as a "ClVariable *" and cannot + reason about ClVariable-s because it doesn't see the struct defn. + + * c++/ClC.cc, c++/ClC.h: Added CL_SimplexSolverSetEditedValue, + CL_SimplexSolverPrint, CL_SimplexSolverSetChangeClvCallback, + CL_VariableSetPv, CL_VariablePv. + + * c++/ClCTest.cc: Test CL_SimplexSolverSetEditedValue, CL_SimplexSolverPrint. + +Wed Mar 3 17:37:17 1999 Greg J Badros + + * c++/ClSimplexSolver.h (UpdateExternalVariables): Added this + function to provide a publicly available way to get at setExternalVariables() + + * c++/ClCTest.c, c++/ClC.h, c++/ClC.cc: Added for the beginnings + of a rudimentary C interface to the c++ library. + + * c++/Makefile: Updated to build ClCTest, libccassowary.so (the C + interface to Cassowary [for Amaya, initially]) + +Mon Mar 1 Greg J Badros + + * Release v0.31 + +Mon Mar 1 15:11:52 1999 Greg J Badros + + * c++/ClVariable.h: Added explict copy ctr. + + * c++/ClEditConstraint.h, c++/ClStayConstraint.h: Changed output + format so parentheses started by super:: call to ClConstraint.h + are closed properly. + + * c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc: Undo removing a + pass by reference of ClVariable when used as an output argument. + Added printing for ClEditInfo class instancesm, + ClVarToEditInfoMap. + +Mon Mar 1 13:46:48 1999 Greg J Badros + + * README: Updated for version 0.31. + + * c++/Makefile: Added QocaBench.o to TEST_OBJS, comment out + CL_USE_HASH_MAP_AND_SET by default. + + * c++/ClTestColumns.cc: Allocate constraint objects on heap, not + as temporaries on local stack + + * c++/ClStayConstraint.h, c++/ClSimplexSolver.h, + c++/ClSimplexSolver.cc, c++/ClPoint.h, c++/ClLinearInequality.h, + c++/ClEditOrStayConstraint.h, c++/ClEditConstraint.h: Pass and + return ClVariable-s by value, not by reference. (Fixes bug in + QocaBench from re-use of a ClVariable object with the underlying + pointer different. + + * c++/Cl.h: include creader.h + + * c++/README: Fix spelling of deprecated, URL for WxWindows. + + * c++/test-ClConstraint.cc: Comment out unused variables + +Mon Mar 1 12:53:02 1999 Greg J Badros + + * c++/qdemos/QuadDemoWindow.cc: Allocate constraint objects on + heap, not as temporaries on local stack. + +Fri Feb 26 09:16:31 1999 Greg J Badros + + * wrappers/cassowary.i: Use .c_str() off of exception descriptions + to get the char * (description() now returns a string) + +Fri Feb 26 09:11:17 1999 Greg J Badros + + * c++/ClConstraint.h: Added FIsInSolver() + + * guile/cassowary_scm.cc: Wrap cl-constraint-is-in-solver? + +Thu Feb 25 18:58:55 1999 Greg J Badros + + * guile/cltests.scm: Added (use-modules..) invocation to get the + dynamically-loaded module so that it can be tested outside of + scwm. Updated to reflect changed behaviour in cl-add-stay. Added + some test code for make-cl-constraint-from-string. + + * guile/cassowary_scm.hpp: Added ScmMakeClConstraint(..) to + abstract out setting "answer" for the (now) two ClConstraint ctrs. + + * guile/cassowary_scm.cc: Added make-cl-constraint-from-string for + interfacing to the parser. Wrap + cl-constraint-change-{strength,weight}!. Make dynamically loadable + module! Fix BUG: was returning SCM_UNDEFINED instead of + SCM_UNSPECIFIED. + + * guile/Makefile: Build libconstraints.so, and necessary directory + structure if neeeded. + + +Thu Feb 25 18:41:34 1999 Greg J Badros + + * c++/ClSimplexSolver.h, c++/ClSimplexSolver.cc: Make constraints + get told when they're added/removed from a solver. This means + that constraints are no longer const params to add/remove + Constraint functions, and also that removeConstraint needs an + internal version that doesn't do the counting (since + removeConstraint can get called from addConstraint to clean up + after a failed addition). + + * c++/ClSimplexSolver.cc: Clean up uses of ClConstraint &cn -- + prefer ClConstraint *pcn even internally. + + * c++/ClConstraint.h: Added ChangeStrength(..), ChangeWeight(..) + and _times_added memvar along w/ private (for friend + ClSimplexSolver) addedTo(..) and removedFrom(..) functions. Only + permit strength/weight changing if constraint is in no solvers + presently. + + * c++/ClConstraint.cc: Output _times_added memvar in printOn(...) + +Thu Feb 25 15:58:27 1999 Greg J Badros + + * c++/ClErrors.h: Added parse error classes, and have description + return a "string" instead of a "char *" + + * c++/creader.y: Use exception ExCLParseErrorMisc in clerror, Use + ClVarLookupFunction instead of mapVars and fAutoCreate + + * c++/creader.l: Use ClVarLookupFunction instead of doing it + inline with mapVars and fAutoCreate; throw exceptions on errors. + + * c++/creader.h: Added ClVarLookupFunction and ClVarLookupInMap + and use them when parsing. + + * c++/Makefile: Added some dependencies for proper building of + .l,.y files + + * c++/ClSimplexSolver.cc: Descend VarInVarSet from + unary_function<..,..> + + * c++/ClParseTest.cc: Catch parse errors and display the message. + Use ClVarLookupInMap class + +Thu Feb 25 12:09:48 1999 Greg J Badros + + * c++/ClSimplexSolver.cc: Simplify removeConstraint to not use + references. + + * c++/ClSimplexSolver.h: Updated a comment + + * c++/ClTests.cc: Use addEditVar, beginEdit, and endEdit, instead + of building EditConstraints directly. + +Tue Feb 23 18:48:21 1999 Greg J Badros + + * c++/creader.y, c++/creader.h: Remove old crummy lexer. Added + fAutoCreate flag to PcnParseConstraint to allow parsing with + automatic introduction of newly-referenced variables. + + * c++/creader.l: Fixed bugs in missing tokens "|", "(", ")", and + permit "==" as a synonym for "=". Honour the _fAutoCreate flag by + introducing variables when needed. + + * c++/ClTests.cc: Display version id string at startup. + + * c++/ClSimplexSolver.cc, c++/Cl.h: Added szCassowaryVersion id + string. + + * c++/ClParseTest.cc: Test auto-addition of variable (fAutoCreate + = true) + +Tue Feb 23 18:12:23 1999 Greg J Badros + + * c++/Makefile: Build libcassowary.{a,so} by default, not + libcassowary-notrace.{a,so}. Remove special rule for building + ClParseTest; list creader-lex.o, creader.o in OBJS and have them + be a part of the library. + + * c++/ClVariable.h, c++/ClVariable.cc: Rename pmapSzPclv to + pmapStrPclv. Make it a map from "const string" not "string". + Make setName erase the old mapping, and add the new mapping. + + * c++/ClParseTest.cc: Accept "-" option to mean "rename x to foo" + for testing the setName change above. + + * c++/ClFloatVariable.cc: Do not output warning msg in setName -- + instead, do the right thing in ClVariable.h + +Tue Feb 23 08:55:28 1999 Greg J Badros + + * c++/Makefile: Fix build rules for bison/flex parser so + dependencies are correct. Added new targets, all-notests, + all-tests, make 'lib' the default target, and all really build + everything. + + * c++/creader.h, c++/creader.l, c++/creader.y: Take address of + ClVariable-s from the map's values (cannot use ClVariable in the + union directly because union members cannot have constructors). + #include ClVariable.h instead of fwd decl of ClVariable so that we + get the StringToVarMap typedef, too. + +Mon Feb 22 16:33:16 1999 Greg J Badros + + * c++/Makefile: Use CL_LIBRARY, not LIB_FILE, throughout. Use + flags for maximum performance. + + * c++/ClVariable.h, c++/ClConstraintHash.h, c++/Cassowary.h: + Divide pointer address by CL_PTR_HASH_DIVISOR in hash functions + + * c++/ClTests.cc: Added CL_SHOW_CNS_IN_BENCHMARK guard protecting + new displaying of constraints and listing of inconsistent constraints. + +Mon Feb 22 12:18:53 1999 Greg J Badros + + * c++/ClTests.cc (inconsistent3): Drop extra redundant + inconsistency for pedagogical reasons. Use simpler pointer-based + addConstraint in benchmark test + + * c++/ClSimplexSolver.h: Added addConstraintNoException, + removeConstraintNoException taking ClConstraint &'s -- deprecated. + Added CL_NO_DEPRECATED guard for turning off availability of + deprecated functions. + +Mon Feb 22 11:12:35 1999 Greg J Badros + + * c++/ClSimplexSolver.h: Added deprecated + FIsConstraintSatisfied(Constraint &) + + * guile/cassowary_scm.cc: Use ClConstraintToVarMap for return + value of ConstraintMap(). Pass Constraint *'s instead of &'s. + Use new name printOnVerbose instead of printDebugInfo. + +Fri Feb 19 Greg J Badros + + * Release v0.3. + +Fri Feb 19 18:00:49 1999 Greg J Badros + + * c++/ClTests.cc: Updated to fix below interface. + + * c++/ClSimplexSolver.cc, c++/ClSimplexSolver.h: make + addConstraint, addConstraintNoException, removeConstraint, + removeConstraintNoException take ClConstraint *'s instead of + ClConstraint &'s. Clarifies the mental model, and simplifies the + syntax. Old style is still accepted, but is deprecated. + +Fri Feb 19 17:41:45 1999 Greg J Badros + + * c++/ClFloatVariable.cc, c++/ClFloatVariable.h: Added -- moved + here from ClVariable.h, and renamed from class ClVariableRep since + they not what ClVariable wraps (ClVariable wraps + ClAbstractVariable) + + * c++/ClAbstractVariable.h: Fatten interface to include set_value, + change_value, setPv, and Pv. + + * c++/ClVariable.h, c++/ClVariable.cc: Move ClVariableRep into + ClFloatVariable.{h,cc}, and use pclv-> for + set_value, change_value, SetPv, and Pv since ClAbstractVariable + now has a fat interface and we do not need to do the dynamic + down-casting. + + * c++/Makefile: Added new files to build rules. + +Fri Feb 19 17:08:29 1999 Greg J Badros + + * c++/debug.h, c++/ClTableau.h: Move operator<< out into ClTableau.h + + * c++/ClVariable.h, c++/ClVariable.cc: Move some inline functions + into .cc so that the hash function can go in the .h file (some stl + dependency issue, it seems). + + * c++/ClErrors.h, c++/ClTypedefs.h: Move typedef for + ClConstraintSet from ClErrors.h into ClTypedefs.h, and have former + include the latter. + + * c++/Cassowary.h: #include ClConstraintHash.h + + * c++/ClConstraintHash.h: Added. The hash function needs to + appear before any typedef that uses a hash_map or hash_set, so + this file is included by Cassowary.h + +Fri Feb 19 08:45:24 1999 Greg J Badros + + * c++/ClSubgraphTest.cc: Fix some bugs just from not testing + completely. + + * c++/*: Fix bugs from not-updated-code hidden by #ifdefs. Builds + w/ all compile-options except -DCL_USE_HASH_MAP_AND_SET. Drop + some gratuitous appearances of ClAbstractVariable + +Thu Feb 18 18:53:56 1999 Greg J Badros + + * c++/ClLinearExpression.cc: Use clvNill when returning a + ClVariable instead of NULL + + * c++/ClVariable.h, c++/ClVariable.cc: operators ==, !=, < all should use the + contained pointers address, not value. Also define global clvNil, + isNil(). + + * c++/ClTests.cc: BUGFIX: #if 0 removed from adding stays in + simple1 test + + * c++/ClSimplexSolver.h: Use ClVariable-s internally for + ClObjectiveVariable-s. + + * c++/ClSimplexSolver.cc: Use ClVariable-s internally for + ClObjectiveVariable-s and replace ClAbstractVariable + *p{entryVar,exitVar} with ClVariable-s. (Use clvNil and isNil() + to test for not yet set). + +Thu Feb 18 Greg J Badros + + * c++/*: First compilable and almost working version with + ClVariable as a handle to ClVariableRep. Major simplifications + throughout. + +Thu Feb 18 14:22:14 1999 Greg J Badros + + * c++/Makefile: Split out the options into += lists so they can be + flipped independently more easily. + + * c++/ClSimplexSolver.cc, c++/ClSimplexSolver.h: Added output + operation for ClConstraintToVarSetMap; use fFoundErrorVar flag to + simplify some redundant tests in removeConstraint -- no longer use + errorVarsCopy. + + * c++/CLVariable.h: Fix a comment's example. + + * c++/ClTypedefs.h: Use set always for ClTableauVarSet (Steve + Wolfman notes that it's faster as a set than as a hash_set). + + * c++/debug.h: Add CtrTracer, DtrTracer fns that do nothing when + not CL_TRACE + + * c++/ClConstraint.h: Invoke CtrTracer, DtrTracer in ctr, dtr for + finding memory problem + + * c++/ClTests.cc: Fix some long-time bugs in the use of ctrs that + build temporary objects whose lifetime was expected to be longer + than it was. + + * c++/*: Invert sense of CL_NO_TRACE to CL_TRACE + +Wed Feb 17 12:10:28 1999 Greg J Badros + + * c++/ClTypedefs.h: Added -- factored out useful typedefs from + ClSimplexSolver.h, ClTableau.h and put them in this file. + + * c++/ClTableau.h, c++/ClSimplexSolver.h, c++/debug.h: Use + ClTypedefs.h. Drop gdb_print (it uses printOn and printTo, now). + Renamed printDebugInfo to printOnVerbose (for generalized gdb + interface) + + * c++/ClSimplexSolver.cc: Fix two bugs where I was modifying data + structures indirectly while iterating over them. Remove a delete + that was premature to fix another bug in optimized builds. + + * c++/ClLinearExpression.h, c++/ClConstraint.h, + c++/ClAbstractVariable.h: Drop gdb_print(). + + * c++/ClSymbolicWeight.h: Use Number instead of double more consistently. + +Tue Feb 16 15:04:06 1999 Greg J Badros + + * c++/Cassowary.h,ClAbstractVariable.h,ClMap.h,ClSet.h,Makefile: Use + CL_USE_HASH_MAP_AND_SET, not USE_HASH_MAP_AND_SET. + + * c++/Cl.h: #undef CL_TRACE_VERBOSE ifdef CL_NO_IO + +Tue Feb 16 14:55:12 1999 Greg J Badros + + * java/ClVariable.java: Add setVarMap(..), getVarMap() for + maintaining symbol table of ClVariables. Added + setAttachedObject(..), getAttachedObject() for hanging something + off of a variable. + + * java/ClConstraint.java: Added setAttachedObject(..), + getAttachedObject() for hanging something off of a constraint. + + * java/ClTests.java: Added inconsistent3() and multiedit() tests + + * java/ClSimplexSolver.java: Manage multiple (nested) edits + properly. Provide access to the _markerVars var through + getConstraintMap() accessor. Deprecate resolve(Vector) fn. + +Tue Feb 16 14:29:46 1999 Greg J Badros + + * README: Updated reference to swig web site. + +Tue Feb 16 12:45:04 1999 Greg J Badros + + * java/ClSimplexSolver.java, java/ClEditInfo.java, java/Makefile: + Fixed Michael Kaufmann's bug. (See Feb 15 note for C++ version + two entries below.) + + * java/*.java: Updated copyright to include 1999. + +Tue Feb 16 10:51:01 1999 Greg J Badros + + * c++/*: Added CL_FIND_LEAK guard and ctr/ctr counters for + tracking various variable kinds. + +Mon Feb 15 18:38:06 1999 Greg J Badros + + * c++/ClAbstractVariable.{cc,h}, ClSlackVariable.{cc,h}, + ClDummyVariable.{cc,h}: Add counters to ctr/dtr for leakage detection. + + * c++/ClSimplexSolver.{cc,h}: Replace ClConstraintAndIndex with + ClEditInfo, and remove ugliness of parallel vectors for edit + constraints. Drop _editPlusErrorVars, _editMinusErrorVars, + _prevEditConstants, and bundle them all up in the value end of the + map attached to _editVarMap. This fixes a bug reported in the + Java version by Michael Kaufmann long ago, and generally cleans + code up a bit. The resolve(vector) function is + deprecated, and now implemented in terms of the indices stored in + the new ClEditInfo class. + + * c++/*: Updated copyright to include 1999. + +1999-02-15 Greg J Badros + + * c++/ClVariable.{cc,h}, c++/ClAbstractVariable.h: Added + SetVarMap(..), VarMap(), and make variables given names get their + names mapped to the objects in the var map (for access when + parsing constraints as strings). Make setName() virtual so + ClVariable can override it. + +1999-02-12 Greg J Badros + + * c++/creader.{y,h}: New version from Steve Wolfman, slightly + updated for cleaner integration. Pass in a map instead of an array of ClVariable; improve error handling a + bit. + + * c++/debug.h: Use ClMap, ClSet + + * c++/{ClMap.h,ClSet.h}: Added, for optionally using hash_map, + hash_set instead of map, set. + + * c++/ClSimplexSolver.{cc,h}: Added Steve Wolfman's explanation + support (added back map for marker->constraint, _fExplainFailure + var + getter & settor). Use ClMap, ClSet. Cleaned up some cerr + output, and use DEBUG_FAILURES cpp symbol to guard some output. + + * c++/Cassowary.h: Added operator() for hash<..> to support + hashing things used as keys in hash_map/hash_set + + * c++/ClErrors.h: Added ExCLRequiredFailureWithExplanation class + for explanation support. + + * c++/{ClLinearExpression.h,ClTableau.h}: Use ClMap, not map. Use + ClSet, not set. + + * c++/ClSymbolicWeight.h: Return a symbolic weight even when + assert(false) to avoid compiler warning. + +1999-02-11 Greg J Badros + + * guile/cassowary_scm.cc: Use cl-snarf.h, not scwm-snarf.h. Use + CL_PROC to denote primitives, not SCWM_PROC. Use + CL_VAR_INIT_PERMANENT macro for variables, and document them (the + strength objects only, for now). Fix the default strength of + cl-add-editvar to Strong, not Weak, and update docs (was cut&paste + error from the cl-add-stay primitive). Thanks Anthony Beurivé for + noticing this bug, too! + +Sat Jan 30 Greg Badros + + * Release v0.23. + +Sat Jan 30 13:16:31 1999 Greg Badros + + * c++/ClSimplexSolver.cc: Fixed bug in removing a stay + constraint. Was editing a vector in place while iterating over + it. Now I use remove_if and erase. Thanks to Anthony Beurivé for + noticing the bug. + + * c++/ClBug1.cc: Added -- bug report from Anthony Beurivé. + +Sat Jan 23 Greg Badros + + * Release v0.22. + +Sat Jan 23 16:46:27 1999 Greg Badros + + * guile/cassowary_scm.cc: Replace iarg uses with literal argument + index numbers. Use const_cast to avoid warnings when calling + ScmMakeClStrength on clsWeak,clsMedium,clsStrong,clsRequired objects + +Sat Jan 23 15:30:16 1999 Greg Badros + + * c++/ClSimplexSolver.cc: Added some comments, some explanations + when exceptions are thrown, and some minor cleanups, bug-fixes + + * c++/ClTests.cc: Added inconsistent3() test, and run it. + + * c++/ClStrength.h: Added _pv memvar, and setPv(), Pv() -- needed + for tracking ClStrengths in guile + + * guile/cassowary_scm.cc: Replace all iarg uses with the literal + number. Point ClStrength objects at their scheme-level object + using their new _pv field. Protect ClStrength objects properly. + +Sat Sep 19 17:08:21 1998 Greg Badros + + * c++/Makefile (CPPFLAGS): Added USE_GC, commented out, and added + OTHER_LIBS variable for linking with the gc library + +Sat Sep 19 17:01:16 1998 Greg Badros + + * c++/ClTableau.h: Added AssertValid() for testing integrity of + Tableau + + * c++/ClSymbolicWeight.h, c++/ClStrength.h, c++/ClSlackVariable.h, + c++/ClLinearExpression.h, c++/ClErrors.h, c++/ClDummyVariable.h, + c++/ClConstraint.h, c++/ClAbstractVariable.h: Descend objects + from "gc" class conditioned on USE_GC* pp macros + + * c++/Cassowary.h: Conditionally include gc_cpp.h ifdef USE_GC; + added NEWVAR and DELVAR macros for outputting debug information at + new/delete sites + + * c++/ClSimplexSolver.h: Call AssertValid before solving + + * c++/ClSimplexSolver.cc: Remove memory leak of the artificial + objective variable + + * c++/ClLinearExpression.h: Fix gdb_print to have a newline + + * c++/ClLeakTest: Added leakTest2 which more obviously leaks, and + use GC_gcollect() to force a collect + +Tue Sep 15 16:36:20 1998 Greg Badros + + * c++/ClTableau.h, ClTableau.cc: Handle removing vars from _columns more + carefully, and add gdb_print(), virtual destructor + + * c++/ClLinearExpression.h, c++/ClConstraint.h, + c++/ClAbstractVariable.h: Added gdb_print() + +Tue Sep 14 Greg Badros + + * Release v0.21. + +Wed Sep 9 09:46:35 1998 Greg Badros + + * c++/ClLinearExpression.h, c++/ClLinearExpression.cc: added uses + of 'typename' keyword as needed by egcs-1.1b's -pedantic (and the + C++ FDIS) + +Sun Sep 6 13:19:01 1998 Greg Badros + + * c++/ClSimplexSolver.h: Added _pv field, and Pv() setPv() getter + and setter + + * guile/cassowary_scm.cc: Use solver's _pv field to point + ClSimplexSolver back at the scheme object that wraps it + +Fri Sep 4 18:52:50 1998 Greg Badros + + * guile/cassowary_scm.hpp, guile/cassowary_scm.cc: Added PvFromScm + and ScmFromPv to hide the reinterpret casts used to store a scheme + object as the void * Pv() attached to a cassowary object. Attach + the scheme-level cl-variable to a ClVariable object. Added + `clv-attach!' and `clv-attached-object' to manipulate the attached + object (often better to use scheme level properties, though) + +Fri Sep 4 18:51:30 1998 Greg Badros + + * guile/Makefile: Use "perl" from path to run extract docs instead + of relying on #! line, and generate the -procedures.txt file as + well as the .sgml file + +Wed Sep 2 17:08:14 1998 Greg Badros + + * guile/cassowary_scm.cc, guile/cassowary_scm.hpp: Added + ClStayConstraint wrapper. Make cl-add-stay, cl-add-editvar take a + list of variables instead of a varargs last argument and instead + add two optional arguments STRENGTH and FACTOR (thus those + primitives remain backward compatible as long as only one variable + was given). + +Wed Sep 2 13:55:37 1998 Greg Badros + + * ClSimplexSolver.h: Added weight option to addEditVar and use it + + * ClLinearExpression.h: Added PconstClAbstractVariable, use it; + use ClVarToCoeffMap in coefficientFor. + +Thu Aug 6 20:56:45 1998 Greg Badros + + * Release v0.2. + +Thu Aug 6 20:41:40 1998 Greg Badros + + * ClTests.cc: Added multiedit() test for testing nested + beginEdit-s + + * ClSimplexSolver.h, ClSimplexSolver.cc: Support nested + beginEdit-s -- use removeEditVarsTo(n), and rewrite + removeAllEditVars in terms of the former; Use FIsSatisfied on + constraint and compare with testing internally for + FIsConstraintSatisfied() -- untested. + + * ClLinearInequality.h, ClLinearEquation.h, ClConstraint.h: Added + virtual FIsSatisfied + + * ClLinearExpression.h, ClLinearExpression.cc: Added evaluate() + + * ClAbstractVariable.h: Return 0 for value(), and make it a + virtual function. + +Wed Aug 5 16:10:56 1998 Greg Badros + + * ClStrength.h: Have ClStrength::symbolicWeight return a const + ref, instead of by value, make clsXXX const refs. + + * ClSimplexSolver.cc, ClLinearInequality.cc, ClLinearEquation.cc, + ClLinearConstraint.cc: Take ClStrengths by const refs + +Tue Aug 4 15:22:08 1998 Greg Badros + + * guile/cassowary_scm.cc, cassowary_scm.hpp: Move all inline + functions into .hpp file. Added cl-is-constraint-satisfied? + + * ClTableau.h: Added a rowExpression() const memfn, for + FIsConstraintSatisfied() + + * ClSimplexSolver.h, ClSimplexSolver.cc: Added (probably broken) + FIsConstraintSatisfied(cn) memfn -- needs testing + +Sun Aug 2 16:49:34 1998 Greg Badros + + * ClSimplexSolver.h: Added ConstraintMap() accessor to + _markerVars, for cl-constraint-list guile primitive + + * ClConstraint.h: Added setPv(), Pv(), and _pv field to a + constraint, for attaching extra information. + +Thu Jul 30 19:15:40 1998 Greg Badros + + * ClTests.cc: Added simple2, to test new EditMisuse exception on + editing a variable that is nowhere in the solver. + + * ClTableau.h, ClTableau.cc: Be more careful about inserting into + _externalParametricVars; add FIsBasicVar to assist that care. + + * ClSimplexSolver.cc, ClSimplexSolver.h: Added pfnCnSatCallback -- + does nothing for now; throw an ExCLEditMisuse exception if an + edit constraint is added on a variable that is not in the tableau + (needs at least a stay constraint in the solver); replace some + calls to rowExpression with FIsBasicVar when the latter is the + intent. + +Thu Jul 21 Greg Badros + + * ClVariable.h, ClVariable.cc: Added _pv field, settor and gettor. + + +ABOVE CHANGES ONLY IN C++ IMPLEMENTATION AND ITS WRAPPERS + +Fri Jul 17 19:24:54 1998 Greg Badros + + * ClVariable.h, .java: Added change_value memfn, and make it virtual + instead of setValue -- thus subclasses can specialize behaviour + when the variable gets set by the solver. + + * ClSimplexSolver.h, .java: Use change_value for setEditedValue if + the variable is not in the tableau; call resolve() before + removeAllEditVars in endEdit + + * ClSimplexSolver.cc, .java (setExternalVariables): Use change_value + instead of set_value when so subclasses can override and notice a + changed variable + +Thu Jul 16 19:49:45 1998 Greg Badros + + * Added setEditedValue(), FContainsVariable(), and addVar() to c++ + and Java implementations + + * Fixed bug in C++ and Java in solvers lacking stay constraints + that was due to not-updating the external parametric variables + set. + +Fri Jul 10 09:00:15 1998 Greg Badros + + * Fixed bug whereby a dummy variable was being pivoted into the + basis because pexpr->anyVariable() didn't guarantee the variable + it returned was a pivotable variable -- now it's called + anyPivotableVariable(), and does the right thing. + + * Fixed bug whereby column mappings that had no rows remained in + the list of columns -- now erase the column key when its value is + the empty set + + * Fixed bug whereby constraints that threw required failure + exceptions remained in the tableau (a removeConstraint on a + constraint that failed to be added used to succeed, now it does + not) + +Monday Jun 29 16:50:00 1998 Greg Badros + + * Release Cassowary v0.1 --- see local/POST-ANNOUNCE-TO for + list of places where it was announced + diff --git a/libs/cassowary/ClAbstractVariable.cc b/libs/cassowary/ClAbstractVariable.cc new file mode 100644 index 0000000000..b5502d4fbb --- /dev/null +++ b/libs/cassowary/ClAbstractVariable.cc @@ -0,0 +1,23 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClAbstractVariable.cc + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +long ClAbstractVariable::iVariableNumber = 0; +#ifdef CL_FIND_LEAK +long ClAbstractVariable::cAbstractVariables = 0; +#endif + diff --git a/libs/cassowary/ClBug0.cc b/libs/cassowary/ClBug0.cc new file mode 100644 index 0000000000..09ca1826cb --- /dev/null +++ b/libs/cassowary/ClBug0.cc @@ -0,0 +1,102 @@ +// $Id$ + +#include + +/* This bug fixed --02/15/99 gjb + Replaced the parallel vectors for edit constraints + (the errorPlus..., errorMinus..., prevEditConstants vectors) + with a ClEditInfo class that is the Value of the _editVarMap map. + + Later I realized that I need to go to a _editVars list so that + multiple edits on the same variable that nest are handled properly. + --09/19/99 gjb +*/ + +int main() +{ + ClSimplexSolver solver; + + ClVariable x("x",7); + ClVariable y("y",8); + ClVariable z("z",9); + + solver + .AddStay(x) + .AddStay(y) + .AddStay(z); + + try { + solver.AddEditVar(x); + solver.AddEditVar(y); + solver.AddEditVar(z); + solver.BeginEdit(); + + solver.SuggestValue(x,1); + solver.SuggestValue(z,2); + + solver.RemoveEditVar(y); + + solver.SuggestValue(x,3); + solver.SuggestValue(z,4); + + solver.EndEdit(); + + } catch (ExCLError &e) { + cerr << e.description() << endl; + } + + cout << x << endl << y << endl << z < + To: + Subject: bugreport + Date: Thu, 1 Oct 1998 11:40:55 +0200 + Message-Id: <000001bded1f$973a2060$230e1fac@itc_mk.sbcs.swissbank.com> + Mime-Version: 1.0 + Content-Type: text/plain; + charset="iso-8859-1" + Content-Transfer-Encoding: 7bit + X-Priority: 3 (Normal) + X-Msmail-Priority: Normal + X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 + Importance: Normal + X-Mimeole: Produced By Microsoft MimeOLE V4.72.2106.4 + + Dear Mr Noth, + + I am currently working with the Java implementation of Cassowary and found + the following bug: + + If I Add several editConstraints, remove some of them again later and + perform a 'ClSimplexSolver.SuggestValue()', the indices of + 'ClConstraintAndIndex' in the variable 'cai' are sometimes wrong (see + ClSimplexSolver.SuggestValue(ClVariable v, double x), the 3rd line). This is + because if you remove an element from a 'java.util.Vector', and the element + is somewhere in the middle of the Vector, the indices of the Vector change. + (see java.util.Vector.removeElementAt(int index): + + public final synchronized void removeElementAt(int index) { + if (index >= elementCount) { + throw new ArrayIndexOutOfBoundsException(index + " >= " + + elementCount); + } + else if (index < 0) { + throw new ArrayIndexOutOfBoundsException(index); + } + int j = elementCount - index - 1; + if (j > 0) { + System.arraycopy(elementData, index + 1, elementData, index, j); + } + elementCount--; + elementData[elementCount] = null; /* to let gc do its work */ + } + + + My workaround now is, that everytime when I remove an EditVariable from the + Solver, I have to remove all the EditVariables and Add then the ones again, + that I do not want to remove. + +#endif diff --git a/libs/cassowary/ClBug1.cc b/libs/cassowary/ClBug1.cc new file mode 100644 index 0000000000..e7543757e3 --- /dev/null +++ b/libs/cassowary/ClBug1.cc @@ -0,0 +1,21 @@ +#include + +int main() +{ + ClVariable *var = new ClVariable(); + ClSimplexSolver *solver = new ClSimplexSolver(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),1.0); + + cout << *solver; + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} +/* +The result is a segmentation fault when the constraint is removed. I +don't understand why. + +Anthony Beurive'" +*/ + diff --git a/libs/cassowary/ClBug2.cc b/libs/cassowary/ClBug2.cc new file mode 100644 index 0000000000..3a1e424259 --- /dev/null +++ b/libs/cassowary/ClBug2.cc @@ -0,0 +1,130 @@ +/* $Id$ + +From: "Anthony Beurive'" +Subject: cassowary +To: gjb@cs.washington.edu +Date: Tue, 9 Mar 1999 12:42:24 +0100 (CET) + +I believe there's a bug in cassowary. It seems to be related to the +previous one I encountered a while ago, concerning the removal of +constraints. + +The three following examples may help you to track the bug, I hope. + +-------------------------------------------------------------------------------- +#include "Cl.h" + +void main() +{ + ClSimplexSolver *solver = new ClSimplexSolver(); + ClVariable *var = new ClVariable(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),1.0); + + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} +-------------------------------------------------------------------------------- +This works fine. + + +Now, the factor of the stay constraint is changed. +-------------------------------------------------------------------------------- +#include "Cl.h" + +void main() +{ + ClSimplexSolver *solver = new ClSimplexSolver(); + ClVariable *var = new ClVariable(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),2.0); + + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} +-------------------------------------------------------------------------------- +The result is: +test2: ClSimplexSolver.cc:1199: void ClSimplexSolver::Optimize(class ClVariable): Assertion \ +`pzRow != __null' failed. +Aborted + + +Now, the solver is created after the variable. +-------------------------------------------------------------------------------- +#include "Cl.h" + +void main() +{ + ClVariable *var = new ClVariable(); + ClSimplexSolver *solver = new ClSimplexSolver(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),2.0); + + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} +-------------------------------------------------------------------------------- +This works again. + + +Can you reproduce the same results? Maybe the cause is my c++ +compiler (egcs-2.90.29 980515 (egcs-1.0.3 release)). I don't know. + +*/ + +#include + +void foo1() +{ + ClSimplexSolver *solver = new ClSimplexSolver(); + ClVariable *var = new ClVariable(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),1.0); + + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} + + +void foo2() +{ + ClSimplexSolver *solver = new ClSimplexSolver(); + ClVariable *var = new ClVariable(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),2.0); + + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} + + +void foo3() +{ + ClVariable *var = new ClVariable(); + ClSimplexSolver *solver = new ClSimplexSolver(); + ClStayConstraint *stcn = new ClStayConstraint(*var,ClsWeak(),2.0); + + solver->AddConstraint(*stcn); + cout << *solver; + solver->RemoveConstraint(*stcn); + cout << *solver; +} + + +int main() +{ + cerr << "Test1: " << endl; + foo1(); + + cerr << "\nTest2: " << endl; + foo2(); + + cerr << "\nTest3: " << endl; + foo3(); + +} diff --git a/libs/cassowary/ClConstraint.cc b/libs/cassowary/ClConstraint.cc new file mode 100644 index 0000000000..1bc6be91b3 --- /dev/null +++ b/libs/cassowary/ClConstraint.cc @@ -0,0 +1,32 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClConstraint.cc + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#ifndef CL_NO_IO +#include // for VarSet printing + +ostream & +ClConstraint::PrintOn(ostream &xo) const +{ + // Note that the trailing "= 0)" or ">= 0)" is missing, as derived classes will + // print the right thing after calling this function + xo << strength() << " w{" << weight() << "} ta{" + << _times_added << "} RO" << _readOnlyVars << " " << "(" << Expression(); + return xo; +} + +#endif diff --git a/libs/cassowary/ClDummyVariable.cc b/libs/cassowary/ClDummyVariable.cc new file mode 100644 index 0000000000..e1e9b39c0c --- /dev/null +++ b/libs/cassowary/ClDummyVariable.cc @@ -0,0 +1,12 @@ +// $Id$ + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#ifdef CL_FIND_LEAK +long ClDummyVariable::cDummyVariables = 0; +#endif diff --git a/libs/cassowary/ClFDBinaryOneWayConstraint.cc b/libs/cassowary/ClFDBinaryOneWayConstraint.cc new file mode 100644 index 0000000000..e7bf7f1089 --- /dev/null +++ b/libs/cassowary/ClFDBinaryOneWayConstraint.cc @@ -0,0 +1,140 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDBinaryOneWayConstraint.cc + + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#include +#include +#include +#include + + +void +ClFDBinaryOneWayConstraint::EnsurePreconditionsForCn(const ClConstraint &cn) +{ + ClVarSet setRO = cn.ReadOnlyVars(); + if (setRO.size() > 1) + throw ExCLTooDifficultSpecial("Only 0 or 1 read only variables are allowed"); + const ClLinearExpression &expr = cn.Expression(); + const ClVarToNumberMap &terms = expr.Terms(); + if (terms.size() > 2) + throw ExCLTooDifficultSpecial("Cannot have more than 2 variables"); + if (terms.size() == 0) + throw ExCLTooDifficultSpecial("Must have at least 1 variable"); + if (terms.size() == 2 && setRO.size() == 0) + throw ExCLTooDifficultSpecial("Both variables cannot be read-write, one must be read-only"); + if (terms.size() == 1 && setRO.size() == 1) + throw ExCLTooDifficultSpecial("Single read-only variable in LinearConstraint -- must not be read-only."); + ClVariable clv = (*terms.begin()).first; + /* GJB:FIXME:: iterate over all the variables */ + if (!clv->IsFDVariable()) { + throw ExCLTooDifficultSpecial("FD constraint contains non-FD variables"); + } +} + +bool +ClFDBinaryOneWayConstraint::FCanConvertCn(const ClConstraint &cn) +{ + try { + EnsurePreconditionsForCn(cn); + return true; + } catch (...) { + return false; + } +} + + +ClFDBinaryOneWayConstraint::ClFDBinaryOneWayConstraint(const ClConstraint &cn) + :ClFDConstraint(cn.strength(), cn.weight()) +{ + EnsurePreconditionsForCn(cn); + list l; + /* GJB:FIXME:: varargs inteface, with sentinel as first arg? */ + l.push_back(9); + l.push_back(10); + l.push_back(12); + l.push_back(14); + l.push_back(20); + + ClVarSet setRO = cn.ReadOnlyVars(); + + ClVariable clvRO = clvNil; + ClVariable clvROLinear = clvNil; + Number coeffRO = 0; + + ClVariable clvRW = clvNil; + Number coeffRW = 0; + + if (setRO.size() == 1) { + const ClVariable &clv = *(setRO.begin()); + if (clv->IsFDVariable()) + clvRO = clv; + else + clvRO = new ClFDVariable(clv.Name(),clv.IntValue(),l); + clvROLinear = clv; + } + const ClLinearExpression &expr = cn.Expression(); + const ClVarToNumberMap &terms = expr.Terms(); + + for (ClVarToNumberMap::const_iterator it = terms.begin(); + it != terms.end(); + ++it) { + ClVariable clv = (*it).first; + if (clv == clvROLinear) { + coeffRO = (*it).second; + } else { + if (clv->IsFDVariable()) + clvRW = clv; + else + clvRW = new ClFDVariable(clv.Name(),clv.Value(),l); + coeffRW = (*it).second; + } + } + assert(!clvRW.IsNil()); + if (coeffRW == 0) { + throw ExCLTooDifficultSpecial("RW variable's coefficient must be non-zero"); + } + + bool fInequality = cn.IsInequality(); + bool fStrictInequality = cn.IsStrictInequality(); + double rhs_constant = expr.Constant(); + + // now we have: + // coeffRW * clvRW + coeffRO * clvRO rhs_constant + // where is >= if fInequality, or = if !fInequality + // + // need: + // clvRW coefficient * clvRO + constant + // + // so: + // coefficient = -coeffRO/coeffRW + // constant = rhs_constant/coeffRW + + if (fStrictInequality) + _rel = cnGT; + else if (fInequality) + _rel = cnGEQ; + else + _rel = cnEQ; + + if (coeffRW < 0) + _rel = ReverseInequality(_rel); + + _coefficient = -coeffRO/coeffRW; + _constant = -rhs_constant/coeffRW; + _vRW = clvRW; + _vRO = clvRO; + return; +} diff --git a/libs/cassowary/ClFDConnectorVariable.cc b/libs/cassowary/ClFDConnectorVariable.cc new file mode 100644 index 0000000000..e6618eb9d4 --- /dev/null +++ b/libs/cassowary/ClFDConnectorVariable.cc @@ -0,0 +1,29 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDConnectorVariable.cc + +#include +#include // for list printing + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +// Use < > for ClFDConnector-s, instead of [ ] +#ifndef CL_NO_IO +ostream &ClFDConnectorVariable::PrintOn(ostream &xo) const +{ + xo << "<" << Name() << "=" << Value() + << "{" << _clvFloat << "}" + << ":" << *PlfdnDomain() << ">"; + return xo; +} +#endif diff --git a/libs/cassowary/ClFDSolver.cc b/libs/cassowary/ClFDSolver.cc new file mode 100644 index 0000000000..7f2d199869 --- /dev/null +++ b/libs/cassowary/ClFDSolver.cc @@ -0,0 +1,364 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDSolver.cc + + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int fDebugFDSolve; + +ClFDSolver & +ClFDSolver::AddConstraint(ClConstraint *const pcn) +{ + AddConstraintInternal(pcn); + if (_fAutosolve) Solve(); + return *this; +} + +ClFDSolver & +ClFDSolver::RemoveConstraint(ClConstraint *const pcn) +{ + RemoveConstraintInternal(pcn); + if (_fAutosolve) Solve(); + return *this; +} + +ClFDSolver & +ClFDSolver::AddConstraintInternal(ClConstraint *const pcn) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << *pcn << ")" << endl; +#endif + + ClFDBinaryOneWayConstraint *const pcnfd = + dynamic_cast(pcn); + if (!pcnfd) { + throw ExCLTooDifficultSpecial("Can only add ClFDBinaryOneWayConstraint-s to ClFDSolvers"); + } + ClVariable rw = pcnfd->ClvRW(); + ClVariable ro = pcnfd->ClvRO(); + if (!rw.IsFDVariable()) { + throw ExCLTooDifficultSpecial("RW variable must be an FDVariable"); + } + if (!(ro.IsNil() || ro.IsFDVariable())) { + throw ExCLTooDifficultSpecial("RO variable must be an FDVariable or clvNil"); + } + // add the constraint to our set of cns + _setCns.insert(pcn); + // and add the constraint to the cns that affect var rw + assert(!rw.IsNil()); + _mapClvToCns[rw].insert(pcn); + + + node nRw = GetVarNode(rw); + if (!ro.IsNil()) { + node nRo = GetVarNode(ro); + edge e = G.new_edge(nRo, nRw); + + _mapCnToEdge[pcn] = e; + + if (!G.is_acyclic()) { + /* there is a cycle... give up after cleaning up */ + RemoveConstraint(pcn); + throw ExCLCycleNotAllowed(); + } + } + return *this; +} + +ClFDSolver & +ClFDSolver::RemoveConstraintInternal(ClConstraint *const pcn) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << *pcn << ")" << endl; +#endif + + ClFDBinaryOneWayConstraint *const pcnfd = + dynamic_cast(pcn); + + if (!pcnfd) { + throw ExCLInternalError("Could not downcast to a ClFDBinaryOneWayConstraint"); + } + + ClConstraintSet::iterator itCn = _setCns.find(pcnfd); + if (itCn == _setCns.end()) { + throw ExCLConstraintNotFound(); + } + _setCns.erase(itCn); + + ClVariable rw = pcnfd->ClvRW(); + ClVariable ro = pcnfd->ClvRO(); + ClConstraintSet &_cnsAffectingRW = _mapClvToCns[rw]; + ClConstraintSet::iterator it = _cnsAffectingRW.find(pcnfd); + if (it == _cnsAffectingRW.end()) { + throw ExCLInternalError("Cannot find pcnfd"); + } + _cnsAffectingRW.erase(it); + + if (!ro.IsNil()) { + edge e = _mapCnToEdge[pcn]; + G.del_edge(e); + _mapCnToEdge.erase(pcn); + + if (_mapVarToNode.find(ro) != _mapVarToNode.end() && + _mapVarToNode[ro].degree() == 0) { + G.del_node(_mapVarToNode[ro]); + _mapVarToNode.erase(ro); + } + } + if (_mapVarToNode.find(rw) != _mapVarToNode.end() && + _mapVarToNode[rw].degree() == 0) { + G.del_node(_mapVarToNode[rw]); + _mapVarToNode.erase(rw); + } + if (_mapClvToCns[rw].size() == 0) { + _mapClvToCns.erase(rw); + } + + return *this; +} + +ClFDSolver & +ClFDSolver::Solve() +{ + topsort t; + t.run(G); + topsort::topsort_iterator it = t.top_order_begin(); + topsort::topsort_iterator end = t.top_order_end(); + ClSymbolicWeight errorTotal; + ResetSetFlagsOnVariables(); + for (; it != end; ++it) { + ClVariable clv = nodeToVar[*it]; + ClFDVariable *pcldv = dynamic_cast(clv.get_pclv()); +#ifndef NO_FDSOLVE_DEBUG + if (fDebugFDSolve) { + if (!clv.IsNil()) cout << "node " << (*it) << " is " << clv << endl; + cerr << "Set from: " << endl; + for (ClConstraintSet::iterator itCns = _mapClvToCns[clv].begin(); + itCns != _mapClvToCns[clv].end(); + ++itCns) { + const ClConstraint *pcn = *itCns; + cerr << *pcn << endl; + } + cerr << endl; + } +#endif + pair p = ComputeBest(pcldv); + ClSymbolicWeight e = p.first; + FDNumber v = p.second; + if (v == FDN_NOTSET) + throw ExCLRequiredFailure(); + pcldv->ChangeValue(v); + pcldv->SetFIsSet(true); + errorTotal += e; + } + return *this; +} + +/* return the best (lowest) incremental error and the value + at which that error occurs */ +pair +ClFDSolver::ComputeBest(ClFDVariable *pcldv) +{ + assert(pcldv); + // assert(!pcldv->FIsSet()); //GJB:FIXME:: + ClSymbolicWeight minError = ClsRequired().symbolicWeight(); + FDNumber bestValue = FDN_NOTSET; + // ClVariable clv(pcldv); + // for each domain value + for (list::const_iterator itVal= pcldv->PlfdnDomain()->begin(); + itVal != pcldv->PlfdnDomain()->end(); + ++itVal) { + FDNumber value = *itVal; + ClSymbolicWeight error; + const ClConstraintSet &setCns = _mapClvToCns[pcldv]; + // for each constraint affecting *pcldv + for (ClConstraintSet::const_iterator itCn = setCns.begin(); + itCn != setCns.end(); + ++itCn) { + const ClConstraint *pcn = *itCn; + ClSymbolicWeight e = ErrorForClvAtValSubjectToCn(pcldv,value,*pcn); + error += e; + } + // now error is the total error for binding clv <- value + if (error < minError) { + minError = error; + bestValue = value; + } + } + // now minError is the lowest error we can get for clv + // and it occurs binding clv <- bestValue + if (bestValue == FDN_NOTSET) + throw ExCLRequiredFailure(); + return pair(minError,bestValue); +} + +ClSymbolicWeight +ClFDSolver::ErrorForClvAtValSubjectToCn(ClFDVariable *pcldv,FDNumber value,const ClConstraint &cn) +{ + const ClFDBinaryOneWayConstraint *pcnFd = dynamic_cast(&cn); + if (!pcnFd) throw ExCLInternalError("Not a binary FD constraint."); + ClCnRelation rel = pcnFd->Relation(); + double m = pcnFd->Coefficient(); + double b = pcnFd->Constant(); + ClVariable rw = pcnFd->ClvRW(); + ClVariable ro = pcnFd->ClvRO(); + assert(rw.get_pclv() == pcldv); + double e; + double x = ro.IsNil()? 0 : ro.Value(); + // return the error in satisfying: + // value REL m*x + b + double rhs = m*x + b; + switch (rel) { + case cnLEQ: + if (value <= rhs) e = 0; + else e = 1 + value-rhs; + break; + case cnLT: + if (value < rhs) e = 0; + else e = 1 + value-rhs; + break; + case cnGEQ: + if (value >= rhs) e = 0; + else e = 1+ rhs-value; + break; + case cnGT: + if (value > rhs) e = 0; + else e = 1 + rhs-value; + break; + case cnEQ: + if (value == rhs) e = 0; + else e = 1 + fabs(rhs-value); + break; + case cnNEQ: + if (value != rhs) e = 0; + else e = 1; /* GJB:FIXME:: what makes sense here? */ + break; + default: + e = 0; /* quiet warning */ + assert(false); + } + + ClSymbolicWeight err; + if (cn.IsRequired() && e > 0) + err = ClsRequired().symbolicWeight(); + else + err = cn.symbolicWeight() * (e*cn._weight); +#ifndef NO_FDSOLVE_DEBUG + if (fDebugFDSolve) { + cerr << "Error at " << value << " = " << err << endl; + } +#endif + return err; +} + + +ClFDSolver & +ClFDSolver::ShowSolve() +{ + topsort t; + t.run(G); + topsort::topsort_iterator it = t.top_order_begin(); + topsort::topsort_iterator end = t.top_order_end(); + for (; it != end; ++it) { + ClVariable clv = nodeToVar[*it]; + if (!clv.IsNil()) cout << "Node " << (*it) << " is " << clv << endl; + cout << "Set from: " << endl; + for (ClConstraintSet::iterator itCns = _mapClvToCns[clv].begin(); + itCns != _mapClvToCns[clv].end(); + ++itCns) { + const ClConstraint *pcn = *itCns; + cout << *pcn << endl; + } + cout << endl; + } + return *this; +} + + +/* Turn all FDVariable FIsSet() flags to false */ +void +ClFDSolver::ResetSetFlagsOnVariables() +{ + for (ClVarToConstraintSetMap::iterator it = _mapClvToCns.begin(); + it != _mapClvToCns.end(); + ++it) { + ClVariable clv = (*it).first; + ClFDVariable *pcldv = dynamic_cast(clv.get_pclv()); + assert(pcldv); + pcldv->SetFIsSet(false); + } +} + + +ostream & +ClFDSolver::PrintOn(ostream &xo) const +{ + xo << "FDSolver: " + << _setCns + << "Graph nodes, edges = " << G.number_of_nodes() << ", " << G.number_of_edges() + << endl; + return xo; +} + +ostream & +ClFDSolver::PrintInternalInfo(ostream &xo) const +{ return xo; } + + +ostream &operator<<(ostream &xo, const ClFDSolver &clfds) +{ return clfds.PrintOn(xo); } + + +//// protected member functions + +/* Create node for v in G, if necessary, + otherwise return the node we already created. */ +node +ClFDSolver::GetVarNode(ClVariable v) +{ + ClMap::iterator it = _mapVarToNode.find(v); + if (it == _mapVarToNode.end()) { + node n = G.new_node(); + _mapVarToNode[v] = n; + nodeToVar[n] = v; + return n; + } else { + return (*it).second; + } +} + + +void +ListPushOnto(list *pl, ...) +{ + va_list ap; + va_start(ap, pl); + FDNumber n; + while ( (n = va_arg(ap, FDNumber)) != FDN_EOL) { + pl->push_back(n); + } + va_end(ap); +} diff --git a/libs/cassowary/ClFDVariable.cc b/libs/cassowary/ClFDVariable.cc new file mode 100644 index 0000000000..5ab9d518b1 --- /dev/null +++ b/libs/cassowary/ClFDVariable.cc @@ -0,0 +1,27 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDVariable.cc + +#include +#include // for list printing + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +// Use < > for ClFDVariable-s, instead of [ ] +#ifndef CL_NO_IO +ostream &ClFDVariable::PrintOn(ostream &xo) const +{ + xo << "<" << Name() << "=" << Value() << ":" << *PlfdnDomain() << ">"; + return xo; +} +#endif diff --git a/libs/cassowary/ClFloatVariable.cc b/libs/cassowary/ClFloatVariable.cc new file mode 100644 index 0000000000..a3096e4b08 --- /dev/null +++ b/libs/cassowary/ClFloatVariable.cc @@ -0,0 +1,25 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFloatVariable.cc + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#ifndef CL_NO_IO +ostream &ClFloatVariable::PrintOn(ostream &xo) const +{ + xo << "[" << Name() << ":" << _value << "]"; + return xo; +} +#endif diff --git a/libs/cassowary/ClLinearExpression.cc b/libs/cassowary/ClLinearExpression.cc new file mode 100644 index 0000000000..72383ffec1 --- /dev/null +++ b/libs/cassowary/ClLinearExpression.cc @@ -0,0 +1,473 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClLinearExpression.cc + +using namespace std; + +#include +#include /// needed only to instantiate with T=ClSymbolicWeight +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +template +ClGenericLinearExpression::ClGenericLinearExpression(T num) : + _constant(num) +{ } + +// Convert from ClVariable to a ClLinearExpression +// this replaces ClVariable::asLinearExpression +template +ClGenericLinearExpression::ClGenericLinearExpression(ClVariable clv, T value, + T Constant) : + _constant(Constant) +{ + _terms[clv] = value; +} + +template +ClGenericLinearExpression::~ClGenericLinearExpression() +{ } + +#ifndef CL_NO_IO +template +ostream & +ClGenericLinearExpression::PrintOn(ostream &xo) const +{ + typename ClVarToCoeffMap::const_iterator i = _terms.begin(); + + if (!ClApprox(_constant,0.0) || i == _terms.end()) + { + xo << _constant; + } + else + { + if (i == _terms.end()) + return xo; + xo << (*i).second << "*" << (*i).first; + ++i; + } + for ( ; i != _terms.end(); ++i) + { + xo << " + " << (*i).second << "*" << (*i).first; + } + return xo; +} +#endif + + + +// Destructively multiply self by x. +// (private memfn) +template +ClGenericLinearExpression & +ClGenericLinearExpression::MultiplyMe(T x) +{ + _constant *= x; + + typename ClVarToCoeffMap::const_iterator i = _terms.begin(); + for ( ; i != _terms.end(); ++i) + { + _terms[(*i).first] = (*i).second * x; + } + return *this; +} + +// Return a new linear expression formed by multiplying self by x. +// (Note that this result must be linear.) +template +ClGenericLinearExpression +ClGenericLinearExpression::Times(Number x) const +{ + ClGenericLinearExpression result = *this; + return result.MultiplyMe(x); +} + +// Return a new linear expression formed by multiplying self by x. +// (Note that this result must be linear.) +// The above function optimizes the specific case of multiplying +// by a Constant, here is the more general case +template +ClGenericLinearExpression +ClGenericLinearExpression::Times(const ClGenericLinearExpression &expr) const +{ + if (IsConstant()) + { + return expr.Times(_constant); + } + else if (!expr.IsConstant()) + { + // neither are constants, so we'd introduce non-linearity + throw ExCLNonlinearExpression(); + } + return Times(expr._constant); +} + + +// Return a new linear expression formed by adding x to self. +template +ClGenericLinearExpression +ClGenericLinearExpression::Plus(const ClGenericLinearExpression &expr) const +{ + ClGenericLinearExpression result = *this; + result.AddExpression(expr,1.0); + return result; +} + +// Return a new linear expression formed by subtracting x from self. +template +ClGenericLinearExpression +ClGenericLinearExpression::Minus(const ClGenericLinearExpression &expr) const +{ + ClGenericLinearExpression result = *this; + result.AddExpression(expr,-1.0); + return result; +} + +// Return a new linear expression formed by dividing self by x. +// (Note that this result must be linear.) +template +ClGenericLinearExpression +ClGenericLinearExpression::Divide(Number x) const +{ + if (ClApprox(x,0.0)) + { + throw ExCLNonlinearExpression(); + } + return Times(1.0/x); +} + +// Return a new linear expression formed by dividing self by x. +// (Note that this result must be linear.) +template +ClGenericLinearExpression +ClGenericLinearExpression::Divide(const ClGenericLinearExpression &expr) const +{ + if (!expr.IsConstant()) + { + throw ExCLNonlinearExpression(); + } + return Divide(expr._constant); +} + + +// Return a new linear expression (expr/this). Since the result +// must be linear, this is permissible only if 'this' is a Constant. +template +ClGenericLinearExpression +ClGenericLinearExpression::DivFrom(const ClGenericLinearExpression &expr) const +{ + if (!IsConstant() || ClApprox(_constant,0.0)) + { + throw ExCLNonlinearExpression(); + } + return expr.Divide(_constant); +} + +// Add n*expr to this expression for another expression expr. +template +ClGenericLinearExpression & +ClGenericLinearExpression::AddExpression(const ClGenericLinearExpression &expr, Number n) +{ + IncrementConstant(expr.Constant()*n); + + typename ClVarToCoeffMap::const_iterator i = expr._terms.begin(); + for ( ; i != expr._terms.end(); ++i) + { + AddVariable((*i).first, (*i).second * n); + } + return *this; +} + +// Add n*expr to this expression for another expression expr. +// Notify the solver if a variable is added or deleted from this +// expression. +template +ClGenericLinearExpression & +ClGenericLinearExpression::AddExpression(const ClGenericLinearExpression &expr, Number n, + ClVariable subject, + ClTableau &solver) +{ + IncrementConstant(expr.Constant() * n); + + typename ClVarToCoeffMap::const_iterator i = expr._terms.begin(); + for ( ; i != expr._terms.end(); ++i) + { + AddVariable((*i).first, (*i).second * n, subject, solver); + } + return *this; +} + +// Add a term c*v to this expression. If the expression already +// contains a term involving v, Add c to the existing coefficient. +// If the new coefficient is approximately 0, delete v. +template +ClGenericLinearExpression & +ClGenericLinearExpression::AddVariable(ClVariable v, T c) +{ // body largely duplicated below +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << v << ", " << c << ")" << endl; +#endif + typename ClVarToCoeffMap::iterator i = _terms.find(v); + if (i != _terms.end()) + { + // expression already contains that variable, so Add to it + T new_coefficient = 0; + new_coefficient = (*i).second + c; + if (ClApprox(new_coefficient,0.0)) + { + // new coefficient is Zero, so erase it + _terms.erase(i); + } + else + { + (*i).second = new_coefficient; + } + } + else // expression did not contain that variable + { + if (!ClApprox(c,0.0)) + { + _terms[v] = c; + } + } + return *this; +} + +// Add a term c*v to this expression. If the expression already +// contains a term involving v, Add c to the existing coefficient. +// If the new coefficient is approximately 0, delete v. Notify the +// solver if v appears or disappears from this expression. +template +ClGenericLinearExpression & +ClGenericLinearExpression::AddVariable(ClVariable v, T c, + ClVariable subject, + ClTableau &solver) +{ // body largely duplicated above +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << v << ", " << c << ", " << subject << ", ...)" << endl; +#endif + typename ClVarToCoeffMap::iterator i = _terms.find(v); + if (i != _terms.end()) + { + // expression already contains that variable, so Add to it + T new_coefficient = (*i).second + c; + if (ClApprox(new_coefficient,0.0)) + { + // new coefficient is Zero, so erase it + solver.NoteRemovedVariable((*i).first,subject); + _terms.erase(i); + } + else + { + (*i).second = new_coefficient; + } + } + else // expression did not contain that variable + { + if (!ClApprox(c,0.0)) + { + _terms[v] = c; + solver.NoteAddedVariable(v,subject); + } + } +#ifdef CL_TRACE + cerr << "Now *this == " << *this << endl; +#endif + return *this; +} + +// Return a variable in this expression. (It is an error if this +// expression is Constant -- signal ExCLInternalError in that case). +template +ClVariable +ClGenericLinearExpression::AnyPivotableVariable() const +{ + if (IsConstant()) + { + throw ExCLInternalError("(ExCLInternalError) No pivotable variables in Constant expression"); + } + typename ClVarToCoeffMap::const_iterator i = _terms.begin(); + for ( ; i != _terms.end(); ++i) + { + ClVariable v = (*i).first; + if (v.IsPivotable()) + return v; + } + return clvNil; +} + +// Replace var with a symbolic expression expr that is equal to it. +// If a variable has been added to this expression that wasn't there +// before, or if a variable has been dropped from this expression +// because it now has a coefficient of 0, inform the solver. +// PRECONDITIONS: +// var occurs with a non-Zero coefficient in this expression. +template +void +ClGenericLinearExpression::SubstituteOut(ClVariable var, + const ClGenericLinearExpression &expr, + ClVariable subject, + ClTableau &solver) +{ +#ifdef CL_TRACE + cerr << "* ClGenericLinearExpression::"; + Tracer TRACER(__FUNCTION__); + cerr << "(" << var << ", " << expr << ", " << subject << ", " + << solver << ")" << endl; + cerr << "*this == " << *this << endl; +#endif + + typename ClVarToCoeffMap::iterator pv = _terms.find(var); + +#ifndef NDEBUG + if (pv == _terms.end()) + { +#ifndef CL_NO_IO + cerr << "SubstituteOut: pv != _terms.end()" << endl; + cerr << "(" << var << ", " << expr << ", " << subject << ", " + << ")" << endl; + cerr << "*this == " << *this << endl; +#endif + throw "SubstituteOut: pv != _terms.end()"; + } +#endif + assert(pv != _terms.end()); + // FIXGJB: this got thrown! assert(!ClApprox((*pv).second,0.0)); + + T multiplier = (*pv).second; + _terms.erase(pv); + IncrementConstant(multiplier * expr._constant); + typename ClVarToCoeffMap::const_iterator i = expr._terms.begin(); + for ( ; i != expr._terms.end(); ++i) + { + ClVariable v = (*i).first; + T c = (*i).second; + typename ClVarToCoeffMap::iterator poc = _terms.find(v); + if (poc != _terms.end()) + { // if oldCoeff is not nil +#ifdef CL_TRACE + cerr << "Considering (*poc) == " << (*poc).second << "*" << (*poc).first << endl; +#endif + // found it, so new coefficient is old one Plus what is in *i + T newCoeff = (*poc).second + (multiplier*c); + if (ClApprox(newCoeff,0.0)) + { + solver.NoteRemovedVariable((*poc).first,subject); + _terms.erase(poc); + } + else + { + (*poc).second = newCoeff; + } + } + else + { // did not have that variable already (oldCoeff == nil) +#ifdef CL_TRACE + cerr << "Adding (*i) == " << (*i).second << "*" << (*i).first << endl; +#endif + _terms[v] = multiplier * c; + solver.NoteAddedVariable(v,subject); + } + } +#ifdef CL_TRACE + cerr << "Now (*this) is " << *this << endl; +#endif +} + +// This linear expression currently represents the equation +// oldSubject=self. Destructively modify it so that it represents +// the equation NewSubject=self. +// +// Precondition: NewSubject currently has a nonzero coefficient in +// this expression. +// +// NOTES +// Suppose this expression is c + a*NewSubject + a1*v1 + ... + an*vn. +// +// Then the current equation is +// oldSubject = c + a*NewSubject + a1*v1 + ... + an*vn. +// The new equation will be +// NewSubject = -c/a + oldSubject/a - (a1/a)*v1 - ... - (an/a)*vn. +// Note that the term involving NewSubject has been dropped. +// +// Basically, we consider the expression to be an equation with oldSubject +// equal to the expression, then Resolve the equation for NewSubject, +// and destructively make the expression what NewSubject is then equal to +template +void +ClGenericLinearExpression::ChangeSubject(ClVariable old_subject, + ClVariable new_subject) +{ + _terms[old_subject] = NewSubject(new_subject); +} + +inline double ReciprocalOf(double n) +{ return 1.0/n; } + +// This linear expression currently represents the equation self=0. Destructively modify it so +// that subject=self represents an equivalent equation. +// +// Precondition: subject must be one of the variables in this expression. +// NOTES +// Suppose this expression is +// c + a*subject + a1*v1 + ... + an*vn +// representing +// c + a*subject + a1*v1 + ... + an*vn = 0 +// The modified expression will be +// subject = -c/a - (a1/a)*v1 - ... - (an/a)*vn +// representing +// subject = -c/a - (a1/a)*v1 - ... - (an/a)*vn = 0 +// +// Note that the term involving subject has been dropped. +// +// Returns the reciprocal, so that NewSubject can be used by ChangeSubject +template +T +ClGenericLinearExpression::NewSubject(ClVariable subject) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << subject << ")" << endl; +#endif + typename ClVarToCoeffMap::iterator pnewSubject = _terms.find(subject); + assert(pnewSubject != _terms.end()); + // assert(!ClApprox((*pnewSubject).second,0.0)); + T reciprocal = ReciprocalOf((*pnewSubject).second); + _terms.erase(pnewSubject); + MultiplyMe(-reciprocal); + return reciprocal; +} + +template +T +ClGenericLinearExpression::Evaluate() const +{ + T answer = _constant; + typename ClVarToCoeffMap::const_iterator i = _terms.begin(); + + for ( ; i != _terms.end(); ++i) + { + ClVariable v = (*i).first; + answer += (*i).second * v.Value(); + } + return answer; +} + + +template class ClGenericLinearExpression; +// template class ClGenericLinearExpression; diff --git a/libs/cassowary/ClReader.l b/libs/cassowary/ClReader.l new file mode 100644 index 0000000000..77fa13a5a1 --- /dev/null +++ b/libs/cassowary/ClReader.l @@ -0,0 +1,87 @@ +/* $Id$ + Cassowary Incremental Constraint Solver + Original Smalltalk Implementation by Alan Borning + This C++ Implementation by Greg J. Badros, + http://www.cs.washington.edu/homes/gjb + (C) 1998, 1999 Greg J. Badros and Alan Borning + See ../LICENSE for legal details regarding this software + + ClReader.l - Scanner for constraint parsing. + By Greg J. Badros + */ + +%{ +/* Get the token numbers that bison created for us + (uses the -d option of bison) */ + +#include +#include "ClReader.cc.h" + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +/* global variable for the istream we are reading from; + gets set by PcnParseConstraint */ +istream *pxi_lexer; + +/* Pass in an extra variable (ClParseData *) to cllex so that + it can look up variable names */ +#define YY_DECL int cllex(YYSTYPE *lvalp, void *YYLEX_PARAM) + +/* Make lexer reader from the global variable */ +#define YY_INPUT(buf,result,max_size) \ + do { if (pxi_lexer->get(buf[0]) && buf[0] > 0) result = 1; \ + else result = YY_NULL; } while (0) + +%} + +%option noyywrap + +DIGIT [0-9] +ALPHA [A-Za-z] +ALPHANUM [A-Za-z0-9] +ID_OK_PUNC [-_\[\]] +RO_ANNOTATION "?" +ID {ALPHA}({ALPHANUM}|{ID_OK_PUNC})*({RO_ANNOTATION})? +NUMID "{"{DIGIT}+"}" +ws [ \t\n]+ + +%% +{ws} /* skip whitespace */ +\n|";" { return 0; } +">=" { return GEQ; } +">" { return GT; } +"<=" { return LEQ; } +"<" { return LT; } +"==" { return '='; } +"="|"-"|"+"|"*"|"/"|"("|")" { return yytext[0]; } + +{DIGIT}+("."{DIGIT}*)? | +"."{DIGIT}+ { lvalp->num = strtod(yytext,0); return NUM; } + +{ID} { /* Lookup the variable name */ + ClParseData *pclpd = ((ClParseData *) YYLEX_PARAM); + int cch = strlen(yytext); + ClVariable *pclv = NULL; + bool fReadOnly = false; + if (yytext[cch-1] == '?') { + yytext[cch-1] = '\0'; + fReadOnly = true; + } + const string str = string(yytext); + pclv = pclpd->_lookup_func(str); + if (!pclv->IsNil()) { + lvalp->pclv = pclv; + return fReadOnly?RO_VAR:VAR; + } else { + pxi_lexer = NULL; + yy_flush_buffer(YY_CURRENT_BUFFER); + throw ExCLParseErrorBadIdentifier(str); + return 0; + } + } + +. { pxi_lexer = NULL; throw ExCLParseErrorMisc("Unrecognized character"); } + diff --git a/libs/cassowary/ClReader.y b/libs/cassowary/ClReader.y new file mode 100644 index 0000000000..f9f0dca43e --- /dev/null +++ b/libs/cassowary/ClReader.y @@ -0,0 +1,154 @@ +/* + $Id$ + + Cassowary Incremental Constraint Solver + Original Smalltalk Implementation by Alan Borning + This C++ Implementation by Greg J. Badros, + http://www.cs.washington.edu/homes/gjb + (C) 1998, 1999 Greg J. Badros and Alan Borning + See ../LICENSE for legal details regarding this software + + ClReader.y + Original implementation contributed by Steve Wolfman + Subsequently largely revised by Greg J. Badros + + Supports parsing of read-only variables in constraints via "?" suffix + annotations on variables. If a variable is followed by "?" in any of + its occurrences in the constraint, that variable is deemed read-only + and entered into the constraint object as such. E.g., + + x = 2*y? + + is a one-way constraint that sets x from y's value. + + x = y + y? + and + x = y? + y + + are identical one-way constraints with y read-only. One would prefer + to have it written like so: + + x = y? + y? + + but it need not be, and no warning or error is raised. +*/ + + +%{ + /* C Declarations */ + +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#ifdef USE_CRUMMY_LEXER +string current; /* Global to help in debugging/error messages */ +#endif + +/* Get yyparse, yylex to have an extra argument (type void *) */ +#define YYPARSE_PARAM cl_parse_data +#define YYLEX_PARAM cl_parse_data +#ifndef YYERROR_VERBOSE +#define YYERROR_VERBOSE +#endif +#define YYDEBUG 1 + +%} + + +/* Bison Declarations */ + +%pure_parser + +%union { + double num; + const ClVariable *pclv; + ClLinearExpression *pcle; + ClConstraint *pcn; +} + +%{ +int yylex(YYSTYPE *lvalp, void *YYLEX_PARAM); +void yyerror(const char *sz); +%} + +%start constraint + +%token NUM +%token VAR +%token RO_VAR + +%token GEQ +%token GT +%token LEQ +%token LT + +%type expr +%type constraint equation inequality + +%left '-' '+' +%left '*' '/' +%left NEG + +%% +/* Grammar Rules */ + +constraint: equation { $$ = $1; ((ClParseData*)YYPARSE_PARAM)->_pcn = $1; } + | inequality { $$ = $1; ((ClParseData*)YYPARSE_PARAM)->_pcn = $1; } +; + +equation: expr '=' expr { $$ = new ClLinearEquation(*$1, *$3); } +; + +inequality: expr GEQ expr { $$ = new ClLinearInequality(*$1, cnGEQ, *$3); } + | expr LEQ expr { $$ = new ClLinearInequality(*$1, cnLEQ, *$3); } + | expr LT expr { $$ = new ClLinearInequality(*$1, cnLT, *$3); } + | expr GT expr { $$ = new ClLinearInequality(*$1, cnGT, *$3); } +; + +expr: NUM { $$ = new ClLinearExpression($1); } + | VAR { $$ = new ClLinearExpression(*$1); } + | RO_VAR { $$ = new ClLinearExpression(*$1); + ((ClParseData*)YYPARSE_PARAM)->_readOnlyVarsSoFar.insert(*$1); } + | expr '+' expr { $$ = new ClLinearExpression(*$1 + *$3); } + | expr '-' expr { $$ = new ClLinearExpression(*$1 - *$3); } + | expr '*' expr { $$ = new ClLinearExpression(*$1 * *$3); } + | expr '/' expr { $$ = new ClLinearExpression(*$1 / *$3); } + | '-' expr %prec NEG { $$ = new ClLinearExpression(-1 * *$2); } + | '(' expr ')' { $$ = $2; } +; + +%% + +void clerror(const char *sz) +{ + throw ExCLParseErrorMisc(sz); +} + +extern istream *pxi_lexer; + +// xi is the stream from which to read the constraint. +// aVars is an array of variables large enough to account for +// each one that might be mentioned in a constraint +ClConstraint *PcnParseConstraint(istream &xi, const ClVarLookupFunction &lookup_func, + const ClStrength &strength) +{ + ClParseData cl_parse_data(xi, lookup_func); + pxi_lexer = ξ + if (yyparse(&cl_parse_data) == 0) { // success +#ifdef DEBUG_PARSER + cerr << *cl_parse_data.Pcn() << endl; +#endif + cl_parse_data.Pcn()->ChangeStrength(strength); + cl_parse_data.Pcn()->AddROVars(cl_parse_data._readOnlyVarsSoFar); + return cl_parse_data.Pcn(); + } + else { // failed + return 0; + } +} diff --git a/libs/cassowary/ClSimplexSolver.cc b/libs/cassowary/ClSimplexSolver.cc new file mode 100644 index 0000000000..424a5d5aab --- /dev/null +++ b/libs/cassowary/ClSimplexSolver.cc @@ -0,0 +1,1633 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSimplexSolver.cc + +using namespace std; + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +const char *szCassowaryVersion = VERSION; + +// Need to delete all expressions +// and all slack and dummy variables +// See NewExpression -- all allocation is done in there +ClSimplexSolver::~ClSimplexSolver() +{ +#ifdef CL_SOLVER_STATS + cerr << "_slackCounter == " << _slackCounter + << "\n_artificialCounter == " << _artificialCounter + << "\n_dummyCounter == " << _dummyCounter << endl; + cerr << "stayMinusErrorVars " << _stayMinusErrorVars.size() << ", " + << "stayPlusErrorVars " << _stayPlusErrorVars.size() << ", " + << "errorVars " << _errorVars.size() << ", " + << "markerVars " << _markerVars.size() << endl; +#endif + // Cannot print *this here, since local ClVariable-s may have been + // destructed already +} + +// Add the constraint cn to the tableau +ClSimplexSolver & +ClSimplexSolver::AddConstraint(ClConstraint *const pcn) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << *pcn << ")" << endl; +#endif + + if (!pcn->FIsOkayForSimplexSolver()) { + throw ExCLTooDifficultSpecial("SimplexSolver cannot handle this constraint object"); + } + + if (pcn->IsStrictInequality()) { + // cannot handle strict inequalities + throw ExCLStrictInequalityNotAllowed(); + } + + if (pcn->ReadOnlyVars().size() > 0) { + // cannot handle read-only vars + throw ExCLReadOnlyNotAllowed(); + } + + if (pcn->IsEditConstraint()) + { + ClEditConstraint *pcnEdit = dynamic_cast(pcn); + const ClVariable &v = pcnEdit->variable(); + if (!v.IsExternal() || + (!FIsBasicVar(v) && !ColumnsHasKey(v))) + { + // we could try to make this case work, + // but it'd be unnecessarily inefficient -- + // and probably easier for the client application + // to deal with + throw ExCLEditMisuse("(ExCLEditMisuse) Edit constraint on variable not in tableau."); + } + ClEditInfo *pcei = PEditInfoFromClv(v); + if (pcei) + { + // we need to only add a partial _editInfoList entry for this + // edit constraint since the variable is already being edited. + // otherwise a more complete entry is added later in this function + _editInfoList.push_back(new ClEditInfo(v, NULL, clvNil, clvNil, 0)); + return *this; + } + } + + ClVariable clvEplus, clvEminus; + Number prevEConstant; + ClLinearExpression *pexpr = NewExpression(pcn, /* output to: */ + clvEplus,clvEminus, + prevEConstant); + bool fAddedOkDirectly = false; + + try + { + // If possible Add expr directly to the appropriate tableau by + // choosing a subject for expr (a variable to become basic) from + // among the current variables in expr. If this doesn't work use an + // artificial variable. After adding expr re-Optimize. + fAddedOkDirectly = TryAddingDirectly(*pexpr); + } + catch (ExCLRequiredFailure &error) + { +#ifdef CL_TRACE + cerr << "could not Add directly -- caught ExCLRequiredFailure error" << endl; +#endif + RemoveConstraintInternal(pcn); + throw; + } + + if (!fAddedOkDirectly) + { // could not Add directly + ExCLRequiredFailureWithExplanation e; + if (!AddWithArtificialVariable(*pexpr, e)) + { +#ifdef CL_DEBUG_FAILURES + cerr << "Failed solve! Could not Add constraint.\n" + << *this << endl; +#endif + RemoveConstraintInternal(pcn); + if (FIsExplaining()) + throw e; + else + throw ExCLRequiredFailure(); + } + } + + _fNeedsSolving = true; + + if (pcn->IsEditConstraint()) + { + ClEditConstraint *pcnEdit = dynamic_cast(pcn); + ClVariable clv = pcnEdit->variable(); + _editInfoList.push_back(new ClEditInfo(clv, pcnEdit, clvEplus, clvEminus, + prevEConstant)); + } + + if (_fAutosolve) + { + Optimize(_objective); + SetExternalVariables(); + } + + pcn->addedTo(*this); + return *this; +} + +// Add weak stays to the x and y parts of each point. These have +// increasing weights so that the solver will try to satisfy the x +// and y stays on the same point, rather than the x stay on one and +// the y stay on another. +ClSimplexSolver & +ClSimplexSolver::AddPointStays(const vector &listOfPoints, + const ClStrength &strength) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); +#endif + + vector::const_iterator it = listOfPoints.begin(); + double weight = 1.0; + static const double multiplier = 2.0; + for ( ; it != listOfPoints.end(); ++it ) + { + AddPointStay((*it)->X(),(*it)->Y(),strength,weight); + weight *= multiplier; + } + return *this; +} + +ClSimplexSolver & +ClSimplexSolver::AddPointStay(const ClPoint &clp, const ClStrength &strength, double weight) +{ + AddPointStay(clp.X(),clp.Y(),strength,weight); + return *this; +} + + +ClSimplexSolver & +ClSimplexSolver::RemoveEditVarsTo(unsigned int n) +{ + queue qclv; + ClVarSet sclvStillEditing; // Set of edit variables that we need to *not* remove +#ifdef DEBUG_NESTED_EDITS + cerr << __FUNCTION__ << " " << n << endl; +#endif + unsigned int i = 0; + for ( ClEditInfoList::const_iterator it = _editInfoList.begin(); + (it != _editInfoList.end() && _editInfoList.size() != static_cast(n)); + ++it, ++i ) + { + const ClEditInfo *pcei = (*it); + assert(pcei); +#ifdef DEBUG_NESTED_EDITS + cerr << __FUNCTION__ << "Checking " << pcei->_clv + << ", index = " << i << endl; +#endif + if (i >= n) + qclv.push(pcei->_clv); + else + sclvStillEditing.insert(pcei->_clv); + } + while (!qclv.empty()) + { + ClVariable clv = qclv.front(); + // only remove the variable if it's not in the set of variable + // from a previous nested outer edit + // e.g., if I do: + // Edit x,y + // Edit w,h,x,y + // EndEdit + // The end edit needs to only get rid of the edits on w,h + // not the ones on x,y + if (sclvStillEditing.find(clv) == sclvStillEditing.end()) + { +#ifdef DEBUG_NESTED_EDITS + cerr << __FUNCTION__ << ": Removing " << clv << endl; +#endif + RemoveEditVar(clv); + } +#ifdef DEBUG_NESTED_EDITS + else + { + cerr << __FUNCTION__ << ": Not removing " << clv << endl; + } +#endif + qclv.pop(); + } + while (_editInfoList.size() > n) { + _editInfoList.pop_back(); + } + + return *this; +} + + +/* A predicate used for remove_if */ +class VarInVarSet : public unary_function { +public: + VarInVarSet(const ClVarSet &clvset) : + _set(clvset), + _setEnd(clvset.end()) + { } + + bool operator ()(ClVariable clv) const { + return (_set.find(clv) != _setEnd); + } + +private: + const ClVarSet &_set; + const ClVarSet::iterator _setEnd; +}; + + + +// Remove the constraint cn from the tableau +// Also remove any error variable associated with cn +ClSimplexSolver & +ClSimplexSolver::RemoveConstraintInternal(const ClConstraint *const pcn) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << *pcn << ")" << endl; +#endif + + // We are about to remove a constraint. There may be some stay + // constraints that were unsatisfied previously -- if we just + // removed the constraint these could come into play. Instead, + // Reset all of the stays so that things should stay where they are + // at the moment. + _fNeedsSolving = true; + + ResetStayConstants(); + + // remove any error variables from the objective function + ClLinearExpression *pzRow = RowExpression(_objective); + +#ifdef CL_TRACE + cerr << _errorVars << endl << endl; +#endif + + ClConstraintToVarSetMap::iterator + it_eVars = _errorVars.find(pcn); + bool fFoundErrorVar = (it_eVars != _errorVars.end()); + + if (fFoundErrorVar) + { + ClVarSet &eVars = (*it_eVars).second; + ClVarSet::iterator it = eVars.begin(); + for ( ; it != eVars.end(); ++it ) + { + const ClLinearExpression *pexpr = RowExpression(*it); + if (pexpr == NULL ) + { + pzRow->AddVariable(*it,-pcn->weight() * pcn->strength().symbolicWeight().AsDouble(), + _objective,*this); + } + else + { // the error variable was in the basis + pzRow->AddExpression(*pexpr,-pcn->weight() * pcn->strength().symbolicWeight().AsDouble(), + _objective,*this); + } + } + } + + ClConstraintToVarMap::iterator + it_marker = _markerVars.find(pcn); + if (it_marker == _markerVars.end()) + { // could not find the constraint + throw ExCLConstraintNotFound(); + } + // try to make the marker variable basic if it isn't already + const ClVariable marker = (*it_marker).second; + _markerVars.erase(it_marker); + _constraintsMarked.erase(marker); +#ifdef CL_TRACE + cerr << "Looking to remove var " << marker << endl; +#endif + if (!FIsBasicVar(marker)) + { // not in the basis, so need to do some work + // first choose which variable to move out of the basis + // only consider restricted basic variables + ClVarSet &col = _columns[marker]; + ClVarSet::iterator it_col = col.begin(); +#ifdef CL_TRACE + cerr << "Must Pivot -- columns are " << col << endl; +#endif + + ClVariable exitVar = clvNil; + bool fExitVarSet = false; + double minRatio = 0.0; + for ( ; it_col != col.end(); ++it_col) + { + const ClVariable &v = *it_col; + if (v.IsRestricted() ) + { + const ClLinearExpression *pexpr = RowExpression(v); + assert(pexpr != NULL ); + Number coeff = pexpr->CoefficientFor(marker); +#ifdef CL_TRACE + cerr << "Marker " << marker << "'s coefficient in " << *pexpr << " is " + << coeff << endl; +#endif + // only consider negative coefficients + if (coeff < 0.0) + { + Number r = - pexpr->Constant() / coeff; + if (!fExitVarSet || r < minRatio) + { + minRatio = r; + exitVar = v; + fExitVarSet = true; + } + } + } + } + // if we didn't set exitvar above, then either the marker + // variable has a positive coefficient in all equations, or it + // only occurs in equations for unrestricted variables. If it + // does occur in an equation for a restricted variable, pick the + // equation that gives the smallest ratio. (The row with the + // marker variable will become infeasible, but all the other rows + // will still be feasible; and we will be dropping the row with + // the marker variable. In effect we are removing the + // non-negativity restriction on the marker variable.) + if (!fExitVarSet) + { +#ifdef CL_TRACE + cerr << "exitVar did not get set" << endl; +#endif + it_col = col.begin(); + for ( ; it_col != col.end(); ++it_col) + { + ClVariable v = *it_col; + if (v.IsRestricted() ) + { + const ClLinearExpression *pexpr = RowExpression(v); + assert(pexpr != NULL); + Number coeff = pexpr->CoefficientFor(marker); + Number r = pexpr->Constant() / coeff; + if (!fExitVarSet || r < minRatio) + { + minRatio = r; + exitVar = v; + fExitVarSet = true; + } + } + } + } + + if (!fExitVarSet) + { // exitVar is still nil + // If col is empty, then exitVar doesn't occur in any equations, + // so just remove it. Otherwise pick an exit var from among the + // unrestricted variables whose equation involves the marker var + if (col.size() == 0) + { + RemoveColumn(marker); + } + else + { + // A. Beurive' Tue Sep 14 18:26:05 CEST 1999 + // Don't pick the objective, or it will be removed! + it_col = col.begin(); + for ( ; it_col != col.end(); ++it_col) + { + ClVariable v = *it_col; + if (v != _objective) + { + exitVar = v; + fExitVarSet = true; + break; + } + } + assert(fExitVarSet == true); + } + } + + if (fExitVarSet) + { + Pivot(marker,exitVar); + } + } + + if (FIsBasicVar(marker)) + { + ClLinearExpression *pexpr = RemoveRow(marker); +#ifdef CL_TRACE + cerr << "delete@ " << pexpr << endl; +#endif + delete pexpr; + } + + // Delete any error variables. If cn is an inequality, it also + // contains a slack variable; but we use that as the marker variable + // and so it has been deleted when we removed its row. + if (fFoundErrorVar) + { + ClVarSet &eVars = (*it_eVars).second; + ClVarSet::iterator it = eVars.begin(); + for ( ; it != eVars.end(); ++it ) + { + ClVariable v = (*it); + if (v != marker) + { + RemoveColumn(v); + } + } + } + + if (pcn->isStayConstraint()) + { + // iterate over the stay{Plus,Minus}ErrorVars and remove those + // variables v in those vectors that are also in set eVars + if (fFoundErrorVar) + { + ClVarSet &eVars = (*it_eVars).second; + _stayPlusErrorVars + .erase(remove_if(_stayPlusErrorVars.begin(),_stayPlusErrorVars.end(), + VarInVarSet(eVars)), + _stayPlusErrorVars.end()); + _stayMinusErrorVars + .erase(remove_if(_stayMinusErrorVars.begin(),_stayMinusErrorVars.end(), + VarInVarSet(eVars)), + _stayMinusErrorVars.end()); + } + } + else if (pcn->IsEditConstraint()) + { + const ClEditConstraint *pcnEdit = dynamic_cast(pcn); + const ClVariable clv = pcnEdit->variable(); + ClEditInfo *pcei = PEditInfoFromClv(clv); + assert(pcei); + ClVariable clvEditMinus = pcei->_clvEditMinus; + RemoveColumn(clvEditMinus); // clvEditPlus is a marker var and gets removed later + delete pcei; + _editInfoList.remove(pcei); + } + + if (fFoundErrorVar) + { + // This code is not needed since the variables are deleted + // when they are removed from the row -- + // leaving it in results in double deletions + // delete the constraint's error variables + // ClVarSet &evars_set = (*it_eVars).second; + // ClVarSet::const_iterator it_set = evars_set.begin(); + // for ( ; it_set != evars_set.end(); ++it_set) + // { + // delete *it_set; + // } + _errorVars.erase((*it_eVars).first); + } + + if (_fAutosolve) + { + Optimize(_objective); + SetExternalVariables(); + } + + return *this; +} + + +// Re-initialize this solver from the original constraints, thus +// getting rid of any accumulated numerical problems. (Actually, +// Alan hasn't observed any such problems yet, but here's the method +// anyway.) +void +ClSimplexSolver::Reset() +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "()" << endl; +#endif + // FIXGJB -- can postpone writing this for a while + // gotta be careful, though, as it's a likely place for + // a memory leak to sneak in + assert(false); +} + + +// Re-solve the cuurent collection of constraints, given the new +// values for the edit variables that have already been +// suggested (see SuggestValue() method) +void +ClSimplexSolver::Resolve() +{ // CODE DUPLICATED ABOVE +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); +#endif + DualOptimize(); + SetExternalVariables(); + _infeasibleRows.clear(); + if (_fResetStayConstantsAutomatically) + ResetStayConstants(); +} + +ClSimplexSolver & +ClSimplexSolver::SuggestValue(ClVariable v, Number x) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); +#endif + ClEditInfo *pcei = PEditInfoFromClv(v); + if (NULL == pcei) + { +#ifndef CL_NO_IO + std::stringstream ss; + ss << "SuggestValue for variable " << v << ", but var is not an edit variable" << ends; + throw ExCLEditMisuse(ss.str().c_str()); +#else + throw ExCLEditMisuse(v.Name().c_str()); +#endif + } + ClVariable clvEditPlus = pcei->_clvEditPlus; + ClVariable clvEditMinus = pcei->_clvEditMinus; + Number delta = x - pcei->_prevEditConstant; + pcei->_prevEditConstant = x; + DeltaEditConstant(delta,clvEditPlus,clvEditMinus); + return *this; +} + +// Re-solve the cuurent collection of constraints, given the new +// values for the edit variables that have already been +// suggested (see SuggestValue() method) +// This is not guaranteed to work if you remove an edit constraint +// from the middle of the edit constraints you added +// (e.g., edit A, edit B, edit C, remove B -> this will fail!) +// DEPRECATED +void +ClSimplexSolver::Resolve(const vector &newEditConstants) +{ + ClEditInfoList::iterator it = _editInfoList.begin(); + unsigned int i = 0; + for (; i < newEditConstants.size() && it != _editInfoList.end(); ++it, ++i) + { + ClEditInfo *pcei = (*it); + SuggestValue(pcei->_clv,newEditConstants[i]); + } + Resolve(); +} + + +//// protected + +// Add the constraint expr=0 to the inequality tableau using an +// artificial variable. To do this, create an artificial variable +// av and Add av=expr to the inequality tableau, then make av be 0. +// (Raise an exception if we can't attain av=0 -- and prepare explanation) +bool +ClSimplexSolver::AddWithArtificialVariable(ClLinearExpression &expr, + ExCLRequiredFailureWithExplanation &e) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << expr << ")" << endl; +#endif + + // Allocate the objects on the heap because the objects + // will remain in the tableau if we throw an exception, + // and that will result in the destructor cleaning up + // after us + ClSlackVariable *pav = new ClSlackVariable(++_artificialCounter,"a"); + ClObjectiveVariable *paz = new ClObjectiveVariable("az"); + ClLinearExpression *pazRow = new ClLinearExpression(expr); + // the artificial objective is av, which we know is equal to expr + // (which contains only parametric variables) + +#ifdef CL_FIND_LEAK + cerr << "aC = " << _artificialCounter + << "\nDeletes = " << _cArtificialVarsDeleted << endl; +#endif +#ifdef CL_TRACE + cerr << __FUNCTION__ << " before addRow-s:\n" + << (*this) << endl; +#endif + + // the artificial objective is av, which we know is equal to expr + // (which contains only parametric variables) + + // objective is treated as a row in the tableau, + // so do the substitution for its value (we are minimizing + // the artificial variable) + // this row will be removed from the tableau after optimizing + addRow(*paz,*pazRow); + + // now Add the normal row to the tableau -- when artifical + // variable is minimized to 0 (if possible) + // this row remains in the tableau to maintain the constraint + // we are trying to Add + addRow(*pav,expr); + +#ifdef CL_TRACE + cerr << __FUNCTION__ << " after addRow-s:\n" + << (*this) << endl; +#endif + + // try to Optimize az to 0 + // note we are *not* optimizing the real objective, but optimizing + // the artificial objective to see if the error in the constraint + // we are adding can be set to 0 + Optimize(*paz); + + // Careful, we want to get the Expression that is in + // the tableau, not the one we initialized it with! + ClLinearExpression *pazTableauRow = RowExpression(*paz); +#ifdef CL_TRACE + cerr << "pazTableauRow->Constant() == " << pazTableauRow->Constant() << endl; +#endif + + // Check that we were able to make the objective value 0 + // If not, the original constraint was not satisfiable + if (!ClApprox(pazTableauRow->Constant(),0.0)) + { + BuildExplanation(e, paz, pazTableauRow); + // remove the artificial objective row that we just + // added temporarily + delete RemoveRow(*paz); + // and delete the artificial objective variable that we also added above + delete paz; + return false; + } + + // see if av is a basic variable + const ClLinearExpression *pe = RowExpression(*pav); + if (pe != NULL) + { + // FIXGJB: do we ever even get here? + // Find another variable in this row and Pivot, so that av becomes parametric + // If there isn't another variable in the row then + // the tableau contains the equation av = 0 -- just delete av's row + if (pe->IsConstant()) + { + // FIXGJB: do we ever get here? + assert(ClApprox(pe->Constant(),0.0)); + delete RemoveRow(*pav); + // remove the temporary objective function + // FIXGJB may need this too: delete RemoveRow(*paz); + delete pav; +#ifdef CL_FIND_LEAK + ++_cArtificialVarsDeleted; +#endif + return true; + } + ClVariable entryVar = pe->AnyPivotableVariable(); + if (entryVar.IsNil()) + { + BuildExplanation(e, *pav, pe); + return false; /* required failure */ + } + Pivot(entryVar, *pav); + } + // now av should be parametric + assert(RowExpression(*pav) == NULL); + RemoveColumn(*pav); + delete pav; +#ifdef CL_FIND_LEAK + ++_cArtificialVarsDeleted; +#endif + // remove the temporary objective function + delete RemoveRow(*paz); + delete paz; + return true; +} + + +// Using the given equation (av = cle) build an explanation which +// implicates all constraints used to construct the equation. That +// is, everything for which the variables in the equation are markers. +void ClSimplexSolver::BuildExplanation(ExCLRequiredFailureWithExplanation &e, + ClVariable av, + const ClLinearExpression *pcle) +{ + ClVarToConstraintMap::iterator it_cn; + it_cn = _constraintsMarked.find(av); + if (it_cn != _constraintsMarked.end()) + { + e.AddConstraint((*it_cn).second); + } + + assert(pcle != NULL); + + const ClVarToNumberMap & terms = pcle->Terms(); + ClVarToNumberMap::const_iterator it_term; + for (it_term = terms.begin(); it_term != terms.end(); it_term++) + { + it_cn = _constraintsMarked.find((*it_term).first); + if (it_cn != _constraintsMarked.end()) + { + e.AddConstraint((*it_cn).second); + } + } +} + + + +// We are trying to Add the constraint expr=0 to the appropriate +// tableau. Try to Add expr directly to the tableaus without +// creating an artificial variable. Return true if successful and +// false if not. +bool +ClSimplexSolver::TryAddingDirectly(ClLinearExpression &expr) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << expr << ")" << endl; +#endif + ClVariable subject = ChooseSubject(expr); + if (subject.get_pclv() == NULL ) + { +#ifdef CL_TRACE + cerr << "- returning false" << endl; +#endif + return false; + } + expr.NewSubject(subject); + if (ColumnsHasKey(subject)) + { + SubstituteOut(subject,expr); + } + addRow(subject,expr); +#ifdef CL_TRACE + cerr << "- returning true" << endl; +#endif + return true; // successfully added directly +} + + +// We are trying to Add the constraint expr=0 to the tableaux. Try +// to choose a subject (a variable to become basic) from among the +// current variables in expr. If expr contains any unrestricted +// variables, then we must choose an unrestricted variable as the +// subject. Also, if the subject is new to the solver we won't have +// to do any substitutions, so we prefer new variables to ones that +// are currently noted as parametric. If expr contains only +// restricted variables, if there is a restricted variable with a +// negative coefficient that is new to the solver we can make that +// the subject. Otherwise we can't find a subject, so return nil. +// (In this last case we have to Add an artificial variable and use +// that variable as the subject -- this is done outside this method +// though.) +// +// Note: in checking for variables that are new to the solver, we +// ignore whether a variable occurs in the objective function, since +// new slack variables are added to the objective function by +// 'NewExpression:', which is called before this method. +ClVariable +ClSimplexSolver::ChooseSubject(ClLinearExpression &expr) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << expr << ")" << endl; +#endif + ClVariable subject(clvNil); // the current best subject, if any + + // true iff we have found a subject that is an unrestricted variable + bool foundUnrestricted = false; + + // true iff we have found a restricted variable that is new to the + // solver (except for being in the obj. function) and that has a + // negative coefficient + bool foundNewRestricted = false; + + const ClVarToNumberMap &terms = expr.Terms(); + ClVarToNumberMap::const_iterator it = terms.begin(); + for ( ; it != terms.end(); ++it ) + { + ClVariable v = (*it).first; + Number c = (*it).second; + + if (foundUnrestricted) + { + // We have already found an unrestricted variable. The only + // time we will want to use v instead of the current choice + // 'subject' is if v is unrestricted and new to the solver and + // 'subject' isn't new. If this is the case just pick v + // immediately and return. + if (!v.IsRestricted()) + { + if (!ColumnsHasKey(v)) + return v; + } + } + else + { // we haven't found an restricted variable yet + if (v.IsRestricted()) + { + // v is restricted. If we have already found a suitable + // restricted variable just stick with that. Otherwise, if v + // is new to the solver and has a negative coefficient pick + // it. Regarding being new to the solver -- if the variable + // occurs only in the objective function we regard it as being + // new to the solver, since error variables are added to the + // objective function when we make the Expression. We also + // never pick a dummy variable here. + if (!foundNewRestricted && !v.IsDummy() && c < 0.0) + { + const ClTableauColumnsMap &col = Columns(); + ClTableauColumnsMap::const_iterator it_col = col.find(v); + if (it_col == col.end() || + ( col.size() == 1 && ColumnsHasKey(_objective) ) ) + { + subject = v; + foundNewRestricted = true; + } + } + } + else + { + // v is unrestricted. + // If v is also new to the solver just pick it now + subject = v; + foundUnrestricted = true; + } + } + } + if (!subject.IsNil()) + return subject; + + // subject is nil. + // Make one last check -- if all of the variables in expr are dummy + // variables, then we can pick a dummy variable as the subject + Number coeff = 0; + it = terms.begin(); + for ( ; it != terms.end(); ++it ) + { + ClVariable v = (*it).first; + Number c = (*it).second; + if (!v.IsDummy()) + return clvNil; // nope, no luck + // if v is new to the solver, tentatively make it the subject + if (!ColumnsHasKey(v)) + { + subject = v; + coeff = c; + } + } + + // If we get this far, all of the variables in the Expression should + // be dummy variables. If the Constant is nonzero we are trying to + // Add an unsatisfiable required constraint. (Remember that dummy + // variables must take on a value of 0.) Otherwise, if the Constant + // is Zero, multiply by -1 if necessary to make the coefficient for + // the subject negative." + if (!ClApprox(expr.Constant(),0.0)) + { +#ifdef CL_DEBUG_FAILURES + cerr << "required failure in choose subject:\n" + << *this << endl; +#endif + if (FIsExplaining()) + { + ExCLRequiredFailureWithExplanation e; + BuildExplanation(e, clvNil, &expr); + throw e; + } + else + throw ExCLRequiredFailure(); + } + if (coeff > 0.0) + { + expr.MultiplyMe(-1); + } + return subject; +} + +// Each of the non-required edits will be represented by an equation +// of the form +// v = c + eplus - eminus +// where v is the variable with the edit, c is the previous edit +// value, and eplus and eminus are slack variables that hold the +// error in satisfying the edit constraint. We are about to change +// something, and we want to fix the constants in the equations +// representing the edit constraints. If one of eplus and eminus is +// basic, the other must occur only in the Expression for that basic +// error variable. (They can't both be basic.) Fix the Constant in +// this Expression. Otherwise they are both nonbasic. Find all of +// the expressions in which they occur, and fix the constants in +// those. See the UIST paper for details. +// (This comment was for resetEditConstants(), but that is now +// gone since it was part of the screwey vector-based interface +// to resolveing. --02/15/99 gjb) +void +ClSimplexSolver::DeltaEditConstant(Number delta, + ClVariable plusErrorVar, + ClVariable minusErrorVar) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << delta << ", " << plusErrorVar << ", " << minusErrorVar << ")" << endl; +#endif + // first check if the plusErrorVar is basic + ClLinearExpression *pexprPlus = RowExpression(plusErrorVar); + if (pexprPlus != NULL ) + { + pexprPlus->IncrementConstant(delta); + // error variables are always restricted + // so the row is infeasible if the Constant is negative + if (pexprPlus->Constant() < 0.0) + { + _infeasibleRows.insert(plusErrorVar); + } + return; + } + // check if minusErrorVar is basic + ClLinearExpression *pexprMinus = RowExpression(minusErrorVar); + if (pexprMinus != NULL) + { + pexprMinus->IncrementConstant(-delta); + if (pexprMinus->Constant() < 0.0) + { + _infeasibleRows.insert(minusErrorVar); + } + return; + } + // Neither is basic. So they must both be nonbasic, and will both + // occur in exactly the same expressions. Find all the expressions + // in which they occur by finding the column for the minusErrorVar + // (it doesn't matter whether we look for that one or for + // plusErrorVar). Fix the constants in these expressions. + ClVarSet &columnVars = _columns[minusErrorVar]; + ClVarSet::iterator it = columnVars.begin(); + for (; it != columnVars.end(); ++it) + { + ClVariable basicVar = *it; + ClLinearExpression *pexpr = RowExpression(basicVar); + assert(pexpr != NULL ); + double c = pexpr->CoefficientFor(minusErrorVar); + pexpr->IncrementConstant(c*delta); + if (basicVar.IsRestricted() && pexpr->Constant() < 0.0) + { + _infeasibleRows.insert(basicVar); + } + } +} + +// We have set new values for the constants in the edit constraints. +// Re-Optimize using the dual simplex algorithm. +void +ClSimplexSolver::DualOptimize() +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "()" << endl; +#endif + const ClLinearExpression *pzRow = RowExpression(_objective); + // need to handle infeasible rows + while (!_infeasibleRows.empty()) + { + ClVarSet::iterator it_exitVar = _infeasibleRows.begin(); + ClVariable exitVar = *it_exitVar; + _infeasibleRows.erase(it_exitVar); + ClVariable entryVar; + // exitVar might have become basic after some other pivoting + // so allow for the case of its not being there any longer + ClLinearExpression *pexpr = RowExpression(exitVar); + if (pexpr != NULL ) + { + // make sure the row is still not feasible + if (pexpr->Constant() < 0.0) + { + double ratio = DBL_MAX; + double r; + ClVarToNumberMap &terms = pexpr->Terms(); + ClVarToNumberMap::iterator it = terms.begin(); + for ( ; it != terms.end(); ++it ) + { + ClVariable v = (*it).first; + Number c = (*it).second; + if (c > 0.0 && v.IsPivotable()) + { + Number zc = pzRow->CoefficientFor(v); + r = zc/c; // FIXGJB r:= zc/c or Zero, as ClSymbolicWeight-s + if (r < ratio) + { + entryVar = v; + ratio = r; + } + } + } + if (ratio == DBL_MAX) + { + stringstream ss; + ss << "ratio == nil (DBL_MAX)" << ends; + throw ExCLInternalError(ss.str().c_str()); + } + Pivot(entryVar,exitVar); + } + } + } +} + +// Make a new linear Expression representing the constraint cn, +// replacing any basic variables with their defining expressions. +// Normalize if necessary so that the Constant is non-negative. If +// the constraint is non-required give its error variables an +// appropriate weight in the objective function. +ClLinearExpression * +ClSimplexSolver::NewExpression(const ClConstraint *pcn, + /* output to */ + ClVariable &clvEplus, + ClVariable &clvEminus, + Number &prevEConstant) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << *pcn << ")" << endl; + cerr << "cn.IsInequality() == " << pcn->IsInequality() << endl; + cerr << "cn.IsRequired() == " << pcn->IsRequired() << endl; +#endif + const ClLinearExpression &cnExpr = pcn->Expression(); + cl_auto_ptr pexpr ( new ClLinearExpression(cnExpr.Constant()) ); + cl_auto_ptr pslackVar; + cl_auto_ptr pdummyVar; + cl_auto_ptr peminus(0); + cl_auto_ptr peplus(0); + const ClVarToNumberMap &cnTerms = cnExpr.Terms(); + ClVarToNumberMap::const_iterator it = cnTerms.begin(); + for ( ; it != cnTerms.end(); ++it) + { + ClVariable v = (*it).first; + Number c = (*it).second; + const ClLinearExpression *pe = RowExpression(v); + if (pe == NULL) + { + pexpr->AddVariable(v,c); + } + else + { + pexpr->AddExpression(*pe,c); + } + } + + // Add slack and error variables as needed + if (pcn->IsInequality()) + { + // cn is an inequality, so Add a slack variable. The original + // constraint is expr>=0, so that the resulting equality is + // expr-slackVar=0. If cn is also non-required Add a negative + // error variable, giving + // expr-slackVar = -errorVar, in other words + // expr-slackVar+errorVar=0. + // Since both of these variables are newly created we can just Add + // them to the Expression (they can't be basic). + ++_slackCounter; + ReinitializeAutoPtr(pslackVar,new ClSlackVariable (_slackCounter, "s")); + pexpr->setVariable(*pslackVar,-1); + // index the constraint under its slack variable and vice-versa + _markerVars[pcn] = pslackVar.get(); + _constraintsMarked[pslackVar.get()] = pcn; + + if (!pcn->IsRequired()) + { + ++_slackCounter; + ReinitializeAutoPtr(peminus,new ClSlackVariable (_slackCounter, "em")); + pexpr->setVariable(*peminus,1.0); + // Add emnius to the objective function with the appropriate weight + ClLinearExpression *pzRow = RowExpression(_objective); + // FIXGJB: pzRow->AddVariable(eminus,pcn->strength().symbolicWeight() * pcn->weight()); + ClSymbolicWeight sw = pcn->strength().symbolicWeight().Times(pcn->weight()); + pzRow->setVariable(*peminus,sw.AsDouble()); + _errorVars[pcn].insert(peminus.get()); + NoteAddedVariable(*peminus,_objective); + } + } + else + { // cn is an equality + if (pcn->IsRequired()) + { + // Add a dummy variable to the Expression to serve as a marker + // for this constraint. The dummy variable is never allowed to + // enter the basis when pivoting. + ++_dummyCounter; + ReinitializeAutoPtr(pdummyVar,new ClDummyVariable (_dummyCounter, "d")); + pexpr->setVariable(*pdummyVar,1.0); + _markerVars[pcn] = pdummyVar.get(); + _constraintsMarked[pdummyVar.get()] = pcn; +#ifdef CL_TRACE + cerr << "Adding dummyVar == d" << _dummyCounter << endl; +#endif + } + else + { + // cn is a non-required equality. Add a positive and a negative + // error variable, making the resulting constraint + // expr = eplus - eminus, + // in other words: expr-eplus+eminus=0 + ++_slackCounter; + ReinitializeAutoPtr(peplus,new ClSlackVariable (_slackCounter, "ep")); + ReinitializeAutoPtr(peminus,new ClSlackVariable (_slackCounter, "em")); + + pexpr->setVariable(*peplus,-1.0); + pexpr->setVariable(*peminus,1.0); + // index the constraint under one of the error variables + _markerVars[pcn] = peplus.get(); + _constraintsMarked[peplus.get()] = pcn; + + ClLinearExpression *pzRow = RowExpression(_objective); + // FIXGJB: pzRow->AddVariable(eplus,pcn->strength().symbolicWeight() * pcn->weight()); + ClSymbolicWeight sw = pcn->strength().symbolicWeight().Times(pcn->weight()); + double swCoeff = sw.AsDouble(); +#ifdef CL_TRACE + if (swCoeff == 0) + { + cerr << "sw == " << sw << endl + << "cn == " << *pcn << endl; + cerr << "adding " << *peplus << " and " << *peminus + << " with swCoeff == " << swCoeff << endl; + } +#endif + pzRow->setVariable(*peplus,swCoeff); + NoteAddedVariable(*peplus,_objective); + // FIXGJB: pzRow->AddVariable(eminus,pcn->strength().symbolicWeight() * pcn->weight()); + pzRow->setVariable(*peminus,swCoeff); + NoteAddedVariable(*peminus,_objective); + _errorVars[pcn].insert(peminus.get()); + _errorVars[pcn].insert(peplus.get()); + if (pcn->isStayConstraint()) + { + _stayPlusErrorVars.push_back(peplus.get()); + _stayMinusErrorVars.push_back(peminus.get()); + } + else if (pcn->IsEditConstraint()) + { + clvEplus = peplus.get(); + clvEminus = peminus.get(); + prevEConstant = cnExpr.Constant(); + } + } + } + + // the Constant in the Expression should be non-negative. + // If necessary normalize the Expression by multiplying by -1 + if (pexpr->Constant() < 0) + { +#ifdef CL_TRACE + cerr << "NewExpression's Constant is " << pexpr->Constant() << ", < 0, so flipping" << endl; +#endif + pexpr->MultiplyMe(-1); + } +#ifdef CL_TRACE + cerr << "- returning " << *pexpr << endl; +#endif + // Terrible Name -- release() does *not* delete the object, + // only makes sure that the destructor won't delete the object + // (it releases the cl_auto_ptr from the responsibility of deleting the object) + pslackVar.release(); + pdummyVar.release(); + peminus.release(); + peplus.release(); + return pexpr.release(); +} + +// Minimize the value of the objective. (The tableau should already +// be feasible.) +void +ClSimplexSolver::Optimize(ClVariable zVar) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << zVar << ")\n" + << *this << endl; +#endif + ClLinearExpression *pzRow = RowExpression(zVar); + assert(pzRow != NULL); + ClVariable entryVar = clvNil; + ClVariable exitVar = clvNil; + while (true) + { + Number objectiveCoeff = 0; + // Find the most negative coefficient in the objective function + // (ignoring the non-pivotable dummy variables). If all + // coefficients are positive we're done + ClVarToNumberMap &terms = pzRow->Terms(); + ClVarToNumberMap::iterator it = terms.begin(); + for (; it != terms.end(); ++it) + { + ClVariable v = (*it).first; + Number c = (*it).second; + if (v.IsPivotable() && c < objectiveCoeff) + { + objectiveCoeff = c; + entryVar = v; + // A. Beurive' Tue Jul 13 23:03:05 CEST 1999 Why the most + // negative? I encountered unending cycles of pivots! + break; + } + } + // if all coefficients were positive (or if the objective + // function has no pivotable variables) + // we are at an optimum + if (objectiveCoeff >= -_epsilon) + return; +#ifdef CL_TRACE + cerr << "entryVar == " << entryVar << ", " + << "objectiveCoeff == " << objectiveCoeff + << endl; +#endif + + // choose which variable to move out of the basis + // Only consider pivotable basic variables + // (i.e. restricted, non-dummy variables) + double minRatio = DBL_MAX; + ClVarSet &columnVars = _columns[entryVar]; + ClVarSet::iterator it_rowvars = columnVars.begin(); + Number r = 0.0; + for (; it_rowvars != columnVars.end(); ++it_rowvars) + { + ClVariable v = *it_rowvars; +#ifdef CL_TRACE + cerr << "Checking " << v << endl; +#endif + if (v.IsPivotable()) + { + const ClLinearExpression *pexpr = RowExpression(v); + Number coeff = pexpr->CoefficientFor(entryVar); + // only consider negative coefficients + if (coeff < 0.0) + { + r = - pexpr->Constant() / coeff; + if (r < minRatio) + { +#ifdef CL_TRACE + cerr << "New minRatio == " << r << endl; +#endif + minRatio = r; + exitVar = v; + } + } + } + } + // If minRatio is still nil at this point, it means that the + // objective function is unbounded, i.e. it can become + // arbitrarily negative. This should never happen in this + // application. + if (minRatio == DBL_MAX) + { + stringstream ss; + ss << "objective function is unbounded!" << ends; + throw ExCLInternalError(ss.str().c_str()); + } + Pivot(entryVar, exitVar); +#ifdef CL_TRACE + cerr << "After Optimize:\n" + << *this << endl; +#endif + } +} + +// Do a Pivot. Move entryVar into the basis (i.e. make it a basic variable), +// and move exitVar out of the basis (i.e., make it a parametric variable) +void +ClSimplexSolver::Pivot(ClVariable entryVar, ClVariable exitVar) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << entryVar << ", " << exitVar << ")" << endl; +#endif + + // the entryVar might be non-pivotable if we're doing a RemoveConstraint -- + // otherwise it should be a pivotable variable -- enforced at call sites, + // hopefully + + // expr is the Expression for the exit variable (about to leave the basis) -- + // so that the old tableau includes the equation: + // exitVar = expr + ClLinearExpression *pexpr = RemoveRow(exitVar); + + // Compute an Expression for the entry variable. Since expr has + // been deleted from the tableau we can destructively modify it to + // build this Expression. + pexpr->ChangeSubject(exitVar,entryVar); + SubstituteOut(entryVar,*pexpr); + + if (entryVar.IsExternal()) + { + // entry var is no longer a parametric variable since we're moving + // it into the basis + _externalParametricVars.erase(entryVar); + } + addRow(entryVar,*pexpr); +} + + + +// Each of the non-required stays will be represented by an equation +// of the form +// v = c + eplus - eminus +// where v is the variable with the stay, c is the previous value of +// v, and eplus and eminus are slack variables that hold the error +// in satisfying the stay constraint. We are about to change +// something, and we want to fix the constants in the equations +// representing the stays. If both eplus and eminus are nonbasic +// they have value 0 in the current solution, meaning the previous +// stay was exactly satisfied. In this case nothing needs to be +// changed. Otherwise one of them is basic, and the other must +// occur only in the Expression for that basic error variable. +// Reset the Constant in this Expression to 0. +void +ClSimplexSolver::ResetStayConstants() +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "()" << endl; +#endif + ClVarVector::const_iterator + itStayPlusErrorVars = _stayPlusErrorVars.begin(); + ClVarVector::const_iterator + itStayMinusErrorVars = _stayMinusErrorVars.begin(); + + for ( ; itStayPlusErrorVars != _stayPlusErrorVars.end(); + ++itStayPlusErrorVars, ++itStayMinusErrorVars ) + { + ClLinearExpression *pexpr = RowExpression(*itStayPlusErrorVars); + if (pexpr == NULL ) + { + pexpr = RowExpression(*itStayMinusErrorVars); + } + if (pexpr != NULL) + { + pexpr->Set_constant(0.0); + } + } +} + +// Set the external variables known to this solver to their appropriate values. +// Set each external basic variable to its value, and set each +// external parametric variable to 0. (It isn't clear that we will +// ever have external parametric variables -- every external +// variable should either have a stay on it, or have an equation +// that defines it in terms of other external variables that do have +// stays. For the moment I'll put this in though.) Variables that +// are internal to the solver don't actually store values -- their +// values are just implicit in the tableu -- so we don't need to set +// them." +void +ClSimplexSolver::SetExternalVariables() +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "()\n" + << *this << endl; +#endif + + // FIXGJB -- oughta check some invariants here + + // Set external parametric variables first + // in case I've screwed up + ClVarSet::iterator itParVars = _externalParametricVars.begin(); + for ( ; itParVars != _externalParametricVars.end(); ++itParVars ) + { + ClVariable v = *itParVars; +#ifndef NDEBUG + // defensively skip it if it is basic -- ChangeValue is virtual + // so don't want to call it twice; this should never + // happen + if (FIsBasicVar(v)) + { +#ifndef CL_NO_IO + // WARNING + cerr << __FUNCTION__ << "Error: variable " << v + << " in _externalParametricVars is basic" << endl; + cerr << "Row is: " << *RowExpression(v) << endl; +#endif + continue; + } +#endif + ChangeClv(v,0.0); + } + + // Only iterate over the rows w/ external variables + ClVarSet::iterator itRowVars = _externalRows.begin(); + for ( ; itRowVars != _externalRows.end() ; ++itRowVars ) + { + ClVariable v = *itRowVars; + ClLinearExpression *pexpr = RowExpression(v); + ChangeClv(v,pexpr->Constant()); + } + + _fNeedsSolving = false; + if (_pfnResolveCallback) + _pfnResolveCallback(this); +} + +#ifndef CL_NO_IO +ostream & +PrintTo(ostream &xo, const ClVarVector &varlist) +{ + ClVarVector::const_iterator it = varlist.begin(); + xo << varlist.size() << ":" << "[ "; + if (it != varlist.end()) + { + xo << *it; + ++it; + } + for (; it != varlist.end(); ++it) + { + xo << ", " << *it; + } + xo << " ]"; + return xo; +} + +ostream &operator<<(ostream &xo, const ClVarVector &varlist) +{ return PrintTo(xo,varlist); } + + +ostream & +PrintTo(ostream &xo, const ClConstraintToVarSetMap &mapCnToVarSet) +{ + ClConstraintToVarSetMap::const_iterator it = mapCnToVarSet.begin(); + for ( ; it != mapCnToVarSet.end(); ++it) { + const ClConstraint *pcn = (*it).first; + const ClVarSet &set = (*it).second; + xo << "CN: " << pcn << *pcn << ":: " << set << endl; + } + return xo; +} + +ostream &operator <<(ostream &xo, const ClConstraintToVarSetMap &mapCnToVarSet) +{ return PrintTo(xo,mapCnToVarSet); } + + + +ostream & +ClSimplexSolver::PrintOn(ostream &xo) const +{ + ClTableau::PrintOn(xo); + + xo << "_stayPlusErrorVars: " + << _stayPlusErrorVars << endl; + xo << "_stayMinusErrorVars: " + << _stayMinusErrorVars << endl; + xo << "_editInfoList:\n" + << _editInfoList << endl; + return xo; +} + + +ostream & +ClSimplexSolver::PrintInternalInfo(ostream &xo) const +{ + ClTableau::PrintInternalInfo(xo); + xo << "; edvars: " << _editInfoList.size(); + xo << endl; + printExternalVariablesTo(xo); + return xo; +} + +ostream &operator<<(ostream &xo, const ClSimplexSolver &clss) +{ + return clss.PrintOn(xo); +} + +#endif + +bool +ClSimplexSolver::FIsConstraintSatisfied(const ClConstraint *const pcn) const +{ + ClConstraintToVarMap::const_iterator it_marker = _markerVars.find(pcn); + if (it_marker == _markerVars.end()) + { // could not find the constraint + throw ExCLConstraintNotFound(); + } + +#ifndef CL_NO_IO + bool fCnsays = pcn->FIsSatisfied(); +#endif + + ClConstraintToVarSetMap::const_iterator it_eVars = _errorVars.find(pcn); + + if (it_eVars != _errorVars.end()) + { + const ClVarSet &eVars = (*it_eVars).second; + ClVarSet::const_iterator it = eVars.begin(); + for ( ; it != eVars.end(); ++it ) + { + const ClLinearExpression *pexpr = RowExpression(*it); + if (pexpr != NULL && !ClApprox(pexpr->Constant(),0.0)) + { +#ifndef CL_NO_IO + if (fCnsays) + cerr << __FUNCTION__ << ": constraint says satisfiable, but solver does not" << endl; +#endif + return false; + } + } + } + +#ifndef CL_NO_IO + if (!fCnsays) + cerr << __FUNCTION__ << ": solver says satisfiable, but constraint does not" << endl; +#endif + return true; +} + + + +#ifndef CL_NO_ID + +ostream &PrintTo(ostream &xo, const ClSimplexSolver::ClEditInfoList &listPEditInfo) +{ + ClSimplexSolver::ClEditInfoList::const_iterator it = listPEditInfo.begin(); + for ( ; it != listPEditInfo.end(); ++it) { + const ClSimplexSolver::ClEditInfo *pcei = (*it); + xo << *pcei << endl; + } + return xo; +} + + +ostream &operator<<(ostream &xo, const ClSimplexSolver::ClEditInfoList &listPEditInfo) +{ return PrintTo(xo,listPEditInfo); } + +#endif + +// A. Beurive' Tue Jul 6 17:03:32 CEST 1999 +void +ClSimplexSolver::ChangeStrengthAndWeight(ClConstraint *pcn, const ClStrength &strength, double weight) +{ + ClConstraintToVarSetMap::iterator it_eVars = _errorVars.find(pcn); + // Only for constraints that already have error variables (i.e. non-required constraints) + assert(it_eVars != _errorVars.end()); + + ClLinearExpression *pzRow = RowExpression(_objective); + + Number old_coeff = pcn->weight() * pcn->strength().symbolicWeight().AsDouble(); + pcn->setStrength(strength); + pcn->setWeight(weight); + Number new_coeff = pcn->weight() * pcn->strength().symbolicWeight().AsDouble(); + + if (new_coeff != old_coeff) + { +#ifdef CL_TRACE + cerr << "Changing strength and/or weight for constraint: " << endl << *pcn << endl; + cerr << "Updating objective row from:" << endl << *pzRow << endl; +#endif + ClVarSet &eVars = (*it_eVars).second; + ClVarSet::iterator it = eVars.begin(); + for ( ; it != eVars.end(); ++it ) + { + const ClLinearExpression *pexpr = RowExpression(*it); + if (pexpr == NULL ) + { + pzRow->AddVariable(*it,-old_coeff,_objective,*this); + pzRow->AddVariable(*it,new_coeff,_objective,*this); + } + else + { + pzRow->AddExpression(*pexpr,-old_coeff,_objective,*this); + pzRow->AddExpression(*pexpr,new_coeff,_objective,*this); + } + } +#ifdef CL_TRACE + cerr << "to: " << endl << *pzRow << endl; +#endif + + if (_fAutosolve) + { + Optimize(_objective); + SetExternalVariables(); + } + } +} + +// A. Beurive' Tue Jul 6 17:03:42 CEST 1999 +void +ClSimplexSolver::ChangeStrength(ClConstraint *pcn, const ClStrength &strength) +{ + ChangeStrengthAndWeight(pcn,strength,pcn->weight()); +} + +// A. Beurive' Tue Jul 6 17:03:42 CEST 1999 +void +ClSimplexSolver::ChangeWeight(ClConstraint *pcn, double weight) +{ + ChangeStrengthAndWeight(pcn,pcn->strength(),weight); +} diff --git a/libs/cassowary/ClSlackVariable.cc b/libs/cassowary/ClSlackVariable.cc new file mode 100644 index 0000000000..eaf0432eb0 --- /dev/null +++ b/libs/cassowary/ClSlackVariable.cc @@ -0,0 +1,12 @@ +// $Id$ + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#ifdef CL_FIND_LEAK +long ClSlackVariable::cSlackVariables = 0; +#endif diff --git a/libs/cassowary/ClSolver.cc b/libs/cassowary/ClSolver.cc new file mode 100644 index 0000000000..18b0b7f9cc --- /dev/null +++ b/libs/cassowary/ClSolver.cc @@ -0,0 +1,59 @@ +// $Id$ + +using namespace std; + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +#include +#include +#include +#include +#include + + +ClSolver & +ClSolver::AddConstraint(ClConstraint *const ) +{ + return *this; +} + + +ostream & +PrintTo(ostream &xo, const ClConstraintSet &setCn) +{ + ClConstraintSet::const_iterator it = setCn.begin(); + for (; it != setCn.end(); ++it) { + const ClConstraint *pcn = *it; + xo << *pcn << endl; + } + return xo; +} + +ostream & +PrintTo(ostream &xo, const list &listFDN) +{ + list::const_iterator it = listFDN.begin(); + for (; it != listFDN.end(); ) { + FDNumber n = *it; + xo << n; + ++it; + if (it != listFDN.end()) + xo << ","; + } + return xo; +} + + +ostream &operator<<(ostream &xo, const ClConstraintSet &setCn) +{ return PrintTo(xo,setCn); } + + +ostream &operator<<(ostream &xo, const ClSolver &solver) +{ return solver.PrintOn(xo); } + +ostream &operator<<(ostream &xo, const list &listFDN) +{ return PrintTo(xo,listFDN); } + diff --git a/libs/cassowary/ClStrength.cc b/libs/cassowary/ClStrength.cc new file mode 100644 index 0000000000..0629d4afff --- /dev/null +++ b/libs/cassowary/ClStrength.cc @@ -0,0 +1,52 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClStrength.cc + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +// Use the singleton pattern for the strength objects +const ClStrength &ClsRequired() +{ + // required is distinct by equality to this static object, + // but I still use an especially high symbolic weight, just in case + // FIXGJB: hack? + static ClStrength required_strength("", 1000, 1000, 1000); + return required_strength; +} + +const ClStrength &ClsStrong() +{ + static ClStrength strong_strength("strong", 1.0, 0.0, 0.0); + return strong_strength; +} + +const ClStrength &ClsMedium() +{ + static ClStrength medium_strength("medium", 0.0, 1.0, 0.0); + return medium_strength; +} + + +const ClStrength &ClsWeak() +{ + static ClStrength weak_strength("weak", 0.0, 0.0, 1.0); + return weak_strength; +} + +// special case for when nLevels = 3, should assert nLevels() == 3 +ClStrength::ClStrength(const string &Name, double w1, double w2, double w3) : + _name(Name), _symbolicWeight(w1, w2, w3) +{ +} diff --git a/libs/cassowary/ClSymbolicWeight.cc b/libs/cassowary/ClSymbolicWeight.cc new file mode 100644 index 0000000000..9dddaa5949 --- /dev/null +++ b/libs/cassowary/ClSymbolicWeight.cc @@ -0,0 +1,149 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSymbolicWeight.cc + +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +// Help g++ out, tell it to instantiate this +//template vector &vector::operator =(const vector &); + +ClSymbolicWeight::ClSymbolicWeight(unsigned int CLevels, double value) : + _values(CLevels, value) +{ + assert(_values.size() == CLevels); +} + +ClSymbolicWeight::ClSymbolicWeight(double w1, double w2, double w3) +{ + _values.push_back(w1); + _values.push_back(w2); + _values.push_back(w3); + assert(_values.size() == 3); +} + +ClSymbolicWeight::ClSymbolicWeight(const vector &weights) : + _values(weights) +{ } + +ClSymbolicWeight & +ClSymbolicWeight::Zero() +{ + static ClSymbolicWeight Zero(0.0, 0.0, 0.0); + return Zero; +} + + +ClSymbolicWeight & +ClSymbolicWeight::negated() +{ + vector::iterator it = _values.begin(); + for (; it != _values.end(); ++it) + { + *it = -*it; + } + return *this; +} + +ClSymbolicWeight & +ClSymbolicWeight::MultiplyMe(Number n) +{ + vector::iterator it = _values.begin(); + for (; it != _values.end(); ++it) + { + *it *= n; + } + return *this; +} + + +ClSymbolicWeight +ClSymbolicWeight::DivideBy(Number n) const +{ + assert(n!=0); + ClSymbolicWeight clsw(0); + vector::const_iterator i = _values.begin(); + for (; i != _values.end(); ++i) + { + clsw.push_back(*i / n); + } + return clsw; +} + +ClSymbolicWeight & +ClSymbolicWeight::addtoMe(const ClSymbolicWeight &cl) +{ + assert(cl.CLevels() == CLevels()); + + vector::iterator i1 = _values.begin(); + vector::const_iterator i2 = cl._values.begin(); + for (; i1 != _values.end(); ++i1, ++i2) + { + *i1 += *i2; + } + return *this; +} + +ClSymbolicWeight +ClSymbolicWeight::Subtract(const ClSymbolicWeight &cl) const +{ + assert(cl.CLevels() == CLevels()); + + ClSymbolicWeight clsw(0); + vector::const_iterator i1 = _values.begin(); + vector::const_iterator i2 = cl._values.begin(); + for (; i1 != _values.end(); ++i1, ++i2) + { + clsw.push_back(*i1 - *i2); + } + return clsw; +} + + +bool +ClSymbolicWeight::lessThan(const ClSymbolicWeight &cl) const +{ + return _values < cl._values; +} + +bool +ClSymbolicWeight::lessThanOrEqual(const ClSymbolicWeight &cl) const +{ + return _values <= cl._values; +} + +bool +ClSymbolicWeight::equal(const ClSymbolicWeight &cl) const +{ + return _values == cl._values; +} + +bool +ClSymbolicWeight::greaterThan(const ClSymbolicWeight &cl) const +{ + return _values > cl._values; +} + +bool +ClSymbolicWeight::greaterThanOrEqual(const ClSymbolicWeight &cl) const +{ + return _values >= cl._values; +} + +bool +ClSymbolicWeight::isNegative() const +{ + return _values < Zero()._values; +} diff --git a/libs/cassowary/ClTableau.cc b/libs/cassowary/ClTableau.cc new file mode 100644 index 0000000000..85ac841725 --- /dev/null +++ b/libs/cassowary/ClTableau.cc @@ -0,0 +1,297 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClTableau.cc + +using namespace std; + +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + + +// delete the linear expressions +// let ClSimplexSolver worry about deleting the variables +ClTableau::~ClTableau() +{ + ClTableauRowsMap::iterator it = _rows.begin(); + for (; it != _rows.end(); ++it) + { + // free the ClLinearExpression that we new-ed +#ifdef CL_TRACE + cerr << "Deleting row delete@ " << ((*it).second) << endl; +#endif + delete (*it).second; + } +} + +#ifndef CL_NO_IO +// Some extra debugging info +ostream & +ClTableau::PrintInternalInfo(ostream &xo) const +{ + xo << "ncns:" << _rows.size() -1 + << "; cols:" << _columns.size() + << "; infrows:" << _infeasibleRows.size() + << "; ebvars:" << _externalRows.size() + << "; epvars:" << _externalParametricVars.size(); + return xo; +} + + +ostream & +ClTableau::printExternalVariablesTo(ostream &xo) const +{ + xo << "Parametric: "; + ClVarSet::iterator itParVars = _externalParametricVars.begin(); + for ( ; itParVars != _externalParametricVars.end(); ++itParVars ) { + ClVariable v = *itParVars; + xo << v << " "; + } + xo << "\nBasic: "; + ClVarSet::iterator itRowVars = _externalRows.begin(); + for ( ; itRowVars != _externalRows.end() ; ++itRowVars ) { + ClVariable v = *itRowVars; + xo << v << " "; + } + return xo << endl; +} + +#endif + + +// Add v, update column cross indices +// v becomes a basic variable +// expr is now owned by ClTableau class, +// and ClTableauis responsible for deleting it +// (also, expr better be allocated on the heap!) +void +ClTableau::addRow(ClVariable var, const ClLinearExpression &expr) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << var << ", " << expr << ")" << endl; +#endif + _rows[var] = const_cast(&expr); + ClVarToNumberMap::const_iterator it = expr.Terms().begin(); + // for each variable in expr, Add var to the set of rows which have that variable + // in their Expression + for (; it != expr.Terms().end(); ++it) + { + ClVariable v = (*it).first; + _columns[v].insert(var); + if (v.IsExternal() && !FIsBasicVar(v)) + { + _externalParametricVars.insert(v); + } + } + if (var.IsExternal()) + { + _externalRows.insert(var); + } +#ifdef CL_TRACE + cerr << *this << endl; +#endif +} + +// Remove var from the tableau -- remove the column cross indices for var +// and remove var from every Expression in rows in which v occurs +// Remove the parametric variable var, updating the appropriate column and row entries. +// (Renamed from Smalltalk implementation's `removeParametricVar') +ClVariable +ClTableau::RemoveColumn(ClVariable var) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << var << ")" << endl; +#endif + ClTableauColumnsMap::iterator it_var = _columns.find(var); + if (it_var == _columns.end()) + return var; // nothing to do + + ClVarSet &varset = (*it_var).second; + // remove the rows with the variables in varset + ClVarSet::iterator it = varset.begin(); + for (; it != varset.end(); ++it) + { + ClVariable v = (*it); + ClVarToNumberMap &Terms = _rows[v]->Terms(); + Terms.erase(Terms.find(var)); + } + if (var.IsExternal()) + { + _externalRows.erase(var); + _externalParametricVars.erase(var); + } + _columns.erase(it_var); + return var; +} + +// Remove the basic variable v from the tableau row v=expr +// Then update column cross indices +ClLinearExpression * +ClTableau::RemoveRow(ClVariable var) +{ +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + cerr << "(" << var << ")" << endl; +#endif + ClTableauRowsMap::iterator it = _rows.find(var); + assert(it != _rows.end()); + ClLinearExpression *pexpr = (*it).second; + ClVarToNumberMap &Terms = pexpr->Terms(); + ClVarToNumberMap::iterator it_term = Terms.begin(); + for (; it_term != Terms.end(); ++it_term) + { + ClVariable v = (*it_term).first; + _columns[v].erase(var); + if (_columns[v].size() == 0) + { + _columns.erase(v); + _externalParametricVars.erase(v); + } + } + + _infeasibleRows.erase(var); + + if (var.IsExternal()) + { + _externalRows.erase(var); + _externalParametricVars.erase(var); + } + + _rows.erase(it); +#ifdef CL_TRACE + cerr << "- returning " << *pexpr << endl; +#endif + return pexpr; +} + +// Replace all occurrences of oldVar with expr, and update column cross indices +// oldVar should now be a basic variable +// Uses the Columns data structure and calls SubstituteOut on each +// row that has oldVar in it +// oldVar is leaving the basis, and becoming parametric +void +ClTableau::SubstituteOut(ClVariable oldVar, const ClLinearExpression &expr) +{ +#ifdef CL_TRACE + cerr << "* ClTableau::"; + Tracer TRACER(__FUNCTION__); + cerr << "(" << oldVar << ", " << expr << ")" << endl; + cerr << (*this) << endl; +#endif + + ClTableauColumnsMap::iterator it_oldVar = _columns.find(oldVar); + if (it_oldVar == _columns.end()) + return; + + ClVarSet &varset = (*it_oldVar).second; + ClVarSet::iterator it = varset.begin(); + for (; it != varset.end(); ++it) + { + ClVariable v = (*it); + ClLinearExpression *prow = _rows[v]; + prow->SubstituteOut(oldVar,expr,v,*this); + if (v.IsRestricted() && prow->Constant() < 0.0) + { + _infeasibleRows.insert(v); + } + } + _columns.erase(it_oldVar); + if (oldVar.IsExternal()) + { + if (_columns[oldVar].size() > 0) + { + _externalRows.insert(oldVar); + } + _externalParametricVars.erase(oldVar); + } +} + + +#ifndef CL_NO_IO + +ostream & +PrintTo(ostream &xo, const ClVarSet & varset) +{ + ClVarSet::const_iterator it = varset.begin(); + xo << "{ "; + if (it != varset.end()) + { + xo << *it; + ++it; + } + for (; it != varset.end(); ++it) + { + xo << ", " << *it; + } + xo << " }"; + return xo; +} + +ostream &operator<<(ostream &xo, const ClVarSet & varset) +{ return PrintTo(xo,varset); } + +ostream & +PrintTo(ostream &xo, const ClTableauColumnsMap & varmap) +{ + ClTableauColumnsMap::const_iterator it = varmap.begin(); + for (; it != varmap.end(); ++it) + { + xo << (*it).first << " -> " << (*it).second << endl; + } + return xo; +} + +ostream &operator<<(ostream &xo, const ClTableauColumnsMap & varmap) +{ return PrintTo(xo,varmap); } + +ostream & +PrintTo(ostream &xo, const ClTableauRowsMap & rows) +{ + ClTableauRowsMap::const_iterator it = rows.begin(); + for (; it != rows.end(); ++it) + { + ClVariable v = it->first; + const ClLinearExpression *pe = it->second; + xo << v << " <-=-> "; + if (pe) xo << *pe; else xo << "NilExpr"; + xo << endl; + } + return xo; +} + +ostream &operator<<(ostream &xo, const ClTableauRowsMap & rows) +{ return PrintTo(xo,rows); } + +ostream & +ClTableau::PrintOn(ostream &xo) const +{ + xo << "Tableau:\n" + << _rows << endl; + xo << "Columns:\n" + << _columns << endl; + xo << "Infeasible rows: " + << _infeasibleRows << endl; + xo << "External basic variables: " + << _externalRows << endl; + xo << "External parametric variables: " + << _externalParametricVars << endl; + return xo; +} + +ostream &operator<<(ostream &xo, const ClTableau &clt) +{ return clt.PrintOn(xo); } + +#endif diff --git a/libs/cassowary/ClTests.cc b/libs/cassowary/ClTests.cc new file mode 100644 index 0000000000..606d6f3e44 --- /dev/null +++ b/libs/cassowary/ClTests.cc @@ -0,0 +1,884 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClTests.cc + +#include +#include +#include +#include +#include + +inline +double UniformRandom() +{ return double(rand())/RAND_MAX; } + + +bool +simple1() +{ + try + { + bool fOkResult = true; + ClVariable x(167); + ClVariable y(2); + ClSimplexSolver solver; + + ClLinearEquation eq(x,y+0.0); + solver.AddStay(x); + solver.AddStay(y); + solver.AddConstraint(eq); + cout << "x = " << x.Value() << endl + << "y = " << y.Value() << endl; + fOkResult = (x.Value() == y.Value()); + return fOkResult; + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + + +/* Add an edit variable to an empty solver */ +bool +simple2() +{ + try + { + ClVariable x(167); + ClSimplexSolver solver; + + solver.AddEditVar(x); + solver.BeginEdit(); + solver.SuggestValue(x,100); + solver.EndEdit(); + + cout << "x = " << x.Value() << endl; + } + catch (ExCLEditMisuse &error) + { + cout << "Success: got the exception" << endl; + return true; + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } + cerr << "Should have gotten an exception!" << endl; + return false; +} + + +bool +justStay1() +{ + try + { + bool fOkResult = true; + ClVariable x(5); + ClVariable y(10); + ClSimplexSolver solver; + +#if 0 + solver.AddPointStay(x,y,1); +#else + solver.AddStay(x); + solver.AddStay(y); +#endif + fOkResult = fOkResult && ClApprox(x,5); + fOkResult = fOkResult && ClApprox(y,10); + cout << "x == " << x.Value() << endl; + cout << "y == " << y.Value() << endl; + + return(fOkResult); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + + + +bool +addDelete1() +{ + try + { + bool fOkResult = true; + ClVariable x("x"); + ClSimplexSolver solver; + + solver.AddConstraint(new ClLinearEquation( x, 100, ClsWeak() )); + + ClLinearInequality c10(x,cnLEQ,10.0); + ClLinearInequality c20(x,cnLEQ,20.0); + solver + .AddConstraint(c10) + .AddConstraint(c20); + + fOkResult = fOkResult && ClApprox(x,10.0); + cout << "x == " << x.Value() << endl; + + cout << endl << solver << endl; + + solver.RemoveConstraint(c10); + + cout << endl << solver << endl; + + fOkResult = fOkResult && ClApprox(x,20.0); + cout << "x == " << x.Value() << endl; + + solver.RemoveConstraint(c20); + fOkResult = fOkResult && ClApprox(x,100.0); + cout << "x == " << x.Value() << endl; + + ClLinearInequality c10again(x,cnLEQ,10.0); + + solver + .AddConstraint(c10) + .AddConstraint(c10again); + + fOkResult = fOkResult && ClApprox(x,10.0); + cout << "x == " << x.Value() << endl; + + solver.RemoveConstraint(c10); + fOkResult = fOkResult && ClApprox(x,10.0); + cout << "x == " << x.Value() << endl; + + solver.RemoveConstraint(c10again); + fOkResult = fOkResult && ClApprox(x,100.0); + cout << "x == " << x.Value() << endl; + + return(fOkResult); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + +bool +addDelete2() +{ + try + { + bool fOkResult = true; + ClVariable x("x"); + ClVariable y("y"); + ClSimplexSolver solver; + + solver + .AddConstraint(new ClLinearEquation(x, 100.0, ClsWeak())) + .AddConstraint(new ClLinearEquation(y, 120.0, ClsStrong())); + + ClLinearInequality c10(x,cnLEQ,10.0); + ClLinearInequality c20(x,cnLEQ,20.0); + + solver + .AddConstraint(c10) + .AddConstraint(c20); + fOkResult = fOkResult && ClApprox(x,10.0) && ClApprox(y,120.0); + cout << "x == " << x.Value() << ", y == " << y.Value() << endl; + + solver.RemoveConstraint(c10); + fOkResult = fOkResult && ClApprox(x,20.0) && ClApprox(y,120.0); + cout << "x == " << x.Value() << ", y == " << y.Value() << endl; + + ClLinearEquation cxy( 2*x, y); + solver.AddConstraint(cxy); + fOkResult = fOkResult && ClApprox(x,20.0) && ClApprox(y,40.0); + cout << "x == " << x.Value() << ", y == " << y.Value() << endl; + + solver.RemoveConstraint(c20); + fOkResult = fOkResult && ClApprox(x,60.0) && ClApprox(y,120.0); + cout << "x == " << x.Value() << ", y == " << y.Value() << endl; + + solver.RemoveConstraint(cxy); + fOkResult = fOkResult && ClApprox(x,100.0) && ClApprox(y,120.0); + cout << "x == " << x.Value() << ", y == " << y.Value() << endl; + + + return(fOkResult); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + +bool +casso1() +{ + try + { + bool fOkResult = true; + ClVariable x("x"); + ClVariable y("y"); + ClSimplexSolver solver; + + solver + .AddConstraint(new ClLinearInequality(x,cnLEQ,y)) + .AddConstraint(new ClLinearEquation(y, x+3.0)) + .AddConstraint(new ClLinearEquation(x,10.0,ClsWeak())) + .AddConstraint(new ClLinearEquation(y,10.0,ClsWeak())) + ; + + fOkResult = fOkResult && + ( ClApprox(x,10.0) && ClApprox(y,13.0) || + ClApprox(x,7.0) && ClApprox(y,10.0) ); + + cout << "x == " << x.Value() << ", y == " << y.Value() << endl; + + return(fOkResult); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + +bool +inconsistent1() +{ + ClSimplexSolver solver; + ClVariable x("x"); + ClLinearEquation eq1(x,10.0); + ClLinearEquation eq2(x,5.0); + try + { + + solver.AddConstraint( eq1 ); + solver.AddConstraint( eq2 ); + + // no exception, we failed! + return(false); + } + catch (ExCLRequiredFailure) + { + // we want this exception to get thrown + cout << "Success -- got the exception" << endl; + // solver.RemoveConstraint(eq2); this would throw a constraint not found exception + // cout << solver << endl; + return(true); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + +bool +inconsistent2() +{ + try + { + ClVariable x("x"); + ClSimplexSolver solver; + + solver + .AddConstraint(new ClLinearInequality(x,cnGEQ,10.0)) + .AddConstraint(new ClLinearInequality(x,cnLEQ, 5.0)); + + // no exception, we failed! + return(false); + } + catch (ExCLRequiredFailure &) + { + // we want this exception to get thrown + cout << "Success -- got the exception" << endl; + // cout << solver << endl; + return(true); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + +bool +inconsistent3() +{ + try + { + ClVariable w("w"); + ClVariable x("x"); + ClVariable y("y"); + ClVariable z("z"); + ClSimplexSolver solver; + + solver + .AddConstraint(new ClLinearInequality(w,cnGEQ,10.0)) + .AddConstraint(new ClLinearInequality(x,cnGEQ,w)) + .AddConstraint(new ClLinearInequality(y,cnGEQ,x)) + .AddConstraint(new ClLinearInequality(z,cnGEQ,y)) + .AddConstraint(new ClLinearInequality(z,cnLEQ,4.0)); + + // no exception, we failed! + return(false); + } + catch (ExCLRequiredFailure &) + { + // we want this exception to get thrown + cout << "Success -- got the exception" << endl; + // cout << solver << endl; + return(true); + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + + +bool +multiedit() +{ + try + { + bool fOkResult = true; + + ClVariable x("x",0); + ClVariable y("y",0); + ClVariable w("w",0); + ClVariable h("h",0); + ClSimplexSolver solver; + + solver + .AddStay(x) + .AddStay(y) + .AddStay(w) + .AddStay(h); + + solver + .AddEditVar(x) + .AddEditVar(y) + .BeginEdit(); + + solver + .SuggestValue(x,10) + .SuggestValue(y,20) + .Resolve(); + + cout << "x = " << x.Value() << "; y = " << y.Value() << endl + << "w = " << w.Value() << "; h = " << h.Value() << endl; + + fOkResult = fOkResult && + ClApprox(x,10) && ClApprox(y,20) && ClApprox(w,0) && ClApprox(h,0); + + solver + .AddEditVar(w) + .AddEditVar(h) + .BeginEdit(); + + solver + .SuggestValue(w,30) + .SuggestValue(h,40) + .EndEdit(); + + cout << "x = " << x.Value() << "; y = " << y.Value() << endl + << "w = " << w.Value() << "; h = " << h.Value() << endl; + + fOkResult = fOkResult && + ClApprox(x,10) && ClApprox(y,20) && ClApprox(w,30) && ClApprox(h,40); + + solver + .SuggestValue(x,50) + .SuggestValue(y,60) + .EndEdit(); + + cout << "x = " << x.Value() << "; y = " << y.Value() << endl + << "w = " << w.Value() << "; h = " << h.Value() << endl; + + fOkResult = fOkResult && + ClApprox(x,50) && ClApprox(y,60) && ClApprox(w,30) && ClApprox(h,40); + + return fOkResult; + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } + cerr << "Should have gotten an exception!" << endl; + return false; +} + + +bool +multiedit2() +{ + try + { + bool fOkResult = true; + + ClVariable x("x",0); + ClVariable y("y",0); + ClVariable w("w",0); + ClVariable h("h",0); + ClSimplexSolver solver; + + solver + .AddStay(x) + .AddStay(y) + .AddStay(w) + .AddStay(h); + + solver + .AddEditVar(x) + .AddEditVar(y) + .BeginEdit(); + + solver + .SuggestValue(x,10) + .SuggestValue(y,20) + .Resolve(); + + cout << "x = " << x.Value() << "; y = " << y.Value() << endl + << "w = " << w.Value() << "; h = " << h.Value() << endl; + + fOkResult = fOkResult && + ClApprox(x,10) && ClApprox(y,20) && ClApprox(w,0) && ClApprox(h,0); + + solver + .AddEditVar(x) + .AddEditVar(y) + .AddEditVar(w) + .AddEditVar(h) + .BeginEdit(); + + solver + .SuggestValue(w,30) + .SuggestValue(h,40) + .EndEdit(); + + cout << "x = " << x.Value() << "; y = " << y.Value() << endl + << "w = " << w.Value() << "; h = " << h.Value() << endl; + + fOkResult = fOkResult && + ClApprox(x,10) && ClApprox(y,20) && ClApprox(w,30) && ClApprox(h,40); + + solver + .SuggestValue(x,50) + .SuggestValue(y,60) + .EndEdit(); + + cout << "x = " << x.Value() << "; y = " << y.Value() << endl + << "w = " << w.Value() << "; h = " << h.Value() << endl; + + fOkResult = fOkResult && + ClApprox(x,50) && ClApprox(y,60) && ClApprox(w,30) && ClApprox(h,40); + + return fOkResult; + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(false); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } + cerr << "Should have gotten an exception!" << endl; + return false; +} + + +// From a bug report from Steve Wolfman on his +// SAT project using "blackbox" +bool +blackboxsat() +{ + try + { + ClSimplexSolver solver; + + ClVariable r1("r1"); + ClVariable r2("r2"); + ClVariable r3("r3"); + ClVariable r4("r4"); + ClVariable r5("r5"); + ClVariable r6("r6"); + ClVariable r7("r7"); + ClVariable r8("r8"); + + ClConstraint *rgpcn[30]; + for (int i=0; i> szCmd; + if (!cin) + break; + if (szCmd[0] == '#') + { + cin.getline(szCmd,900); + continue; + } + if (strcasecmp(szCmd,"Add") == 0) + { + cin >> i; + cout << "eq" << i << ": " << solver.AddConstraintNoException(rgpcn[i]) + << "\t" << *(rgpcn[i]) << endl; + cout << r1 << " = " << r1.Value() << endl; + } + else if (strcasecmp(szCmd,"del") == 0) + { + cin >> i; + cout << "REMeq" << i << ": " << solver.RemoveConstraintNoException(rgpcn[i]) + << "\t" << *(rgpcn[i]) << endl; + cout << r1 << " = " << r1.Value() << endl; + } + else if (strcasecmp(szCmd,"dump") == 0) + { + cout << solver << endl; + } + else if (strcasecmp(szCmd,"val") == 0) + { + cout << r1 << " = " << r1.Value() << endl; + } + else if (strcasecmp(szCmd,"solve") == 0) + { + cout << solver.Solve() << endl; + } + else if (strcasecmp(szCmd,"autosolve") == 0) + { + solver.SetAutosolve(true); + } + else if (strcasecmp(szCmd,"noautosolve") == 0) + { + solver.SetAutosolve(true); + } + } + + cout << r1 << " = " << r1.Value() << endl + << r2 << " = " << r2.Value() << endl + << r3 << " = " << r3.Value() << endl + << r4 << " = " << r4.Value() << endl + << r5 << " = " << r5.Value() << endl + << r6 << " = " << r6.Value() << endl + << r7 << " = " << r7.Value() << endl + << r8 << " = " << r8.Value() << endl; + + return false; + } + catch (ExCLError &error) + { + cerr << "Exception! " << error.description() << endl; + return(true); + } + catch (...) + { + cerr << "Unknown exception" << endl; + return(false); + } +} + +typedef ClVariable *PClVariable; + +bool +addDel(const int nCns = 900, const int nVars = 900, const int nResolves = 10000) +//addDel(int nCns = 300, int nVars = 300, int nResolves = 1000) +//addDel(int nCns = 30, int nVars = 30, int nResolves = 100) +{ + Timer timer; + // FIXGJB: from where did .12 come? + static const double ineqProb = 0.12; + static const int maxVars = 3; + + cout << "starting timing test. nCns = " << nCns + << ", nVars = " << nVars << ", nResolves = " << nResolves << endl; + + timer.Start(); + ClSimplexSolver solver; + solver.SetAutosolve(false); + + ClVariable **rgpclv = new PClVariable[nVars]; + for (int i = 0; i < nVars; i++) + { + rgpclv[i] = new ClVariable(i,"x"); + solver.AddStay(*rgpclv[i]); + } + + ClConstraint **rgpcns = new PClConstraint[nCns]; + int nvs = 0; + int k; + int j; + double coeff; + for (j = 0; j < nCns; j++) + { + // number of variables in this constraint + nvs = int(UniformRandom()*maxVars) + 1; + ClLinearExpression expr = UniformRandom()*20.0 - 10.0; + for (k = 0; k < nvs; k++) + { + coeff = UniformRandom()*10 - 5; + expr.AddExpression(*(rgpclv[int(UniformRandom()*nVars)]) * coeff); + } + if (UniformRandom() < ineqProb) + { + rgpcns[j] = new ClLinearInequality(expr); + } + else + { + rgpcns[j] = new ClLinearEquation(expr); + } +#ifdef CL_SHOW_CNS_IN_BENCHMARK + cout << "Cn[" << j << "]: " << *rgpcns[j] << endl; +#endif + } + + cout << "done building data structures" << endl; + cout << "time = " << timer.ElapsedTime() << "\n" << endl; + timer.Start(); + int cExceptions = 0; +#ifdef CL_SHOW_CNS_IN_BENCHMARK + cout << "Exceptions on: "; +#endif + for (j = 0; j < nCns; j++) + { + // Add the constraint -- if it's incompatible, just ignore it + try + { + solver.AddConstraint(rgpcns[j]); + } + catch (ExCLRequiredFailure &) + { + cExceptions++; + rgpcns[j] = NULL; +#ifdef CL_SHOW_CNS_IN_BENCHMARK + cout << j << " "; +#endif + } + } +#ifdef CL_SHOW_CNS_IN_BENCHMARK + cout << "\n" << endl; +#endif + solver.Solve(); + cout << "done adding constraints [" << cExceptions << " exceptions]" << endl; + cout << "time = " << timer.ElapsedTime() << "\n" << endl; + cout << "time per cn = " << timer.ElapsedTime()/nCns << "\n" << endl; + cout << "time per actual cn = " << timer.ElapsedTime()/(nCns - cExceptions) << "\n" <Value()*1.001) + .SuggestValue(e2,e2->Value()*1.001) + .Resolve(); + } + solver.EndEdit(); + // cout << "run time: " << + + cout << "done resolves -- now removing constraints" << endl; + cout << "time = " << timer.ElapsedTime() << "\n" < 1) + cns = atoi(argv[1]); + + if (argc > 2) + vars = atoi(argv[2]); + + if (argc > 3) + resolves = atoi(argv[3]); + + if (cns > 0) + { + cout << "addDel" << ":" << endl; + fResult = addDel(cns,vars,resolves); fAllOkResult &= fResult; + if (!fResult) cout << "Failed!" << endl; + } + +#undef RUN_TEST + +#ifdef CL_FIND_LEAK + cout << "ClAbstractVariables: " << ClAbstractVariable::cAbstractVariables + << "\nClDummyVariables: " << ClDummyVariable::cDummyVariables + << "\nClSlackVariables: " << ClSlackVariable::cSlackVariables + << endl; +#endif + + + return (fAllOkResult? 0 : 255); + + } + catch (...) + { + cerr << "exception!" << endl; + } +} diff --git a/libs/cassowary/ClVariable.cc b/libs/cassowary/ClVariable.cc new file mode 100644 index 0000000000..2a136c1096 --- /dev/null +++ b/libs/cassowary/ClVariable.cc @@ -0,0 +1,21 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClVariable.cc + +#include + +#ifdef HAVE_CONFIG_H +#include +#define CONFIG_H_INCLUDED +#endif + +StringToVarMap *ClVariable::pmapStrPclv = NULL; +ClVariable clvNil(static_cast(0)); + diff --git a/libs/cassowary/IMPORTANT b/libs/cassowary/IMPORTANT new file mode 100644 index 0000000000..1edaabfa01 --- /dev/null +++ b/libs/cassowary/IMPORTANT @@ -0,0 +1,26 @@ +Cassowary/C++ needs to be compiled using a modern C++ compiler. +At one time or another, it has compiled using: + o egcs-1.0.1, egcs-1.0.3, egcs-1.1b, gcc-2.8.1, gcc-2.95.2 + o Visual C++ 5.0 + +Cassowary/Java was developed using Sun's JDK-1.1.3, ported to Linux +More recent versions should work fine, and it has been tested +with JDK-1.2pre2. + +The included Makefiles depend upon features of GNU Make. See: + +ftp://ftp.gnu.org/pub/gnu/ + +for a version that you can build. + + +To build the c++/qdemos/QuadDemo application, you'll need TrollTech's Qt +widget set for X11, available from: + +http://www.troll.no/dl/qtfree-dl.html + + +See also the Scwm (Scheme Constraints Window Manager) web page for a use +of Cassowary in a substantial application: + +http://scwm.mit.edu/scwm/ diff --git a/libs/cassowary/INSTALL b/libs/cassowary/INSTALL new file mode 100644 index 0000000000..b42a17ac46 --- /dev/null +++ b/libs/cassowary/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/libs/cassowary/LICENSE b/libs/cassowary/LICENSE new file mode 100644 index 0000000000..21ecedf70d --- /dev/null +++ b/libs/cassowary/LICENSE @@ -0,0 +1,18 @@ +Cassowary Constraint Solving Toolkit +Copyright (C) 1998-200 Greg J. Badros + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +See COPYING.LGPL diff --git a/libs/cassowary/Makefile.am b/libs/cassowary/Makefile.am new file mode 100644 index 0000000000..fb36aef47c --- /dev/null +++ b/libs/cassowary/Makefile.am @@ -0,0 +1,32 @@ +MAINTAINERCLEANFILES = autom4te.cache Makefile.in aclocal.m4 configure \ + config.h.in stamp-h.in config.guess mkinstalldirs \ + missing install-sh config.sub ltconfig \ + ltmain.sh acinclude.m4 config.log config.status \ + depcomp ClReader.cc ClReader.hh ClReader-lex.cc + +EXTRA_DIST = ClReader.l ClReader.y + +SUBDIRS = cassowary + +noinst_LIBRARIES = libcassowary.a + +libcassowary_a_SOURCES = \ + ClAbstractVariable.cc \ + ClConstraint.cc \ + ClLinearExpression.cc \ + ClSolver.cc \ + ClSimplexSolver.cc \ + ClStrength.cc \ + ClSymbolicWeight.cc \ + ClTableau.cc \ + ClVariable.cc \ + ClFloatVariable.cc \ + ClSlackVariable.cc \ + ClDummyVariable.cc \ + ClReader-lex.cc + +ClReader-lex.cc: ClReader.l cassowary/ClReader.h ClReader.cc + $(LEX) -Pcl -o$@ $< + +ClReader.cc: ClReader.y cassowary/ClReader.h + $(YACC) -d -pcl --output-file $@ $< diff --git a/libs/cassowary/NEWS b/libs/cassowary/NEWS new file mode 100644 index 0000000000..0f950dacef --- /dev/null +++ b/libs/cassowary/NEWS @@ -0,0 +1,229 @@ +Cassowary NEWS -- history of user-visible changes. -*- text -*- + +Cassowary Constraint Solving Toolkit was +Implemented by: + +Greg J. Badros and +Alan Borning +University of Washington +Computer Science and Engineering +Seattle, WA 98195-2350 + +with Constraint Drawing Applet (CDA) by Michael Noth + +12-March-2000: Version 0.60 released. +* Changed license to LGPL!!! +* Added SetAutoResetStayConstants(), FIsAutoResetStayConstants(), make ResetStayConstants() public + +29-Jan-2000: Version 0.55 released. +* Some bug fixes +* Added ClSimplexSolver::{ChangeStrength,ChangeStrengthAndWeight,ChangeWeight, + DisplayObjective,ExternalResetStayConstants} fns + From A. Beurivé. + +16-Dec-1999: Version 0.54a released. +* Include correct version of OTI Smalltalk .dat file + (the source in the *.app files was right, the .dat file was old) +* Fix java build bug + +15-Dec-1999: Version 0.54 released. +* Bug fixes +* auto-configuration improvements +* Support Java 2 (jdk-1.2) +* Improved ease of building Java demos +* Build guile wrapper as long as guile-config works, use new --disable-guile-build to force off +* Alpha-version of Java constraint parser contributed by Will Portnoy + +24-October-1999: Version 0.53 released. +* Bug fixes +* License exception for linking with Scwm. + +25-September-1999: Version 0.52 released. +* Bug fix for nested edits where a later edit includes an already-being-edited variable + +14-September-1999: Version 0.51 released. +* Minor bug fixes +* Much better packaging, RPMs, etc. more forced reliance on GTL + +26-August-1999: Version 0.51 pre-releases begin + +12-July-1999: Version 0.50 released. +* Made only C++ version build by default, --enable-java-build is needed to turn java on +* Added restricted finite domain solver +** needs --with-gtl configure option, and libGTL.{a,so*} to be installed +* Added ClSolver base class, and use its type for pointers in callbacks + +14-Apr-1999: Version 0.43 released. +* DEBUG_PARSE turned off by default +* Added cassowary.spec for RPM building + +31-Mar-1999: Version 0.42 released. +* Fixed autoconf bugs (.41 was a buggy release) +* Added --disable-cpp-build,--disable-java-build, and disable Python/Guile builds +automatically if directories cannot be found + +20-Mar-1999: Version 0.41 released. +* Fixed bug in autoconf support -- config.sub, config.guess to the +distribution so configure should actually work (they were symlinks +before, in error). + +18-Mar-1999: Version 0.4 released. + +18-Mar-1999: Changes since Cassowary v0.32 (for release v0.4) +* MUCH improved autoconf/automake support including numerous configure +options, added libtool support. +* Renamed many identifiers in the public API; this will break old code +using Cassowary. See the scripts/convert-ids script for help converting +your code (beware false positives; i.e., improper or unnecessary +changes). + + +10-Mar-1999: Changes since Cassowary v0.31 (for release v0.32) +* Added automake/autoconf support. Old Makefiles are now +Makefile.linux. This is not yet fully tested or correct, but I need to +make a release now for the bug fixes. Consider compiling with "make -f +Makefile.linux all" if you have problems running autoconf and/or +automake. + +* Changes to C++ +** Bug fix for problem Anthony Beurivé noticed regarding removing non-1 +weight stay constraints. +** Minor bug fix for parser. Also renamed the creader files to ClReader. + +* Changes to Java +** Bug fix for problem Emmanuel Pietriga reported regarding edit +constraints. +** Improved debugging support a bit by adding descriptions to +ExCLInternalError-s and assert()s + +* Changes to guile wrapper +** changed name of library to libcassowaryguile.a from libconstraints.a + + +1-Mar-1999: Changes since Cassowary v0.3 (for release v0.31) +* Changes to C++ +** Some bug fixes -- pass ClVariable-s around by value instead of const +& since they are now a handle class. +** Changed output format for ClEditConstraint, ClStayConstraint instances +** Use a function-object for controlling lookup/creation of variables in PcnParseConstraint +** Fix bugs in creader.y parser (did not accept parens or division +before). Introduced "==" as a a synonym for "=" +** Added szCassowaryVersion id string as a public char *. +** Added ChangeStrength, ChangeWeight to ClConstraint's public +interface, and have it valid only when the constraint is not in a solver +** Added ClConstraint::FIsInSolver() + +* Changes to Guile wrapper +** Fix bugs +** Wrap parsing functionality, including a lambda for lookup/creation of +variables +** Build a dynamically-loadable guile module, update cltests.scm to use it + + +23-Feb-1999: Version 0.3 released. + +19-Feb-1999, Changes since Cassowary v0.23 (for release v0.3) + +* Changes to Java and C++ +** Bug fix for Michael Kaufmann's report (see ChangeLog for details) +** resolve(Vector..) procedure is now depracated; preferred interface is +suggestValue(...) calls followed by resolve() (the one taking no +arguments). +** Added ClVariable::SetVarMap(..), ClVariable::VarMap() to permit +ClVariable ctr to save the mapping between given name and actual object +in a symbol table (used for parsing ascii expressions in C++ version) + +* Changes to just C++ implementation +** Use ClVariable as a handle class to a ClAbstractVariable-- old +ClVariable is now a ClFloatVariable. SetChangeClvCallback now takes a +function that takes a ClVariable handle, not a pointer. +** Passing ClConstraints's by const & is now deprecated -- pass by +pointer to the ClConstraint object +** Added creader.y, creader.l and function PcnParseConstraint(..) for +creating a constraint from an ASCII string. +** Added CL_NO_IO compile-time option to C++ version for preventing need +to link with the stream library (is not complete) +** Added CL_FIND_LEAK compile-time option for counting ctrs/dtr +invocations +** Added CL_USE_HASH_MAP compile-time option to permit using the GNU +hash_map class instead of the standard STL map (which is a sorted +associative container whose performance for lookups is logarithmic +rather than constant time). Still does not work for me --02/16/99 gjb. + +* Changes to just Java implementation (updated to match changes to C++ +version for .2) +** Added {get,set}AttachedObject for ClVariable, ClConstant +** Permit access to ClSimplexSolver.ConstraintMap() +** Permit nested beginEdit()s and handle them correctly + +* Miscellaneous changes +** Updated copyright to include 1999 +** Fixed wrappers/Makefile for building Python wrapper +** Reference Anthony Beurivé's STk wrapper +** Fix Scwm URL + + +30-Jan-1999, Changes since Cassowary v0.22 (for release v0.23) +* Bug fix (see ChangeLog for details) + + +23-Jan-1999, Changes since Cassowary v0.21 (for release v0.22) +* Minor code cleanup, additions of comments. + + +14-Sep-98, Changes since Cassowary v0.2 (for release v0.21) + +* Make compile cleanly using egcs-1.1b -- use typename, and drop + unused templated instantiation + +* Improved guile interface: add a void pointer to the solver objects, + and let the guile wrapper use it to keep a pointer to the scheme-level + object; also added clv-attach! and clv-attached-object for attaching + an object to a cl-variable (somewhat redundant with guile's + object properties) + +* Wrap ClStayConstraints so they can be managed explicitly + +* cl-add-stay, cl-add-editvar now take strength and factor arguments, + instead of a list of cl-vars + +* Added weight option to addEditVar + + +6-Aug-98, Changes since Cassowary v0.1 (for release v0.2): + +* Changes to the distribution for release v0.2 + +** added guile/scheme wrapper of C++ version + +** mention SCWM in README + +** mention non-maintenance of Smalltalk implementation unless we have users + +* Changes to the C++ and Java implementations + +** Fixed several bugs -- dummy variables were wrongly being pivoted into + the basis, and constraints that threw required failure exceptions + were mistakenly remaining in the tableau (now trying to remove an + exception that was not added because of a required-failure exception + will correctly throw a ConstraintNotFound exception); more -- see ChangeLog + +** Added a virtual change_value function to permit applications to watch + for changes made to external variables. + +* Changes to only the C++ version (Java version will catch up in 0.3) + +** Added new test cases to ClTests, fixed bugs in ClTestColumns + +** Added _pv (void *) field hanging off of ClConstraint and ClVariable + for associating arbitrary structs with those (needed by SCWM) + +** Permit nested beginEdit()s, and do the right thing upon calling + endEdit() -- i.e., not all the edit variables are removed, only the + nested ones + +** Permit access to ClSimplexSolver::ConstraintMap() (used by + guile-wrapper to efficiently get at a list of constraints in the + solver) + +** Added ExCLEditMisuse exception diff --git a/libs/cassowary/README b/libs/cassowary/README new file mode 100644 index 0000000000..16ed492b8e --- /dev/null +++ b/libs/cassowary/README @@ -0,0 +1,241 @@ +Cassowary Constraint Solving Toolkit for C++, Java, and Smalltalk +Version 0.60 + +Web Page: http://www.cs.washington.edu/research/constraints/cassowary +Contact: cassowary@cs.washington.edu + +Greg J. Badros and +Alan Borning +University of Washington +Computer Science and Engineering +Seattle, WA 98195-2350 +12-March-2000 + +with Constraint Drawing Applet (CDA) by Michael Noth + +See ANNOUNCE for a brief description and announcement of this distribution. +See NEWS for a history of user-visible changes. +See ChangeLog for a detailed listing of the changes to each source file. +See LICENSE for legalese regarding use of this distribution. + +The Smalltalk implementation is in the public domain -- see smalltalk/README. + +Please send bug reports to cassowary@cs.washington.edu + +Also, send mail to cassowary@cs.washington.edu if you would like to be +informed about bug fixes, feature enhancements, etc. Let us know what +implementation(s) you are using, too. + +------------------------------------------------------------------ + +HOW TO GET STARTED + +The Cassowary library uses GNU autoconf to permit easy building on +various platforms. You should be able to do: + +./configure +make + +and everything will work. A more complex, but realistic example is: + +./configure --with-prefix=/usr/contrib \ + --with-guile-prefix=/usr/contrib \ + --with-python-headers=/usr/include/python1.5 \ + --enable-java-build \ + --with-gtl=/usr/contrib \ + --with-java-class-path=/usr/contrib/share/java/site \ + --enable-warnings +make -k + +Be sure to give the extra --enable-permissive flag to configure if +you are building with gcc-2.95 or more recent. + +As yet another data point, I build Cassowary with: + +./configure --with-guile-exec-prefix=/uns/bin \ + --with-guile-prefix=/uns/share --prefix=/uns/share \ + --exec-prefix=/uns --enable-maintainer-mode + +See the file "INSTALL" for more details about +autoconf support and the options that the "configure" takes. You can +also do "./configure --help" for the list of the options that configure +accepts. + +If the make in any of the subdirectories fails, you can turn on the "-k" +option to make, or just do make in the subdirectories that you want +build. E.g., if you do not have the JDK installed, the Java version of +Cassowary might not compile; if you still want the guile version, just +"cd guile; make -k". + +Be sure that configure detects the validity of using the "-fpermissive" +flag of more recent g++/egcs compilers to work around some +const-discrepancies between the const-challenged guile header files and +Cassowary's more const-correct usage. You should get a message like: + + checking whether gcc understands -fpermissive option... yes + +when running configure if you're using, e.g., gcc-2.95 or later. + +You need to apply GTL.h.patch to the installed GTL.h header file for +Cassowary to compile with recent versions of egcs/gcc (e.g., gcc-2.95). + +Also, you may need to change libguile/gsubr.h from: + + extern SCM scm_make_gsubr SCM_P ((char *name, int req, int opt, + int rst, SCM (*fcn)())); + to + + extern SCM scm_make_gsubr SCM_P ((char *name, int req, int opt, + int rst, void*)); + +or patch guile's snarf.h to insert the appropriate case at each call to +SCM_PROC and SCM_PROC1. (Thanks to Alexandre Duret-Lutz for the above +information about more recent g++/egcs compilers). + +Note that the generated Makefiles depend upon features of GNU Make. See: + +ftp://ftp.gnu.org/pub/gnu/ + +for a version of make that you can build first to then build Cassowary. + +Example applications exist in subdirectories of the top-level +implementation subdirectories (e.g., c++/qdemos contains demos for C++ +that use the Qt Widget toolkit). + +Please send mail to cassowary@cs.washington.edu if you are using this +toolkit so we know how to reach you for bug fixes, updates, etc. + +------------------------------------------------------------------ + +WHAT THE DISTRIBUTION CONTAINS + +This distribution contains 3 implementations of the Cassowary constraint +solving toolkit: + +o C++ +o Java +o Smalltalk + +For each implementation language, there is at least one example program; +for some there are many. + +There is a wrapping of the C++ solver in Guile-Scheme -- see the guile/ +subdirectory. Also, Anthony Beurivé has wrapped Cassowary for +STk/Scheme. His code is available at: + + http://dept-info.labri.u-bordeaux.fr/~beurive/Code + +and the STk Scheme system is available at: + + http://kaolin.unice.fr/STk/ + +There is also a SWIG-generated wrapper of the C++ library making the +solver available from the Python language. + +A technical report describing the solver, its interface, and its +implementation is in cassowary-tr.ps (pdf version in cassowary-tr.pdf). +This paper is required reading if you intend to use the solver in your +own project(s). + +See also the Scwm (Scheme Constraints Window Manager) web page: + +http://scwm.mit.edu/scwm/ + +Scwm, also by Greg Badros (and Maciej Stachowiak), is the most +substantial application using this toolkit that we are aware of. + +------------------------------------------------------------------ + +VARIOUS IMPLEMENTATION NOTES + +Cassowary/C++ needs to be compiled using a modern C++ compiler. +At one time or another, it has compiled using: + o egcs-1.0.1 + o egcs-1.0.3a + o egcs-1.1b + o egcs-1.1.1 + o gcc-2.8.1 (needs libstdc++-2.8.x, too) + o Visual C++ 5.0 (not tried recently) + +In particular, Cassowary will *not* build with gcc-2.7.x.x! + +See c++/README for more details about building the C++ version. + +The C++ implementation of the toolkit also has an optional finite domain +subsolver. You need to build and install the GTL -- the Graph Template +Library -- and use the "--with-gtl=DIR" configure option for the finite +domain subsolver to be built. GTL is available from: + +http://www.fmi.uni-passau.de/Graphlet/GTL/ + +Cassowary was tested against GTL-0.3.1; it may work with later +versions, but I have not tried it. You need to apply GTL.h.patch to +the installed GTL.h header file for Cassowary to compile with recent +versions of egcs/gcc (e.g., gcc-2.95). + +Cassowary/Java was developed using Sun's JDK-1.1.x, ported to Linux +More recent versions should work fine. + +See java/README for more details about building the Java version. + + +Cassowary/Smalltalk was written under OTI Smalltalk-- other versions of +smalltalk will likely require (possibly significant) changes. + +See smalltalk/README for more details about the Smalltalk version. + +See guile/README for details about the Guile Scheme wrapper of the C++ +implementation, and for a pointer to SCWM, the Scheme Constraints Window +Manager which uses Cassowary. + +The Python bindings (by Tessa Lau) bindings for the Cassowary library +are in the wrappers/ subdirectory. SWIG was used in wrapping the +library. These bindings may no longer work, and are provided only for +your hacking pleasure (please send back useful patches if you do get the +code working). + +For more information about SWIG, see: + +http://www.swig.org/ + + +For more information about the Python language, see: + +http://www.python.org/ + + +For more information about the Guile-Scheme language, see: + +http://www.red-bean.com/guile/ +http://www.fsf.org/software/guile/guile.html + + +------------------------------------------------------------------ + +DEMONSTRATION APPLICATION + +A standard demonstration application is included for each implementation +of the Cassowary solver. The application builds a quadrilateral and +connects the neighboring midpoints of each of the outer edges to form an +interior quadrilateral which is provably a parallelogram. The +constraint solver manages the constraints to keep the outer +quadrilateral inside the window, keep the midpoints properly positioned, +and keep the outer quadrilateral from turning "inside out." + +The user is able to select points (draggable boxes) and move them around +within the window (both midpoints and endpoints can be selected, of +course). The solver updates the figure, and redraws. + + +------------------------------------------------------------------ + +FUNDING ACKNOWLEDGEMENTS + +This work has been funded in part by the National Science Foundation under +Grants IRI-9302249 and CCR-9402551, by Object Technology International, and +by a Fulbright Award from the Australian-American Educational +Foundation. + +Additionally, Greg Badros is supported by a National Science Foundation +Graduate Research Fellowship. Parts of this material are based upon +work supported under that fellowship. diff --git a/libs/cassowary/THANKS b/libs/cassowary/THANKS new file mode 100644 index 0000000000..11918b3d52 --- /dev/null +++ b/libs/cassowary/THANKS @@ -0,0 +1,30 @@ +Cassowary Constraint Solving Toolkit was +Implemented by: + +Greg J. Badros and +Alan Borning +University of Washington +Computer Science and Engineering +Seattle, WA 98195-2350 + +with Constraint Drawing Applet (CDA) by Michael Noth + +Please send bug reports to cassowary@cs.washington.edu + + +Bug reports, helpful testing, and/or code from: + +Spencer Allain +Anthony Beurivé +Robert Chassell +Alexandre 'Pollux' Duret-Lutz +Michael Kaufmann +Brian Grant +Pengling He +Tessa Lau +John MacPhail +Larry Melia +Michael Noth +Emmanuel Pietriga +Will Portnoy +Steve Wolfman diff --git a/libs/cassowary/autogen.sh b/libs/cassowary/autogen.sh new file mode 100644 index 0000000000..4d1bcb29e5 --- /dev/null +++ b/libs/cassowary/autogen.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +aclocal $ACLOCAL_FLAGS && autoheader && automake --add-missing && autoconf + diff --git a/libs/cassowary/cassowary-config b/libs/cassowary/cassowary-config new file mode 100755 index 0000000000..172237763e --- /dev/null +++ b/libs/cassowary/cassowary-config @@ -0,0 +1,102 @@ +#!/bin/sh +# Modified from gtk-config +# --09/07/99 gjb + +# gotten from LDADD in c++/Makefile.am +cassowary_gtllibs="" +cassowary_libs="-L/usr/local/lib $cassowary_gtllibs" +cassowary_cflags="-I/usr/local/include " + +prefix=/usr/local +exec_prefix=${prefix} +exec_prefix_set=no + +usage() +{ + cat <&2 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo_prefix=yes + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo_exec_prefix=yes + ;; + --version) + echo 0.60 + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=yes + ;; + --gtllibs) + echo_gtllibs=yes + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +if test "$echo_prefix" = "yes"; then + echo $prefix +fi + +if test "$echo_exec_prefix" = "yes"; then + echo $exec_prefix +fi + + +if test "$echo_cflags" = "yes"; then + if test ${prefix}/include != /usr/include ; then + includes=-I${prefix}/include + for i in $cassowary_cflags ; do + if test $i = -I${prefix}/include ; then + includes="" + fi + done + fi + echo $includes $cassowary_cflags +fi + +if test "$echo_libs" = "yes"; then + echo -L${exec_prefix}/lib -lcassowary -lstdc++ $cassowary_libs +fi + +if test "$echo_gtllibs" = "yes"; then + echo $cassowary_gtllibs +fi diff --git a/libs/cassowary/cassowary-config.in b/libs/cassowary/cassowary-config.in new file mode 100755 index 0000000000..ac1b3ac8ce --- /dev/null +++ b/libs/cassowary/cassowary-config.in @@ -0,0 +1,102 @@ +#!/bin/sh +# Modified from gtk-config +# --09/07/99 gjb + +# gotten from LDADD in c++/Makefile.am +cassowary_gtllibs="@GTL_LIB@" +cassowary_libs="-L@prefix@/lib $cassowary_gtllibs" +cassowary_cflags="@GUILE_INCLUDES@ @GTL_INCLUDES@" + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +usage() +{ + cat <&2 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo_prefix=yes + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo_exec_prefix=yes + ;; + --version) + echo @CASSOWARY_VERSION@ + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=yes + ;; + --gtllibs) + echo_gtllibs=yes + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +if test "$echo_prefix" = "yes"; then + echo $prefix +fi + +if test "$echo_exec_prefix" = "yes"; then + echo $exec_prefix +fi + + +if test "$echo_cflags" = "yes"; then + if test @includedir@ != /usr/include ; then + includes=-I@includedir@ + for i in $cassowary_cflags ; do + if test $i = -I@includedir@ ; then + includes="" + fi + done + fi + echo $includes $cassowary_cflags +fi + +if test "$echo_libs" = "yes"; then + echo -L@libdir@ -lcassowary -lstdc++ $cassowary_libs +fi + +if test "$echo_gtllibs" = "yes"; then + echo $cassowary_gtllibs +fi diff --git a/libs/cassowary/cassowary-nofd.spec2 b/libs/cassowary/cassowary-nofd.spec2 new file mode 100644 index 0000000000..d1abb93c5f --- /dev/null +++ b/libs/cassowary/cassowary-nofd.spec2 @@ -0,0 +1,84 @@ +# Note that this is NOT a relocatable package +%define ver 0.60 +%define rel 2 +%define prefix /usr + +Name: cassowary-nofd +Summary: A Linear Arithmetic Constraint Solving Library. +Version: %ver +Release: %rel +# This source just has a different top-level directory name +Source: http://www.cs.washington.edu/research/constraints/cassowary/cassowary-nofd-%ver.tar.gz +Group: Development/Libraries +BuildRoot: /tmp/cassowary-%ver-build +Copyright: Copyright (C) 1998,1999 Greg J. Badros +Packager: Greg J. Badros +URL: http://www.cs.washington.edu/research/constraints/cassowary +Requires: guile >= 1.3.2 +Provides: cassowary-constraint-solver + +%description + +Cassowary is an advanced incremental constraint solving toolkit that +efficiently solves systems of linear equalities and inequalities. +Constraints may be either requirements or preferences. Client code +specifies the constraints to be maintained, and the solver updates the +constrained variables to have values that satisfy the constraints. + +This package lacks the finite domain subsolver. The cassowary RPM +contains that solver as well, but also requires the GTL (Graph +Template Library) package. + + +%changelog +* Tue Sep 7 1999 Greg J. Badros +- Rework spec file. + +* Wed Apr 14 1999 Greg J. Badros + +- Initial release of this package. + +%prep + +%setup + +%build +ln -sf . ./c++/cassowary + +%ifarch alpha +./configure --host=alpha-linux --prefix=%prefix --enable-guile-build --enable-fsstd --enable-permissive +%else +./configure --prefix=%prefix --enable-guile-build --enable-fsstd --enable-permissive +%endif + +make + +%install +make prefix=$RPM_BUILD_ROOT%{prefix} install-strip + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +%postun + +%files +%defattr(-, root, root) + +%{prefix}/bin/* +%{prefix}/lib/* +%{prefix}/include/* + +%doc ANNOUNCE AUTHORS COPYING IMPORTANT INSTALL LICENSE NEWS README THANKS +%doc ChangeLog docs/cassowary-tr.pdf docs/cassowary-tr.ps.gz +%doc guile/cassowary_scm-procedures.txt guile/cassowary_scm-variables.txt +%doc guile/cassowary_scm.sgml diff --git a/libs/cassowary/cassowary-nofd.spec2.in b/libs/cassowary/cassowary-nofd.spec2.in new file mode 100644 index 0000000000..ee951bb446 --- /dev/null +++ b/libs/cassowary/cassowary-nofd.spec2.in @@ -0,0 +1,84 @@ +# Note that this is NOT a relocatable package +%define ver @VERSION@ +%define rel 2 +%define prefix /usr + +Name: cassowary-nofd +Summary: A Linear Arithmetic Constraint Solving Library. +Version: %ver +Release: %rel +# This source just has a different top-level directory name +Source: http://www.cs.washington.edu/research/constraints/cassowary/cassowary-nofd-%ver.tar.gz +Group: Development/Libraries +BuildRoot: /tmp/cassowary-%ver-build +Copyright: Copyright (C) 1998,1999 Greg J. Badros +Packager: Greg J. Badros +URL: http://www.cs.washington.edu/research/constraints/cassowary +Requires: guile >= 1.3.2 +Provides: cassowary-constraint-solver + +%description + +Cassowary is an advanced incremental constraint solving toolkit that +efficiently solves systems of linear equalities and inequalities. +Constraints may be either requirements or preferences. Client code +specifies the constraints to be maintained, and the solver updates the +constrained variables to have values that satisfy the constraints. + +This package lacks the finite domain subsolver. The cassowary RPM +contains that solver as well, but also requires the GTL (Graph +Template Library) package. + + +%changelog +* Tue Sep 7 1999 Greg J. Badros +- Rework spec file. + +* Wed Apr 14 1999 Greg J. Badros + +- Initial release of this package. + +%prep + +%setup + +%build +ln -sf . ./c++/cassowary + +%ifarch alpha +./configure --host=alpha-linux --prefix=%prefix --enable-guile-build --enable-fsstd --enable-permissive +%else +./configure --prefix=%prefix --enable-guile-build --enable-fsstd --enable-permissive +%endif + +make + +%install +make prefix=$RPM_BUILD_ROOT%{prefix} install-strip + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +%postun + +%files +%defattr(-, root, root) + +%{prefix}/bin/* +%{prefix}/lib/* +%{prefix}/include/* + +%doc ANNOUNCE AUTHORS COPYING IMPORTANT INSTALL LICENSE NEWS README THANKS +%doc ChangeLog docs/cassowary-tr.pdf docs/cassowary-tr.ps.gz +%doc guile/cassowary_scm-procedures.txt guile/cassowary_scm-variables.txt +%doc guile/cassowary_scm.sgml diff --git a/libs/cassowary/cassowary.spec b/libs/cassowary/cassowary.spec new file mode 100644 index 0000000000..bd30177048 --- /dev/null +++ b/libs/cassowary/cassowary.spec @@ -0,0 +1,78 @@ +# Note that this is NOT a relocatable package +%define ver 0.60 +%define rel 1 +%define prefix /usr + +Name: cassowary +Summary: A Linear Arithmetic Constraint Solving Library. +Version: %ver +Release: %rel +Source: http://www.cs.washington.edu/research/constraints/cassowary/cassowary-%ver.tar.gz +Group: Development/Libraries +BuildRoot: /tmp/cassowary-%ver-build +Copyright: Copyright (C) 1998,1999 Greg J. Badros +Packager: Greg J. Badros +URL: http://www.cs.washington.edu/research/constraints/cassowary +Requires: guile >= 1.3.4 +Requires: GTL >= 0.3.1 +Provides: cassowary-constraint-solver + +%description + +Cassowary is an advanced incremental constraint solving toolkit that +efficiently solves systems of linear equalities and inequalities. +Constraints may be either requirements or preferences. Client code +specifies the constraints to be maintained, and the solver updates the +constrained variables to have values that satisfy the constraints. + +%changelog +* Tue Sep 7 1999 Greg J. Badros +- Rework spec file. + +* Wed Apr 14 1999 Greg J. Badros + +- Initial release of this package. + +%prep + +%setup + +%build +ln -sf . ./c++/cassowary + +%ifarch alpha +fake_root_for_install=$RPM_BUILD_ROOT ./configure --host=alpha-linux --prefix=%prefix --with-gtl=%prefix --enable-fd-solver --enable-fsstd --enable-permissive +%else +fake_root_for_install=$RPM_BUILD_ROOT ./configure --prefix=%prefix --with-gtl=%prefix --enable-fd-solver --enable-fsstd --enable-permissive +%endif + +make + +%install +make prefix=$RPM_BUILD_ROOT%{prefix} fake_root_for_install=$RPM_BUILD_ROOT install-strip + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +%postun + +%files +%defattr(-, root, root) + +%{prefix}/bin/* +%{prefix}/lib/* +%{prefix}/include/* + +%doc ANNOUNCE AUTHORS COPYING IMPORTANT INSTALL LICENSE NEWS README THANKS +%doc ChangeLog docs/cassowary-tr.pdf docs/cassowary-tr.ps.gz +%doc guile/cassowary_scm-procedures.txt guile/cassowary_scm-variables.txt +%doc guile/cassowary_scm.sgml diff --git a/libs/cassowary/cassowary.spec.in b/libs/cassowary/cassowary.spec.in new file mode 100644 index 0000000000..2b7c23a8e5 --- /dev/null +++ b/libs/cassowary/cassowary.spec.in @@ -0,0 +1,78 @@ +# Note that this is NOT a relocatable package +%define ver @VERSION@ +%define rel 1 +%define prefix /usr + +Name: cassowary +Summary: A Linear Arithmetic Constraint Solving Library. +Version: %ver +Release: %rel +Source: http://www.cs.washington.edu/research/constraints/cassowary/cassowary-%ver.tar.gz +Group: Development/Libraries +BuildRoot: /tmp/cassowary-%ver-build +Copyright: Copyright (C) 1998,1999 Greg J. Badros +Packager: Greg J. Badros +URL: http://www.cs.washington.edu/research/constraints/cassowary +Requires: guile >= 1.3.4 +Requires: GTL >= 0.3.1 +Provides: cassowary-constraint-solver + +%description + +Cassowary is an advanced incremental constraint solving toolkit that +efficiently solves systems of linear equalities and inequalities. +Constraints may be either requirements or preferences. Client code +specifies the constraints to be maintained, and the solver updates the +constrained variables to have values that satisfy the constraints. + +%changelog +* Tue Sep 7 1999 Greg J. Badros +- Rework spec file. + +* Wed Apr 14 1999 Greg J. Badros + +- Initial release of this package. + +%prep + +%setup + +%build +ln -sf . ./c++/cassowary + +%ifarch alpha +fake_root_for_install=$RPM_BUILD_ROOT ./configure --host=alpha-linux --prefix=%prefix --with-gtl=%prefix --enable-fd-solver --enable-fsstd --enable-permissive +%else +fake_root_for_install=$RPM_BUILD_ROOT ./configure --prefix=%prefix --with-gtl=%prefix --enable-fd-solver --enable-fsstd --enable-permissive +%endif + +make + +%install +make prefix=$RPM_BUILD_ROOT%{prefix} fake_root_for_install=$RPM_BUILD_ROOT install-strip + +%clean +rm -rf $RPM_BUILD_ROOT + +%post + +%postun + +%files +%defattr(-, root, root) + +%{prefix}/bin/* +%{prefix}/lib/* +%{prefix}/include/* + +%doc ANNOUNCE AUTHORS COPYING IMPORTANT INSTALL LICENSE NEWS README THANKS +%doc ChangeLog docs/cassowary-tr.pdf docs/cassowary-tr.ps.gz +%doc guile/cassowary_scm-procedures.txt guile/cassowary_scm-variables.txt +%doc guile/cassowary_scm.sgml diff --git a/libs/cassowary/cassowary/.cvsignore b/libs/cassowary/cassowary/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/libs/cassowary/cassowary/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/libs/cassowary/cassowary/Cassowary.h b/libs/cassowary/cassowary/Cassowary.h new file mode 100644 index 0000000000..8413f321f9 --- /dev/null +++ b/libs/cassowary/cassowary/Cassowary.h @@ -0,0 +1,40 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// Cassowary.h + +#ifndef Cassowary_H +#define Cassowary_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) + #include + #define CONFIG_INLINE_H_INCLUDED +#endif + +#ifndef CL_PTR_HASH_DIVISOR + #define CL_PTR_HASH_DIVISOR 4 +#endif + +#include "ClConstraintHash.h" +#include + +#include +#include +#include + +typedef double Number; + +typedef long FDNumber; + +enum { FDN_NOTSET = LONG_MIN }; + +#define NEWVAR(x) do { cerr << "line " << __LINE__ << ": new " << x << endl; } while (0) +#define DELVAR(x) do { cerr << "line " << __LINE__ << ": del " << x << endl; } while (0) + +#endif // Cassowary_H diff --git a/libs/cassowary/cassowary/Cl.h b/libs/cassowary/cassowary/Cl.h new file mode 100644 index 0000000000..6c2604da6f --- /dev/null +++ b/libs/cassowary/cassowary/Cl.h @@ -0,0 +1,49 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// Cl.h +// This is the top level include file for external clients + +#ifndef CL_H +#define CL_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#ifdef CL_NO_IO +#undef CL_TRACE +#undef CL_SOLVER_STATS +#undef CL_DEBUG_FAILURES +#undef CL_TRACE_VERBOSE +#endif + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "cassowary/ClVariable.h" +#include "cassowary/ClSimplexSolver.h" +#include "cassowary/ClLinearEquation.h" +#include "cassowary/ClLinearInequality.h" +#include "cassowary/ClErrors.h" +#include "cassowary/ClEditConstraint.h" +#include "cassowary/ClStayConstraint.h" +#include "cassowary/ClReader.h" +#include "cassowary/ClConstraint.h" +#if defined(CL_HAVE_GTL) && defined(CL_BUILD_FD_SOLVER) +#include "cassowary/ClFDBinaryOneWayConstraint.h" +#include "cassowary/ClFDSolver.h" +#endif + +extern const char *szCassowaryVersion; + +#endif diff --git a/libs/cassowary/cassowary/ClAbstractVariable.h b/libs/cassowary/cassowary/ClAbstractVariable.h new file mode 100644 index 0000000000..08ade9ec98 --- /dev/null +++ b/libs/cassowary/cassowary/ClAbstractVariable.h @@ -0,0 +1,161 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClAbstractVariable.h + +#ifndef ClAbstractVariable_H +#define ClAbstractVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include /* for sprintf */ +#include "Cassowary.h" +#include "ClErrors.h" +#include +#include +#include +#include "cl_auto_ptr.h" + +using std::string; +using std::ostream; + +class ClAbstractVariable { +public: + ClAbstractVariable(string Name = "") : + _name(Name), _pv(0) + { + ++iVariableNumber; +#ifdef CL_FIND_LEAK + ++cAbstractVariables; +#endif + if (Name.length() == 0) + { + char sz[16]; + sprintf(sz,"v%ld",iVariableNumber); + _name = string(sz); + } + } + + ClAbstractVariable(long varnumber, char *prefix) : + _pv(0) + { + cl_auto_ptr pch (new char[16+strlen(prefix)]); + iVariableNumber++; +#ifdef CL_FIND_LEAK + ++cAbstractVariables; +#endif + sprintf(pch.get(),"%s%ld",prefix,varnumber); + _name = string(pch.get()); + } + + virtual ~ClAbstractVariable() +#ifdef CL_FIND_LEAK + { --cAbstractVariables; } + + static long cAbstractVariables; +#else + { } +#endif + + // Return the Name of the variable + string Name() const + { return _name; } + + // Set the Name of the variable + virtual void SetName(string const &Name) + { _name = Name; } + + // Return true iff this variable is a ClFloatVariable + virtual bool IsFloatVariable() const + { return false; } + + // Return true iff this variable is a ClFDVariable + virtual bool IsFDVariable() const + { return false; } + + // Return true if this a dummy variable (used as a marker variable + // for required equality constraints). Such variables aren't + // allowed to enter the basis when pivoting. + virtual bool IsDummy() const + { return false; } + + // Return true if this a variable known outside the solver. + // (We need to give such variables a Value after solving is complete.) + virtual bool IsExternal() const + { return false; } + + // Return true if we can Pivot on this variable. + virtual bool IsPivotable() const + { throw ExCLTooDifficultSpecial("Variable not usable inside SimplexSolver"); return false; } + + // Return true if this is a restricted (or slack) variable. Such + // variables are constrained to be non-negative and occur only + // internally to the simplex solver. + virtual bool IsRestricted() const + { throw ExCLTooDifficultSpecial("Variable not usable inside SimplexSolver"); return false; } + +#ifndef CL_NO_IO + // Prints a semi-descriptive representation to the stream, using the + // Name if there is one, and otherwise the hash number of this + // object. + // EXAMPLES + // x[10.0] -- w/ Name + // x[0.0,100] -- w/ Name, bounds but no Value yet + // CV#345(10.0) -- w/o Name + virtual ostream &PrintOn(ostream &xo) const = 0; + + friend ostream& operator<<(ostream &xos, const ClAbstractVariable &clv) + { clv.PrintOn(xos); return xos; } + +#endif // CL_NO_IO + + friend bool operator<(const ClAbstractVariable &cl1, const ClAbstractVariable &cl2) + { return &cl1 < &cl2; } + + friend bool operator==(const ClAbstractVariable &cl1, const ClAbstractVariable &cl2) + { + return &cl1 == &cl2; + } + + friend bool operator!=(const ClAbstractVariable &cl1, const ClAbstractVariable &cl2) + { + return !(cl1 == cl2); + } + + virtual Number Value() const { return 0; } + virtual int IntValue() const { return 0; } + + virtual void SetValue(Number) + { assert(false); } + + virtual void ChangeValue(Number) + { assert(false); } + + void SetPv(void *pv) + { _pv = pv; } + + void *Pv() const + { return _pv; } + +private: + string _name; + + static long iVariableNumber; + + // C-style extension mechanism so I + // don't have to wrap ScwmClVariables separately + void *_pv; +}; + +typedef ClAbstractVariable *PClAbstractVariable; + +#endif diff --git a/libs/cassowary/cassowary/ClConstraint.h b/libs/cassowary/cassowary/ClConstraint.h new file mode 100644 index 0000000000..0b670e6c07 --- /dev/null +++ b/libs/cassowary/cassowary/ClConstraint.h @@ -0,0 +1,198 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClConstraint.h + +#ifndef ClConstraint_H +#define ClConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "debug.h" + +#include "Cassowary.h" +#include "ClLinearExpression.h" +#include "ClStrength.h" +#include + +using std::string; + +class ClSimplexSolver; +class ClFDSolver; +class ClBlueSolver; + +// enum setup so additive inverse flips the direction of the inequality +enum ClCnRelation {cnEQ = 0, cnNEQ = 100, cnLEQ = 2, cnGEQ = -2, cnLT = 3, cnGT = -3 }; + +inline enum ClCnRelation +ReverseInequality(enum ClCnRelation c) +{ + if (c != cnNEQ) + c = (enum ClCnRelation) (- int(c)); + return c; +} + +inline string +StrCnRelation(enum ClCnRelation rel) { + switch (rel) { + case cnEQ: return "="; + case cnNEQ: return "=/="; + case cnLEQ: return "<="; + case cnGEQ: return ">="; + case cnLT: return "<"; + case cnGT: return ">"; + default: assert(false); + } +} + + + +class ClConstraint { +public: + + ClConstraint(const ClStrength &strength = ClsRequired(), double weight = 1.0 ) : + _strength(strength), + _readOnlyVars(), + _weight(weight), + _pv(0), + _times_added(0) + { + CtrTracer(__FUNCTION__,this); + } + + virtual ~ClConstraint() + { + DtrTracer(__FUNCTION__,this); + } + + // Return my linear Expression. (For linear equations, this + // constraint represents Expression=0; for linear inequalities it + // represents Expression>=0.) + virtual ClLinearExpression Expression() const + { assert(false); } + + // Returns true if this is an edit constraint + virtual bool IsEditConstraint() const + { return false; } + + // Return true if this is an inequality constraint and + // false if it is an equality constraint. The default is + // that it is not. + virtual bool IsInequality() const + { return false; } + + virtual bool IsStrictInequality() const + { return false; } + + virtual bool IsRequired() const + { return _strength.IsRequired(); } + + virtual bool isStayConstraint() const + { return false; } + + virtual const ClStrength &strength() const + { return _strength; } + + virtual double weight() const + { return _weight; } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const = 0; + + friend ostream& operator<<(ostream &xos, const ClConstraint &constraint) + { constraint.PrintOn(xos); return xos; } + +#endif + + + void SetPv(void *pv) + { _pv = pv; } + + void *Pv() const + { return _pv; } + + virtual bool FIsSatisfied() const { return false; } + + virtual bool FIsInSolver() const { return _times_added != 0; } + + virtual bool FIsOkayForSimplexSolver() const { return true; } + + void ChangeStrength( const ClStrength &strength) + { + if (_times_added == 0) { + setStrength(strength); + } else { + throw ExCLTooDifficult(); + } + } + + void ChangeWeight( double weight ) + { + if (_times_added == 0) { + setWeight(weight); + } else { + throw ExCLTooDifficult(); + } + } + + bool FIsReadOnlyVar(ClVariable v) const { + return !(_readOnlyVars.find(v) == _readOnlyVars.end()); + } + + const ClVarSet &ReadOnlyVars() const { + return _readOnlyVars; + } + + ClConstraint &AddROVars(const ClVarSet &setClv) { + for ( ClVarSet::const_iterator it = setClv.begin(); + it != setClv.end(); ++it) { + _readOnlyVars.insert(*it); + } + return *this; + } + + friend class ClSimplexSolver; + friend class ClFDSolver; + friend class ClBlueSolver; +private: + + ClSymbolicWeight symbolicWeight() const { + return _strength.symbolicWeight(); + } + + void addedTo(const ClSimplexSolver &) + { ++_times_added; } + + void removedFrom(const ClSimplexSolver &) + { --_times_added; } + + void setStrength( const ClStrength &strength ) + { _strength = strength; } + + void setWeight( double weight ) + { _weight = weight; } + + /// instance variables + ClStrength _strength; + + ClVarSet _readOnlyVars; + + double _weight; + + void *_pv; + + int _times_added; +}; + +typedef ClConstraint* PClConstraint; + +#endif diff --git a/libs/cassowary/cassowary/ClConstraintHash.h b/libs/cassowary/cassowary/ClConstraintHash.h new file mode 100644 index 0000000000..9d51fad311 --- /dev/null +++ b/libs/cassowary/cassowary/ClConstraintHash.h @@ -0,0 +1,39 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClHash.h + +#ifndef CL_HASH_H__ +#define CL_HASH_H__ + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#ifdef CL_USE_HASH_MAP_AND_SET + +#include + +class ClConstraint; + +struct hash { + size_t operator()(const ClConstraint * const p) const + { return size_t((unsigned long)p/CL_PTR_HASH_DIVISOR); } +}; + +struct hash { + size_t operator()(ClConstraint * const p) const + { return size_t((unsigned long)p/CL_PTR_HASH_DIVISOR); } +}; + +#endif // CL_USE_HASH_MAP_AND_SET + + +#endif diff --git a/libs/cassowary/cassowary/ClDummyVariable.h b/libs/cassowary/cassowary/ClDummyVariable.h new file mode 100644 index 0000000000..ad959a6d20 --- /dev/null +++ b/libs/cassowary/cassowary/ClDummyVariable.h @@ -0,0 +1,88 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClDummyVariable.h + +#ifndef ClDummyVariable_H +#define ClDummyVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClAbstractVariable.h" + +class ClTableau; +class ClSimplexSolver; + +class ClDummyVariable : public ClAbstractVariable { + +public: + +#ifdef CL_FIND_LEAK + ~ClDummyVariable() { --cDummyVariables; }; + + static long cDummyVariables; + +#endif + +protected: + friend class ClTableau; + friend class ClSimplexSolver; + + ClDummyVariable(string Name = "") : + ClAbstractVariable(Name) + { +#ifdef CL_FIND_LEAK + ++cDummyVariables; +#endif + } + + ClDummyVariable(long number, char *prefix) : + ClAbstractVariable(number,prefix) + { +#ifdef CL_FIND_LEAK + ++cDummyVariables; +#endif + } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { + xo << "[" << Name() << ":dummy]"; + return xo; + } +#endif + + // Return true if this a dummy variable (used as a marker variable + // for required equality constraints). Such variables aren't + // allowed to enter the basis when pivoting. + virtual bool IsDummy() const + { return true; } + + // Return true if this a variable known outside the solver. + // (We need to give such variables a Value after solving is complete.) + virtual bool IsExternal() const + { return false; } + + // Return true if we can Pivot on this variable. + virtual bool IsPivotable() const + { return false; } + + // Return true if this is a restricted (or slack) variable. Such + // variables are constrained to be non-negative and occur only + // internally to the simplex solver. + virtual bool IsRestricted() const + { return true; } + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClEditConstraint.h b/libs/cassowary/cassowary/ClEditConstraint.h new file mode 100644 index 0000000000..4bd91e2ca2 --- /dev/null +++ b/libs/cassowary/cassowary/ClEditConstraint.h @@ -0,0 +1,45 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClEditConstraint.h + +#ifndef ClEditConstraint_H +#define ClEditConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClEditOrStayConstraint.h" + +class ClEditConstraint : public ClEditOrStayConstraint { + typedef ClEditOrStayConstraint super; + public: + + ClEditConstraint(const ClVariable var, + const ClStrength &strength = ClsStrong(), double weight = 1.0 ) : + ClEditOrStayConstraint(var,strength,weight) + { } + + // Returns true if this is an edit constraint + virtual bool IsEditConstraint() const + { return true; } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { super::PrintOn(xo); return xo << "= edit)"; } +#endif + + private: + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClEditOrStayConstraint.h b/libs/cassowary/cassowary/ClEditOrStayConstraint.h new file mode 100644 index 0000000000..79b6761b69 --- /dev/null +++ b/libs/cassowary/cassowary/ClEditOrStayConstraint.h @@ -0,0 +1,51 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClEditOrStayConstraint.h + +#ifndef ClEditOrStayConstraint_H +#define ClEditOrStayConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "ClConstraint.h" +#include "ClLinearExpression.h" + +class ClVariable; + +class ClEditOrStayConstraint : public ClConstraint { + public: + + ClEditOrStayConstraint(const ClVariable var, + const ClStrength &strength = ClsRequired(), double weight = 1.0 ) : + ClConstraint(strength,weight), + _variable(var) + { } + + const ClVariable variable() const + { return _variable; } + + ClLinearExpression Expression() const + { return ClLinearExpression(_variable,-1,_variable.Value()); } + + private: + + void setVariable( const ClVariable v) + { _variable = v; } + + /// instance variables + ClVariable _variable; + + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClErrors.h b/libs/cassowary/cassowary/ClErrors.h new file mode 100644 index 0000000000..867c578dbc --- /dev/null +++ b/libs/cassowary/cassowary/ClErrors.h @@ -0,0 +1,179 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClErrors.h + +#ifndef ClErrors_H +#define ClErrors_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClTypedefs.h" +#include +#include + +using std::string; +using std::exception; + +class ExCLError : public exception { + public: + ExCLError() : _msg(0) { } + virtual ~ExCLError() throw() {} + virtual string description() const + { return "(ExCLError) An error has occured in CL"; } + protected: + char *_msg; +}; + +class ExCLInternalError : public ExCLError { + public: + ExCLInternalError(const char *sz) + { _msg = strdup(sz); } + virtual string description() const + { + if (_msg) return _msg; + else return "(ExCLInternalError) An internal error has occurred"; + } +}; + +class ExCLBadResolve : public ExCLError { + public: + ExCLBadResolve(const char *sz) + { _msg = strdup(sz); } + virtual string description() const + { + if (_msg) return _msg; + else return "(ExCLBadResolve) Number of resolve values did not match number of edit vars"; + } +}; + +class ExCLEditMisuse : public ExCLError { + public: + ExCLEditMisuse(const char *sz) + { _msg = strdup(sz); } + virtual string description() const + { + if (_msg) return _msg; + return "(ExCLEditMisuse) Edit protocol usage violation"; + } +}; + +class ExCLTooDifficult : public ExCLError { + public: + virtual string description() const + { return "(ExCLTooDifficult) The constraints are too difficult to solve"; } +}; + +class ExCLTooDifficultSpecial : public ExCLTooDifficult { + public: + ExCLTooDifficultSpecial(const char *sz) + { _msg = strdup(sz); } + virtual string description() const + { + if (_msg) return _msg; + else return "(ExCLTooDifficultSpecial) Solver requirements are not satisfied"; + } +}; + +class ExCLReadOnlyNotAllowed : public ExCLTooDifficult { + public: + virtual string description() const + { return "(ExCLReadOnlyNotAllowed) The read-only annotation is not permitted by the solver"; } +}; + +class ExCLCycleNotAllowed : public ExCLTooDifficult { + public: + virtual string description() const + { return "(ExCLCycleNotAllowed) A cyclic constraint graph is not permitted by the solver"; } +}; + +class ExCLStrictInequalityNotAllowed : public ExCLTooDifficult { + public: + virtual string description() const + { return "(ExCLStrictInequalityNotAllowed) The strict inequality is not permitted by the solver"; } +}; + +class ExCLRequiredFailure : public ExCLError { + public: + virtual ~ExCLRequiredFailure() throw() {} + virtual string description() const + { return "(ExCLRequiredFailure) A required constraint cannot be satisfied"; } +}; + +class ExCLNotEnoughStays : public ExCLError { + public: + virtual string description() const + { return "(ExCLNotEnoughStays) There are not enough stays to give specific values to every variable"; } +}; + +class ExCLNonlinearExpression : public ExCLError { + public: + virtual string description() const + { return "(ExCLNonlinearExpression) The resulting expression would be nonlinear"; } +}; + +class ExCLConstraintNotFound : public ExCLError { + public: + virtual string description() const + { return "(ExCLConstraintNotFound) Tried to remove a constraint that was never added"; } +}; + +class ExCLParseError : public ExCLError { + public: + virtual ~ExCLParseError() throw() {} + virtual string description() const + { return "(ExCLParseError)"; } +}; + +class ExCLParseErrorMisc : public ExCLParseError { + public: + ExCLParseErrorMisc(const string &s) + : _msg("(ExCLParseError) ") + { _msg += s; } + virtual ~ExCLParseErrorMisc() throw() {} + virtual string description() const + { return _msg; } + private: + string _msg; +}; + +class ExCLParseErrorBadIdentifier : public ExCLParseError { + public: + ExCLParseErrorBadIdentifier(const string &id) + : _msg("(ExCLParseErrorBadIdentifier) Did not recognize identifier '") + { + _msg += id; + _msg += "'"; + } + virtual ~ExCLParseErrorBadIdentifier() throw() {} + virtual string description() const + { return _msg; } + private: + string _msg; +}; + +class ExCLRequiredFailureWithExplanation : public ExCLRequiredFailure +{ +public: + virtual ~ExCLRequiredFailureWithExplanation() throw() {} + virtual string description() const + { return "(ExCLRequiredFailureWithExplanation) A required constraint cannot be satisfied"; } + virtual void AddConstraint(const ClConstraint *cnExpl) + { _explanation.insert(cnExpl); } + virtual const ClConstraintSet & explanation() const + { return _explanation; } +protected: + ClConstraintSet _explanation; +}; + +#endif // ClErrors_H diff --git a/libs/cassowary/cassowary/ClFDBinaryOneWayConstraint.h b/libs/cassowary/cassowary/ClFDBinaryOneWayConstraint.h new file mode 100644 index 0000000000..a779ec1f91 --- /dev/null +++ b/libs/cassowary/cassowary/ClFDBinaryOneWayConstraint.h @@ -0,0 +1,94 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDBinaryOneWayConstraint.h + +#ifndef ClFDBinaryOneWayConstraint_H +#define ClFDBinaryOneWayConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClFDConstraint.h" + +class ClLinearConstraint; + +// Just a node in the class hierarchy for now +class ClFDBinaryOneWayConstraint : public ClFDConstraint { + private: typedef ClFDConstraint super; + + public: + + ClFDBinaryOneWayConstraint(ClVariable vRW, enum ClCnRelation rel, ClVariable vRO, + double coefficient = 1.0, double constant = 0.0, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) + : ClFDConstraint(strength,weight), _vRW(vRW), _rel(rel), _vRO(vRO), + _coefficient(coefficient), _constant(constant) + { } + + ClFDBinaryOneWayConstraint(ClVariable vRW, enum ClCnRelation rel, double constant, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) + : ClFDConstraint(strength,weight), _vRW(vRW), _rel(rel), _vRO(clvNil), + _coefficient(0), _constant(constant) + { } + + ClFDBinaryOneWayConstraint(const ClConstraint &cn); + + static void EnsurePreconditionsForCn(const ClConstraint &cn); + + static bool FCanConvertCn(const ClConstraint &cn); + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { + xo << "FDCn: " << _vRW << " " << StrCnRelation(_rel) << " "; + if (_coefficient != 0) { + if (_coefficient != 1) xo << _coefficient << "*"; + if (_vRO != clvNil) xo << _vRO; + } + if (_constant != 0) xo << " + " << _constant; + return xo; + } + + friend ostream& operator<<(ostream &xos, const ClFDBinaryOneWayConstraint &constraint) + { return constraint.PrintOn(xos); } + +#endif + + ClVariable ClvRW() const + { return _vRW; } + ClVariable ClvRO() const + { return _vRO; } + enum ClCnRelation Relation() const + { return _rel; } + double Coefficient() const + { return _coefficient; } + double Constant() const + { return _constant; } + + bool IsInequality() const + { return (_rel != cnEQ && _rel != cnNEQ); } + + bool IsStrictInequality() const + { return (_rel == cnGT || _rel == cnLT); } + + protected: + ClVariable _vRW; + enum ClCnRelation _rel; + ClVariable _vRO; + double _coefficient; + double _constant; +}; + +#endif diff --git a/libs/cassowary/cassowary/ClFDConnectorVariable.h b/libs/cassowary/cassowary/ClFDConnectorVariable.h new file mode 100644 index 0000000000..4ae38ae42e --- /dev/null +++ b/libs/cassowary/cassowary/ClFDConnectorVariable.h @@ -0,0 +1,89 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDConnectorVariable.h + +#ifndef ClFDConnectorVariable_H +#define ClFDConnectorVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include +#include +#include +#include "Cassowary.h" +#include "ClVariable.h" +#include "ClFDVariable.h" +#include "ClLinearEquation.h" +#include "ClSimplexSolver.h" + +/* Creates a new variable in the FD region + that sets clvFloat in solver (simplex region) + when it changes */ +class ClFDConnectorVariable : public ClFDVariable { +public: + typedef ClFDVariable super; + + ClFDConnectorVariable(string name, FDNumber Value, const list &initial_domain, + ClSimplexSolver &solver, ClVariable clvFloat) : + ClFDVariable(name,Value,initial_domain), + _solver(solver), + _clvFloat(clvFloat), + _pcnRequiredLink(new ClLinearEquation(clvFloat,Value)) + { solver.AddConstraint(_pcnRequiredLink); } + +#ifndef CL_NO_IO + // Prints a semi-descriptive representation to the stream, using the + // name if there is one, and otherwise the hash number of this + // object. + // EXAMPLE + // [x:10.0] -- name = "x", Value = 10.0 + virtual ostream &PrintOn(ostream &xo) const; +#endif + + // permit overriding in subclasses in case something needs to be + // done when the Value is changed by the solver + // may be called when the Value hasn't actually changed -- just + // means the solver is setting the external variable + virtual void ChangeValue(FDNumber Value) + { + if (_value != Value) { + _value = Value; + cerr << "Updating " << _clvFloat << " now!" << endl; + _solver.RemoveConstraint(_pcnRequiredLink); + _pcnRequiredLink->ChangeConstant(_value); + _solver.AddConstraint(_pcnRequiredLink); + } + } + +private: + + // similar to SetValue -- see caveat above -- made private for now + // since it's probably the wrong thing and is too easy to invoke + FDNumber operator=(FDNumber Value) + { _value = Value; return Value; } + + // Copy constructor left undefined since we want to + // outlaw passing by Value! Will get a link error if you + // try to use within ClFDConnectorVariable.c, compile-time error everywhere else + ClFDConnectorVariable(const ClFDConnectorVariable &); + + ClSimplexSolver &_solver; + + ClVariable _clvFloat; + + ClLinearEquation *_pcnRequiredLink; + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClFDConstraint.h b/libs/cassowary/cassowary/ClFDConstraint.h new file mode 100644 index 0000000000..2cf9776449 --- /dev/null +++ b/libs/cassowary/cassowary/ClFDConstraint.h @@ -0,0 +1,40 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDConstraint.h + +#ifndef ClFDConstraint_H +#define ClFDConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClConstraint.h" + + +// Just a node in the class hierarchy for now +class ClFDConstraint : public ClConstraint { + private: typedef ClConstraint super; + + public: + // Constructor + ClFDConstraint(const ClStrength &strength = ClsRequired(), + double weight = 1.0) + : ClConstraint(strength, weight) { } + + virtual bool FIsOkayForSimplexSolver() const { return false; } + + protected: + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClFDSolver.h b/libs/cassowary/cassowary/ClFDSolver.h new file mode 100644 index 0000000000..2fbb637764 --- /dev/null +++ b/libs/cassowary/cassowary/ClFDSolver.h @@ -0,0 +1,120 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSolver.h + +#ifndef ClFDSolver_H +#define ClFDSolver_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClSolver.h" +#include "ClVariable.h" +#include "ClErrors.h" +#include "ClTypedefs.h" +#include "ClSymbolicWeight.h" +#include +#include + +using std::map; + +class ClVariable; +class ClFDBinaryOneWayConstraint; + +// ClFDSolver is a concrete class +// implementing a very restricted (for now --04/23/99 gjb) +// finite-domain constraint solving algorithm +class ClFDSolver: public ClSolver { + public: + ClFDSolver() + : _setCns(), _mapClvToCns(), G(), nodeToVar(G) + { G.make_directed(); } + + virtual ~ClFDSolver() + { } + + virtual ClFDSolver &AddConstraint(ClConstraint *const pcn); + + virtual ClFDSolver &RemoveConstraint(ClConstraint *const pcn); + + virtual ClFDSolver &Solve(); + + virtual ClFDSolver &ShowSolve(); + + void ChangeClv(ClVariable clv, FDNumber n) { + clv.ChangeValue(n); + if (_pfnChangeClvCallback) { + _pfnChangeClvCallback(&clv,this); + } + } + + +#ifndef CL_NO_IO + ostream &PrintOn(ostream &xo) const; + + ostream &PrintInternalInfo(ostream &xo) const; + + ostream &PrintOnVerbose(ostream &xo) const + { PrintOn(xo); PrintInternalInfo(xo); xo << endl; return xo; } + + friend ostream &operator<<(ostream &xo, const ClFDSolver &solver); + +#endif + + protected: + + virtual ClFDSolver &AddConstraintInternal(ClConstraint *const pcn); + + virtual ClFDSolver &RemoveConstraintInternal(ClConstraint *const pcn); + + /* Create node for v in G, if necessary, + otherwise return the node we already created. */ + node GetVarNode(ClVariable v); + + /* return the best (lowest) incremental error and the value + at which that error occurs */ + pair ComputeBest(ClFDVariable *pcldv); + + ClSymbolicWeight ErrorForClvAtValSubjectToCn(ClFDVariable *pcldv, + FDNumber value,const ClConstraint &cn); + + /* Turn all FDVariable FIsSet() flags to false */ + void ResetSetFlagsOnVariables(); + + /* all the constraints in the solver */ + ClConstraintSet _setCns; + + /* _mapClvToCns maps variable to the constraints in which + it is rw (it omits where it is ro) */ + ClVarToConstraintSetMap _mapClvToCns; + + /* track what edges correspond to which constraints + so we can update the constraint graph when + removing a constraint */ + map _mapCnToEdge; + + /* track what nodes correspond to which variables */ + map _mapVarToNode; + + /* directed graph that mirrors the structure of + the relations of the added constraints */ + graph G; + + node_map nodeToVar; +}; + +#define FDN_EOL LONG_MIN + +void ListPushOnto(list *pl, ...); + +#endif diff --git a/libs/cassowary/cassowary/ClFDVariable.h b/libs/cassowary/cassowary/ClFDVariable.h new file mode 100644 index 0000000000..326b339459 --- /dev/null +++ b/libs/cassowary/cassowary/ClFDVariable.h @@ -0,0 +1,126 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFDVariable.h + +#ifndef ClFDVariable_H +#define ClFDVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include +#include +#include +#include "Cassowary.h" +#include "ClAbstractVariable.h" + +using std::map; +using std::list; +using std::string; + +class ClFDVariable : public ClAbstractVariable { +public: + typedef ClAbstractVariable super; + +#if 0 /* GJB:FIXME:: */ + ClFDVariable(string name, FDNumber Value) : + ClAbstractVariable(name), + _value(Value), + _fSet(true), + _desired_value(Value), + _plfdnInitialDomain(0) + { } +#endif + + ClFDVariable(string name, FDNumber Value, const list &initial_domain) : + ClAbstractVariable(name), + _value(Value), + _fSet(true), + _desired_value(Value), + _plfdnInitialDomain(new list()) + { + *_plfdnInitialDomain = initial_domain; + } + + virtual bool IsFDVariable() const + { return true; } + + // Return true if this a variable known outside the solver. + // (We need to give such variables a Value after solving is complete.) + virtual bool IsExternal() const + { return true; } + +#ifndef CL_NO_IO + // Prints a semi-descriptive representation to the stream, using the + // name if there is one, and otherwise the hash number of this + // object. + // EXAMPLE + // [x:10.0] -- name = "x", Value = 10.0 + virtual ostream &PrintOn(ostream &xo) const; +#endif + + // Return the current Value I hold. + Number Value() const + { return _value; } + + // Round the Value to an integer and return it + int IntValue() const + { return _value; } + + // change the Value held -- should *not* use this if the variable is + // in a solver -- instead use AddEditVar() and SuggestValue() interface + void SetValue(FDNumber Value) + { _value = Value; } + + // permit overriding in subclasses in case something needs to be + // done when the Value is changed by the solver + // may be called when the Value hasn't actually changed -- just + // means the solver is setting the external variable + virtual void ChangeValue(FDNumber Value) + { _value = Value; } + + virtual bool FIsSet() + { return _fSet; } + + virtual void SetFIsSet(bool f) + { _fSet = f; } + + virtual FDNumber DesiredValue() const + { return _desired_value; } + + virtual const list *PlfdnDomain() const + { return _plfdnInitialDomain; } + +protected: + + // similar to SetValue -- see caveat above -- made private for now + // since it's probably the wrong thing and is too easy to invoke + FDNumber operator=(FDNumber Value) + { _value = Value; return Value; } + + // Copy constructor left undefined since we want to + // outlaw passing by Value! Will get a link error if you + // try to use within ClFDVariable.c, compile-time error everywhere else + ClFDVariable(const ClFDVariable &); + + FDNumber _value; + + // has the _value been set? Used during solves. + bool _fSet; + + FDNumber _desired_value; + + list *_plfdnInitialDomain; +}; + +#endif diff --git a/libs/cassowary/cassowary/ClFloatVariable.h b/libs/cassowary/cassowary/ClFloatVariable.h new file mode 100644 index 0000000000..4e58036ab7 --- /dev/null +++ b/libs/cassowary/cassowary/ClFloatVariable.h @@ -0,0 +1,119 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClFloatVariable.h + +#ifndef ClFloatVariable_H +#define ClFloatVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include +#include +#include "Cassowary.h" +#include "ClAbstractVariable.h" + +using std::map; +using std::string; + +class ClFloatVariable : public ClAbstractVariable { +public: + typedef ClAbstractVariable super; + + ClFloatVariable(string name, Number Value = 0.0) : + ClAbstractVariable(name), + _value(Value) + { } + + ClFloatVariable(Number Value = 0.0) : + ClAbstractVariable(""), + _value(Value) + { } + + ClFloatVariable(long number, char *prefix, Number Value = 0.0) : + ClAbstractVariable(number,prefix), + _value(Value) + { } + + virtual bool IsFloatVariable() const + { return true; } + + // Return true if this a dummy variable (used as a marker variable + // for required equality constraints). Such variables aren't + // allowed to enter the basis when pivoting. + virtual bool IsDummy() const + { return false; } + + // Return true if this a variable known outside the solver. + // (We need to give such variables a Value after solving is complete.) + virtual bool IsExternal() const + { return true; } + + // Return true if we can Pivot on this variable. + virtual bool IsPivotable() const + { return false; } + + // Return true if this is a restricted (or slack) variable. Such + // variables are constrained to be non-negative and occur only + // internally to the simplex solver. + virtual bool IsRestricted() const + { return false; } + +#ifndef CL_NO_IO + // Prints a semi-descriptive representation to the stream, using the + // name if there is one, and otherwise the hash number of this + // object. + // EXAMPLE + // [x:10.0] -- name = "x", Value = 10.0 + virtual ostream &PrintOn(ostream &xo) const; +#endif + + // Return the current Value I hold. + Number Value() const + { return _value; } + + // Round the Value to an integer and return it + int IntValue() const + { return int(_value + 0.5); } + + // change the Value held -- should *not* use this if the variable is + // in a solver -- instead use AddEditVar() and SuggestValue() interface + void SetValue(Number Value) + { _value = Value; } + + // permit overriding in subclasses in case something needs to be + // done when the Value is changed by the solver + // may be called when the Value hasn't actually changed -- just + // means the solver is setting the external variable + virtual void ChangeValue(Number Value) + { _value = Value; } + +private: + + // similar to SetValue -- see caveat above -- made private for now + // since it's probably the wrong thing and is too easy to invoke + Number operator=(Number Value) + { _value = Value; return Value; } + + // Copy constructor left undefined since we want to + // outlaw passing by Value! Will get a link error if you + // try to use within ClFloatVariable.c, compile-time error everywhere else + ClFloatVariable(const ClFloatVariable &); + + Number _value; + +}; + + + +#endif diff --git a/libs/cassowary/cassowary/ClLinearConstraint.h b/libs/cassowary/cassowary/ClLinearConstraint.h new file mode 100644 index 0000000000..d657d1d73e --- /dev/null +++ b/libs/cassowary/cassowary/ClLinearConstraint.h @@ -0,0 +1,61 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClLinearConstraint.h + +#ifndef ClLinearConstraint_H +#define ClLinearConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClConstraint.h" +#include "ClLinearExpression.h" + + +// Add the ClLinearExpression member variable needed for both +// ClLinearEquation and ClLinearInequality +class ClLinearConstraint : public ClConstraint { + private: typedef ClConstraint super; + + public: + + // Constructor + ClLinearConstraint(const ClLinearExpression &cle, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClConstraint(strength, weight), + _expression(cle) + { } + + virtual ~ClLinearConstraint() {} + + // Return my linear Expression. (For linear equations, this + // constraint represents Expression=0; for linear inequalities it + // represents Expression>=0.) + ClLinearExpression Expression() const + { return _expression; } + + // do not do this if *this is inside a solver + void ChangeConstant(Number constant) + { _expression.Set_constant(constant); } + + protected: + + ClLinearExpression _expression; + + virtual void setExpression( const ClLinearExpression &expr) + { _expression = expr; } + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClLinearEquation.h b/libs/cassowary/cassowary/ClLinearEquation.h new file mode 100644 index 0000000000..a02b51d70b --- /dev/null +++ b/libs/cassowary/cassowary/ClLinearEquation.h @@ -0,0 +1,74 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClLinearEquation.h + +#ifndef ClLinearEquation_H +#define ClLinearEquation_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClLinearConstraint.h" +#include "ClLinearExpression.h" + +class ClStrength; +class ClVariable; + +class ClLinearEquation : public ClLinearConstraint { + private: typedef ClLinearConstraint super; + + public: + //// Constructors + + // ClLinearEquation(expr,...) is expr == 0 + ClLinearEquation(const ClLinearExpression &cle, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint(cle,strength, weight) + { } + + // ClLinearEquation(var,expr,...) is var == expr + ClLinearEquation(ClVariable clv, + const ClLinearExpression &cle, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint(cle,strength,weight) + { _expression.AddVariable(clv,-1.0); } + + // ClLinearEquation(expr,var,...) is var == expr + ClLinearEquation(const ClLinearExpression &cle, + ClVariable clv, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint(cle,strength,weight) + { _expression.AddVariable(clv,-1.0); } + + // ClLinearEquation(expr,expr,...) is expr == expr + ClLinearEquation(const ClLinearExpression &cle1, + const ClLinearExpression &cle2, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint(cle1,strength,weight) + { _expression.AddExpression(cle2,-1.0); } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { super::PrintOn(xo); xo << " = 0 )"; return xo; } +#endif + + virtual bool FIsSatisfied() const + { return (_expression.Evaluate() == 0); } + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClLinearExpression.h b/libs/cassowary/cassowary/ClLinearExpression.h new file mode 100644 index 0000000000..0a1df9c243 --- /dev/null +++ b/libs/cassowary/cassowary/ClLinearExpression.h @@ -0,0 +1,298 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClLinearExpression.h + +#ifndef ClLinearExpression_H +#define ClLinearExpression_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "debug.h" +#include "ClVariable.h" +#include "ClLinearExpression_fwd.h" + +class ClSimplexSolver; +class ClTableau; +class ClSymbolicWeight; + +ClLinearExpression &cleNil(); + +template +class ClGenericLinearExpression { + public: + typedef std::map ClVarToCoeffMap; + + // convert Number-s into ClLinearExpression-s + ClGenericLinearExpression(T num = 0.0); + + // Convert from ClVariable to a ClLinearExpression + // this replaces ClVariable::asLinearExpression + ClGenericLinearExpression(ClVariable clv, T value = 1.0, T constant = 0.0); + + // copy ctr + ClGenericLinearExpression(const ClGenericLinearExpression &expr) : + _constant(expr._constant), + _terms(expr._terms) + { } + + virtual ~ClGenericLinearExpression(); + + // Return a new linear expression formed by multiplying self by x. + // (Note that this result must be linear.) + ClGenericLinearExpression Times(Number x) const; + + // Return a new linear expression formed by multiplying self by x. + // (Note that this result must be linear.) + ClGenericLinearExpression Times(const ClGenericLinearExpression &expr) const; + + // Return a new linear expression formed by adding x to self. + ClGenericLinearExpression Plus(const ClGenericLinearExpression &expr) const; + + // Return a new linear expression formed by subtracting x from self. + ClGenericLinearExpression Minus(const ClGenericLinearExpression &expr) const; + + // Return a new linear expression formed by dividing self by x. + // (Note that this result must be linear.) + ClGenericLinearExpression Divide(Number x) const; + + + + // Return a new linear expression formed by multiplying self by x. + // (Note that this result must be linear.) + ClGenericLinearExpression *P_times(Number x) const + { return new ClGenericLinearExpression(Times(x)); } + + // Return a new linear expression formed by adding x to self. + ClGenericLinearExpression *P_plus(const ClGenericLinearExpression &expr) const + { return new ClGenericLinearExpression(Plus(expr)); } + + // Return a new linear expression formed by subtracting x from self. + ClGenericLinearExpression *P_minus(const ClGenericLinearExpression &expr) const + { return new ClGenericLinearExpression(Minus(expr)); } + + // Return a new linear expression formed by dividing self by x. + // (Note that this result must be linear.) + ClGenericLinearExpression *P_divide(Number x) const + { return new ClGenericLinearExpression(Divide(x)); } + + // Return a new linear expression formed by dividing self by x. + // (Note that this result must be linear.) + ClGenericLinearExpression Divide(const ClGenericLinearExpression &expr) const; + + // Return a new linear expression (aNumber/this). Since the result + // must be linear, this is permissible only if 'this' is a constant. + ClGenericLinearExpression DivFrom(const ClGenericLinearExpression &expr) const; + + // Return a new linear expression (aNumber-this). + ClGenericLinearExpression SubtractFrom(const ClGenericLinearExpression &expr) const + { return expr.Minus(*this); } + + // Add n*expr to this expression from another expression expr. + ClGenericLinearExpression &AddExpression(const ClGenericLinearExpression &expr, + Number n = 1.0); + + // Add n*expr to this expression from another expression expr. + // Notify the solver if a variable is added or deleted from this + // expression. + ClGenericLinearExpression &AddExpression(const ClGenericLinearExpression &expr, Number n, + ClVariable subject, + ClTableau &solver); + + // Add a term c*v to this expression. If the expression already + // contains a term involving v, Add c to the existing coefficient. + // If the new coefficient is approximately 0, delete v. + ClGenericLinearExpression &AddVariable(ClVariable v, T c = 1.0); + + // Add a term c*v to this expression. If the expression already + // contains a term involving v, Add c to the existing coefficient. + // If the new coefficient is approximately 0, delete v. + ClGenericLinearExpression &setVariable(ClVariable v, T c) + {assert(c != 0.0); _terms[v] = c; return *this; } + + // Add a term c*v to this expression. If the expression already + // contains a term involving v, Add c to the existing coefficient. + // If the new coefficient is approximately 0, delete v. Notify the + // solver if v appears or disappears from this expression. + ClGenericLinearExpression &AddVariable(ClVariable v, T c, + ClVariable subject, + ClTableau &solver); + + // Return a pivotable variable in this expression. (It is an error + // if this expression is constant -- signal ExCLInternalError in + // that case). Return NULL if no pivotable variables + ClVariable AnyPivotableVariable() const; + + // Replace var with a symbolic expression expr that is equal to it. + // If a variable has been added to this expression that wasn't there + // before, or if a variable has been dropped from this expression + // because it now has a coefficient of 0, inform the solver. + // PRECONDITIONS: + // var occurs with a non-Zero coefficient in this expression. + void SubstituteOut(ClVariable v, + const ClGenericLinearExpression &expr, + ClVariable subject, + ClTableau &solver); + + // This linear expression currently represents the equation + // oldSubject=self. Destructively modify it so that it represents + // the equation NewSubject=self. + // + // Precondition: NewSubject currently has a nonzero coefficient in + // this expression. + // + // NOTES + // Suppose this expression is c + a*NewSubject + a1*v1 + ... + an*vn. + // + // Then the current equation is + // oldSubject = c + a*NewSubject + a1*v1 + ... + an*vn. + // The new equation will be + // NewSubject = -c/a + oldSubject/a - (a1/a)*v1 - ... - (an/a)*vn. + // Note that the term involving NewSubject has been dropped. + void ChangeSubject(ClVariable old_subject, + ClVariable new_subject); + + // This linear expression currently represents the equation self=0. Destructively modify it so + // that subject=self represents an equivalent equation. + // + // Precondition: subject must be one of the variables in this expression. + // NOTES + // Suppose this expression is + // c + a*subject + a1*v1 + ... + an*vn + // representing + // c + a*subject + a1*v1 + ... + an*vn = 0 + // The modified expression will be + // subject = -c/a - (a1/a)*v1 - ... - (an/a)*vn + // representing + // subject = -c/a - (a1/a)*v1 - ... - (an/a)*vn + // + // Note that the term involving subject has been dropped. + // Returns the reciprocal, so ChangeSubject can use it, too + T NewSubject(ClVariable subject); + + // Return the value of the linear expression + // given the current assignments of values to contained variables + T Evaluate() const; + + // Return the coefficient corresponding to variable var, i.e., + // the 'ci' corresponding to the 'vi' that var is: + // v1*c1 + v2*c2 + .. + vn*cn + c + T CoefficientFor(ClVariable var) const + { + typename ClVarToCoeffMap::const_iterator it = _terms.find(var); + if (it != _terms.end()) + return (*it).second; + return 0.0; + } + + T Constant() const + { return _constant; } + + void Set_constant(T c) + { _constant = c; } + + const ClVarToCoeffMap &Terms() const + { return _terms; } + + ClVarToCoeffMap &Terms() + { return _terms; } + + void IncrementConstant(T c) + { _constant += c; } + + bool IsConstant() const + { return _terms.size() == 0; } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const; + + friend ostream &operator<<(ostream &xo,const ClGenericLinearExpression &cle) + { return cle.PrintOn(xo); } +#endif + + friend ClGenericLinearExpression operator+(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Plus(e2); } + + friend ClGenericLinearExpression operator-(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Minus(e2); } + + friend ClGenericLinearExpression operator*(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Times(e2); } + + + friend ClGenericLinearExpression operator/(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Divide(e2); } + + // FIXGJB -- this may be wrong -- should test underlying expression for equality + friend bool operator==(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return &e1 == &e2; } + + /// Named versions of the operator functions for ease of + /// wrapping, or expressing using prefix notation + + friend ClGenericLinearExpression Plus(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Plus(e2); } + + friend ClGenericLinearExpression Minus(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Minus(e2); } + + friend ClGenericLinearExpression Times(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return e1.Times(e2); } + + + friend ClGenericLinearExpression *Divide(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return new ClGenericLinearExpression(e1.Divide(e2)); } + + friend ClGenericLinearExpression *p_Plus(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return new ClGenericLinearExpression(e1.Plus(e2)); } + + friend ClGenericLinearExpression *p_Minus(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return new ClGenericLinearExpression(e1.Minus(e2)); } + + friend ClGenericLinearExpression *p_Times(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return new ClGenericLinearExpression(e1.Times(e2)); } + + friend ClGenericLinearExpression *p_Divide(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return new ClGenericLinearExpression(e1.Divide(e2)); } + + + // FIXGJB -- this may be wrong -- should test underlying expression for equality + friend bool FEquals(const ClGenericLinearExpression &e1, + const ClGenericLinearExpression &e2) + { return &e1 == &e2; } + + ClGenericLinearExpression &MultiplyMe(T x); + + private: + + T _constant; + ClVarToCoeffMap _terms; + +}; + +typedef ClGenericLinearExpression::ClVarToCoeffMap ClVarToNumberMap; + +#endif diff --git a/libs/cassowary/cassowary/ClLinearExpression_fwd.h b/libs/cassowary/cassowary/ClLinearExpression_fwd.h new file mode 100644 index 0000000000..99b48557ec --- /dev/null +++ b/libs/cassowary/cassowary/ClLinearExpression_fwd.h @@ -0,0 +1,26 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClLinearExpression.h + +#ifndef ClLinearExpression_fwd_H +#define ClLinearExpression_fwd_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" + +template class ClGenericLinearExpression; +typedef ClGenericLinearExpression ClLinearExpression; +typedef ClLinearExpression* PClLinearExpression; + +#endif diff --git a/libs/cassowary/cassowary/ClLinearInequality.h b/libs/cassowary/cassowary/ClLinearInequality.h new file mode 100644 index 0000000000..017c4b819e --- /dev/null +++ b/libs/cassowary/cassowary/ClLinearInequality.h @@ -0,0 +1,167 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClLinearInequality.h + +#ifndef ClLinearInequality_H +#define ClLinearInequality_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "ClConstraint.h" +#include "ClLinearConstraint.h" + +class ClVariable; + +class ClLinearInequality : public ClLinearConstraint { + private: typedef ClLinearConstraint super; + + public: + //// Constructors + // ClLinearInequality(expr,...) is expr >= 0 + ClLinearInequality(const ClLinearExpression &cle, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint(cle,strength, weight), + _fStrictInequality(false) + { } + + // ClLinearInequality(var,OP,expr) is var >= expr + ClLinearInequality(const ClVariable clv, + enum ClCnRelation op, + const ClLinearExpression &cle, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint( cle, strength, weight), + _fStrictInequality(false) + { + if (op == cnGEQ || op == cnGT) + { + _expression.MultiplyMe(-1.0); + _expression.AddVariable(clv,1.0); + } + else if (op == cnLEQ || op == cnGEQ) + { + _expression.AddVariable(clv,-1.0); + } + else + { + throw ExCLEditMisuse("Cannot use that operator for ClLinearInequality objects"); + } + if (op == cnLT || op == cnGT) { + _fStrictInequality = true; + } + } + +#ifdef FIXGJB_AMBIGUOUS + // ClLinearInequality(expr,OP,var) is var ?<>? expr + ClLinearInequality(const ClLinearExpression &cle, + enum ClCnRelation op, + const ClVariable clv, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint( cle, strength, weight), + _fStrictInequality(false) + { + if (op == cnLEQ || op == cnLT) + { + _expression.MultiplyMe(-1.0); + _expression.AddVariable(clv,1.0); + } + else if (op == cnGEQ || op == cnGT) + { + _expression.AddVariable(clv,-1.0); + } + if (op == cnLT || op == cnGT) { + _fStrictInequality = true; + } + } +#endif + + // ClLinearInequality(expr,OP,expr) is expr >= expr + ClLinearInequality(const ClLinearExpression &cle1, + enum ClCnRelation op, + const ClLinearExpression &cle2, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint( cle2, strength, weight), + _fStrictInequality(false) + { + if (op == cnGEQ || op == cnGT) + { + _expression.MultiplyMe(-1.0); + _expression.AddExpression(cle1); + } + else if (op == cnLEQ || op == cnLT) + { + _expression.AddExpression(cle1,-1.0); + } + if (op == cnLT || op == cnGT) { + _fStrictInequality = true; + } + } + +#ifdef FIXGJB_AMBIGUOUS + // ClLinearInequality(var,OP,var) is var ?<>? var + ClLinearInequality(const ClVariable clv1, + enum ClCnRelation op, + const ClVariable clv2, + const ClStrength &strength = ClsRequired(), + double weight = 1.0) : + ClLinearConstraint( clv2, strength, weight), + _fStrictInequality(false) + { + if (op == cnGEQ || op == cnGT) + { + _expression.MultiplyMe(-1.0); + _expression.AddVariable(clv1,1.0); + } + else if (op == cnLEQ || op == cnLT) + { + _expression.AddVariable(clv1,-1.0); + } + if (op == cnLT || op == cnGT) { + _fStrictInequality = true; + } + } +#endif + + + // Return true if this is an inequality constraint and + // false if it is an equality constraint. The default is + // that it is not. + virtual bool IsInequality() const + { return true; } + + virtual bool IsStrictInequality() const + { return _fStrictInequality; } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { super::PrintOn(xo); xo << " >= 0 )"; return xo; } +#endif + + virtual bool FIsSatisfied() const + { + Number v = _expression.Evaluate(); + if (_fStrictInequality) + return (v > 0); + else + return (v >= 0); + } + + private: + + bool _fStrictInequality; +}; + +#endif diff --git a/libs/cassowary/cassowary/ClObjectiveVariable.h b/libs/cassowary/cassowary/ClObjectiveVariable.h new file mode 100644 index 0000000000..664e2d65a4 --- /dev/null +++ b/libs/cassowary/cassowary/ClObjectiveVariable.h @@ -0,0 +1,63 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClObjectiveVariable.h + +#ifndef ClObjectiveVariable_H +#define ClObjectiveVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClAbstractVariable.h" + +class ClTableau; +class ClSimplexSolver; + +class ClObjectiveVariable : public ClAbstractVariable { +protected: + friend class ClTableau; + friend class ClSimplexSolver; + + ClObjectiveVariable(string name = "") : + ClAbstractVariable(name) + { } + + ClObjectiveVariable(long number, char *prefix) : + ClAbstractVariable(number,prefix) + { } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { + xo << "[" << Name() << ":obj]"; + return xo; + } +#endif + + // We don't need to give such variables a Value after solving is complete. + virtual bool IsExternal() const + { return false; } + + // Return true if we can Pivot on this variable. + virtual bool IsPivotable() const + { return false; } + + // Return true if this is a restricted (or slack) variable. Such + // variables are constrained to be non-negative and occur only + // internally to the simplex solver. + virtual bool IsRestricted() const + { return false; } + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClPoint.h b/libs/cassowary/cassowary/ClPoint.h new file mode 100644 index 0000000000..15139aa73b --- /dev/null +++ b/libs/cassowary/cassowary/ClPoint.h @@ -0,0 +1,74 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClPoint.h + +#ifndef ClPoint_H +#define ClPoint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClVariable.h" + +// ClPoint is just a convenience class for pairs of +// ClVariables -- often useful for coordinate pairs in 2-space +class ClPoint { + public: + ClPoint(Number x, Number y) + : _clv_x(x), _clv_y(y) + { } + + ClPoint() + { } + + ClVariable X() + { return _clv_x; } + + ClVariable Y() + { return _clv_y; } + + const ClVariable X() const + { return _clv_x; } + + const ClVariable Y() const + { return _clv_y; } + + void SetXY(Number x, Number y) + { _clv_x.SetValue(x); _clv_y.SetValue(y); } + + Number Xvalue() const + { return X().Value(); } + + Number Yvalue() const + { return Y().Value(); } + + private: + ClVariable _clv_x; + ClVariable _clv_y; + +#ifndef CL_NO_IO + friend ostream &operator<<(ostream &xo, const ClPoint &clp); +#endif + +}; + +#ifndef CL_NO_IO +inline ostream & +operator<<(ostream &xo, const ClPoint &clp) +{ + xo << "(" << clp._clv_x << ", " << clp._clv_y << ")"; + return xo; +} +#endif + +#endif diff --git a/libs/cassowary/cassowary/ClReader.h b/libs/cassowary/cassowary/ClReader.h new file mode 100644 index 0000000000..59369d6ac2 --- /dev/null +++ b/libs/cassowary/cassowary/ClReader.h @@ -0,0 +1,117 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClReader.h +// Original implementation contributed by Steve Wolfman +// Subsequently largely revised by Greg J. Badros + +#ifndef CREADER_H +#define CREADER_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include +#include +#include +#include "ClErrors.h" +#include "ClVariable.h" +#include "ClStrength.h" +#include "ClLinearExpression_fwd.h" + +using std::string; +using std::istream; + +class ClConstraint; + +class ClVarLookupFunction : public std::unary_function { +public: + virtual ClVariable *operator()(const string &) const { return &clvNil; } +}; + + +// Attempts to read a constraint of input stream in +// Returns constraint (freshly allocated, client responsibility to deallocate) +// if succesful. Otherwise, returns 0. +ClConstraint *PcnParseConstraint(istream &xi, const ClVarLookupFunction &lookup_func, + const ClStrength &strength = ClsRequired()); + +class ClVarLookupInMap : public ClVarLookupFunction { +public: + ClVarLookupInMap(StringToVarMap *pmapVars, bool fAutoCreate) + : _pmapVars(pmapVars), _fAutoCreate(fAutoCreate) { } + + ClVariable *operator()(const string &str) const + { + if (!_pmapVars) + return &clvNil; + StringToVarMap &_mapVars = *_pmapVars; + StringToVarMap::iterator it = _mapVars.find(str); + if (it != _mapVars.end()) { + return &it->second; + } else if (_fAutoCreate) { + // save the old symbol table, if any + StringToVarMap *pmapOld = ClVariable::VarMap(); + // and set it to this one temporarily + ClVariable::SetVarMap(&_mapVars); + ClVariable *pclv = new ClVariable(str); + // now switch it back + ClVariable::SetVarMap(pmapOld); + return pclv; + } else { + return &clvNil; + } + } +private: + StringToVarMap *_pmapVars; + bool _fAutoCreate; +}; + + +/* the "yyerror" function */ +void clerror(const char *sz); + +struct ClParseData { + ClParseData(istream &xi, const ClVarLookupFunction &lookup_func) + : _xi(xi), _lookup_func(lookup_func) { } + + ClConstraint *Pcn() { return _pcn; } + + ClVarSet _readOnlyVarsSoFar; + + istream & _xi; + ClConstraint * _pcn; + const ClVarLookupFunction &_lookup_func; +}; + + +inline +const ClStrength +&ClsFromSz(const char *sz) +{ + const ClStrength *pcls = &ClsRequired(); + double n1, n2, n3; + if (strcmp("required",sz) == 0) + ; /* initialized to ClsRequired, above */ + else if (strcasecmp("strong",sz) == 0) { pcls = &ClsStrong(); } + else if (strcasecmp("medium",sz) == 0) { pcls = &ClsMedium(); } + else if (strcasecmp("weak",sz) == 0) { pcls = &ClsWeak(); } + else if (sscanf(sz,"(%lf,%lf,%lf)",&n1,&n2,&n3) == 3) { + pcls = new ClStrength("parsed",n1,n2,n3); + } else { + throw ExCLParseErrorMisc("Error parsing strength"); + } + return *pcls; +} + + +#endif diff --git a/libs/cassowary/cassowary/ClSimplexSolver.h b/libs/cassowary/cassowary/ClSimplexSolver.h new file mode 100644 index 0000000000..c187992728 --- /dev/null +++ b/libs/cassowary/cassowary/ClSimplexSolver.h @@ -0,0 +1,588 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSimplexSolver.h + +#ifndef ClSimplexSolver_H +#define ClSimplexSolver_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include +#include +#include "Cassowary.h" +#include "ClSolver.h" +#include "ClTableau.h" +#include "ClLinearInequality.h" +#include "ClStrength.h" +#include "ClStayConstraint.h" +#include "ClEditConstraint.h" +#include "ClSlackVariable.h" +#include "ClObjectiveVariable.h" +#include "ClErrors.h" +#include "ClTypedefs.h" + +using std::list; +using std::stack; +using std::ostream; + +class ClVariable; +class ClPoint; +class ExCLRequiredFailureWithExplanation; + + +// ClSimplexSolver encapsulates the solving behaviour +// of the cassowary algorithm +class ClSimplexSolver : public ClSolver, public ClTableau { + protected: + class ClEditInfo; + typedef list ClEditInfoList; + + ClEditInfo *PEditInfoFromClv(ClVariable clv) { + ClEditInfoList::iterator it = _editInfoList.begin(); + for (; it != _editInfoList.end(); ++it) { + ClEditInfo *pei = (*it); + if (pei->_clv == clv) + return pei; + } + return 0; + } + + public: + + // Constructor + ClSimplexSolver() : + ClSolver(), + _objective(ClVariable(new ClObjectiveVariable("Z"))), + _slackCounter(0), + _artificialCounter(0), +#ifdef CL_FIND_LEAK + _cArtificialVarsDeleted(0), +#endif + _dummyCounter(0), + _epsilon(1e-8), + _fResetStayConstantsAutomatically(true), + _fNeedsSolving(false), + _fExplainFailure(false), + _pfnResolveCallback(0), + _pfnCnSatCallback(0) + { + _rows[_objective] = new ClLinearExpression(); + // start out with no edit variables + _stkCedcns.push(0); +#ifdef CL_TRACE + std::cerr << "objective row new@ " << _rows[_objective] << std::endl; +#endif + } + + virtual ~ClSimplexSolver(); + + // Add constraints so that lower<=var<=upper. (nil means no bound.) + ClSimplexSolver &AddLowerBound(ClVariable v, Number lower) + { + ClLinearInequality *pcn = new ClLinearInequality(ClLinearExpression(v - lower)); + return AddConstraint(pcn); + } + ClSimplexSolver &AddUpperBound(ClVariable v, Number upper) + { + ClLinearInequality *pcn = new ClLinearInequality(ClLinearExpression(upper - v)); + return AddConstraint(pcn); + } + ClSimplexSolver &AddBounds(ClVariable v, Number lower, Number upper) + { AddLowerBound(v,lower); AddUpperBound(v,upper); return *this; } + + // Add the constraint cn to the tableau + ClSimplexSolver &AddConstraint(ClConstraint *const pcn); + +#ifndef CL_NO_DEPRECATED + // Deprecated! --02/19/99 gjb + ClSimplexSolver &AddConstraint(ClConstraint &cn) + { return AddConstraint(&cn); } +#endif + + // Add an edit constraint for "v" with given strength + ClSimplexSolver &AddEditVar(const ClVariable v, const ClStrength &strength = ClsStrong(), + double weight = 1.0 ) + { + ClEditConstraint *pedit = new ClEditConstraint(v, strength, weight); + return AddConstraint(pedit); + } + + ClSimplexSolver &RemoveEditVar(ClVariable v) + { + ClEditInfo *pcei = PEditInfoFromClv(v); + if (!pcei) { + throw ExCLEditMisuse("Removing edit variable that was not found"); + } + ClConstraint *pcnEdit = pcei->_pconstraint; + RemoveConstraint(pcnEdit); + delete pcnEdit; + return *this; + } + + // BeginEdit() should be called before sending + // Resolve() messages, after adding the appropriate edit variables + ClSimplexSolver &BeginEdit() + { + if (_editInfoList.size() == 0) { + throw ExCLEditMisuse("BeginEdit called, but no edit variable"); + } + // may later want to do more in here + _infeasibleRows.clear(); + ResetStayConstants(); + _stkCedcns.push(_editInfoList.size()); + return *this; + } + + // EndEdit should be called after editing has finished + // for now, it just removes edit variables added from before the last BeginEdit + ClSimplexSolver &EndEdit() + { + if (_editInfoList.size() == 0) + throw ExCLEditMisuse("EndEdit called but no edit variables"); + Resolve(); + _stkCedcns.pop(); + RemoveEditVarsTo(_stkCedcns.top()); + // may later want to do more in here + return *this; + } + + // RemoveAllEditVars() just eliminates all the edit constraints + // that were added + ClSimplexSolver &RemoveAllEditVars() { RemoveEditVarsTo(0); return *this; } + + // remove the last added edit vars to leave only n edit vars left + ClSimplexSolver &RemoveEditVarsTo(unsigned int n); + + int numEditVars() const + { return _editInfoList.size(); } + + // Add weak stays to the x and y parts of each point. These have + // increasing weights so that the solver will try to satisfy the x + // and y stays on the same point, rather than the x stay on one and + // the y stay on another. + ClSimplexSolver &AddPointStays(const vector &listOfPoints, + const ClStrength &strength = ClsWeak()); + + ClSimplexSolver &AddPointStay(const ClVariable vx, const ClVariable vy, + const ClStrength &strength = ClsWeak(), + double weight = 1.0) + { AddStay(vx,strength,weight); AddStay(vy,strength,weight); return *this; } + + ClSimplexSolver &AddPointStay(const ClPoint &clp, + const ClStrength &strength = ClsWeak(), + double weight = 1.0); + + + // Add a stay of the given strength (default to weak) of v to the tableau + ClSimplexSolver &AddStay(const ClVariable v, + const ClStrength &strength = ClsWeak(), double weight = 1.0 ) + { + ClStayConstraint *pcn = new ClStayConstraint(v,strength,weight); + return AddConstraint(pcn); + } + + // Remove the constraint cn from the tableau + // Also remove any error variable associated with cn + ClSimplexSolver &RemoveConstraint(ClConstraint *const pcn) + { RemoveConstraintInternal(pcn); pcn->removedFrom(*this); return *this; } + +#ifndef CL_NO_DEPRECATED + // Deprecated! --02/19/99 gjb + ClSimplexSolver &RemoveConstraint(ClConstraint &cn) + { return RemoveConstraint(&cn); } +#endif + + + // Re-initialize this solver from the original constraints, thus + // getting rid of any accumulated numerical problems. (Actually, we + // haven't definitely observed any such problems yet) + void Reset(); + + // Re-solve the current collection of constraints, given the new + // values for the edit variables that have already been + // suggested (see SuggestValue() method) + // This is not guaranteed to work if you remove an edit constraint + // from the middle of the edit constraints you added + // (e.g., edit A, edit B, edit C, remove B -> this will fail!) + // DEPRECATED + void Resolve(); + + // Re-solve the current collection of constraints for new values for + // the constants of the edit variables. + // This is implemented in terms of SuggestValue-s, and is + // less efficient than that more natural interface + void Resolve(const vector &newEditConstants); + + // Convenience function for Resolve-s of two variables + void Resolve(Number x, Number y) + { + vector vals; + vals.push_back(x); + vals.push_back(y); + Resolve(vals); + } + + // Suggest a new value for an edit variable + // the variable needs to be added as an edit variable + // and BeginEdit() needs to be called before this is called. + // The tableau will not be solved completely until + // after Resolve() has been called + ClSimplexSolver &SuggestValue(ClVariable v, Number x); + + // Set and check whether or not the solver will attempt to compile + // an explanation of failure when a required constraint conflicts + // with another required constraint + ClSimplexSolver &SetExplaining(bool f) + { _fExplainFailure = f; return *this; } + + bool FIsExplaining() const + { return _fExplainFailure; } + + // If autosolving has been turned off, client code needs + // to explicitly call solve() before accessing variables + // values + ClSimplexSolver &Solve() + { +#ifdef CL_SOLVER_CHECK_INTEGRITY + AssertValid(); +#endif + if (_fNeedsSolving) + { + Optimize(_objective); + SetExternalVariables(); +#ifdef CL_TRACE_VERBOSE + std::cerr << "Manual solve actually solving." << std::endl; +#endif + } + return *this; + } + + ClSimplexSolver &SetEditedValue(ClVariable v, double n) + { + if (!FContainsVariable(v)) + { + ChangeClv(v,n); + return *this; + } + + if (!ClApprox(n, v.Value())) + { + AddEditVar(v); + BeginEdit(); + SuggestValue(v,n); + EndEdit(); + } + return *this; + } + + // Solver contains the variable if it's in either the columns + // list or the rows list + bool FContainsVariable(const ClVariable v) + { return ColumnsHasKey(v) || RowExpression(v); } + + ClSimplexSolver &AddVar(const ClVariable v) + { if (!FContainsVariable(v)) + { + AddStay(v); +#ifdef CL_TRACE + std::cerr << "added initial stay on " << v << std::endl; +#endif + } + return *this; } + + typedef void (*PfnResolveCallback)(ClSimplexSolver *psolver); + + void SetResolveCallback(PfnResolveCallback pfn) + { _pfnResolveCallback = pfn; } + + typedef void (*PfnCnSatCallback)(ClSimplexSolver *psolver, + ClConstraint *pcn, bool fSatisfied); + + void SetCnSatCallback(PfnCnSatCallback pfn) + { _pfnCnSatCallback = pfn; } + +#ifndef CL_NO_IO + friend ostream &operator<<(ostream &xo, const ClSimplexSolver &tableau); + + ostream &PrintOn(ostream &xo) const; + + ostream &PrintInternalInfo(ostream &xo) const; + + ostream &PrintOnVerbose(ostream &xo) const + { PrintOn(xo); PrintInternalInfo(xo); xo << std::endl; return xo; } + +#endif + + const ClConstraintToVarMap &ConstraintMap() const + { return _markerVars; } + + const ClVarToConstraintMap &MarkerMap() const + { return _constraintsMarked; } + + bool FIsConstraintSatisfied(const ClConstraint *const pcn) const; + + // DEPRECATED + bool FIsConstraintSatisfied(const ClConstraint &pcn) const + { return FIsConstraintSatisfied(&pcn); } + + // re-set all the external variables to their current values + // most importantly, this re-calls all the ChangeClv callbacks + // (which might be used to copy the ClVariable's value to another + // variable) + void UpdateExternalVariables() + { SetExternalVariables(); } + + // A. Beurive' Tue Jul 6 17:05:39 CEST 1999 + void ChangeStrengthAndWeight(ClConstraint *pcn, const ClStrength &strength, double weight); + void ChangeStrength(ClConstraint *pcn, const ClStrength &strength); + void ChangeWeight(ClConstraint *pcn, double weight); + // void DisplayObjective(); + + // Each of the non-required stays will be represented by an equation + // of the form + // v = c + eplus - eminus + // where v is the variable with the stay, c is the previous value of + // v, and eplus and eminus are slack variables that hold the error + // in satisfying the stay constraint. We are about to change + // something, and we want to fix the constants in the equations + // representing the stays. If both eplus and eminus are nonbasic + // they have value 0 in the current solution, meaning the previous + // stay was exactly satisfied. In this case nothing needs to be + // changed. Otherwise one of them is basic, and the other must + // occur only in the Expression for that basic error variable. + // Reset the Constant in this Expression to 0. + void ResetStayConstants(); + + ClSimplexSolver &SetAutoResetStayConstants(bool f) + { _fResetStayConstantsAutomatically = f; if (f) ResetStayConstants(); return *this; } + + bool FIsAutoResetStayConstants() const + { return _fResetStayConstantsAutomatically; } + + protected: + + // ClEditInfo is a privately-used class + // that just wraps a constraint, its positive and negative + // error variables, and its prior edit Constant. + // It is used as values in _editInfoList, and replaces + // the parallel vectors of error variables and previous edit + // constants from the smalltalk version of the code. + class ClEditInfo { + friend class ClSimplexSolver; + public: + + // These instances own none of the pointers; + // the tableau row (the Expression) owns the peplus, peminus, + // and AddEditVar/RemoveEditVar pair or the client code owns + // the constraint object + ClEditInfo(ClVariable clv, + ClEditConstraint *pconstraint, + ClVariable eplus, ClVariable eminus, + Number prevEditConstant) + :_clv(clv), + _pconstraint(pconstraint), + _clvEditPlus(eplus), _clvEditMinus(eminus), + _prevEditConstant(prevEditConstant) + { } + + ~ClEditInfo() + { } + + ostream &PrintOn(ostream &xo) const + { xo << _clv << " -> [" << _clvEditPlus << ", " << _clvEditMinus << "](" + << _prevEditConstant << ")@" << " -- " + << *_pconstraint; + return xo; } + + friend ostream &operator<<(ostream &xo, const ClEditInfo &cei) + { return cei.PrintOn(xo); } + + private: + ClVariable _clv; + ClConstraint *_pconstraint; + ClVariable _clvEditPlus; + ClVariable _clvEditMinus; + Number _prevEditConstant; + }; + + // Add the constraint expr=0 to the inequality tableau using an + // artificial variable. To do this, create an artificial variable + // av and Add av=expr to the inequality tableau, then make av be 0. + // (Raise an exception if we can't attain av=0.) + // (Raise an exception if we can't attain av=0.) If the Add fails, + // prepare an explanation in e that describes why it failed (note + // that an empty explanation is considered to mean the explanation + // encompasses all active constraints. + bool AddWithArtificialVariable(ClLinearExpression &pexpr, + ExCLRequiredFailureWithExplanation &e); + + // Using the given equation (av = cle) build an explanation which + // implicates all constraints used to construct the equation. That + // is, everything for which the variables in the equation are markers. + // Thanks to Steve Wolfman for the implementation of the explanation feature + void BuildExplanation(ExCLRequiredFailureWithExplanation & e, + ClVariable av, + const ClLinearExpression * pcle); + + // We are trying to Add the constraint expr=0 to the appropriate + // tableau. Try to Add expr directly to the tableax without + // creating an artificial variable. Return true if successful and + // false if not. + bool TryAddingDirectly(ClLinearExpression &pexpr); + + // We are trying to Add the constraint expr=0 to the tableaux. Try + // to choose a subject (a variable to become basic) from among the + // current variables in expr. If expr contains any unrestricted + // variables, then we must choose an unrestricted variable as the + // subject. Also, if the subject is new to the solver we won't have + // to do any substitutions, so we prefer new variables to ones that + // are currently noted as parametric. If expr contains only + // restricted variables, if there is a restricted variable with a + // negative coefficient that is new to the solver we can make that + // the subject. Otherwise we can't find a subject, so return nil. + // (In this last case we have to Add an artificial variable and use + // that variable as the subject -- this is done outside this method + // though.) + // + // Note: in checking for variables that are new to the solver, we + // ignore whether a variable occurs in the objective function, since + // new slack variables are added to the objective function by + // 'NewExpression:', which is called before this method. + ClVariable ChooseSubject(ClLinearExpression &pexpr); + + // Each of the non-required edits will be represented by an equation + // of the form + // v = c + eplus - eminus + // where v is the variable with the edit, c is the previous edit + // value, and eplus and eminus are slack variables that hold the + // error in satisfying the edit constraint. We are about to change + // something, and we want to fix the constants in the equations + // representing the edit constraints. If one of eplus and eminus is + // basic, the other must occur only in the Expression for that basic + // error variable. (They can't both be basic.) Fix the Constant in + // this Expression. Otherwise they are both nonbasic. Find all of + // the expressions in which they occur, and fix the constants in + // those. See the UIST paper for details. + // (This comment was for resetEditConstants(), but that is now + // gone since it was part of the screwey vector-based interface + // to resolveing. --02/15/99 gjb) + void DeltaEditConstant(Number delta, ClVariable pv1, ClVariable pv2); + + // We have set new values for the constants in the edit constraints. + // Re-Optimize using the dual simplex algorithm. + void DualOptimize(); + + // Make a new linear Expression representing the constraint cn, + // replacing any basic variables with their defining expressions. + // Normalize if necessary so that the Constant is non-negative. If + // the constraint is non-required give its error variables an + // appropriate weight in the objective function. + ClLinearExpression *NewExpression(const ClConstraint *pcn, + /* output to */ + ClVariable &clvEplus, + ClVariable &clvEminus, + Number &prevEConstant); + + // Minimize the value of the objective. (The tableau should already + // be feasible.) + void Optimize(ClVariable zVar); + + // Do a Pivot. Move entryVar into the basis (i.e. make it a basic variable), + // and move exitVar out of the basis (i.e., make it a parametric variable) + void Pivot(ClVariable entryVar, ClVariable exitVar); + + // Set the external variables known to this solver to their appropriate values. + // Set each external basic variable to its value, and set each + // external parametric variable to 0. (It isn't clear that we will + // ever have external parametric variables -- every external + // variable should either have a stay on it, or have an equation + // that defines it in terms of other external variables that do have + // stays. For the moment I'll put this in though.) Variables that + // are internal to the solver don't actually store values -- their + // values are just implicit in the tableu -- so we don't need to set + // them. + void SetExternalVariables(); + + // this gets called by RemoveConstraint and by AddConstraint when the + // contraint we're trying to Add is inconsistent + ClSimplexSolver &RemoveConstraintInternal(const ClConstraint *const pcn); + + void ChangeClv(ClVariable clv, Number n) { + clv.ChangeValue(n); + if (_pfnChangeClvCallback) + _pfnChangeClvCallback(&clv,this); + } + + /// instance variables + + // the arrays of positive and negative error vars for the stay constraints + // (need both positive and negative since they have only non-negative values) + ClVarVector _stayMinusErrorVars; + ClVarVector _stayPlusErrorVars; + + // give error variables for a non required constraint, + // maps to ClSlackVariable-s + ClConstraintToVarSetMap _errorVars; + + // Return a lookup table giving the marker variable for each + // constraint (used when deleting a constraint). + ClConstraintToVarMap _markerVars; + + // Reverse of the above-- a lookup table giving the constraint + // for each marker variable (used when building failure explanations) + ClVarToConstraintMap _constraintsMarked; + + ClVariable _objective; + + // Map edit variables to their constraints, errors, and prior + // values + ClEditInfoList _editInfoList; + + int _slackCounter; + int _artificialCounter; +#ifdef CL_FIND_LEAK + int _cArtificialVarsDeleted; +#endif + int _dummyCounter; + const double _epsilon; + + bool _fResetStayConstantsAutomatically; + bool _fNeedsSolving; + bool _fExplainFailure; + + PfnResolveCallback _pfnResolveCallback; + PfnCnSatCallback _pfnCnSatCallback; + + // C-style extension mechanism so I + // don't have to wrap ScwmClSolver separately + void *_pv; + + // a stack of the number of edit constraints + // that existed at the prior BeginEdit. + // an EndEdit needs to pop off the top value, + // then remove constraints to get down + // to the # of constraints as in _stkCedcns.top() + stack _stkCedcns; + + +#ifndef CL_NO_IO + +friend ostream &PrintTo(ostream &xo, const ClSimplexSolver::ClEditInfoList &listPEditInfo); +friend ostream &operator<<(ostream &xo, const ClSimplexSolver::ClEditInfoList &listPEditInfo); + +#endif + +}; + +#endif // ClSimplexSolver_H diff --git a/libs/cassowary/cassowary/ClSlackVariable.h b/libs/cassowary/cassowary/ClSlackVariable.h new file mode 100644 index 0000000000..ca116702e9 --- /dev/null +++ b/libs/cassowary/cassowary/ClSlackVariable.h @@ -0,0 +1,75 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSlackVariable.h + +#ifndef ClSlackVariable_H +#define ClSlackVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClAbstractVariable.h" + +class ClTableau; +class ClSimplexSolver; + + +class ClSlackVariable : public ClAbstractVariable { +public: +#ifdef CL_FIND_LEAK + ~ClSlackVariable() { --cSlackVariables; }; + + static long cSlackVariables; +#endif + +protected: + friend class ClTableau; + friend class ClSimplexSolver; + + ClSlackVariable(string Name = "") : + ClAbstractVariable(Name) + { +#ifdef CL_FIND_LEAK + ++cSlackVariables; +#endif + } + + ClSlackVariable(long number, char *prefix) : + ClAbstractVariable(number,prefix) + { +#ifdef CL_FIND_LEAK + ++cSlackVariables; +#endif + } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { + xo << "[" << Name() << ":slack]"; + return xo; + } +#endif + + virtual bool IsExternal() const + { return false; } + + virtual bool IsPivotable() const + { return true; } + + virtual bool IsRestricted() const + { return true; } + +}; + + +#endif diff --git a/libs/cassowary/cassowary/ClSolver.h b/libs/cassowary/cassowary/ClSolver.h new file mode 100644 index 0000000000..16e798d491 --- /dev/null +++ b/libs/cassowary/cassowary/ClSolver.h @@ -0,0 +1,167 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSolver.h + +#ifndef ClSolver_H +#define ClSolver_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClErrors.h" +#include "ClTypedefs.h" +#include +#include + +using std::list; +using std::ostream; + +class ClVariable; + +// ClSolver is an abstract base class +class ClSolver { + public: + + ClSolver() : _pv(0), _fAutosolve(true), _pfnChangeClvCallback(0) { } + + virtual ~ClSolver() + { } + + // Add the constraint cn to the solver + virtual ClSolver &AddConstraint(ClConstraint *const pcn) = 0; + + // Remove the constraint cn from the solver + virtual ClSolver &RemoveConstraint(ClConstraint *const pcn) = 0; + + // Same as above, but returns false if the constraint cannot be solved + // (i.e., the resulting system would be unsatisfiable) + // The above function "AddConstraint" throws an exception in that case + // which may be inconvenient + virtual bool AddConstraintNoException(ClConstraint *const pcn) + { + try { + AddConstraint(pcn); + return true; + } + catch (const ExCLRequiredFailure &e) + { return false; } + catch (const ExCLTooDifficult &e) + { return false; } + } + +#ifndef CL_NO_DEPRECATED + // Deprecated --02/22/99 gjb + bool AddConstraintNoException(ClConstraint &cn) + { return AddConstraintNoException(&cn); } +#endif + + virtual bool RemoveConstraintNoException(ClConstraint *const pcn) + { + try { + RemoveConstraint(pcn); + return true; + } + catch (const ExCLConstraintNotFound &e) + { return false; } + } + +#ifndef CL_NO_DEPRECATED + // Deprecated --02/22/99 gjb + bool RemoveConstraintNoException(ClConstraint &cn) + { return RemoveConstraintNoException(&cn); } +#endif + + + virtual ClSolver &Solve() + { assert(false); return *this; } + + virtual bool SolveNoException() + { + try { + Solve(); + return true; + } + catch (const ExCLTooDifficult &e) + { return false; } + catch (const ExCLRequiredFailure &e) + { return false; } + } + + + virtual void Resolve() + { assert(false); } + + void SetPv(void *pv) + { _pv = pv; } + + void *Pv() const + { return _pv; } + + typedef void (*PfnChangeClvCallback)(ClVariable *pclv, ClSolver *psolver); + + void SetChangeClvCallback(PfnChangeClvCallback pfn) + { _pfnChangeClvCallback = pfn; } + + // Control whether optimization and setting of external variables + // is done automatically or not. By default it is done + // automatically and solve() never needs to be explicitly + // called by client code; if SetAutosolve is put to false, + // then solve() needs to be invoked explicitly before using + // variables' values + // (Turning off autosolve while adding lots and lots of + // constraints [ala the addDel test in ClTests] saved + // about 20% in runtime, from 68sec to 54sec for 900 constraints, + // with 126 failed adds) + ClSolver &SetAutosolve(bool f) + { _fAutosolve = f; if (f) Solve(); return *this; } + + // Tell whether we are autosolving + bool FIsAutosolving() const + { return _fAutosolve; } + + +#ifndef CL_NO_IO + friend ostream &operator<<(ostream &xo, const ClSolver &solver); + + virtual ostream &PrintOn(ostream &xo) const = 0; + +#endif + + protected: + + // C-style extension mechanism so I + // don't have to wrap ScwmClSolver separately + void *_pv; + + bool _fAutosolve; + + PfnChangeClvCallback _pfnChangeClvCallback; +}; + + +#ifndef CL_NO_IO +ostream &PrintTo(ostream &xo, const ClVarVector &varlist); +ostream &operator<<(ostream &xo, const ClVarVector &varlist); + +ostream &PrintTo(ostream &xo, const ClConstraintToVarSetMap &mapCnToVarSet); +ostream &operator<<(ostream &xo, const ClConstraintToVarSetMap &mapCnToVarSet); + +ostream &PrintTo(ostream &xo, const ClConstraintSet &setCn); +ostream &operator<<(ostream &xo, const ClConstraintSet &setCn); + +ostream &PrintTo(ostream &xo, const list &listFDN); +ostream &operator<<(ostream &xo, const list &listFDN); + +#endif + +#endif diff --git a/libs/cassowary/cassowary/ClStayConstraint.h b/libs/cassowary/cassowary/ClStayConstraint.h new file mode 100644 index 0000000000..f009731b09 --- /dev/null +++ b/libs/cassowary/cassowary/ClStayConstraint.h @@ -0,0 +1,43 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClStayConstraint.h + +#ifndef ClStayConstraint_H +#define ClStayConstraint_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClEditOrStayConstraint.h" + +class ClStayConstraint : public ClEditOrStayConstraint { + typedef ClEditOrStayConstraint super; + public: + + ClStayConstraint(const ClVariable var, + const ClStrength &strength = ClsWeak(), double weight = 1.0 ) : + ClEditOrStayConstraint(var,strength,weight) + { } + + virtual bool isStayConstraint() const + { return true; } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { super::PrintOn(xo); return xo << " STAY)"; } +#endif + + private: +}; + +#endif diff --git a/libs/cassowary/cassowary/ClStrength.h b/libs/cassowary/cassowary/ClStrength.h new file mode 100644 index 0000000000..644c04cb5f --- /dev/null +++ b/libs/cassowary/cassowary/ClStrength.h @@ -0,0 +1,91 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClStrength.h + +#ifndef ClStrength_H +#define ClStrength_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include + +#include "Cassowary.h" +#include "ClSymbolicWeight.h" + +using std::string; + +class ClStrength; + +const ClStrength &ClsRequired(); +const ClStrength &ClsStrong(); +const ClStrength &ClsMedium(); +const ClStrength &ClsWeak(); + +class ClStrength { + public: + + ClStrength(const string &Name, const ClSymbolicWeight &symbolicWeight) : + _name(Name), _symbolicWeight(symbolicWeight) + { } + + // special case for when nLevels = 3, should assert nLevels() == 3 + ClStrength(const string &Name, double w1, double w2, double w3); + + virtual ~ClStrength() + { } + + virtual bool IsRequired() const + { return (_symbolicWeight == ClsRequired()._symbolicWeight); } + +#ifndef CL_NO_IO + virtual ostream &PrintOn(ostream &xo) const + { + xo << Name(); + if (!IsRequired()) + xo << ":" << symbolicWeight(); + return xo; + } + + friend ostream& operator<<(ostream &xos, const ClStrength &Cls) + { Cls.PrintOn(xos); return xos; } + +#endif + + virtual const ClSymbolicWeight &symbolicWeight() const + { return _symbolicWeight; } + + void SetPv(void *pv) + { _pv = pv; } + + void *Pv() const + { return _pv; } + + private: + string Name() const + { return _name; } + + void SetName(string Name) + { _name = Name; } + + void SetSymbolicWeight(const ClSymbolicWeight &symbolicWeight) + { _symbolicWeight = symbolicWeight; } + + // instance variables + string _name; + ClSymbolicWeight _symbolicWeight; + + void *_pv; + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClSymbolicWeight.h b/libs/cassowary/cassowary/ClSymbolicWeight.h new file mode 100644 index 0000000000..1c0339c887 --- /dev/null +++ b/libs/cassowary/cassowary/ClSymbolicWeight.h @@ -0,0 +1,197 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClSymbolicWeight.h + +#ifndef ClSymbolicWeight_H +#define ClSymbolicWeight_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClErrors.h" +#include +#include + +using std::vector; +using std::ostream; + +class ClSymbolicWeight { + public: + ClSymbolicWeight(unsigned int CLevels = 3, Number value = 0.0); + + ClSymbolicWeight(Number w1, Number w2, Number w3); + + ClSymbolicWeight(const vector &weights); + + static ClSymbolicWeight &Zero(); + + ClSymbolicWeight &negated(); + + ClSymbolicWeight &MultiplyMe(Number n); + + ClSymbolicWeight Times(Number n) const + { ClSymbolicWeight cl = *this; cl.MultiplyMe(n); return cl; } + + ClSymbolicWeight DivideBy(Number n) const; + + ClSymbolicWeight &addtoMe(const ClSymbolicWeight &cl); + + ClSymbolicWeight Add(const ClSymbolicWeight &cl) const + { ClSymbolicWeight clRet = *this; clRet.addtoMe(cl); return clRet; } + + ClSymbolicWeight Subtract(const ClSymbolicWeight &cl) const; + + ClSymbolicWeight operator*(const Number &n) const + { return Times(n); } + + ClSymbolicWeight operator/(const Number &n) const + { return DivideBy(n); } + + // FIXGJB: can we express this statically? + ClSymbolicWeight operator*(ClSymbolicWeight &w) const + { throw ExCLInternalError("Multiplication of symbolic weights encountered"); + return w; } + ClSymbolicWeight &operator*=(ClSymbolicWeight &w) + { throw ExCLInternalError("Multiplicative assignment of symbolic weights encountered"); + return w; } + + // FIXGJB: can we express this statically? + ClSymbolicWeight operator-() const + { throw ExCLInternalError("Can not negate a symbolic weight"); + return ClSymbolicWeight::Zero(); } + + friend ClSymbolicWeight ReciprocalOf(const ClSymbolicWeight &); + + ClSymbolicWeight &operator*=(const Number &n) + { return MultiplyMe(n); } + + ClSymbolicWeight operator+(const ClSymbolicWeight &cl) const + { return Add(cl); } + + ClSymbolicWeight operator+=(const ClSymbolicWeight &cl) + { return addtoMe(cl); } + + ClSymbolicWeight operator*(const Number &n) + { ClSymbolicWeight answer(*this); + answer *= n; + return answer; } + + bool lessThan(const ClSymbolicWeight &cl) const; + bool lessThanOrEqual(const ClSymbolicWeight &cl) const; + bool equal(const ClSymbolicWeight &cl) const; + bool greaterThan(const ClSymbolicWeight &cl) const; + bool greaterThanOrEqual(const ClSymbolicWeight &cl) const; + bool isNegative() const; + + friend bool operator==(const ClSymbolicWeight &cl1, const ClSymbolicWeight &cl2) + { return cl1.equal(cl2); } + + friend bool operator!=(const ClSymbolicWeight &cl1, const ClSymbolicWeight &cl2) + { return !(cl1 == cl2); } + + friend bool operator<(const ClSymbolicWeight &cl1, const ClSymbolicWeight &cl2) + { return cl1.lessThan(cl2); } + + friend bool operator>(const ClSymbolicWeight &cl1, const ClSymbolicWeight &cl2) + { return (cl2 < cl1); } + + // function.h provides operator>, >=, <= from operator< + + double AsDouble() const + { + vector::const_reverse_iterator i = _values.rbegin(); + Number sum = 0; + Number factor = 1; + // A. Beurive' Wed Jul 7 11:07:47 CEST 1999 + Number multiplier = 1000000; + for ( ; i != _values.rend(); ++i) + { + sum += *i * factor; + factor *= multiplier; + } + return sum; + } + +#ifndef CL_NO_IO + ostream &PrintOn(ostream &xo) const + { + vector::const_iterator i = _values.begin(); + if (i == _values.end()) + return xo; + + xo << *i; + for (++i; i != _values.end(); ++i) + { + xo << "," << *i; + } + return xo; + } + + // FIXGJB: use a template function to generate these automatically + friend ostream& operator<<(ostream &xos, const ClSymbolicWeight &clsw) + { clsw.PrintOn(xos); return xos; } +#endif + + int CLevels() const + { return _values.size(); } + + friend bool ClApprox(const ClSymbolicWeight &cl, Number n); + friend bool ClApprox(const ClSymbolicWeight &cl1, const ClSymbolicWeight &cl2); + + private: + vector _values; + + void push_back(Number d) + { _values.push_back(d); } + +}; + +inline bool ClApprox(const ClSymbolicWeight &cl, Number n) +{ + vector::const_iterator it = cl._values.begin(); + if (!ClApprox(*it,n)) + return false; + + ++it; + for (; it != cl._values.end(); ++it) + { + if (!ClApprox(*it,0)) + return false; + } + + return true; +} + +inline bool ClApprox(const ClSymbolicWeight &cl1, const ClSymbolicWeight &cl2) +{ + vector::const_iterator it1 = cl1._values.begin(); + vector::const_iterator it2 = cl2._values.begin(); + + for (; it1 != cl1._values.end() && it2 != cl2._values.end(); + ++it1, ++it2) + { + if (!ClApprox(*it1,*it2)) + return false; + } + + if (it1 == cl1._values.end() && it2 == cl2._values.end()) + return true; + + return false; +} + +inline ClSymbolicWeight ReciprocalOf(const ClSymbolicWeight &) +{ throw(ExCLInternalError("Cannot take ReciprocalOf symbolic weight")); + return ClSymbolicWeight::Zero(); } + +#endif diff --git a/libs/cassowary/cassowary/ClTableau.h b/libs/cassowary/cassowary/ClTableau.h new file mode 100644 index 0000000000..117ed0fb9d --- /dev/null +++ b/libs/cassowary/cassowary/ClTableau.h @@ -0,0 +1,230 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClTableau.h + +#ifndef ClTableau_H +#define ClTableau_H + +#include + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "Cassowary.h" +#include "ClLinearExpression.h" +#include "ClVariable.h" +#include "ClTypedefs.h" + + +#ifndef CL_NO_IO +class ClTableau; + +ostream &operator<<(ostream &xo, const ClTableau &clt); + +ostream &operator<<(ostream &xo, const ClVarSet &varset); + +ostream &operator<<(ostream &xo, const ClTableauColumnsMap &varmap); + +ostream &operator<<(ostream &xo, const ClTableauRowsMap &rows); + +ostream &operator<<(ostream &xo, const ClVarVector &varlist); +#endif // CL_NO_IO + +class ClTableau { + + public: + // No public constructor, since this does nothing but support + // an ADT for the ClSimplexSolver + + // Variable v has been removed from an Expression. If the + // Expression is in a tableau the corresponding basic variable is + // subject (or if subject is nil then it's in the objective function). + // Update the column cross-indices. + void NoteRemovedVariable(ClVariable v, ClVariable subject) + { +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + std::cerr << "(" << v << ", " << subject << ")" << std::endl; +#endif + ClVarSet &column = _columns[v]; + ClVarSet::const_iterator it = column.find(subject); + assert(it != column.end()); + column.erase(it); +#ifdef CL_TRACE_VERBOSE + std::cerr << "v = " << v << " and Columns[v].size() = " + << column.size() << std::endl; +#endif + if (column.size() == 0) + { + _columns.erase(v); + _externalRows.erase(v); + _externalParametricVars.erase(v); + } + } + + // v has been added to the linear Expression for subject + // update column cross indices + void NoteAddedVariable(ClVariable v, ClVariable subject) + { +#ifdef CL_TRACE + Tracer TRACER(__FUNCTION__); + std::cerr << "(" << v << ", " << subject << ")" << std::endl; +#endif + _columns[v].insert(subject); + if (v.IsExternal() && !FIsBasicVar(v)) + { + _externalParametricVars.insert(v); + } + } + +#ifndef CL_NO_IO + std::ostream &PrintOn(ostream &xo) const; + + ostream &PrintInternalInfo(ostream &xo) const; + + ostream &printExternalVariablesTo(ostream &xo) const; + +#endif + + // Check integrity of the tableau + // not complete, yet, but a start, at least + // Guard calls to AssertValid with CL_SOLVER_CHECK_INTEGRITY, + // since this is expensive + virtual void AssertValid() const { +#ifndef NDEBUG + // all external basic variables are in _externalRows + // and all external parametric variables are in _externalParametricVars + ClTableauRowsMap::const_iterator itRow = _rows.begin(); + for (; itRow != _rows.end(); ++itRow) + { + const ClVariable clv = (*itRow).first; + if (clv.IsExternal()) + { + if (_externalRows.find(clv) == _externalRows.end()) + { +#ifndef CL_NO_IO + std::cerr << "External basic variable " << clv + << " is not in _externalRows" << std::endl; +#endif + } + } + const ClLinearExpression *pcle = RowExpression(clv); + assert(pcle); + ClVarToNumberMap::const_iterator it = pcle->Terms().begin(); + for (; it != pcle->Terms().end(); ++it) + { + ClVariable clv = (*it).first; + if (clv.IsExternal()) + { + if (_externalParametricVars.find(clv) == _externalParametricVars.end()) + { +#ifndef CL_NO_IO + std::cerr << "External parametric variable " << clv + << " is not in _externalParametricVars" << std::endl; +#endif + } + } + } + } +#endif /* !NDEBUG */ + } + + + protected: + // Constructor -- want to start with empty objects so not much to do + ClTableau() + { } + + virtual ~ClTableau(); + + // Add v=expr to the tableau, update column cross indices + // v becomes a basic variable + // expr is now owned by ClTableau class, + // and ClTableauis responsible for deleting it + // (also, expr better be allocated on the heap!) + void addRow(ClVariable v, const ClLinearExpression &expr); + + // Remove v from the tableau -- remove the column cross indices for v + // and remove v from every Expression in rows in which v occurs + // returns a pointer to the variable (since we often want to delete + // the variable) + ClVariable RemoveColumn(ClVariable v); + + // Remove the basic variable v from the tableau row v=expr + // Then update column cross indices + // Probably want to call delete on the ClLinearExpression * returned + // unless you're adding that same Expression back into the + // tableau + ClLinearExpression *RemoveRow(ClVariable v); + + // Replace all occurrences of oldVar with expr, and update column cross indices + // oldVar should now be a basic variable + void SubstituteOut(ClVariable oldVar, const ClLinearExpression &expr); + + ClTableauColumnsMap Columns() + { return _columns; } + + ClTableauRowsMap Rows() + { return _rows; } + + // return true iff the variable subject is in the Columns keys + bool ColumnsHasKey(ClVariable subject) const + { + ClTableauColumnsMap::const_iterator i = _columns.find(subject); + return (i != _columns.end()); + } + + const ClLinearExpression *RowExpression(ClVariable v) const + { + ClTableauRowsMap::const_iterator i = _rows.find(v); + if (i != _rows.end()) + return (*i).second; + else + return 0; + } + + ClLinearExpression *RowExpression(ClVariable v) + { + const ClTableau *pthis = const_cast(this); + return const_cast(pthis->RowExpression(v)); + } + + + bool FIsBasicVar(ClVariable v) + { return RowExpression(v) != 0; } + + // private: FIXGJB: can I improve the encapsulation? + + // _columns is a mapping from variables which occur in expressions to the + // set of basic variables whose expressions contain them + // i.e., it's a mapping from variables in expressions (a column) to the + // set of rows that contain them + ClTableauColumnsMap _columns; + + // _rows maps basic variables to the expressions for that row in the tableau + ClTableauRowsMap _rows; + + // the collection of basic variables that have infeasible rows + // (used when reoptimizing) + ClVarSet _infeasibleRows; + + // the set of rows where the basic variable is external + // this was added to the C++ version to reduce time in SetExternalVariables() + ClVarSet _externalRows; + + // the set of external variables which are parametric + // this was added to the C++ version to reduce time in SetExternalVariables() + ClVarSet _externalParametricVars; + +}; + +#endif diff --git a/libs/cassowary/cassowary/ClTypedefs.h b/libs/cassowary/cassowary/ClTypedefs.h new file mode 100644 index 0000000000..74b625a72b --- /dev/null +++ b/libs/cassowary/cassowary/ClTypedefs.h @@ -0,0 +1,48 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClTypedefs.h + +#ifndef CL_TYPEDEFS_H__ +#define CL_TYPEDEFS_H__ + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include "ClLinearExpression_fwd.h" +#include +#include +#include + +using std::set; +using std::map; +using std::vector; + +class ClVariable; +class ClConstraint; +class ClEditInfo; + +typedef set ClVarSet; +typedef map ClTableauColumnsMap; +typedef map ClTableauRowsMap; + +// For Solver +typedef map ClConstraintToVarSetMap; +typedef map ClConstraintToVarMap; +typedef map ClVarToConstraintMap; +typedef vector ClVarVector; + +typedef set ClConstraintSet; + +// For FDSolver +typedef map ClVarToConstraintSetMap; + +#endif diff --git a/libs/cassowary/cassowary/ClVariable.h b/libs/cassowary/cassowary/ClVariable.h new file mode 100644 index 0000000000..03814e5ef2 --- /dev/null +++ b/libs/cassowary/cassowary/ClVariable.h @@ -0,0 +1,166 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// ClVariable.h +// A handle on ClAbstractVariable-s + +#ifndef ClVariable_H +#define ClVariable_H + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include +#include +#include "Cassowary.h" +#include "ClFloatVariable.h" +#include "ClFDVariable.h" + +using std::map; +using std::string; + +class ClVariable; +typedef map StringToVarMap; + + +class ClVariable { + ClAbstractVariable *pclv; +public: + // converters from raw ClAbstractVariable + ClVariable(ClAbstractVariable *pclv_) : pclv(pclv_) { } + ClVariable(ClAbstractVariable &clv_) : pclv(&clv_) { } + + // Copy ctr + ClVariable(const ClVariable &clv_) : pclv(clv_.pclv) { } + + /// These ctrs build ClFloatVariable-s + ClVariable(string name, Number Value = 0.0) + : pclv(new ClFloatVariable(name,Value)) + { if (pmapStrPclv) { (*pmapStrPclv)[name] = *this; } } + ClVariable(Number Value = 0.0) + : pclv(new ClFloatVariable(Value)) { } + ClVariable(long number, char *prefix, Number Value = 0.0) + : pclv(new ClFloatVariable(number,prefix,Value)) { } + + // This one builds a ClFDVariable + ClVariable(ClFDVariable *pcfv) + : pclv(pcfv) + { if (pmapStrPclv) { (*pmapStrPclv)[pcfv->Name()] = *this; } } + + /// permit ClVariables to be used as pointers to pclvs + ClAbstractVariable *operator->() { return pclv; } + const ClAbstractVariable *operator->() const { return pclv; } + + /// and also forward the function calls along + + + bool IsFloatVariable() const { assert(pclv); return pclv->IsFloatVariable(); } + bool IsFDVariable() const { assert(pclv); return pclv->IsFDVariable(); } + bool IsDummy() const { assert(pclv); return pclv->IsDummy(); } + bool IsExternal() const { assert(pclv); return pclv->IsExternal(); } + bool IsPivotable() const { assert(pclv); return pclv->IsPivotable(); } + bool IsRestricted() const { assert(pclv); return pclv->IsRestricted(); } + + string Name() const { assert(pclv); return pclv->Name(); } + + Number Value() const { assert(pclv); return pclv->Value(); } + int IntValue() const { assert(pclv); return pclv->IntValue(); } + void SetValue(Number Value) + { assert(pclv); pclv->SetValue(Value); } + void ChangeValue(Number Value) + { assert(pclv); pclv->ChangeValue(Value); } + void SetPv(void *pv) + { assert(pclv); pclv->SetPv(pv); } + void *Pv() const + { assert(pclv); return pclv->Pv(); } + + void SetName(string const &nm) { + assert(pclv); + if (pmapStrPclv) { + pmapStrPclv->erase(Name()); + (*pmapStrPclv)[nm] = *this; + } + pclv->SetName(nm); + } + + ClAbstractVariable *get_pclv() const { return pclv; } + bool IsNil() const { return pclv == 0; } + + virtual FDNumber DesiredValue() const + { assert(false); } + + virtual list *PlfdnDomain() + { assert(false); return 0; } + + static void SetVarMap(StringToVarMap *pmap) { pmapStrPclv = pmap; } + static StringToVarMap *VarMap() { return pmapStrPclv; } + static StringToVarMap *pmapStrPclv; +#ifndef CL_NO_IO + ostream &PrintOn(ostream &xo) const + { + if (pclv) return pclv->PrintOn(xo); /* return xo << "@" << pclv << endl; */ + return xo << "clvNil"; + } +#endif + + friend bool operator<(ClVariable cl1, ClVariable cl2) + { return cl1.pclv < cl2.pclv; } + + friend bool operator==(ClVariable cl1, ClVariable cl2) + { return cl1.pclv == cl2.pclv; } + + friend bool operator!=(ClVariable cl1, ClVariable cl2) + { return !(cl1 == cl2); } + +}; + +#ifndef CL_NO_IO +inline ostream &operator<<(ostream &xo, const ClVariable &clv) +{ return clv.PrintOn(xo); } +#endif + +#ifdef CL_USE_HASH_MAP_AND_SET +struct hash { + size_t operator()(const ClVariable & v) const + { return size_t((unsigned long)v.get_pclv()/CL_PTR_HASH_DIVISOR); } +}; +#endif + + +#include + +// Compare two double-s approximately, since equality is no good +inline bool ClApprox(double a, double b) +{ + const double epsilon = 1.0e-8; + if (a > b) { + return (a - b) < epsilon; + } else { + return (b - a) < epsilon; + } +} + +// Can remove these if I decide to +// autoconvert from ClVariable-s to double-s +inline bool ClApprox(ClVariable clv, double b) +{ + return ClApprox(clv->Value(),b); +} + +inline bool ClApprox(double a, ClVariable clv) +{ + return ClApprox(a,clv->Value()); +} + +extern ClVariable clvNil; + +#endif diff --git a/libs/cassowary/cassowary/Makefile.am b/libs/cassowary/cassowary/Makefile.am new file mode 100644 index 0000000000..cc581b80ff --- /dev/null +++ b/libs/cassowary/cassowary/Makefile.am @@ -0,0 +1,36 @@ +MAINTAINERCLEANFILES = autom4te.cache Makefile.in + +noinst_HEADERS = \ + Cassowary.h \ + ClAbstractVariable.h \ + ClDummyVariable.h \ + ClObjectiveVariable.h \ + ClSlackVariable.h \ + ClConstraint.h \ + ClConstraintHash.h \ + ClEditConstraint.h \ + ClEditOrStayConstraint.h \ + ClErrors.h \ + ClLinearConstraint.h \ + ClLinearEquation.h \ + ClLinearExpression.h \ + ClLinearExpression_fwd.h \ + ClLinearInequality.h \ + ClSolver.h \ + ClSimplexSolver.h \ + ClStayConstraint.h \ + ClStrength.h \ + ClSymbolicWeight.h \ + ClTableau.h \ + ClFDVariable.h \ + ClFDConnectorVariable.h \ + ClFloatVariable.h \ + ClVariable.h \ + ClReader.h \ + ClTypedefs.h \ + ClPoint.h \ + cl_auto_ptr.h \ + config-inline.h \ + debug.h \ + timer.h + diff --git a/libs/cassowary/cassowary/cl_auto_ptr.h b/libs/cassowary/cassowary/cl_auto_ptr.h new file mode 100644 index 0000000000..3c37429676 --- /dev/null +++ b/libs/cassowary/cassowary/cl_auto_ptr.h @@ -0,0 +1,69 @@ +// $Id$ +// See http://cseng.aw.com/bookdetail.qry?ISBN=0-201-63371-X&ptype=634 +// auto_ptr from More Effective C++ an earlier appendix (works w/ egcs) + + +#ifndef CL_AUTO_PTR_H +#define CL_AUTO_PTR_H + +#ifdef _MSC_VER +#include +template +void ReinitializeAutoPtr(auto_ptr &apref, T *pt) +{ + auto_ptr ap(pt); + apref = ap; +} +#define cl_auto_ptr auto_ptr +#else +// FIXGJB: This implementation for egcs is buggy -- be careful +// and replace ASAP +template +class cl_auto_ptr { + public: + explicit cl_auto_ptr(T *p = 0): pointee(p) {} + + template + cl_auto_ptr(cl_auto_ptr& rhs): pointee(rhs.release()) {} + + ~cl_auto_ptr() { delete pointee; } + + template + cl_auto_ptr& operator=(cl_auto_ptr& rhs) + { + if (this != &rhs) reset(rhs.release()); + return *this; + } + + T& operator*() const { return *pointee; } + + T* operator->() const { return pointee; } + + T* get() const { return pointee; } + + T* release() + { + T *oldPointee = pointee; + pointee = 0; + return oldPointee; + } + + // protected: + // This is non-standard + void reset(T *p = 0) { delete pointee; pointee = p; } + + private: + T *pointee; +}; + +template +void ReinitializeAutoPtr(cl_auto_ptr &apref, T *pt) +{ + apref.reset(pt); +} + + +#endif + + +#endif diff --git a/libs/cassowary/cassowary/config-inline.h b/libs/cassowary/cassowary/config-inline.h new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/libs/cassowary/cassowary/config-inline.h @@ -0,0 +1 @@ + diff --git a/libs/cassowary/cassowary/debug.h b/libs/cassowary/cassowary/debug.h new file mode 100644 index 0000000000..aa0499c641 --- /dev/null +++ b/libs/cassowary/cassowary/debug.h @@ -0,0 +1,48 @@ +// $Id$ +// +// Cassowary Incremental Constraint Solver +// Original Smalltalk Implementation by Alan Borning +// This C++ Implementation by Greg J. Badros, +// http://www.cs.washington.edu/homes/gjb +// (C) 1998, 1999 Greg J. Badros and Alan Borning +// See ../LICENSE for legal details regarding this software +// +// debug.h + +#ifndef CASSOWARY_DEBUG_H_ +#define CASSOWARY_DEBUG_H_ + +#if defined(HAVE_CONFIG_H) && !defined(CONFIG_H_INCLUDED) && !defined(CONFIG_INLINE_H_INCLUDED) +#include +#define CONFIG_INLINE_H_INCLUDED +#endif + +#include +#include "Cassowary.h" + +#ifdef CL_TRACE +class Tracer { + public: + Tracer(const char *const sz) : sz_(sz) { cerr << "* " << sz; } + ~Tracer() { cerr << "x " << sz_ << " exited." << endl; } + private: + const char *const sz_; +}; + +inline void CtrTracer(const char *const sz, const void *pv) +{ cerr << "@+ " << sz << " ctrnew@ " << pv << endl; } + +inline void DtrTracer(const char *const sz, const void *pv) +{ cerr << "@- " << sz << " dtrnew@ " << pv << endl; } + +#else +class Tracer { + public: + Tracer(const char *const) { } +}; + +inline void CtrTracer(const char *const, const void *) { } +inline void DtrTracer(const char *const, const void *) { } +#endif // CL_TRACE + +#endif diff --git a/libs/cassowary/cassowary/timer.h b/libs/cassowary/cassowary/timer.h new file mode 100644 index 0000000000..6bad1a6fef --- /dev/null +++ b/libs/cassowary/cassowary/timer.h @@ -0,0 +1,176 @@ +/* $Id$ */ +#ifndef _TIMER_H_ +#define _TIMER_H_ + +// Programmer: John P. Russo +// -------------------------- +// John Russo has given permission to any of my students to use his +// "timer" class. +// +// Please give full credit to him any time you wish to use this class. +// Hossein Hakimzadeh 11/5/96 + +/************************** timer.cpp ********************************** + + A simple example that shows how C++ classes can be used to implement + a "Timer" object, which mimics the familiar actions of a stopwatch. + + The code relies heavily on the clock() function defined in the time + library. The clock() function returns the number of "ticks" that have + elapsed since a program starts. The size of a "tick" is compiler + dependent, but for PC compilers is about 1/18 second. + + The problem with the clock function is that it is not convenient to + use for typical timing operations. The timer class, defined below, by + contrast, shows that an object-oriented approach to modules can + provide tools that are natural and easy to use. + += = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ +#include + +class Timer +{ + //==================== public section ================================ + + // The functions and/or data in the public section of a class are + // accessible to anyone who uses the Timer class. + +public: + Timer(); // Constructor, used to declare Timer objects + void Start(); // Starts a timer object + void Stop(); // Stop a timer object + void Reset(); // Reset timer object + int IsRunning(); // Is the timer object running? + double ElapsedTime(); // How much time has been recorded? + double Resolution(); // Shortest measurable amount of time + + //-------------------- private section ------------------------------- + + // The functions and/or data in the private section of a class are NOT + // accessible to those who use the Timer class. They are accessible by + // member functions of the class. This allows access to the data to be + // carefully controlled. + +private: + long StartReading; // Number of ticks when timer object last started. + long ElapsedTicks; // Number of ticks on timer object. + int TimerIsRunning; // 1 if and only if timer object is running. + double TicksPerSecond() // This inline function is used to convert +// {return 18.206481;} // "ticks" (returned by clock() ) to seconds. + {return CLOCKS_PER_SEC;} // "ticks" (returned by clock() ) to seconds. + // In most UNIX systems this is 1000000 +}; + +/**************************** Start ************************************ + + If the declaration "Timer StopWatch;" has been made, the the call, + "StopWatch.Start();" is like push the start button of a real stopwatch. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +void Timer::Start() +{ + TimerIsRunning = 1; // Stopwatch is now running + StartReading = clock(); // Look at internal clock and remember reading +} + +/**************************** Stop ************************************ + + Looks at the PC's internal clock and computes the number of ticks that + have elapsed since the timer was started. + + Note that if a timer is not reset, it can be used to time several events + and return the elapsed time for the enter set of events. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +void Timer::Stop() +{ + TimerIsRunning = 0; // Stop timer object. + ElapsedTicks += clock() - StartReading; // Add elapsed time to the +} // previous time. + +/**************************** Reset ************************************ + + Clears a Timer of previous elapsed times, so that a new event can be + timed. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +void Timer::Reset() +{ + TimerIsRunning = 0; // Start not yet called. + ElapsedTicks = 0; // No time on timer object yet. +} + +/************************** IsRunning ************************************ + + The data member, "TimerIsRunning" is used to keep track of whether a + timer is active, i.e. whether an event is being timed. While we want + those using the timer class to know when a timer is active, we do NOT + want them to directly access the TimerIsRunning variable. We solve this + problem, by making TimerIsRunning private and providing the public + "access function" below. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +int Timer::IsRunning() +{ + return TimerIsRunning; +} + +/************************* ElapsedTime *********************************** + + This function allows a client to determine the amount of time that has + elapsed on a timer object. Note that there are two possibilities: + + 1) A timer object has been started and stopped. We can detect this + case, because the variable "TimerIsRunning" is false. + + 2) A timer object is "running", i.e. is still in the process of timing + an event. It is not expected that this case will occur as frequently + as case 1). + + In either case, this function converts ticks to seconds. Note that + since the function TicksPerSecond() returns a value of type double, + an implicit type conversion takes place before doing the division + required in either case. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +double Timer::ElapsedTime() +{ + if ( !TimerIsRunning ) // Normal case + return ElapsedTicks/TicksPerSecond(); + + else + return (ElapsedTicks + clock() - StartReading)/TicksPerSecond(); +} + +/************************** Resolution *********************************** + + Althould we have no way of knowing how accurate the internal clock is, + we can predict its resolution, which is the shortest event that can be + measured by the clock. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +double Timer::Resolution() +{ + return 1/TicksPerSecond(); // Note 1 is coverted to 1.0 before division +} + +/******************** Timer (constructor) ******************************* + + A "constructor" is a special class member function, one which has the + same name as the class. The "default constructor" is a constructor that + has no parameters. A constructor is called automatically when an + instance of a class is declared. For example, the constructor defined + below is called when the declaration "Timer T;" is executed. + + If the programmer does not write a default constructor, then the + compiler will generate one automatically. However, by writing the + constructor below, we provide automatic initialization of timer objects. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +Timer::Timer() +{ + TimerIsRunning = 0; // Start not yet called. + ElapsedTicks = 0; // No time on timer object yet. +} + +#endif /* _TIMER_H_ */ diff --git a/libs/cassowary/configure.ac b/libs/cassowary/configure.ac new file mode 100644 index 0000000000..3e565d7709 --- /dev/null +++ b/libs/cassowary/configure.ac @@ -0,0 +1,64 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(cassowary) + +AC_CONFIG_AUX_DIR(.) +AC_CANONICAL_HOST +AC_CANONICAL_TARGET +AC_VALIDATE_CACHED_SYSTEM_TUPLE() + +LIBCASSOWARY_MAJOR_VERSION=0 +LIBCASSOWARY_MINOR_VERSION=60 +LIBCASSOWARY_MICRO_VERSION=3 + +AC_SUBST(LIBCASSOWARY_MAJOR_VERSION) +AC_SUBST(LIBCASSOWARY_MINOR_VERSION) +AC_SUBST(LIBCASSOWARY_MICRO_VERSION) + +BETA= + +LIBCASSOWARY_VERSION=$LIBCASSOWARY_MAJOR_VERSION.$LIBCASSOWARY_MINOR_VERSION.${LIBCASSOWARY_MICRO_VERSION}${BETA} +LIBCASSOWARY_RELEASE=$LIBCASSOWARY_MAJOR_VERSION-$LIBCASSOWARY_MINOR_VERSION-${LIBCASSOWARY_MICRO_VERSION}${BETA} + +AC_SUBST(LIBCASSOWARY_SO_VERSION) +AC_SUBST(LIBCASSOWARY_VERSION) +AC_SUBST(LIBCASSOWARY_RELEASE) + +AM_INIT_AUTOMAKE(libcassowary,${LIBCASSOWARY_VERSION}) + +AM_CONFIG_HEADER(config.h) + +dnl Checks for programs. + +AC_PROG_CC +AC_PROG_CXX +if test "$ac_cv_prog_cxx" = "no" ; then + AC_MSG_ERROR([*** libcassowary is C++. You don't appear to have a C++ compiler]) +fi + +CXXFLAGS="-g -D_REENTRANT" +OPT_CXXFLAGS="-D_REENTRANT -O6 -fomit-frame-pointer -ffast-math -fstrength-reduce -funroll-loops -fmove-all-movables" +if test x"$GXX" = xyes ; then + CXXFLAGS="$CXXFLAGS -Wall" +fi +if test x"$GXX" = xyes ; then + OPT_CXXFLAGS="$OPT_CXXFLAGS -Wall" +fi + +AC_ARG_ENABLE(optimize, + [ --enable-optimize ask the compiler for its best optimizations.], + [ if test "x$enable_optimize" != "xno" ; then CXXFLAGS="$OPT_CXXFLAGS" ; fi ]) + +AC_OBJEXT +AC_PROG_RANLIB +AM_PROG_LEX +AC_PROG_YACC + +AC_LANG_CPLUSPLUS + +CFLAGS="$CFLAGS $GLIB_CFLAGS" +CXXFLAGS="$CXXFLAGS $GLIB_CFLAGS" +LIBS="$LIBS $GLIB_LIBS $POSIX_RTSCHED_LIBS" + +AC_OUTPUT([Makefile + cassowary/Makefile +]) diff --git a/libs/glibmm2/.cvsignore b/libs/glibmm2/.cvsignore new file mode 100644 index 0000000000..865cec5b6c --- /dev/null +++ b/libs/glibmm2/.cvsignore @@ -0,0 +1,11 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.log +config.status +configure +glibmm-2.4.pc +glibmmconfig.h +libtool +stamp-h1 diff --git a/libs/glibmm2/AUTHORS b/libs/glibmm2/AUTHORS new file mode 100644 index 0000000000..35ef03fe26 --- /dev/null +++ b/libs/glibmm2/AUTHORS @@ -0,0 +1,20 @@ +Please use the mailing list (gtkmm-list@gnome.org) instead of emailing developers directly. +See the ChangeLog for up-to-date information. + +Murray Cumming +Daniel Elstner + +Some former contributors: + +Karl Nelson +Tero Pulkkinen +Elliot Lee +Phil Dawes +Erik Andersen +Bibek Sahu +Mirko Streckenbach +Havoc Pennington +Guillaume Laurent +Todd Dukes +Peter Lerner +Herbert Valerio Riedel diff --git a/libs/glibmm2/CHANGES b/libs/glibmm2/CHANGES new file mode 100644 index 0000000000..36571a78e0 --- /dev/null +++ b/libs/glibmm2/CHANGES @@ -0,0 +1,33 @@ +Changes between glibmm 2.2 (previously part of gtkmm) and glibmm 2.4: + +* glibmm is now a separate module, for use with non-GUI software. + (Note that glibmm 2.4 and gtkmm 2.4 install in parallel with + gtkmm 2.2 - so you can install and use both simultaneously and + port to 2.4 whenever you are ready.) +* glibmm now uses libsigc++ 2 rather than libsigc++ 1.2. + There is a libsigc++ compatibility header. The new, undeprecated, API + is slightly improved. + - Connecting signal handlers: + signal_something().connect( SigC::slot(*this, &Something::on_something) ); + should become + signal_something().connect( sigc::mem_fun(*this, &Something::on_something) ); + or, for non-member methods: + signal_something().connect( sigc::ptr_fun(&Something::on_something) ); + - Binding extra parameters: + SigC::bind(...) + should become + sigc::bind(...) + - Declaring signals: + SigC::Signal1 + should become + sigc::signal + - Declaring slots: + SigC::Slot1 + should become + sigc::slot + - Inheriting from the libsigc++ base class: + class Something : public SigC::Object + should become + class Something : public sigc::trackable + + diff --git a/libs/glibmm2/COPYING b/libs/glibmm2/COPYING new file mode 100644 index 0000000000..c4792dd27a --- /dev/null +++ b/libs/glibmm2/COPYING @@ -0,0 +1,515 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +^L + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +^L + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +^L + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +^L + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +^L + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. +^L + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. +^L + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS +^L + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper +mail. + +You should also get your employer (if you work as a programmer) or +your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James +Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/libs/glibmm2/ChangeLog b/libs/glibmm2/ChangeLog new file mode 100644 index 0000000000..0bddbef6b1 --- /dev/null +++ b/libs/glibmm2/ChangeLog @@ -0,0 +1,998 @@ +2.6.1: + +2005-03-07 Murray Cumming + + * glib/glibmm/interface.cc: Disable the new check for pre-existing + interface implementations, because it checks all base gtypes and + not just the current gtype. Bug #169442 by Bryan Forbes. + +2.6.0: + +2.5.6: + +2005-02-18 Murray Cumming + + * glib/glibmm/interface.cc: Interface_Class:add_interface(), used by + add_interface() methods of Interfaces: Do not add interfaces that + have been added before, to avoid the warning from glib. This + allows application code to be simpler. + +2005-02-18 Murray Cumming + + * tools/pm/Output.pm: Add the documentation to the const property() + accessor as well as the non-const one. + +2005-02-13 Murray Cumming + + * tools/extra_defs_gen/generate_extra_defs.cc: Use + g_param_spec_get_blurb() to output the documentation for the + properties in the .defs file. + * tools/m4/property.m4: Take an extra docs argument, and put it in the + doxygen docs. + * tools/pm/Output.pm: Add the extra docs argument when calling the + property m4 macro. + * tools/pm/Property.pm: Read in the new docs part of the .defs, and + add a period at the end if neccessary. + +2005-02-01 Murray Cumming + + * examples/threadpool.cc, dispatcher.cc, dispatcher2.cc: Removed the + #ifdef for AIX, because sigc::bind now works on AIX. + +2005-01-27 Cedric Gustin + + * MSVC_Net2003/glibmm/glibmm.rc.in: Reverted to 2.4 for the + library version number. + +2.5.5: + +2005-01-26 Cedric Gustin + + * MSVC_Net2003/glibmm/glibmm.vcproj: Reverted to 2.4 for the + library version number. + +2005-01-24 Cedric Gustin + + * Makefile.am, configure.in: Added MSVC_Net2003 directory. + * config.h.in: Added mkfifo #define (for mingw32). + * glib/glibmmconfig.h.in: Added new #define's to MSVC section. + * examples/iochannel_stream/Makefile.am: Do not build on win32 + with mingw32 (mkfifo not available). + * scripts/cxx_std.m4: Fixed typo in AC_DEFINE macros. + * build_shared/Makefile_build.am_fragment: Removed + $(sublib_name)_COMPILATION variable (is useless now on + cygwin/mingw as all symbols are dll exported). + * MSVC_Net2003/*: Initial commit imported from glibmm-2-4 branch. + * MSVC_Net2003/glibmm/Makefile.am: Rewrote rule for local copy of + glibmmconfig.h (required for 'make distcheck'). + +2005-01-21 Murray Cumming + + * configure.in, scripts/cxx.m4, glibmm/glibmmconfig.h.in: Added new + compiler tests to see whether extern "C" functions are put in the + global namespace, even when we use extern "C" inside a namespace + declaration. The AIX xlC compiler does this, but allows us to + redeclare the namespace inside the extern "C" block. + * glib/glibmm/property.h: Use the new + #ifdef GLIBMM_MUST_REDECLARE_NAMESPACES_INSIDE_EXTERNC and redeclare + the namespace when necessary. + * examples/thread/dispatcher.cc, dispatcher2.cc: Use sigc::bind<1> + instead of just sigc::bind<> because the AIX xlC compiler needs the + extra hint. However, the linker then fails, so the use of sigc::bind + is ifdefed out for _AIX. See the comments in the code. + +2005-01-21 Murray Cumming + + * configure.in, scripts/cxx.m4, glibmm/glibmmconfig.h.in: Added new + compiler tests. + 1. To see whether it allows use of non extern C functions + as extern C callbacks, because the Tru64 compiler does not + allow this, when using strict_ansi. We do not actually use this yet. + 2. To see whether it allows us to define a template that uses an + undefined type, even if we do not use it before defining the type. + Tru64 does not allow this. That's probably correct. + * glib/glibmm/container.h: #ifdef out a dynamic_cast that Tru64 + does not allow, and which I can not think of a better place to put. + See the comment in the code. + * glib/glibmm/containerhandler_helpers.h: When the compiler does not + alllow the GObject and GtkObject (dynamic_cast of) specializations + here, then put them in glib/glibmm/object.h and + gtkmm/gtk/src/object.hg instead.- needed by Tru64 compiler. + * glib/glibmm/value.h, value_custom.[h|cc]: Conditionally moved + the RefPtr Value specialization into object.h, as above. + * glib/src/ optiongroup.ccg, spawn.ccg, thread.ccg: Make C callacks + separate extern "C". + * glib/src/optiongroup.ccg: Do not use the StringArrayHandle, + because the Tru64 compiler has problems with it - see comments + in code. + * glib/src/optionentry.hg: Remove the include of value.h, because + it is not used and it causes a Tru64 compile error in + optioncontext.cc because its templates are included before the + types that the template uses. + +2005-01-19 Murray Cumming + + * configure.in, scripts/cxx.m4, glibmm/glibmmconfig.h.in: Added a + compiler test, because the IRIX MipsPro compiler does not allow the + inline initialization of ustring::npos. + * glib/glibmm/ustring.[h|cc]: When the compiler does not support the + inline initialization of npos, initialize it in the .cc file. + Declare partial specializations of the SequenceString inner class + inside the class - needed by IRIX MipsPro compiler. + +2005-01-18 Murray Cumming + + * glibmm/src/optiongroup.[hg|ccg]: CppOptionEntry::convert_c_to_cpp(): + Copy the strings to the vector in a loop, instead of using the + ArrayHandle constructor, because that does not seem to work with the + SUN Forte compiler. + +2.5.4: + +2005-01-10 Murray Cumming + + * glibmm/src/optiongroup.[hg|ccg]: Added a castitem constructor + that always takes ownership, needed by Gtk::Main. Added the new + FLAG_REVERSE flag value. Added reference documentation. + +2.5.3: + +2005-01-09 Murray Cumming + + * glib/glibmm/misc_utils.[h|cc]: Added setenv() and unsetenv(), + wrapping new functions added in glib 2.4. + * glib/src/convert.[hg|ccg]: Added filename_display_name() and + filename_display_basename(). + +2005-01-09 Murray Cumming + + * glib/src/optionentry.ccg: Copy constructor: Copy the short name + form the src, not from itself. Bug #16331 from Daniel Holbach. + +2005-01-09 Murray Cumming + + * glib/src/optionentry.[hg|cc]: Add add_entry(entry, bool&), to wrap + use of G_OPTION_ARG_NONE. Bug #163325 from Daniel Holbach. + * examples/options/main.cc: Use the new add_entry() overload. + +2005-01-06 Benoît Dejean + + * glib/glibmm/dispatcher.cc: + * glib/glibmm/error.cc: + * glib/glibmm/exceptionhandler.cc: + * glib/glibmm/main.cc: + * glib/glibmm/threadpool.cc: + * glib/glibmm/ustring.cc: + * glib/glibmm/wrap.cc: Don't export private API. + Closes #163031. + +2005-01-04 Chris Vine + + * examples/iochannel_stream/: Provide a means of obtaining + Glib::IOChannel error information from the streambuffer. Remove + the code conversion option from the fdstream/fdstreambuf + constructors and add comments in fdstream.h about code conversion + and other matters. Add a detach() function and a destructor to + fdstreambuf. Correct an error in fdstreambuf::xsgetn(). Include + missing header file in main.cc. + +2.5.2: + +2004-12-19 Murray Cumming + + * examples/: Adapted and added iochannel_stream example from + Chris Vine in bug #138259. + +2004-12-19 Murray Cumming + + * glib/src/: Added glib_docs.xml, generated with docsextract_to_xml.py + and glib_docs_override.xml, to generate some API reference from + the C docs. + * glib/src/Makefile.am: Mention the new files. + +2004-12-19 Murray Cumming + + * docs/reference/: Added a copy of the libstdc++ doxygen tags file, + but it still does not seem to work, for example with std::vector<> + and std::string. + +2004-12-19 Murray Cumming + + * docs/reference/Doxyfile.in: Use the libstdc++ TAG files, so that + references to std:: classes take people to their docs. + * glib/src/: Added glib_docs.xml and glib_docs_override.xml, and + mentioned them in Makefile.am. + +2004-12-19 Murray Cumming + + * glib/src/date.hg, glib/glibmm/main.h, + glib/glibmm/signalproxy_connectionnode.h: Deal with some doxygen + warnings about undocumented parameters. + * glib/glibmm/ustring.h: Added documentation for the size() and + bytes() methods. + +2004-11-21 Murray Cumming + + * glib/src/optionentry.[hg|ccg]: Removed OptionEntry enum and + set_arg_data(), because they are not needed any more. + +2.5.1: + +2004-11-01 Murray Cumming + + * glib/src/optiongroup.[hg|ccg]: Added add_entry() for vector + and add_entry_filename() for std::string and vector. + * examples/options/main.cc: Test these new methods. + +2004-10-30 Murray Cumming + + * glib/src/optiongroup.[hg|ccg]: Added gobj_give_ownership(). + * glib/src/optioncontext.[hg|ccg]: add_group(), set_main_group(): Use + gobj_give_ownership() because GOptionContext deletes the GOptionGroups + that we give it. + +2004-10-26 Murray Cumming + + * glib/src/optionentry.hg: Remove accessors for arg and arg_data. + * glib/src/optiongroup.[hg|ccg]: add_entry(): Remove arg_type parameter + and instead add overrides which take specific C++ value types. + Add CppOptionEntry inner class to hold information about each entry + and its dynamically allocated C value. + Add map_entries_ map to store them, so we can iterate over them during + post_parse. + +2004-10-21 Murray Cumming + + * build_shared/Makefile_build.am_fragment: Patch from Roger Leigh in + bug # 15589 to use PLATFORM_WIN32 rather than OS_WIN32 to enable + -no-undefined. This allows glibmm to build in a cgwin environment, + apparently. + +2.5.0: + +2004-10-17 Murray Cumming + + * glib/src/optioncontext.[hg|ccg]: add_entry(): Fixed crash by + creating a temporary array, with a nulled last item, which is what the + C function wants. In callbacks, ignore the group parameter because our + option group in the data parameter is the same, and does not require + construction of a second C++ wrapper instance for the same C instance. + * glib/src/optiongroup.[hg|ccg]: Removed the cast constructor, because + it is not needed anymore, and there is no clear way to implement it. + +2004-10-14 Murray Cumming + + * tools/pm/WrapParser.pm: on_wrap_property(): Convert property name to + canonical form, so that we can recognise notifications of property + value changes. Bug #152764. + +2004-10-07 Philip Langdale + + * glib/glibmm/signalproxy_connectionnode.cc: Remove unnecessary warning + when notify() is called after destroy_notify_handler(). (bug #154498) + +2004-10-01 Murray Cumming + + * glib/src/option*.[hg|ccg], examples/options/main.cc: Rethought the + structure now that I see how the parts work together. Rearranged the + example to show how the parsing can fill values in member variables + of a derived OptionGroup class. However, 1. it crashes now, 2. we need + extra code to map the GOption C types to suitable C++ types, probably + by doing pre and post parsing to create temporary C types for the C++ + types. + +2004-09-27 Murray Cumming + + * glib/src/option*.[hg|ccg]: Wrapped more methods, but I have still not + finished. + * examples/options/: Started an example. + +2004-09-26 Murray Cumming + + * glib/src/glib_functions.defs: Regenerated with h2defs.py + * glib/src/: Added optionentry.[hg|ccg], optiongroup.[hg|ccg], + optioncontext.[hg|ccg]. + +2004-09-19 Murray Cumming + + * This is the HEAD branch. + +2004-09-13 Cedric Gustin + + * examples/thread/dispatcher.cc: Fixed a race condition on win32 + that involved the combined use of auto_ptr and multithreading (bug + #109966). + +2.4.4: + +2004-07-23 Martin Schulze + + * glib/glibmm/main.cc: Move deletion of SourceConnectionNode object + into destroy_notify_callback() exclusively; do not delete from + notify(). + (bug #144420) + +2004-07-10 Murray Cumming + + * glib/glibmm/signalproxy_connectionnode.cc: notify(): Do not delete + the connection after disconnecting it, because disconnecting it + always causes disconnect_notify to be called, so just delete it there. + This prevents double deletes and reading of deleting memory, found in + bug #145571. + +2004-07-09 Murray Cumming + + * glib/glibmm/signalproxy.h.m4: Added some documentation. + +2004-06-20 Daniel Elstner + + * glib/glibmm/objectbase.cc: Spring cleaning. + * glib/glibmm/object.cc: ditto. + +2.4.3: + +2004-06-18 Daniel Elstner + + * scripts/macros.m4 (GTKMM_ARG_ENABLE_WARNINGS): Add + -Wno-long-long to the list of tried warning flags. + +2004-06-16 Daniel Elstner + + * glib/glibmm/dispatcher.cc (DispatchNotifier::create_pipe): There + is no point in calling g_file_error_from_errno() on win32 since we + have no real errno. Also fix the error text to say "event" rather + than "pipe". + +2004-06-14 Daniel Elstner + + * scripts/cxx.m4: Add a couple of casts to void in order to suppress + warnings about unused variables. I still have no idea as to why the + hardcore warning flags are remembered when running make distcheck... + +2004-06-14 Daniel Elstner + + * examples/thread/dispatcher.cc: Explicitely join all threads. + Hopefully that'll fix the crash on win32 (see bug #109966). + +2004-06-13 Daniel Elstner + + * examples/thread/dispatcher*.cc (main): Remove unused parameter + names to fix building with -Werror. + +2004-06-13 Daniel Elstner + + * configure.in (GTKMM_ENABLE_DEBUG_REFCOUNTING): s/^GTK/GLIB/ + +2004-06-08 Daniel Elstner + + * build_shared/Makefile_build.am_fragment (all_includes): Remove + left-over include paths for pango, atk, gdk and gtk. + +2004-06-07 Daniel Elstner + + * glib/glibmm/stringutils.h: Replace a couple of double quotes with + " to prevent doxygen from escaping the enclosed HTML entities. + +2004-06-04 Daniel Elstner + + * glib/glibmm/ustring.h: Use /*! instead of /** to introduce + doxygen comments in order to avoid cluttering the long method list + of class Glib::ustring. Replace a few double quotes with " + to prevent doxygen from escaping the enclosed HTML entities. + +2.4.2: + +2004-06-03 Daniel Elstner + + * scripts/Makefile.am (EXTRA_DIST): Remove mkinstalldirs, because + automake-1.8 doesn't use it anymore and prior versions should pick + it up automatically anyway. + +2004-06-03 Daniel Elstner + + * glib/glibmm/dispatcher.cc: Complete overhaul of the Win32 + implementation of Glib::Dispatcher. That is, mutex locking is + done correctly now and dynamic memory allocation is no longer + used, plus a few other cleanups. See reopened bug #109966. + +2004-06-03 Daniel Elstner + + * glib/glibmm/signalproxy_connectionnode.cc + (SignalProxyConnectionNode::SignalProxyConnectionNode): + Reorder the initializer list to match the declaration order. + + (SignalProxyConnectionNode::notify): Add missing return 0. + +2004-05-26 Daniel Elstner + + * glib/glibmm/ustring.{cc,h}: Globally apply some minor code + cleanup and optimization tweaks. + + (get_unichar_from_std_iterator): Replace implementation with a + hand-optimized and profiled variant that has been lurking in my + local tree for quite some time, thus should be well tested. + Also add the G_GNUC_PURE() attribute. + + (operator+): Explicitely instantiate and return a temporary string, + instead of accessing the reference ustring::operator+=() returns. + This quite often allows the compiler to eliminate the additional + copy constructor invocation. + +2004-05-25 Murray Cumming + + * configure.in, Makefile.am: Removed the glibmm.spec files, because + it is broken and nobody has volunteered to fix it. + +2004-05-20 Daniel Elstner + + * examples/thread/dispatcher.cc: Revert last commit because it's + silly. To make the code truly exception-safe it would be necessary + to either join all threads or to notify them, which is way beyond + the scope of this example. + +2004-05-20 Daniel Elstner + + * examples/thread/dispatcher.cc: Set a good example and + be paranoid about possible memory leaks due to exeptions. + +2004-05-20 Daniel Elstner + + * examples/thread/dispatcher.cc: Code cleanup. Most importantly, + get rid of the locking around std::cout since it obfuscates the + purpose of using Glib::Dispatcher. + +2004-05-13 Daniel Elstner + + * glib/glibmm/object.{cc,h} (ConstructParams::ConstructParams): + Implement the copy constructor in a way that actually works if used. + Relying on the compiler to optimize it away is a bad idea. (#132300) + +2004-05-04 Murray Cumming + + * glib/glibmm/ustring.h: Documented the constructors, based on + the libstdc++ documentation, to make it clear that sizes are in + characters rather than bytes. + +2004-05-01 Murray Cumming + + * configure.in: Increase glib dependency to 2.4.0. + +2004-04-30 Murray Cumming + + * tools/m4/gobject.m4: Allow use of _CUSTOM_DTOR(), needed by + Gnome::Gda::Connection. + +2.4.1: + +2004-04-17 Murray Cumming + + * docs/reference/Makefile.am: Make the generated html depend on the + beautify_docs.pl.in source instead of the generated beautify_docs.pl, + so that the html is not rebuilt from tarballs. + +2004-04-17 Murray Cumming + + * glib/glibmm/container_handle.h: Reimplemented more of the + to_cpp_type() methods without using dependent methods, so that they + work with g++ 3.4 (cvs versions). + +2.4.0: + +2004-04-11 Murray Cumming + + * tools/pm/WrapParser.pm, Output.pm, m4/signal.m4: Allow _WRAP_SIGNAL() + to take an refreturn argument, so that Gtk::Widget::on_get_accessible() + can do an extra ref before returning the Atk::Object. + +2004-04-09 Murray Cumming + + * tools/pm/Output.pm: output_wrap_property(): Provide the actual + property name as well as one with - replace with _, so we can + test for the correct value in notification signal handler. + * tools/m4/property.m4: Use the actual property name when calling + C functions. + +2.3.8: + +2004-03-24 Murray Cumming + + * scripts/cxx.m4: Corrected parentheses, which cause the docs to be + written into config.h. Thanks to Alexander Nedotsukov. + +2004-03-23 Murray Cumming + + * scripts/cxx.m4: Corrected the ambiguous const template test, which + failed on all platforms because it generated bad code. + +2004-03-20 Martin Schulze + + * glibmm/main.cc: Bug fix in SourceConnectionNode::notify() (#137030). + +2004-03-18 Murray Cumming + + * tools/generate_wrap_init.pl: Change a regex so that files are + included without full path. Apparently this helps when building outside + of the source directory, though I'm sceptical. By Victor Zverovich in + bug #137530. + +2.3.7: + +2004-03-14 Murray Cumming + + * scripts/sun.m4: Set the correct variable, so it is actually set in + glibmmconfig. + +2004-03-14 Murray Cumming + * glib/glibmm/containerhandle_shared.h value.h: Used ifdef + GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS to avoid + problems with the SUN Forte compiler. + +2004-03-14 Murray Cumming + + * scripts/cxx.m4: Added CAN_DISAMBIGUATE_CONST_TEMPLATE_SPECIALIZATIONS + m4 macro to use in configure.in, to check for the SUN Forte problem - + see the comments in cxx.m4. + * scripts/sun.m4: Moved some brackets around to make the define + actually work. + +2004-03-13 Murray Cumming + + * glib/glibmm/containerhandle_shared.h: TypeTraits to_cpp_type() + specializations: Use wrap_auto() directly instead of a specific + wrap() overload that would be dependent. Needed for g++ 3.4. + * glib/glibmm/containers.h: Same again. + +2004-03-13 Murray Cumming + + * tools/m4/class_shared.m4: Remove the parent get_type() call from + the Class::init() function, because it is optimised away, and g++ 3.4 + actually complains that it does nothing. + * glib/glibmm/object.[h|cc]: Add a public ConstructParams copy + constructor, needed by g++ 3.4. See comments in the code. + * tests/glibmm_value/glibmm_value.cc: Instantiate instances of + value types, to fix the g++ 3.4 build. I don't know what the code + was meant to do before anyway. + +2004-03-11 Murray Cumming + + * scripts/: Added sun.m4, copied from libsigc++-1.2/scripts and + modified, so we can detect the SUN Forte compiler. + * configure.in: Used the m4 macro. + * glibmm/glibmm-config.h: Undef the GLIBMM_COMPILER_SUN_FORTE macro + so that it will be defined if configure sets it. + +2004-03-09 Murray Cumming + + * Some, but not all, SUN Forte build fixes: + * tools/m4/convert_gdk.m4, convert_glib.m4: Use existing + sun-specific conversion when converting from any + RefPtr to *Something. + +2004-04-08 Hagen Moebius + + * tools/pm/DocsParser.pm: Another change to give better warnings and + errors at gmmproc-runtime. Further improvment of parsing parameter names + to strip traling underscres. This not only for reference text, but for + the parameter list also. + +2004-04-07 Hagen Moebius + + * tools/pm/DocsParser.pm: Allow overrides to only override + part of the docs. Add a tag to associate non-prefixed + functions with classes. Improve parsing of parameter names so they + can now have numbers in the names. + +2.3.6: + +2004-03-03 Murray Cumming + + * Added glib/glibmm/i18n.h and i18n-lib.h which defines _() and friends + for internationalization. See the comments in the header - you must + include things in the right order. + * glib/src/spawn.[hg|ccg]: Added spawn_close_id() as wrapper for + g_spawn_close_id(). + * glib/glibmm/main.[h|cc]: Added MainLoop::depth() as wrapper for + g_main_depth(). + + 2004-03-02 Murray Cumming + + * tools/pm/Function.pm: parse_param(): Only parse const as an + individual part of the type name if it is followed by a space, so + that we can have const const_iterator& types. + +2004-02-27 Martin Schulze + + * CHANGES: Fix typo reported by Chris Vine. + +2004-02-13 Martin Schulze + + * documentation fixes and corrections in the comments reflecting + the shift to libsigc++ 2. + * make all source files in example thread use libsigc++ 2 instead + of libsigc++ 1.2. + +2.3.5: + +2004-02-10 Murray Cumming + + * glibmm now uses libsigc++ 2 instead of libsigc++ 1.2. See bug + #125061 for more details. We must update CHANGES later. + +2.3.4: + +2004-02-02 Murray Cumming + + * glib/glibmm/containerhandle_shared.h: Traits: Added + const_cast, needed by TreeView::get_columns() const: bug #126721. + +2004-01-29 Murray Cumming + + * tools/pm/Parser.pm, Output.pm, tools/m4/signal.m4: Add an optional + custom_c_callback parameter to _WRAP_SIGNAL to allow special code + for the SelectionData& output parameter in Gtk::Widget signals. + Hopefully we won't need too many more of these hacks - the m4 is + becoming very hard to read, with all these nested ifelse() statements. + +2004-01-27 Cedric Gustin + + * build_shared/Makefile_build.am_fragment: Added win32-specific + --export-all-symbols to linker flags. This is backported from + gtkmm-2.2. + * README.win32: Updated text for glibmm-2.4. + * tools/generate_wrap_init.pl.in: Replaced GTKMM_WIN32 by the + standard G_OS_WIN32. + +2.3.3: + +2004-01-22 Murray Cumming + + * glib/date.[hg|ccg]: Added clamp_min() and clamp_max() to wrap the + case where g_date_clamp() takes null values. + +2004-01-18 Alberto Paro + + * glib/src/date.hg: documentated Glib::Date functions. + * glib/glibmm/main.h: documentated Glib::MainLoop,Glib::MainContext + and Glib::Source functions. + +2004-01-18 Murray Cumming + + * tools/pm/Output.pm, tools/m4/property.m4: When the property is not + read-only, add a second read-only propertyproxy for the same property, + with a const accessor. This allows setting of properties in const + methods. Make all read-only propertyproxies have const accessors. + * glib/glibmm/propertyproxy.h: Added class documentation. + * tools/pm/Output.pm: Declare _vfuncs as virtual methods - fixing + an error in my last change. + +2004-01-16 Murray Cumming + + * tools/pm/Output.pm, tools/m4/vfunc.m4: + - Generate const vfuncs when requested with _WRAP_VFUNC(). + - Put the *_vfunc() decleraration directly into the header, where + the _WRAP_VFUNC() macro appears, instead of in a separate section. + This allows us to add doxygen documentation before the _WRAP_VFUNC() + in the .hg file. However, we must check that all of our _WRAP_VFUNC() + macros are in protected: sections. + +2004-01-12 Murray Cumming + + * glib/glibmm/object.cc: Object::Object() default constructor. + Remove the warning because we really need this to implement a custom + TreeModel. Derive a new GType, as in the + Object::Object(ConstructParams) constructor. Like that constructor, + the default one also assumes that you have called a suitable + ObjectBase constructor, such as ObejctBase(typeid(MyCustomClass)). + +2004-01-09 Murray Cumming + + * tools/pm/Output.pm: output_wrap_property(): Allow construct-only + properties to be wrapped, as read-only properties. + +2004-01-03 Murray Cumming + + * tools/gmmproc.in, pm/WrapParser.pm, DocsParser.pm: Removed the + mergecdocs option - because we always want to merge C docs, to avoid + accidental upload of half-complete docs. + +2003-12-29 Murray Cumming + + * Makefile.am: Add scripts and tests directories to SUBDIRS instead of + DIST_SUBDIRS, so that their Makefile.am files are actually used. + * scripts/macros.m4: renamed GTKMM_CHECK_PERL() to GLIBMM_CHECK_PERL() + and install it as glibmm_check_perl.m4, so that other *mm projects + can use it. They need the PERL_PATH for Doxygen. + +2003-12-22 Murray Cumming + + * docs/reference: generate beautify_docs.pl from beautify_docs.pl.in, + so it can have the perl path in it. Install it, so other *mm + modules can use it. + +2003-12-13 Murray Cumming + + * tools/m4/*.m4: Added fuller Doxygen documentation to all gobj() and + wrap() methods. Doxygen should not emit warnings about these now. + +2.3.2: + +2003-11-29 Murray Cumming + + * tools/m4/signal.m4: Add spaces inside signal_proxy template types, + to avoid << and >> when using templated types. + +2003-11-27 Murray Cumming + + * tools/pm/WrapParser.pm, Output.pm: Added WRAP_METHOD_DOCS_ONLY() + macro. + * docs/internal/using_gmmproc.txt: Explained the new macro. + +2003-11-02 Murray Cumming + + * glib/glibmm/: Added init.[h|cc] with Glib::init() so that the + gnomemm init() methods do not need to initialize gtkmm. + * tools/m4/class_gobject.m4, class_gtkobject.m4: Added + _GMMPROC_PROTECTED_GCLASS macro, needed by libgnomecanvasmm. This + was not previously properly merged from gtkmm2. + * tools/m4/property.m4: Re-added PropertyProxy reference documentation + that did not survive a previous merge from gtkmm2. + +2003-11-01 Murray Cumming + + * glib/glibmm/propertyproxy.h, propertyproxy_base.[h|cc]: Now uses + ObjectBase instead of Object, because glib can now have properties + on interfaces. This is needed, for instance, by the GtkFileChooser + interface wrapper in gtkmm. + * glib/glibmm/object.h: Moved get/set_property() methods into + ObjectBase, for the same reason. + * tools/pm/WrapParser.pm, Output.pm: Added optional no_default_handler + parameter to gmmproc _WRAP_SIGNAL() macro, for signals whose + default signal handler is not in the klass struct and therefore + can not be overridden. + +2003-10-31 Murray Cumming + + * docs/Makefile_web.am_fragment: Corrected install location, + so that links from the gtkmm docs work when they are installed. + +2003-10-30 Murray Cumming + + * docs: Added images directory, copied from gtkmm, for the reference + html docs. + * configure.in: Mention docs/images/Makefile. + * docs/reference/Doxyfile.in: Genereate glibmm_doxygen_tags instead + of gtkmm_doxygen_tags. + * docs/reference/Makefile.am: dist glibmm_doxygen_tags. + * docs/reference: gtkmm*.html_fragment are now glibmm*.html_fragment. + +2.3.1: + +2003-10-23 Murray Cumming + + * tools/pm/Output.pm: output_wrap_create(): Used + args_types_and_names_with_default_values() intead of + args_types_and_names(), so that create() functions .in .h files have + the default values as specified in _WRAP_CREATE() in .hg files. + * tools/pm/WrapParser.pm: on_ignore_signals(): Strip the quotes, to + make _IGNORE_SIGNAL() really work in .hg files. + +2003-10-02 J. Abelardo Gutierrez + + * examples/threads/dispatcher.cc + examples/threads/dispatcher2.cc: fixed to cast out all gktmm code, + now they only need glimm. + * configure.in: Added examples/threads because they don't use gtkmm + anymore. Now all examples/threads compiles and run just fine. + +2.3.0: + +2003-09-30 Murray Cumming + + * configure.in: Removed examples/threads because we don't build or + distribute it, because it doesn't build, because it uses gtkmm. + +2003-09-30 Murray Cumming + + * glib/glibmm/object_base.h: ObjectBase inherits virtually from + Sigc::Object. See bug #116280. + +2003-09-27 Cedric Gustin + + * glib/glibmm/threadpool.cc: Removed + _GTKMMPROC_SIGNAL_H_AND_CC(#ifndef G_OS_WIN32) restrictions. These + functions are now implemented in the latest (2.2.4) GTK+ on win32. + * README.win32 : Updated list of unsupported functions. + +2003-08-20 Frank Naumann + + * glib/src/thread.hg, + glib/src/unicode.hg: Warning bugfix for VisualStudio .NET 2003; + made wrapper functions returning bool from glib functions + returning int (C lacks builtin type bool) explicit by adding + an != 0 check. Otherwise VisualStudio .NET warn about implicit + int -> bool cast. + +2003-07-26 Murray Cumming + + * glib/glibmm/dispatcher.cc: Added #include , needed + by MSVC++, as suggested by Frank Naumann in bug #118215. + +2003-05-31 Murray Cumming + + * tools/gmmproc.in: Corrected location of installed .pm files. They + are now in a glibmm-2.3 folder instead of a glibmm-2.4 folder. + +2003-05-14 Murray Cumming + + * Applied some of MSVC++ .NET 2003 changes from jburris. For instance, + use of Gtk:: prefix with manage, because MSVC++ can not guess it. Also + corrected the out-of-sync protected/private modifiers in the private + gtype classes and their prototypes. + +2003-05-09 Cedric Gustin + + * glib/glibmm/dispatcher.cc: small typo in G_OS_WIN32 condition. + +2003-05-07 Murray Cumming + + * scripts/macros.m4: Made the --enable-debug-refcounting configure + option set GLIBMM_* instead of GTKMM_*. + +2003-05-02 Murray Cumming + + * tools/m4/*.m4: Added doxygen comments to gobj() methods. + * examples/markup/parser.cc: Commented-out a std::right that gcc 2.93 + does not like. + +2003-04-23 Andrew Makeev + + * glib/glibmm/dispatcher.cc: Added some #ifdefed code to implement + Glib::Dispatcher on WIN32. See comments with the code. + +2003-04-22 Murray Cumming + + * Install headers in a glibmm-2.3 directory instead of glibmm-2.4, + to be consistent with gtkmm 2.4. + +2003-04-21 Murray Cumming + + * arrayhandle.h, listhandle, slisthandle.h: + Glib::ListHandle, Glib::ListHandle, Glib::SListHandle: Added + reference docs explaining that people can use STL containers. + +2003-04-21 Murray Cumming + + * Removed examples/idle: It's now updated and in gtkmm/examples/book. + +2003-04-19 Murray Cumming + + * tools/pm/GtkDefs.pm: get_unwrapped(): Changed some & to && to + avoid warnings and because that is probably what they should be. + + * tools/m4/extra_defs_gen/generate_defs_glib.cc: Removed parameter + names from main(), because they are not used. Avoid warning. + +2003-03-26 Ross Burton + + * glib/src/module.hg: Added API documentation. + +2003-03-18 Enrico Scholz + + * scripts/*.m4, configure.in: + Added description to several AC_DEFINE statements to make 'autoheader' + happy + * Makefile.am: + Added ACLOCAL_AMFLAGS to make 'autoreconf' work + +2003-03-18 Cedric Gustin + + * Makefile.am : removed examples from DIST_SUBDIRS + +2003-03-18 Enrico Scholz + + * examples/Makefile.am_fragment: Added DESTDIR-support. + +2003-03-14 Cedric Gustin + + * Install examples. The are built by default too. Patch adapted for + glibmm 2.4 by Murray Cumming. + +2003-03-04 Cedric Gustin + + * configure.in : Removed libstdc++ in LDFLAGS on win32. Latest + libtool is taking care of it. + * build_shared/Makefile_build.am_fragment, + tools/extra_defs_gen/Makefile.am : Added + --export-all-symbols linker flag on win32 (required by latest + libtool to build DLLs). + * build_shared/Makefile_gensrc.am_fragment : Modifiy rule that + builds wrap_init.cc. wrap_init.cc now contains reference to all + objects, event on win32. #ifdefs are included when needed. + * README.win32 : updated for version 2.2. Added list of missing + methods and signals on win32 + * tools/m4/base.m4 : Added _GTKMMPROC_SIGNAL_H_AND_CC macro. + + +2003-03-14 Martin Schulze + + * docs/internal/using_gtkmmproc.txt: Correct name of + [...]signals.defs generation utiliy. + +2003-01-30 Rick L Vinyard Jr + + * glib/src/thread.hg Cond: Add documentation + +2003-01-27 Murray Cumming + + * glib/glibmm/refptr.h: Removed RefPtr<>::is_null() to encourage use + of more pointer-like operator bool() instead. Wanted to remove clear() + too, but there is no =0 equivalent yet. + * tools/gmmproc.in: Change harcoded gtkmm-2.0/m4 path to glibmm-2.4/m4. + +2003-01-22 Murray Cumming + + * GTKMM_ m4 tests and #defines are now prefixed with GLIBMM_ + +2003-01-21 Murray Cumming + + * tests/Makefile.am_fragment, examples/Makefile.am_fragment: + Corrected LIBS and CFLAGS. Not all of these build because they + use gtkmm stuff too. They need to be reduced to glibmm-only code. + +2003-01-21 Murray Cumming + + * glib/Makefile.am, glib/glibmm/Makefile.am: Install headers in + glibmm-2.4 directory rather than gtkmm-2.4 + +2003-01-21 Murray Cumming + + * configure.in: Use GLIBMM_* instead of GTKMM_* to avoid config.h + clashes with gtkmm 2.4. + * glib/glibmm-2.4.pc.in: Correct cflags - report 2.4 instead of 2.0. + +2003-01-21 Murray Cumming + + * tools/extra_defs_gen/Makefile.am: Changed extra_defs library name + from 2.4 to 2.3, so it can be unstable. + +2003-01-09 Daniel Elstner + + * glib/glibmm/utility.h (GLIBMM_INITIALIZE_STRUCT): Replace + __builtin_bzero() with __builtin_memset() because the former is + deprecated. Also, it looks like GCC is able to optimize the 0 case + so we don't lose anything here. + +2003-01-09 Daniel Elstner + + * glib/glibmm/miscutils.cc (Glib::build_path): Reserve 256 bytes + in advance to improve performance. + +2003-01-09 Daniel Elstner + + * glib/glibmm/miscutils.{cc,h} (Glib::build_path): Fix to make it + behave exactly like g_build_path(). (#102885, Jarek Dukat) + + (Glib::build_filename(const std::string&, const std::string&)): + Implement in terms of Glib::build_path(). + +2003-01-21 Murray Cumming + + * Renamed gtkmmproc to gmmproc. + +2003-01-08 Murray Cumming + + * glib/glibmm/refptr.h: Removed the operator=(CppObject*), as + suggested in the TODO comment. + +2003-01-08 Murray Cumming + + * make distcheck works. + +2003-01-08 Murray Cumming + + * It now builds, though I haven' tried installing it. The + library names and header directories should now all have 2.4 + instead of 2.0 in their name. + +glibmm was previously part of gtkmm2. + diff --git a/libs/glibmm2/INSTALL b/libs/glibmm2/INSTALL new file mode 100644 index 0000000000..095b1eb406 --- /dev/null +++ b/libs/glibmm2/INSTALL @@ -0,0 +1,231 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PREFIX', the package will +use PREFIX as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/libs/glibmm2/Makefile.am b/libs/glibmm2/Makefile.am new file mode 100644 index 0000000000..8e49568562 --- /dev/null +++ b/libs/glibmm2/Makefile.am @@ -0,0 +1,23 @@ +ACLOCAL_AMFLAGS = -I scripts + +SUBDIRS = glibmm +DIST_SUBDIRS = $(SUBDIRS) + +EXTRA_DIST = build_shared/Makefile_build.am_fragment \ + build_shared/Makefile_build_gensrc.am_fragment \ + build_shared/Makefile_gensrc.am_fragment \ + build_shared/Makefile_gensrc_platform.am_fragment \ + build_shared/Makefile_build_extra.am_fragment \ + CHANGES glibmmconfig.h.in glibmm-2.4.pc.in + +glibmm_includedir = $(includedir)/glibmm-2.4 +glibmm_include_HEADERS = glibmm.h + +glibmm_configdir = $(libdir)/glibmm-2.4/include +glibmm_config_DATA = glibmmconfig.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = glibmm-2.4.pc + +all-local: + @echo "*** Everything completed ***" diff --git a/libs/glibmm2/NEWS b/libs/glibmm2/NEWS new file mode 100644 index 0000000000..9edbf66137 --- /dev/null +++ b/libs/glibmm2/NEWS @@ -0,0 +1,242 @@ +2.6.1: + +* Interface::add_interface(): Disabled the check for a second call, + introduced in 2.6.0, for now, because it stops some valid uses. + (Bryan Forbes) + +2.6.0: + +New stable version. Changes compare to glibmm 2.4.x: + +* Added Option, OptionContext, OptionGroup for parsing of command-line arguments. +* Added filename_display_basename() and filename_display_name(). +* Added setenv() and unsetenv(). +* add_interface() methods will no longer give warnings if you + call them twice. +* gmmproc: + - Now reuses C properties documentation. + +2.5.6: + +* add_interface() methods will no longer give warnings if you +call them twice. +* gmmproc: Output properties documentation taken from the .defs. +* examples now build on AIX. + (Murray Cumming) +* MSVC++ .Net 2003 build fix. (Cedric Gustin) + +2.5.5: + +* Now builds with the following compilers, in addition to +the existing GNU g++, and Intel compilers: +- SUN Forte CC 5.5 +- IBM AIX xlC v7 +- Tru64 C++ V6.5-042 +- IRIX MIPSpro 7.4.2m + (Older versions of all these compilers might also work.) + (Murray Cumming, www.thewrittenword.com) +* Now builds with MSVC++ .Net 2003 (gtkmm 2.4 already did). + (Cedric Gustin) + +2.5.4: + +Options: +* Added Option(GOptionGroup* cast_item) constructor, + needed by Gtk::Main. +* Added reference documentation. +(Murray Cumming) + +2.5.3: + +* Options: + - Allow parsing of boolean arguments (arguments with no value). + - Really use the short names. + (Daniel Holbach, Murray Cumming) +* Added filename_display_basename() and filename_display_name(). + (Murray Cumming) +* Added setenv() and unsetenv(). (Murray Cumming) +* Use static keyword to prevent exporting private API. + (Benoît Dejean) +* input example: Improvements and simplification. (Chris Vine) + +2.5.2: + +* OptionEntry: Remove useless enum. (Murray Cumming) +* Documentation: + - examples: Added iochannel_stream example. (Chris Vine) + - reference: Generate more reference API from the C documentation, and + try to use the libstdc++ doxygen tags file to link to their + documentation. (Murray Cumming) + +2.5.1: + +* OptionContext, OptionGroup, OptionEntry: Made the add_entry() methods + type-safe and fixed several problems memory-management problems. This + API is now worth looking at. + +2.5.0: + +* Added OptionContext, OptionGroup, and OptionEntry classes, for + parsing of command-line options. See examples/options/ + +2.4.4: + +* Signals: Avoid crashes when disconnecting a signal when handling that signal. + (Murray Cumming, Martin Schulze) +* +2.4.3: + +* Minor improvements to reference documentation. (Daniel Elstner) +* Minor Glib::Dispatcher improvements (Daniel Elstner) + +2.4.2: + +* Glib::Dispatcher: win32 implementation rewritten, and hopefully, improved. + (Daniel Elstner) +* Glib::ustring: + - Optimization and code-cleanup. (Daniel Elstner) + - Added reference documentation for constuctors. (Murray Cumming) +* Fixed some compiler warnings. + (Daniel Elstner) +* gmmproc: Some improvements for libgdamm. (Murray Cumming) + + +2.4.1: + +* Build fixes for gcc 3.4.0. +* Doxygen not required when building from tarballs. + (Murray Cumming) + + +2.4.0: + +Changes since 2.2.0: + +* Now separate from gtkmm, so you can use things like Glib::ustring without depending on gtkmm. This glibmm 2.4 API installs in parallel with gtkmm 2.0/2.2, so you can install applications which use either. +* When using pkg-config, you should check for "glibmm-2.4". +* Glib::ObjectBase inherits virtually from SigC::Object, allowing multiple inheritance with other classes that inherit from SigC::Object. +* RefPtr: + - is_null() was removed, to encourage you to use "== 0" instead. + - operator=(CppObject*) was removed. +* The gtkmmproc code-generator is now gmmproc, and has several improvements to support gtkmm 2.4. +* Now uses improved libsigc++ 2.0 API. +* Added i18n.h and i18n-lib.h, which include the relevant + glib headers, which declare internationalization + macros such as _(). +* New methods: + Glib::spawn_close_id(), Glib::MainLoop::depth(), + Glib::Date::clamp_min(), Glib::Date::clamp_max(). +* Improved documentation. + + +2.3.8: + +* Fix crash when using Glib::Main signals. + (Martin Schulze) +* Corrected the configure-time SUN compiler check. + (Murray Cumming, Alexander Nedotsukov) + +2.3.7: + +* Added configure macros to detect SUN compiler oddities. +* Various SUN Forte C+ and g++ 3.4 (cvs) build fixes. + (Murray Cumming) +* gmmproc: Improved parsing of C docs. + (Hagen Moebius) + +2.3.6: + +* Added i18n.h and i18n-lib.h, which include the relevant + glib headers, which declare internationalization + macros such as _(). (Murray Cumming) +* Added Glib::spawn_close_id(). (Murray Cumming) +* Added Glib::MainLoop::depth(). (Murray Cumming) +* Documentation: corrections to CHANGES (Martin Schulze). +* gmmproc: Can now handle "const const_iterator& iter" + parameter names without getting confused by 2 consts. + (Murray Cumming) + +2.3.5: + +* glibmm now uses libsigc++ 2 rather than libsigc++ 1.2. + +2.3.4: + +* ListHandle/SListHandle (intermediate container types): + - Added a const_cast<> to allow lists of const elements. +* gmmproc: _WRAP_SIGNAL(): Added optional custom_c_callback + parameter. + (Murray Cumming) +* WIN32: Build fixes, mostly merged from the 2.2 branch. + (Cedric Gustin) + +2.3.3: + +* gmmproc (code generator) + - properties: Make read-only properties have const accessors, + and add a second read-only const accessor for normal + properties. Wrap construct-only properties as read-only, + instead of ignoring them. + - vfuncs: Really generate const vfuncs when requested. Put + the method declaration directly into the .h file, so that + the doxygen documentation can be next to it. + - documentation: + - Remove mergecdocs configure option - always + merge the C docs, to avoid any risk of uploading or + releasing empty documentation. Just delete the *_docs.xml + files to make building from cvs faster. + - Install a GLIBMM_CHECK_PERL() macro, for use by gtkmm + and other *mm projects, to get the perl path needed by + doxygen. + - Install beautify_docs.pl so it can be reused in gtkmm + and other *mm projects, instead of having lots of copies. +* Glib::ObjectBase: The default constructor, never before used, + now generates a custom GType, for use when creating new + implementations of Glib::Interfaces - for instance, see the + new custom tree model example in gtkmm. +* Glib::Date: Added clamp_min() and clamp_max(). + (Murray Cumming) + +* Documentation: + - Added reference documentation for MainLoop, MainContext, + Source, and Date. (Alberto Paro) + +2.3.2: + +* gmmproc (code generator): + - signal proxies have extra space to avoid << with templates. + - Added WRAP_METHOD_DOCS_ONLY() for reusing documentation even + when the method is hand-coded. + - _WRAP_SIGNAL(): Added optional no_default_handler parameter, + because some of the new GTK+ signals have no public default + handler vfunc. +* Added Glib::init(), for use by non-GUI apps which need to + use Glib::wrap(). +* PropertyProxy: Can now be used with Interfaces. +* Documentation improvements, so that gtkmm docs link to glibmm + docs. + (Murray Cumming) + +2.3.1: + +* gmmproc changes needed by gtkmm 2.3.0 + (Murray Cumming) +* examples updated and buildable and working, + without gtkmm code. + (J. Abelardo Gutierrez) + +Changes in glibmm 2.3.0: + +* Now separate from gtkmm, so you can use things like Glib::ustring without depending on gtkmm. + This glibmm 2.4 API installs in parallel with gtkmm 2.0/2.2, so you can install this unstable library + without the risk of breaking existing application. +* This does not yet require glib 2.3 because there has been no tarball release of that yet. For now, you + can use glibmm 2.3.0 with glib 2.2.x. +* When using pkg-config, you should check for "glibmm-2.4". +* Glib::ObjectBase inherits virtually from SigC::Object, allowing multiple inheritance with other + classes that inherit from SigC::Object. +* RefPtr: + - is_null() was removed, to encourage you to use "== 0" instead. + - operator=(CppObject*) was removed. +* gtkmmproc is now gmmproc. +* All the glibmm bugfixes in gtkmm 2.2.x. diff --git a/libs/glibmm2/README b/libs/glibmm2/README new file mode 100644 index 0000000000..eef49fd1a7 --- /dev/null +++ b/libs/glibmm2/README @@ -0,0 +1,31 @@ +This is the unstable version of gtkmm, aimed at Gtk+ 2.0.x. +See CHANGES for a comparison with gtkmm 1.2. + +Contents: +* Your unstable development environment +* Required libraries: + +Your unstable development environment +------------------------------------- + +Until the GTK+ 2.0 / GNOME 2.0 platform is stable, you should try to separate these unstable libraries from your stable GTK+ 1.2 / GNOME 1.2/1.4 libraries. You can do this by installing the unstable libraries into a different prefix. +e.g. ./configure --prefix=/usr/devgnome2 + +When using the development libraries, you will need to modify some environment variables. This will be easier if you create a file (e.g. devgnome2) in your home directory that contains these commands: + +export PATH="/usr/devgnome2/bin:$PATH"; export LD_LIBRARY_PATH="/usr/devgnome2/lib" ; export PKG_CONFIG_PATH="/usr/devgnome2/lib/pkgconfig:$PKG_CONFIG_PATH" ; + +You can then type +# source devgnome2 +to prepare your environment before building or working with the development libraries. + +You may also need to edit /etc/ld.so.conf to add /usr/devgnome2/lib, and then type /sbin/ldconfig to re-process the ld.so.conf. + + +The vicious-build-scripts module in cvs.gnome.org might help you with this, if you can get it to work. + +Required Libraries +------------------ + +* Of course, you will need gtk+ 2 and its dependencies. +* libsigc++ 1.2 (A release, or libsigc++-1.2 from cvs) diff --git a/libs/glibmm2/SConscript b/libs/glibmm2/SConscript new file mode 100644 index 0000000000..42b716c998 --- /dev/null +++ b/libs/glibmm2/SConscript @@ -0,0 +1,19 @@ +import glob +import os + +glibmm2_files = glob.glob('glibmm/*.cc') + +Import('env libraries') + +glibmm2 = env.Copy() +glibmm2.Merge([libraries['sigc2'], libraries['glib2']]) + +glibmm2.Append(CXXFLAGS='-DHAVE_CONFIG_H') +glibmm2.Append(CXXFLAGS='-DG_DISABLE_DEPRECATED') +glibmm2.Append(CXXFLAGS='-DG_LOG_DOMAIN=\\\"glibmm\\\"') + +glibmm2_configure_script = glibmm2.Command ('configure', 'configure.ac', 'cd libs/glibmm2; ./autogen.sh; cd -', ENV=os.environ) +glibmm2_config_h = glibmm2.Command('glibmmconfig.h', [glibmm2_configure_script, 'glibmmconfig.h.in'], 'cd libs/glibmm2; ./configure; cd -', ENV=os.environ) + +libglibmm2 = glibmm2.StaticLibrary('glibmm2', glibmm2_files) +Default([glibmm2_config_h, libglibmm2]) diff --git a/libs/glibmm2/autogen.sh b/libs/glibmm2/autogen.sh new file mode 100755 index 0000000000..c58ddd27a2 --- /dev/null +++ b/libs/glibmm2/autogen.sh @@ -0,0 +1,18 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +echo "Adding libtools." +libtoolize --automake --copy --force + +echo "Building macros." +aclocal -I "$srcdir/scripts" $ACLOCAL_FLAGS + +echo "Building makefiles." +automake --add-missing --copy + +echo "Building configure." +autoconf + +rm -f config.cache diff --git a/libs/glibmm2/configure.ac b/libs/glibmm2/configure.ac new file mode 100644 index 0000000000..b34fbdbe00 --- /dev/null +++ b/libs/glibmm2/configure.ac @@ -0,0 +1,149 @@ +# Configure.in +# +# This file tests for various compiler features needed to configure +# the gtkmm package. Original skeleton was provided by Stephan Kulow. +# All tests were written by Tero Pulkkinen, Mirko Streckenbach, and +# Karl Nelson. +# +# NOTE! IF YOU DO CHANGES HERE, CHECK IF YOU NEED TO MODIFY .m4 TOO!!! +# +# Copyright 2001 Free Software Foundation +# Copyright 1999 gtkmm Development Team +# Copyright 1998 Stephan Kulow +# +AC_INIT(glibmmconfig.h.in) +AC_PREREQ(2.50) + +######################################################################### +# Version and initialization +######################################################################### +GLIBMM_MAJOR_VERSION=2 +GLIBMM_MINOR_VERSION=6 +GLIBMM_MICRO_VERSION=1 +GLIBMM_VERSION=$GLIBMM_MAJOR_VERSION.$GLIBMM_MINOR_VERSION.$GLIBMM_MICRO_VERSION +GLIBMM_RELEASE=$GLIBMM_MAJOR_VERSION.$GLIBMM_MINOR_VERSION +AC_DEFINE_UNQUOTED(GLIBMM_MAJOR_VERSION, $GLIBMM_MAJOR_VERSION) +AC_DEFINE_UNQUOTED(GLIBMM_MINOR_VERSION, $GLIBMM_MINOR_VERSION) +AC_DEFINE_UNQUOTED(GLIBMM_MICRO_VERSION, $GLIBMM_MICRO_VERSION) +AC_SUBST(GLIBMM_MAJOR_VERSION) +AC_SUBST(GLIBMM_MINOR_VERSION) +AC_SUBST(GLIBMM_MICRO_VERSION) +AC_SUBST(GLIBMM_VERSION) +AC_SUBST(GLIBMM_RELEASE) + +# +# +1 : ? : +1 == new interface that does not break old one +# +1 : ? : 0 == new interface that breaks old one +# ? : ? : 0 == no new interfaces, but breaks apps +# ? :+1 : ? == just some internal changes, nothing breaks but might work +# better +# CURRENT : REVISION : AGE +LIBGLIBMM_SO_VERSION=1:13:0 +AC_SUBST(LIBGLIBMM_SO_VERSION) + +AC_CONFIG_AUX_DIR(scripts) + +dnl For automake. +VERSION=$GLIBMM_VERSION +PACKAGE=glibmm + +dnl Initialize automake stuff +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +dnl Specify a configuration file (no autoheader) +AM_CONFIG_HEADER(glibmmconfig.h) +AM_MAINTAINER_MODE +AL_ACLOCAL_INCLUDE(scripts) + + +######################################################################### +# Configure arguments +######################################################################### + +######################################################################### +# Environment Checks +######################################################################### +AC_PROG_CC +AC_PROG_CPP +AC_PROG_MAKE_SET +AC_CANONICAL_BUILD +AC_CANONICAL_HOST + +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +AL_PROG_GNU_M4(AC_MSG_ERROR([dnl +SUN m4 does not work for building gtkmm. +Please install GNU m4.])) + +AL_PROG_GNU_MAKE(AC_MSG_ERROR([dnl +SUN make does not work for building gtkmm. +Please install GNU make.])) + +######################################################################### +# Dependancy checks +######################################################################### +gtkmm_min_glib_version=2.6.0 + +PKG_CHECK_MODULES(GLIBMM, glib-2.0 >= ${gtkmm_min_glib_version} gobject-2.0 >= ${gtkmm_min_glib_version} gmodule-2.0 >= ${gtkmm_min_glib_version}) +AC_SUBST(GLIBMM_CFLAGS) +AC_SUBST(GLIBMM_LIBS) + +# gthread isn't a requirement, but we should use its CFLAGS if available. +PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= ${gtkmm_min_glib_version},[],[GTHREAD_CFLAGS=''; GTHREAD_LIBS='']) +AC_SUBST(GTHREAD_CFLAGS) +AC_SUBST(GTHREAD_LIBS) + + +######################################################################### +# C++ checks +######################################################################### +AC_PROG_CXX + +AC_LANG_CPLUSPLUS + +AC_CXX_BOOL(,config_error=yes) +AC_CXX_NAMESPACES(,config_error=yes) +AC_CXX_MUTABLE(,config_error=yes) + +AC_MSG_CHECKING(if C++ environment provides all required features) +if test "x$config_error" = xyes ; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Your compiler is not powerful enough to compile gtkmm. If it should be, see config.log for more information of why it failed.]) +fi +AC_MSG_RESULT([yes]) + +GLIBMM_CXX_HAS_NAMESPACE_STD() +GLIBMM_CXX_HAS_STD_ITERATOR_TRAITS() +GLIBMM_CXX_HAS_SUN_REVERSE_ITERATOR() +GLIBMM_CXX_HAS_TEMPLATE_SEQUENCE_CTORS() +GLIBMM_CXX_MEMBER_FUNCTIONS_MEMBER_TEMPLATES() +GLIBMM_CXX_CAN_DISAMBIGUATE_CONST_TEMPLATE_SPECIALIZATIONS() +GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION() +GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS() +GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC() +GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS() + +# Check whether --enable-debug-refcounting was given. +GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING() + +# Evaluate the --enable-warnings=level option. +GTKMM_ARG_ENABLE_WARNINGS() + +# Dummy conditional just to make automake-1.4 happy. +# We need an always-false condition in docs/Makefile.am. +AM_CONDITIONAL(GTKMM_FALSE,[false]) + +# HACK: Assign a dummy in order to prevent execution of autoheader by the +# maintainer-mode rules. That would fail since we aren't using autoheader. +AUTOHEADER=':' + +AC_CONFIG_FILES([ + Makefile + + glibmm-2.4.pc + glibmm/Makefile +]) + +AC_OUTPUT() + diff --git a/libs/glibmm2/glibmm-2.4.pc.in b/libs/glibmm2/glibmm-2.4.pc.in new file mode 100644 index 0000000000..db098824be --- /dev/null +++ b/libs/glibmm2/glibmm-2.4.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: GLibmm +Description: C++ wrapper for GLib +Requires: gobject-2.0 sigc++-2.0 +Version: @VERSION@ +Libs: -L${libdir} -lglibmm-2.4 +Cflags: -I${includedir}/glibmm-2.4 -I${libdir}/glibmm-2.4/include diff --git a/libs/glibmm2/glibmm.h b/libs/glibmm2/glibmm.h new file mode 100644 index 0000000000..3788db51a6 --- /dev/null +++ b/libs/glibmm2/glibmm.h @@ -0,0 +1,72 @@ +/* $Id$ */ + +/* glibmm - a C++ wrapper for the GLib toolkit + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GLIBMM_H +#define _GLIBMM_H + +#include +//#include //This must be included by the application, after system headers such as . +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* _GLIBMM_H */ + diff --git a/libs/glibmm2/glibmm/.cvsignore b/libs/glibmm2/glibmm/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/libs/glibmm2/glibmm/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/libs/glibmm2/glibmm/Makefile.am b/libs/glibmm2/glibmm/Makefile.am new file mode 100644 index 0000000000..ff8555c571 --- /dev/null +++ b/libs/glibmm2/glibmm/Makefile.am @@ -0,0 +1,96 @@ +## Copyright (c) 2001 +## The gtkmm development team. + +SUBDIRS = + +sublib_name = glibmm +sublib_libname = glibmm-2.4 +sublib_namespace = Glib +sublib_cflags = $(GLIBMM_CFLAGS) + +sublib_files_extra_posix_cc = + +sublib_files_general_cc = \ + class.cc \ + containers.cc \ + debug.cc \ + dispatcher.cc \ + error.cc \ + exception.cc \ + exceptionhandler.cc \ + init.cc \ + interface.cc \ + main.cc \ + miscutils.cc \ + object.cc \ + objectbase.cc \ + pattern.cc \ + property.cc \ + propertyproxy.cc \ + propertyproxy_base.cc \ + quark.cc \ + random.cc \ + signalproxy.cc \ + signalproxy_connectionnode.cc \ + streamiochannel.cc \ + stringutils.cc \ + threadpool.cc \ + timer.cc \ + timeval.cc \ + ustring.cc \ + utility.cc \ + value.cc \ + value_custom.cc \ + wrap.cc + +sublib_files_posix_h = + +sublib_files_general_h = \ + arrayhandle.h \ + class.h \ + containerhandle_shared.h \ + containers.h \ + debug.h \ + dispatcher.h \ + error.h \ + exception.h \ + exceptionhandler.h \ + helperlist.h \ + init.h \ + i18n.h \ + interface.h \ + iochannel.h \ + listhandle.h \ + main.h \ + miscutils.h \ + object.h \ + objectbase.h \ + pattern.h \ + property.h \ + propertyproxy.h \ + propertyproxy_base.h \ + quark.h \ + random.h \ + refptr.h \ + sarray.h \ + signalproxy_connectionnode.h \ + slisthandle.h \ + streamiochannel.h \ + stringutils.h \ + threadpool.h \ + timer.h \ + timeval.h \ + ustring.h \ + utility.h \ + value.h \ + value_custom.h \ + wrap.h + +files_built_general_cc = value_basictypes.cc +files_built_general_h = signalproxy.h value_basictypes.h + +lib_LTLIBRARIES = libglibmm-2.4.la +libglibmm_2_4_la_SOURCES = $(files_all_general_cc) $(files_all_posix_cc) +libglibmm_2_4_la_LDFLAGS = $(common_ldflags) +libglibmm_2_4_la_LIBADD = $(GLIBMM_LIBS) + diff --git a/libs/glibmm2/glibmm/arrayhandle.h b/libs/glibmm2/glibmm/arrayhandle.h new file mode 100644 index 0000000000..58e2630f5c --- /dev/null +++ b/libs/glibmm2/glibmm/arrayhandle.h @@ -0,0 +1,522 @@ +// -*- c++ -*- +#ifndef _GLIBMM_ARRAYHANDLE_H +#define _GLIBMM_ARRAYHANDLE_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +namespace Container_Helpers +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/* Count the number of elements in a 0-terminated sequence. + */ +template inline +size_t compute_array_size(const T* array) +{ + const T* pend = array; + + while(*pend) + ++pend; + + return (pend - array); +} + +/* Allocate and fill a 0-terminated array. The size argument + * specifies the number of elements in the input sequence. + */ +template +typename Tr::CType* create_array(For pbegin, size_t size, Tr) +{ + typedef typename Tr::CType CType; + + CType *const array = static_cast(g_malloc((size + 1) * sizeof(CType))); + CType *const array_end = array + size; + + for(CType* pdest = array; pdest != array_end; ++pdest) + { + // Use & to force a warning if the iterator returns a temporary object. + *pdest = Tr::to_c_type(*&*pbegin); + ++pbegin; + } + + *array_end = CType(); + return array; +} + + +/* Convert from any container that supports forward + * iterators and has a size() method. + */ +template +struct ArraySourceTraits +{ + typedef typename Tr::CType CType; + + static size_t get_size(const Cont& cont) + { return cont.size(); } + + static const CType* get_data(const Cont& cont, size_t size) + { return Glib::Container_Helpers::create_array(cont.begin(), size, Tr()); } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +/* Convert from a 0-terminated array. The Cont argument must be a pointer + * to the first element. Note that only arrays of the C type are supported. + */ +template +struct ArraySourceTraits +{ + typedef typename Tr::CType CType; + + static size_t get_size(const CType* array) + { return (array) ? Glib::Container_Helpers::compute_array_size(array) : 0; } + + static const CType* get_data(const CType* array, size_t) + { return array; } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; +}; + +template +struct ArraySourceTraits : ArraySourceTraits +{}; + +/* Convert from a 0-terminated array. The Cont argument must be a pointer + * to the first element. Note that only arrays of the C type are supported. + * For consistency, the array must be 0-terminated, even though the array + * size is known at compile time. + */ +template +struct ArraySourceTraits +{ + typedef typename Tr::CType CType; + + static size_t get_size(const CType*) + { return (N - 1); } + + static const CType* get_data(const CType* array, size_t) + { return array; } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; +}; + +template +struct ArraySourceTraits : ArraySourceTraits +{}; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** + * @ingroup ContHelpers + */ +template +class ArrayHandleIterator +{ +public: + typedef typename Tr::CppType CppType; + typedef typename Tr::CType CType; + + typedef std::random_access_iterator_tag iterator_category; + typedef CppType value_type; + typedef ptrdiff_t difference_type; + typedef value_type reference; + typedef void pointer; + + explicit inline ArrayHandleIterator(const CType* pos); + + inline value_type operator*() const; + inline value_type operator[](difference_type offset) const; + + inline ArrayHandleIterator & operator++(); + inline const ArrayHandleIterator operator++(int); + + // All this random access stuff is only there because STL algorithms + // usually have optimized specializations for random access iterators, + // and we don't want to give away efficiency for nothing. + // + inline ArrayHandleIterator & operator+=(difference_type rhs); + inline ArrayHandleIterator & operator-=(difference_type rhs); + inline const ArrayHandleIterator operator+ (difference_type rhs) const; + inline const ArrayHandleIterator operator- (difference_type rhs) const; + inline difference_type operator-(const ArrayHandleIterator& rhs) const; + + inline bool operator==(const ArrayHandleIterator& rhs) const; + inline bool operator!=(const ArrayHandleIterator& rhs) const; + inline bool operator< (const ArrayHandleIterator& rhs) const; + inline bool operator> (const ArrayHandleIterator& rhs) const; + inline bool operator<=(const ArrayHandleIterator& rhs) const; + inline bool operator>=(const ArrayHandleIterator& rhs) const; + +private: + const CType* pos_; +}; + +} // namespace Container_Helpers + + +/** If a method takes this as an argument, or has this as a return type, then you can use a standard + * container such as std::list or std::vector. + * @ingroup ContHandles + */ +template < class T, class Tr = Glib::Container_Helpers::TypeTraits > +class ArrayHandle +{ +public: + typedef typename Tr::CppType CppType; + typedef typename Tr::CType CType; + + typedef CppType value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef Glib::Container_Helpers::ArrayHandleIterator const_iterator; + typedef Glib::Container_Helpers::ArrayHandleIterator iterator; + + template inline + ArrayHandle(const Cont& container); + + // Take over ownership of an array created by GTK+ functions. + inline ArrayHandle(const CType* array, size_t array_size, Glib::OwnershipType ownership); + inline ArrayHandle(const CType* array, Glib::OwnershipType ownership); + + // Copying clears the ownership flag of the source handle. + inline ArrayHandle(const ArrayHandle& other); + + ~ArrayHandle(); + + inline const_iterator begin() const; + inline const_iterator end() const; + + template inline operator std::vector() const; + template inline operator std::deque() const; + template inline operator std::list() const; + + template inline + void assign_to(Cont& container) const; + + template inline + void copy(Out pdest) const; + + inline const CType* data() const; + inline size_t size() const; + inline bool empty() const; + +private: + size_t size_; + const CType* parray_; + mutable Glib::OwnershipType ownership_; + + // No copy assignment. + ArrayHandle& operator=(const ArrayHandle&); +}; + +/** If a method takes this as an argument, or has this as a return type, then you can use a standard + * container such as std::list or std::vector. + * @ingroup ContHandles + */ +typedef ArrayHandle StringArrayHandle; + + +/***************************************************************************/ +/* Inline implementation */ +/***************************************************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +namespace Container_Helpers +{ + +/**** Glib::Container_Helpers::ArrayHandleIterator<> ***********************/ + +template inline +ArrayHandleIterator::ArrayHandleIterator(const CType* pos) +: + pos_ (pos) +{} + +template inline +typename ArrayHandleIterator::value_type ArrayHandleIterator::operator*() const +{ + return Tr::to_cpp_type(*pos_); +} + +template inline +typename ArrayHandleIterator::value_type +ArrayHandleIterator::operator[](difference_type offset) const +{ + return Tr::to_cpp_type(pos_[offset]); +} + +template inline +ArrayHandleIterator& ArrayHandleIterator::operator++() +{ + ++pos_; + return *this; +} + +template inline +const ArrayHandleIterator ArrayHandleIterator::operator++(int) +{ + return ArrayHandleIterator(pos_++); +} + +template inline +ArrayHandleIterator& +ArrayHandleIterator::operator+=(typename ArrayHandleIterator::difference_type rhs) +{ + pos_ += rhs; + return *this; +} + +template inline +ArrayHandleIterator& +ArrayHandleIterator::operator-=(typename ArrayHandleIterator::difference_type rhs) +{ + pos_ -= rhs; + return *this; +} + +template inline +const ArrayHandleIterator +ArrayHandleIterator::operator+(typename ArrayHandleIterator::difference_type rhs) const +{ + return ArrayHandleIterator(pos_ + rhs); +} + +template inline +const ArrayHandleIterator +ArrayHandleIterator::operator-(typename ArrayHandleIterator::difference_type rhs) const +{ + return ArrayHandleIterator(pos_ - rhs); +} + +template inline +typename ArrayHandleIterator::difference_type +ArrayHandleIterator::operator-(const ArrayHandleIterator& rhs) const +{ + return (pos_ - rhs.pos_); +} + +template inline +bool ArrayHandleIterator::operator==(const ArrayHandleIterator& rhs) const +{ + return (pos_ == rhs.pos_); +} + +template inline +bool ArrayHandleIterator::operator!=(const ArrayHandleIterator& rhs) const +{ + return (pos_ != rhs.pos_); +} + +template inline +bool ArrayHandleIterator::operator<(const ArrayHandleIterator& rhs) const +{ + return (pos_ < rhs.pos_); +} + +template inline +bool ArrayHandleIterator::operator>(const ArrayHandleIterator& rhs) const +{ + return (pos_ > rhs.pos_); +} + +template inline +bool ArrayHandleIterator::operator<=(const ArrayHandleIterator& rhs) const +{ + return (pos_ <= rhs.pos_); +} + +template inline +bool ArrayHandleIterator::operator>=(const ArrayHandleIterator& rhs) const +{ + return (pos_ >= rhs.pos_); +} + +} // namespace Container_Helpers + + +/**** Glib::ArrayHandle<> **************************************************/ + +template + template +inline +ArrayHandle::ArrayHandle(const Cont& container) +: + size_ (Glib::Container_Helpers::ArraySourceTraits::get_size(container)), + parray_ (Glib::Container_Helpers::ArraySourceTraits::get_data(container, size_)), + ownership_ (Glib::Container_Helpers::ArraySourceTraits::initial_ownership) +{} + +template inline +ArrayHandle::ArrayHandle(const typename ArrayHandle::CType* array, size_t array_size, + Glib::OwnershipType ownership) +: + size_ (array_size), + parray_ (array), + ownership_ (ownership) +{} + +template inline +ArrayHandle::ArrayHandle(const typename ArrayHandle::CType* array, + Glib::OwnershipType ownership) +: + size_ ((array) ? Glib::Container_Helpers::compute_array_size(array) : 0), + parray_ (array), + ownership_ (ownership) +{} + +template inline +ArrayHandle::ArrayHandle(const ArrayHandle& other) +: + size_ (other.size_), + parray_ (other.parray_), + ownership_ (other.ownership_) +{ + other.ownership_ = Glib::OWNERSHIP_NONE; +} + +template +ArrayHandle::~ArrayHandle() +{ + if(ownership_ != Glib::OWNERSHIP_NONE) + { + if(ownership_ != Glib::OWNERSHIP_SHALLOW) + { + // Deep ownership: release each container element. + const CType *const pend = parray_ + size_; + for(const CType* p = parray_; p != pend; ++p) + Tr::release_c_type(*p); + } + g_free(const_cast(parray_)); + } +} + +template inline +typename ArrayHandle::const_iterator ArrayHandle::begin() const +{ + return Glib::Container_Helpers::ArrayHandleIterator(parray_); +} + +template inline +typename ArrayHandle::const_iterator ArrayHandle::end() const +{ + return Glib::Container_Helpers::ArrayHandleIterator(parray_ + size_); +} + +template + template +inline +ArrayHandle::operator std::vector() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::vector(this->begin(), this->end()); +#else + std::vector temp; + temp.reserve(this->size()); + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +ArrayHandle::operator std::deque() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::deque(this->begin(), this->end()); +#else + std::deque temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +ArrayHandle::operator std::list() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::list(this->begin(), this->end()); +#else + std::list temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +void ArrayHandle::assign_to(Cont& container) const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + container.assign(this->begin(), this->end()); +#else + Cont temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + container.swap(temp); +#endif +} + +template + template +inline +void ArrayHandle::copy(Out pdest) const +{ + std::copy(this->begin(), this->end(), pdest); +} + +template inline +const typename ArrayHandle::CType* ArrayHandle::data() const +{ + return parray_; +} + +template inline +size_t ArrayHandle::size() const +{ + return size_; +} + +template inline +bool ArrayHandle::empty() const +{ + return (size_ == 0); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_ARRAYHANDLE_H */ + diff --git a/libs/glibmm2/glibmm/class.cc b/libs/glibmm2/glibmm/class.cc new file mode 100644 index 0000000000..ff4a671d8d --- /dev/null +++ b/libs/glibmm2/glibmm/class.cc @@ -0,0 +1,116 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Glib +{ + +void Class::register_derived_type(GType base_type) +{ + if(gtype_) + return; // already initialized + + GTypeQuery base_query = { 0, 0, 0, 0, }; + g_type_query(base_type, &base_query); + + const GTypeInfo derived_info = + { + base_query.class_size, + 0, // base_init + 0, // base_finalize + class_init_func_, + 0, // class_finalize + 0, // class_data + base_query.instance_size, + 0, // n_preallocs + 0, // instance_init + 0, // value_table + }; + + Glib::ustring derived_name = "gtkmm__"; + derived_name += base_query.type_name; + + gtype_ = g_type_register_static(base_type, derived_name.c_str(), &derived_info, GTypeFlags(0)); +} + +GType Class::clone_custom_type(const char* custom_type_name) const +{ + std::string full_name ("gtkmm__CustomObject_"); + Glib::append_canonical_typename(full_name, custom_type_name); + + GType custom_type = g_type_from_name(full_name.c_str()); + + if(!custom_type) + { + g_return_val_if_fail(gtype_ != 0, 0); + + // Cloned custom types derive from the wrapper's parent type, + // so that g_type_class_peek_parent() works correctly. + const GType base_type = g_type_parent(gtype_); + + GTypeQuery base_query = { 0, 0, 0, 0, }; + g_type_query(base_type, &base_query); + + const GTypeInfo derived_info = + { + base_query.class_size, + 0, // base_init + 0, // base_finalize + &Class::custom_class_init_function, + 0, // class_finalize + this, // class_data + base_query.instance_size, + 0, // n_preallocs + 0, // instance_init + 0, // value_table + }; + + custom_type = g_type_register_static( + base_type, full_name.c_str(), &derived_info, GTypeFlags(0)); + } + + return custom_type; +} + +// static +void Class::custom_class_init_function(void* g_class, void* class_data) +{ + // The class_data pointer is set to 'this' by clone_custom_type(). + const Class *const self = static_cast(class_data); + + g_return_if_fail(self->class_init_func_ != 0); + + // Call the wrapper's class_init_function() to redirect + // the vfunc and default signal handler callbacks. + (*self->class_init_func_)(g_class, 0); + + GObjectClass *const gobject_class = static_cast(g_class); + + gobject_class->get_property = &Glib::custom_get_property_callback; + gobject_class->set_property = &Glib::custom_set_property_callback; +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/class.h b/libs/glibmm2/glibmm/class.h new file mode 100644 index 0000000000..c7b5a96fa7 --- /dev/null +++ b/libs/glibmm2/glibmm/class.h @@ -0,0 +1,76 @@ +// -*- c++ -*- +#ifndef _GLIBMM_CLASS_H +#define _GLIBMM_CLASS_H + +/* $Id$ */ + +/* Copyright 2001 Free Software Foundation + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +namespace Glib +{ + +class Class +{ +public: + /* No constructor/destructor: + * Glib::Class objects are used only as static data, which would cause + * lots of ugly global constructor invocations. These are avoidable, + * because the C/C++ standard explicitly specifies that all _static_ data + * is zero-initialized at program start. + */ + //Class(); + //~Class(); + + //static void class_init_function(BaseClassType *p); + //static void object_init_function(BaseObjectType *o); + //GType get_type() = 0; //Creates the GType when this is first called. + + // Hook for translating API + //static Glib::Object* wrap_new(GObject*); + + inline GType get_type() const; + GType clone_custom_type(const char* custom_type_name) const; + +protected: + GType gtype_; + GClassInitFunc class_init_func_; + + void register_derived_type(GType base_type); + +private: + static void custom_class_init_function(void* g_class, void* class_data); +}; + +inline +GType Class::get_type() const +{ + return gtype_; +} + +} // namespace Glib + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +#endif /* _GLIBMM_CLASS_H */ + diff --git a/libs/glibmm2/glibmm/containerhandle_shared.h b/libs/glibmm2/glibmm/containerhandle_shared.h new file mode 100644 index 0000000000..ef557b476a --- /dev/null +++ b/libs/glibmm2/glibmm/containerhandle_shared.h @@ -0,0 +1,343 @@ +// -*- c++ -*- +#ifndef _GLIBMM_CONTAINERHANDLE_SHARED_H +#define _GLIBMM_CONTAINERHANDLE_SHARED_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +GLIBMM_USING_STD(forward_iterator_tag) +GLIBMM_USING_STD(random_access_iterator_tag) +GLIBMM_USING_STD(distance) +GLIBMM_USING_STD(copy) +GLIBMM_USING_STD(vector) +GLIBMM_USING_STD(deque) +GLIBMM_USING_STD(list) + + +namespace Glib +{ + +/** @defgroup ContHandles Generic container converters + */ + +/** + * @ingroup ContHandles + */ +enum OwnershipType +{ + OWNERSHIP_NONE = 0, + OWNERSHIP_SHALLOW, //Release the list, but not its elements, when the container is deleted + OWNERSHIP_DEEP //Release the list, and its elements, when the container is deleted. +}; + + +/** Utility class holding an iterator sequence. + * @ingroup ContHandles + * This can be used to initialize a Glib container handle (such as + * Glib::ArrayHandle) with an iterator sequence. Use the helper + * function Glib::sequence() to create a Sequence<> object. + */ +template +class Sequence +{ +private: + Iterator pbegin_; + Iterator pend_; + +public: + Sequence(Iterator pbegin, Iterator pend) + : pbegin_(pbegin), pend_(pend) {} + + Iterator begin() const { return pbegin_; } + Iterator end() const { return pend_; } + size_t size() const { return std::distance(pbegin_, pend_); } +}; + +/** Helper function to create a Glib::Sequence<> object, which + * in turn can be used to initialize a container handle. + * @ingroup ContHandles + * + * @par Usage example: + * @code + * combo.set_popdown_strings(Glib::sequence(foo_begin, foo_end)); + * @endcode + */ +template inline +Sequence sequence(Iterator pbegin, Iterator pend) +{ + return Sequence(pbegin, pend); +} + + +namespace Container_Helpers +{ + +/** @defgroup ContHelpers Helper classes + * @ingroup ContHandles + */ + +/** Generic TypeTraits implementation. + * @ingroup ContHelpers + * This can be used if the C++ type is the same as the C type, or if implicit + * conversions between the types are available. Also, the types are required + * to implement copy-by-value semantics. (Ownership is just ignored.) + */ +template +struct TypeTraits +{ + typedef T CppType; + typedef T CType; + typedef T CTypeNonConst; + + static CType to_c_type (const CppType& item) { return item; } + static CppType to_cpp_type (const CType& item) { return item; } + static void release_c_type (const CType&) {} +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS /* hide the specializations */ + +//For some (proably, more spec-compliant) compilers, these specializations must +//be next to the objects that they use. +#ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + +/** Partial specialization for pointers to GtkObject instances. + * @ingroup ContHelpers + */ +template +struct TypeTraits +{ + typedef T * CppType; + typedef typename T::BaseObjectType * CType; + typedef typename T::BaseObjectType * CTypeNonConst; + + static CType to_c_type (CppType ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) + { + //We copy/paste the widget wrap() implementation here, + //because we can not use a specific Glib::wrap(T_Impl) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = (GObject*)ptr; + return dynamic_cast(Glib::wrap_auto(cobj, false /* take_copy */)); + } + + static void release_c_type (CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(0, ptr); + g_object_unref(ptr); + } +}; + +//This confuse the SUN Forte compiler, so we ifdef it out: +#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +/** Partial specialization for pointers to const GtkObject instances. + * @ingroup ContHelpers + */ +template +struct TypeTraits +{ + typedef const T * CppType; + typedef const typename T::BaseObjectType * CType; + typedef typename T::BaseObjectType * CTypeNonConst; + + static CType to_c_type (CppType ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) + { + //We copy/paste the widget wrap() implementation here, + //because we can not use a specific Glib::wrap(T_Impl) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = (GObject*)const_cast(ptr); + return dynamic_cast(Glib::wrap_auto(cobj, false /* take_copy */)); + } + + static void release_c_type (CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(0, ptr); + g_object_unref(const_cast(ptr)); + } +}; +#endif //GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +/** Partial specialization for pointers to GObject instances. + * @ingroup ContHelpers + * The C++ type is always a Glib::RefPtr<>. + */ +template +struct TypeTraits< Glib::RefPtr > +{ + typedef Glib::RefPtr CppType; + typedef typename T::BaseObjectType * CType; + typedef typename T::BaseObjectType * CTypeNonConst; + + static CType to_c_type (const CppType& ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) + { + //return Glib::wrap(ptr, true); + + //We copy/paste the wrap() implementation here, + //because we can not use a specific Glib::wrap(CType) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = (GObject*)const_cast(ptr); + return Glib::RefPtr( dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */)) ); + //We use dynamic_cast<> in case of multiple inheritance. + } + + static void release_c_type (CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(0, ptr); + g_object_unref(ptr); + } +}; + +//This confuse the SUN Forte compiler, so we ifdef it out: +#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +/** Partial specialization for pointers to const GObject instances. + * @ingroup ContHelpers + * The C++ type is always a Glib::RefPtr<>. + */ +template +struct TypeTraits< Glib::RefPtr > +{ + typedef Glib::RefPtr CppType; + typedef const typename T::BaseObjectType * CType; + typedef typename T::BaseObjectType * CTypeNonConst; + + static CType to_c_type (const CppType& ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) + { + //return Glib::wrap(ptr, true); + + //We copy/paste the wrap() implementation here, + //because we can not use a specific Glib::wrap(CType) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = (GObject*)(ptr); + return Glib::RefPtr( dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */)) ); + //We use dynamic_cast<> in case of multiple inheritance. + } + + static void release_c_type (CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(0, ptr); + g_object_unref(const_cast(ptr)); + } +}; + +#endif //GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +#endif //GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + +/** Specialization for UTF-8 strings. + * @ingroup ContHelpers + * When converting from C++ to C, Glib::ustring will be accepted as well as + * std::string and 'const char*'. However, when converting to the C++ side, + * the output type cannot be 'const char*'. + */ +template <> +struct TypeTraits +{ + typedef Glib::ustring CppType; + typedef const char * CType; + typedef char * CTypeNonConst; + + static CType to_c_type (const Glib::ustring& str) { return str.c_str(); } + static CType to_c_type (const std::string& str) { return str.c_str(); } + static CType to_c_type (CType str) { return str; } + + static CppType to_cpp_type(CType str) + { return (str) ? Glib::ustring(str) : Glib::ustring(); } + + static void release_c_type(CType str) + { g_free(const_cast(str)); } +}; + +/** Specialization for std::string. + * @ingroup ContHelpers + * When converting from C++ to C, std::string will be accepted as well as + * 'const char*'. However, when converting to the C++ side, the output type + * cannot be 'const char*'. + */ +template <> +struct TypeTraits +{ + typedef std::string CppType; + typedef const char * CType; + typedef char * CTypeNonConst; + + static CType to_c_type (const std::string& str) { return str.c_str(); } + static CType to_c_type (const Glib::ustring& str) { return str.c_str(); } + static CType to_c_type (CType str) { return str; } + + static CppType to_cpp_type(CType str) + { return (str) ? std::string(str) : std::string(); } + + static void release_c_type(CType str) + { g_free(const_cast(str)); } +}; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#ifndef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + +/* The STL containers in Sun's libCstd don't support templated sequence + * constructors, for "backward compatibility" reasons. This helper function + * is used in the ContainerHandle -> STL-container conversion workarounds. + */ +template +void fill_container(Cont& container, In pbegin, In pend) +{ + for(; pbegin != pend; ++pbegin) + container.push_back(*pbegin); +} + +#endif /* GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS */ +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Container_Helpers + +} // namespace Glib + + +#endif /* _GLIBMM_CONTAINERHANDLE_SHARED_H */ + diff --git a/libs/glibmm2/glibmm/containers.cc b/libs/glibmm2/glibmm/containers.cc new file mode 100644 index 0000000000..49803e11b8 --- /dev/null +++ b/libs/glibmm2/glibmm/containers.cc @@ -0,0 +1,33 @@ +// -*- c++ -*- + +/* $Id$ */ + +/* containers.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Glib +{ + +gpointer glibmm_null_pointer=0; + + +} //namespace Glib + diff --git a/libs/glibmm2/glibmm/containers.h b/libs/glibmm2/glibmm/containers.h new file mode 100644 index 0000000000..c7090681a3 --- /dev/null +++ b/libs/glibmm2/glibmm/containers.h @@ -0,0 +1,372 @@ +// -*- c++ -*- +#ifndef _GLIBMM_CONTAINERS_H +#define _GLIBMM_CONTAINERS_H + +/* $Id$ */ + +/* containers.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include /* for backward compatibility */ + +#include +#include + +GLIBMM_USING_STD(bidirectional_iterator_tag) +GLIBMM_USING_STD(forward_iterator_tag) + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +namespace Glib +{ + +template class List_Iterator; +template class List_ConstIterator; +template class List_ReverseIterator; + +// Most of these methods in the non-template classes needs to be moved +// to implementation. + +//Daniel Elstner has ideas about generating these per-widget with m4. murrayc. + + +extern GLIBMM_API gpointer glibmm_null_pointer; + +template +class List_Iterator_Base +{ +public: + typedef T value_type; + typedef T* pointer; + typedef T& reference; +} ; + +///For instance, List_Iterator< Gtk::Widget > +template +class List_Iterator : public List_Iterator_Base +{ +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename List_Iterator_Base::pointer pointer; + typedef typename List_Iterator_Base::reference reference; + + GList* const* head_; + GList* node_; + + typedef List_Iterator Self; + + List_Iterator(GList* const& head, GList* node) + : head_(&head), node_(node) + {} + + List_Iterator() + : head_(0), node_(0) + {} + + List_Iterator(const Self& src) + : head_(src.head_), node_(src.node_) + {} + + bool operator==(const Self& src) const { return node_ == src.node_; } + bool operator!=(const Self& src) const { return node_ != src.node_; } + + Self& operator++() + { + if (!node_) + node_ = g_list_first(*head_); + else + node_ = (GList*)g_list_next(node_); + return *this; + } + + Self operator++(int) + { + Self tmp = *this; + ++*this; + return tmp; + } + + Self& operator--() + { + if (!node_) + node_ = g_list_last(*head_); + else + node_ = (GList*)g_list_previous(node_); + + return *this; + } + + Self operator--(int) + { + Self tmp = *this; + --*this; + return tmp; + } + + reference operator*() const + { + return *(pointer)( node_ ? node_->data : glibmm_null_pointer ); + } + + pointer operator -> () const { return &operator*(); } +}; + +///For instance, SList_Iterator< Gtk::Widget > +template +class SList_Iterator : public List_Iterator_Base +{ +public: + typedef std::forward_iterator_tag iterator_category; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename List_Iterator_Base::pointer pointer; + typedef typename List_Iterator_Base::reference reference; + + GSList* node_; + typedef SList_Iterator Self; + + SList_Iterator(GSList* node) + : node_(node) + {} + + SList_Iterator() + : node_(0) + {} + + SList_Iterator(const Self& src) + : node_(src.node_) + {} + + bool operator==(const Self& src) const { return node_ == src.node_; } + bool operator!=(const Self& src) const { return node_ != src.node_; } + + Self& operator++() + { + node_ = g_slist_next(node_); + return *this; + } + + Self operator++(int) + { + Self tmp = *this; + ++*this; + return tmp; + } + + reference operator*() const + { + g_assert(node_); + return reinterpret_cast( node_ ? node_->data : glibmm_null_pointer ); + } + + pointer operator -> () const { return &operator*(); } +}; + + +// This iterator variation returns T_IFace (wrapped from T_Impl) +// For instance, List_Cpp_Iterator is a little like std::list::iterator +template +class List_Cpp_Iterator : public List_Iterator_Base +{ +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename List_Iterator_Base::pointer pointer; + typedef typename List_Iterator_Base::reference reference; + + typedef List_Cpp_Iterator Self; + + GList** head_; + GList* node_; + + bool operator==(const Self& src) const { return node_ == src.node_; } + bool operator!=(const Self& src) const { return node_ != src.node_; } + + List_Cpp_Iterator(GList*& head, GList* node ) + : head_(&head), node_(node ) + {} + + List_Cpp_Iterator() + : head_(0), node_(0) + {} + + List_Cpp_Iterator(const Self& src) + : head_(src.head_), node_(src.node_) + {} + + reference operator*() const + { + if (node_ && node_->data) + { + //We copy/paste the widget wrap() implementation here, + //because we can not use a specific Glib::wrap(T_Impl) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = static_cast( (*node_).data ); + + #ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + return *(dynamic_cast(Glib::wrap_auto(cobj, false /* take_copy */))); + #else + //We really do need to use dynamic_cast<>, so I expect problems if this code is used. murrayc. + return *(static_cast(Glib::wrap_auto(cobj, false /* take_copy */))); + #endif + + } + + return *(pointer)glibmm_null_pointer; + } + + pointer operator->() const { return &operator*(); } + + Self& operator++() + { + if (!node_) + node_ = g_list_first(*head_); + else + node_ = (GList *)g_list_next(node_); + + return *this; + } + + Self operator++(int) + { + Self tmp = *this; + ++*this; + return tmp; + } + + Self& operator--() + { + if (!node_) + node_ = g_list_last(*head_); + else + node_ = (GList *)g_list_previous(node_); + + return *this; + } + + Self operator--(int) + { + Self tmp = *this; + --*this; + return tmp; + } + +}; + +template +class List_ReverseIterator: private T_Base +{ +public: + typedef typename T_Base::iterator_category iterator_category; + typedef typename T_Base::size_type size_type; + typedef typename T_Base::difference_type difference_type; + + typedef typename T_Base::value_type value_type; + typedef typename T_Base::pointer pointer; + typedef typename T_Base::reference reference; + + typedef List_ReverseIterator Self; + + bool operator==(const Self& src) const { return T_Base::operator==(src); } + bool operator!=(const Self& src) const { return T_Base::operator!=(src); } + + List_ReverseIterator(GList* const& head, GList* node) + : T_Base(head, node) + {} + + List_ReverseIterator() + : T_Base() + {} + + List_ReverseIterator(const Self& src) + : T_Base(src) + {} + + List_ReverseIterator(const T_Base& src) + : T_Base(src) + { ++(*this); } + + + Self& operator++() {T_Base::operator--(); return *this;} + Self& operator--() {T_Base::operator++(); return *this;} + Self operator++(int) {Self src = *this; T_Base::operator--(); return src;} + Self operator--(int) {Self src = *this; T_Base::operator++(); return src;} + + reference operator*() const { return T_Base::operator*(); } + pointer operator->() const { return T_Base::operator->(); } +}; + +template +class List_ConstIterator: public T_Base +{ +public: + typedef typename T_Base::iterator_category iterator_category; + typedef typename T_Base::size_type size_type; + typedef typename T_Base::difference_type difference_type; + + typedef const typename T_Base::value_type value_type; + typedef const typename T_Base::pointer pointer; + typedef const typename T_Base::reference reference; + + typedef List_ConstIterator Self; + + bool operator==(const Self& src) const { return T_Base::operator==(src); } + bool operator!=(const Self& src) const { return T_Base::operator!=(src); } + + List_ConstIterator(GList* const& head, GList* node) + : T_Base(head, node) + {} + + List_ConstIterator() + : T_Base() + {} + + List_ConstIterator(const Self& src) + : T_Base(src) + {} + + List_ConstIterator(const T_Base& src) + : T_Base(src) + {} + + Self& operator++() {T_Base::operator++(); return *this;} + Self& operator--() {T_Base::operator--(); return *this;} + Self operator++(int) {Self src = *this; T_Base::operator++(); return src;} + Self operator--(int) {Self src = *this; T_Base::operator--(); return src;} + + reference operator*() const { return T_Base::operator*(); } + pointer operator->() const { return T_Base::operator->(); } +}; + +} // namespace Glib + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +#endif /* _GLIBMM_CONTAINERS_H */ + diff --git a/libs/glibmm2/glibmm/convert.cc b/libs/glibmm2/glibmm/convert.cc new file mode 100644 index 0000000000..1cd334bcd1 --- /dev/null +++ b/libs/glibmm2/glibmm/convert.cc @@ -0,0 +1,323 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Glib +{ + +/**** Glib::IConv **********************************************************/ + +IConv::IConv(const std::string& to_codeset, const std::string& from_codeset) +: + gobject_ (g_iconv_open(to_codeset.c_str(), from_codeset.c_str())) +{ + if(gobject_ == reinterpret_cast(-1)) + { + GError* error = 0; + + // Abuse g_convert() to create a GError object. This may seem a weird + // thing to do, but it gives us consistently translated error messages + // at no further cost. + g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), 0, 0, &error); + + // If this should ever fail we're fucked. + g_assert(error != 0); + + Error::throw_exception(error); + } +} + +IConv::IConv(GIConv gobject) +: + gobject_ (gobject) +{} + +IConv::~IConv() +{ + g_iconv_close(gobject_); +} + +size_t IConv::iconv(char** inbuf, gsize* inbytes_left, char** outbuf, gsize* outbytes_left) +{ + return g_iconv(gobject_, inbuf, inbytes_left, outbuf, outbytes_left); +} + +void IConv::reset() +{ + // Apparently iconv() on Solaris <= 7 segfaults if you pass in + // NULL for anything but inbuf; work around that. (NULL outbuf + // or NULL *outbuf is allowed by Unix98.) + + char* outbuf = 0; + gsize inbytes_left = 0; + gsize outbytes_left = 0; + + g_iconv(gobject_, 0, &inbytes_left, &outbuf, &outbytes_left); +} + +std::string IConv::convert(const std::string& str) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_convert_with_iconv( + str.data(), str.size(), gobject_, 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get(), bytes_written); +} + + +/**** charset conversion functions *****************************************/ + +bool get_charset() +{ + return g_get_charset(0); +} + +bool get_charset(std::string& charset) +{ + const char* charset_cstr = 0; + const bool is_utf8 = g_get_charset(&charset_cstr); + + charset = charset_cstr; + return is_utf8; +} + +std::string convert(const std::string& str, + const std::string& to_codeset, + const std::string& from_codeset) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_convert( + str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), + 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get(), bytes_written); +} + +std::string convert_with_fallback(const std::string& str, + const std::string& to_codeset, + const std::string& from_codeset) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_convert_with_fallback( + str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), 0, + 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get(), bytes_written); +} + +std::string convert_with_fallback(const std::string& str, + const std::string& to_codeset, + const std::string& from_codeset, + const Glib::ustring& fallback) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_convert_with_fallback( + str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), + const_cast(fallback.c_str()), 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get(), bytes_written); +} + +Glib::ustring locale_to_utf8(const std::string& opsys_string) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_locale_to_utf8( + opsys_string.data(), opsys_string.size(), 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + const ScopedPtr scoped_buf (buf); + return Glib::ustring(scoped_buf.get(), scoped_buf.get() + bytes_written); +} + +std::string locale_from_utf8(const Glib::ustring& utf8_string) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_locale_from_utf8( + utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get(), bytes_written); +} + +Glib::ustring filename_to_utf8(const std::string& opsys_string) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_filename_to_utf8( + opsys_string.data(), opsys_string.size(), 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + const ScopedPtr scoped_buf (buf); + return Glib::ustring(scoped_buf.get(), scoped_buf.get() + bytes_written); +} + +std::string filename_from_utf8(const Glib::ustring& utf8_string) +{ + gsize bytes_written = 0; + GError* error = 0; + + char *const buf = g_filename_from_utf8( + utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get(), bytes_written); +} + +std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname) +{ + char* hostname_buf = 0; + GError* error = 0; + + char *const buf = g_filename_from_uri(uri.c_str(), &hostname_buf, &error); + + if(error) + Error::throw_exception(error); + + // Let's take ownership at this point. + const ScopedPtr scoped_buf (buf); + + if(hostname_buf) + hostname = ScopedPtr(hostname_buf).get(); + else + hostname.erase(); + + return std::string(scoped_buf.get()); +} + +std::string filename_from_uri(const Glib::ustring& uri) +{ + GError* error = 0; + char *const buf = g_filename_from_uri(uri.c_str(), 0, &error); + + if(error) + Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get()); +} + +Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname) +{ + GError* error = 0; + char *const buf = g_filename_to_uri(filename.c_str(), hostname.c_str(), &error); + + if(error) + Error::throw_exception(error); + + return Glib::ustring(ScopedPtr(buf).get()); +} + +Glib::ustring filename_to_uri(const std::string& filename) +{ + GError* error = 0; + char *const buf = g_filename_to_uri(filename.c_str(), 0, &error); + + if(error) + Error::throw_exception(error); + + return Glib::ustring(ScopedPtr(buf).get()); +} + +Glib::ustring filename_display_basename(const std::string& filename) +{ + char *const buf = g_filename_display_basename(filename.c_str()); + + return Glib::ustring(ScopedPtr(buf).get()); +} + + +Glib::ustring filename_display_name(const std::string& filename) +{ + char *const buf = g_filename_display_name(filename.c_str()); + + return Glib::ustring(ScopedPtr(buf).get()); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::ConvertError::ConvertError(Glib::ConvertError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_CONVERT_ERROR, error_code, error_message) +{} + +Glib::ConvertError::ConvertError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::ConvertError::Code Glib::ConvertError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::ConvertError::throw_func(GError* gobject) +{ + throw Glib::ConvertError(gobject); +} + + diff --git a/libs/glibmm2/glibmm/convert.h b/libs/glibmm2/glibmm/convert.h new file mode 100644 index 0000000000..335624f0ff --- /dev/null +++ b/libs/glibmm2/glibmm/convert.h @@ -0,0 +1,299 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_CONVERT_H +#define _GLIBMM_CONVERT_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include /* for gsize */ + +#include +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GIConv* GIConv; } +#endif + + +namespace Glib +{ + +/** @defgroup CharsetConv Character Set Conversion + * Utility functions for converting strings between different character sets. + * @{ + */ + +/** Exception class for charset conversion errors. + * Glib::convert() and friends throw a ConvertError exception if the charset + * conversion failed for some reason. When writing non-trivial applications + * you should always catch those errors, and then try to recover, or tell the + * user the input was invalid. + */ +class ConvertError : public Glib::Error +{ +public: + enum Code + { + NO_CONVERSION, + ILLEGAL_SEQUENCE, + FAILED, + PARTIAL_INPUT, + BAD_URI, + NOT_ABSOLUTE_PATH + }; + + ConvertError(Code error_code, const Glib::ustring& error_message); + explicit ConvertError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +/** Thin %iconv() wrapper. + * glibmm provides Glib::convert() and Glib::locale_to_utf8() which + * are likely more convenient than the raw iconv wrappers. However, + * creating an IConv object once and using the convert() method could + * be useful when converting multiple times between the same charsets. + */ +class IConv +{ +public: + /** Open new conversion descriptor. + * @param to_codeset Destination codeset. + * @param from_codeset %Source codeset. + * @throw Glib::ConvertError + */ + IConv(const std::string& to_codeset, const std::string& from_codeset); + + explicit IConv(GIConv gobject); + + /** Close conversion descriptor. + */ + ~IConv(); + + /** Same as the standard UNIX routine %iconv(), but may be implemented + * via libiconv on UNIX flavors that lack a native implementation. glibmm + * provides Glib::convert() and Glib::locale_to_utf8() which are likely + * more convenient than the raw iconv wrappers. + * @param inbuf Bytes to convert. + * @param inbytes_left In/out parameter, bytes remaining to convert in @a inbuf. + * @param outbuf Converted output bytes. + * @param outbytes_left In/out parameter, bytes available to fill in @a outbuf. + * @return Count of non-reversible conversions, or static_cast(-1) on error. + */ + size_t iconv(char** inbuf, gsize* inbytes_left, char** outbuf, gsize* outbytes_left); + + /** Reset conversion descriptor to initial state. + * Same as iconv(0, 0, 0, 0), but implemented slightly differently + * in order to work on Sun Solaris <= 7. It's also more obvious so you're + * encouraged to use it. + */ + void reset(); + + /** Convert from one encoding to another. + * @param str The string to convert. + * @return The converted string. + * @throw Glib::ConvertError + */ + std::string convert(const std::string& str); + + GIConv gobj() { return gobject_; } + +private: + GIConv gobject_; + + // noncopyable + IConv(const IConv&); + IConv& operator=(const IConv&); +}; + + +/** Get the charset used by the current locale. + * @return Whether the current locale uses the UTF-8 charset. + */ +bool get_charset(); + +/** Get the charset used by the current locale. + * @param charset Will be filled with the charset's name. + * @return Whether the current locale uses the UTF-8 charset. + */ +bool get_charset(std::string& charset); + +/** Convert from one encoding to another. + * @param str The string to convert. + * @param to_codeset Name of the target charset. + * @param from_codeset Name of the source charset. + * @return The converted string. + * @throw Glib::ConvertError + */ +std::string convert(const std::string& str, + const std::string& to_codeset, + const std::string& from_codeset); + +/** Converts a string from one character set to another, possibly including + * fallback sequences for characters not representable in the output. + * Characters not in the target encoding will be represented as Unicode + * escapes \\x{XXXX} or \\x{XXXXXX}. + * @param str The string to convert. + * @param to_codeset Name of the target charset. + * @param from_codeset Name of the source charset. + * @return The converted string. + * @throw Glib::ConvertError + */ +std::string convert_with_fallback(const std::string& str, + const std::string& to_codeset, + const std::string& from_codeset); + +/** Converts a string from one character set to another, possibly including + * fallback sequences for characters not representable in the output. + * @note It is not guaranteed that the specification for the fallback sequences + * in @a fallback will be honored. Some systems may do a approximate conversion + * from @a from_codeset to @a to_codeset in their iconv() functions, in which + * case Glib will simply return that approximate conversion. + * + * @param str The string to convert. + * @param to_codeset Name of the target charset. + * @param from_codeset Name of the source charset. + * @param fallback UTF-8 string to be used in place of characters which aren't + * available in the target encoding. All characters in the fallback string + * @em must be available in the target encoding. + * @return The converted string. + * @throw Glib::ConvertError + */ +std::string convert_with_fallback(const std::string& str, + const std::string& to_codeset, + const std::string& from_codeset, + const Glib::ustring& fallback); + +/** Convert from the current locale's encoding to UTF-8. + * Convenience wrapper around Glib::convert(). + * @param opsys_string The string to convert. Must be encoded in the charset + * used by the operating system's current locale. + * @return The input string converted to UTF-8 encoding. + * @throw Glib::ConvertError + */ +Glib::ustring locale_to_utf8(const std::string& opsys_string); + +/** Convert from UTF-8 to the current locale's encoding. + * Convenience wrapper around Glib::convert(). + * @param utf8_string The UTF-8 string to convert. + * @return The input string converted to the charset used by the operating + * system's current locale. + * @throw Glib::ConvertError + */ +std::string locale_from_utf8(const Glib::ustring& utf8_string); + +/** Converts a string which is in the encoding used for filenames into + * a UTF-8 string. + * @param opsys_string A string in the encoding for filenames. + * @return The converted string. + * @throw Glib::ConvertError + */ +Glib::ustring filename_to_utf8(const std::string& opsys_string); + +/** Converts a string from UTF-8 to the encoding used for filenames. + * @param utf8_string A UTF-8 encoded string. + * @return The converted string. + * @throw Glib::ConvertError + */ +std::string filename_from_utf8(const Glib::ustring& utf8_string); + +/** Converts an escaped UTF-8 encoded URI to a local filename + * in the encoding used for filenames. + * @param uri A string in the encoding for filenames. + * @param hostname Location to store hostname for the URI. If there is no + * hostname in the URI, "" will be stored in this location. + * @return The resulting filename. + * @throw Glib::ConvertError + */ +std::string filename_from_uri(const Glib::ustring& uri, Glib::ustring& hostname); + +/** Converts an escaped UTF-8 encoded URI to a local filename in the encoding + * used for filenames. + * @param uri A string in the encoding for filenames. + * @return The resulting filename. + * @throw Glib::ConvertError + */ +std::string filename_from_uri(const Glib::ustring& uri); + +/** Converts an absolute filename to an escaped UTF-8 encoded URI. + * @param filename An absolute filename specified in the encoding used + * for filenames by the operating system. + * @param hostname A UTF-8 encoded hostname. + * @return The resulting URI. + * @throw Glib::ConvertError + */ +Glib::ustring filename_to_uri(const std::string& filename, const Glib::ustring& hostname); + +/** Converts an absolute filename to an escaped UTF-8 encoded URI. + * @param filename An absolute filename specified in the encoding used + * for filenames by the operating system. + * @return The resulting URI. + * @throw Glib::ConvertError + */ +Glib::ustring filename_to_uri(const std::string& filename); + +/** Returns the display basename for the particular filename, guaranteed + * to be valid UTF-8. The display name might not be identical to the filename, + * for instance there might be problems converting it to UTF-8, and some files + * can be translated in the display + * + * You must pass the whole absolute pathname to this function so that + * translation of well known locations can be done. + * + * This function is preferred over filename_display_name() if you know the + * whole path, as it allows translation. + * + * @param filename An absolute pathname in the GLib file name encoding. + * @result A string containing a rendition of the basename of the filename in valid UTF-8 + */ +Glib::ustring filename_display_basename(const std::string& filename); + +/** Converts a filename into a valid UTF-8 string. The + * conversion is not necessarily reversible, so you + * should keep the original around and use the return + * value of this function only for display purposes. + * Unlike g_filename_to_utf8(), the result is guaranteed + * to be non-empty even if the filename actually isn't in the GLib + * file name encoding. + * + * If you know the whole pathname of the file you should use + * g_filename_display_basename(), since that allows location-based + * translation of filenames. + * + * @param filename: a pathname hopefully in the GLib file name encoding + * @result A string containing a rendition of the filename in valid UTF-8. + */ +Glib::ustring filename_display_name(const Glib::ustring& filename); + +/** @} group CharsetConv */ + +} // namespace Glib + + +#endif /* _GLIBMM_CONVERT_H */ + diff --git a/libs/glibmm2/glibmm/date.cc b/libs/glibmm2/glibmm/date.cc new file mode 100644 index 0000000000..8058376e2a --- /dev/null +++ b/libs/glibmm2/glibmm/date.cc @@ -0,0 +1,348 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#include +#include +#include +#include + +#include +GLIBMM_USING_STD(max) + + +namespace Glib +{ + +Date::Date() +{ + g_date_clear(&gobject_, 1); +} + +Date::Date(Date::Day day, Date::Month month, Date::Year year) +{ + g_date_clear(&gobject_, 1); + g_date_set_dmy(&gobject_, day, (GDateMonth) month, year); +} + +Date::Date(guint32 julian_day) +{ + g_date_clear(&gobject_, 1); + g_date_set_julian(&gobject_, julian_day); +} + +Date::Date(const GDate& castitem) +: + gobject_ (castitem) +{} + +void Date::clear() +{ + g_date_clear(&gobject_, 1); +} + +void Date::set_parse(const Glib::ustring& str) +{ + g_date_set_parse(&gobject_, str.c_str()); +} + +void Date::set_time(GTime time) +{ + g_date_set_time(&gobject_, time); +} + +void Date::set_month(Date::Month month) +{ + g_date_set_month(&gobject_, (GDateMonth) month); +} + +void Date::set_day(Date::Day day) +{ + g_date_set_day(&gobject_, day); +} + +void Date::set_year(Date::Year year) +{ + g_date_set_year(&gobject_, year); +} + +void Date::set_dmy(Date::Day day, Date::Month month, Date::Year year) +{ + g_date_set_dmy(&gobject_, day, (GDateMonth) month, year); +} + +void Date::set_julian(guint32 julian_day) +{ + g_date_set_julian(&gobject_, julian_day); +} + +Date& Date::add_days(int n_days) +{ + if(n_days >= 0) + g_date_add_days(&gobject_, n_days); + else + g_date_subtract_days(&gobject_, -n_days); + return *this; +} + +Date& Date::subtract_days(int n_days) +{ + if(n_days >= 0) + g_date_subtract_days(&gobject_, n_days); + else + g_date_add_days(&gobject_, -n_days); + return *this; +} + +Date& Date::add_months(int n_months) +{ + if(n_months >= 0) + g_date_add_months(&gobject_, n_months); + else + g_date_subtract_months(&gobject_, -n_months); + return *this; +} + +Date& Date::subtract_months(int n_months) +{ + if(n_months >= 0) + g_date_subtract_months(&gobject_, n_months); + else + g_date_add_months(&gobject_, -n_months); + return *this; +} + +Date& Date::add_years(int n_years) +{ + if(n_years >= 0) + g_date_add_years(&gobject_, n_years); + else + g_date_subtract_years(&gobject_, -n_years); + return *this; +} + +Date& Date::subtract_years(int n_years) +{ + if(n_years >= 0) + g_date_subtract_years(&gobject_, n_years); + else + g_date_add_years(&gobject_, -n_years); + return *this; +} + +int Date::days_between(const Date& rhs) const +{ + return g_date_days_between(&gobject_, &rhs.gobject_); +} + +int Date::compare(const Date& rhs) const +{ + return g_date_compare(&gobject_, &rhs.gobject_); +} + +Date& Date::clamp(const Date& min_date, const Date& max_date) +{ + g_date_clamp(&gobject_, &min_date.gobject_, &max_date.gobject_); + return *this; +} + +Date& Date::clamp_min(const Date& min_date) +{ + g_date_clamp(&gobject_, &min_date.gobject_, 0 /* see the C docs */); + return *this; +} + +Date& Date::clamp_max(const Date& max_date) +{ + g_date_clamp(&gobject_, 0 /* see the C docs */, &max_date.gobject_); + return *this; +} + +void Date::order(Date& other) +{ + g_date_order(&gobject_, &other.gobject_); +} + +Date::Weekday Date::get_weekday() const +{ + return (Date::Weekday) g_date_get_weekday(&gobject_); +} + +Date::Month Date::get_month() const +{ + return (Date::Month) g_date_get_month(&gobject_); +} + +Date::Year Date::get_year() const +{ + return g_date_get_year(&gobject_); +} + +Date::Day Date::get_day() const +{ + return g_date_get_day(&gobject_); +} + +guint32 Date::get_julian() const +{ + return g_date_get_julian(&gobject_); +} + +unsigned int Date::get_day_of_year() const +{ + return g_date_get_day_of_year(&gobject_); +} + +unsigned int Date::get_monday_week_of_year() const +{ + return g_date_get_monday_week_of_year(&gobject_); +} + +unsigned int Date::get_sunday_week_of_year() const +{ + return g_date_get_sunday_week_of_year(&gobject_); +} + +bool Date::is_first_of_month() const +{ + return g_date_is_first_of_month(&gobject_); +} + +bool Date::is_last_of_month() const +{ + return g_date_is_last_of_month(&gobject_); +} + +//static +guint8 Date::get_days_in_month(Date::Month month, Date::Year year) +{ + return g_date_get_days_in_month((GDateMonth) month, year); +} + +//static +guint8 Date::get_monday_weeks_in_year(Date::Year year) +{ + return g_date_get_monday_weeks_in_year(year); +} + +//static +guint8 Date::get_sunday_weeks_in_year(Date::Year year) +{ + return g_date_get_sunday_weeks_in_year(year); +} + +//static +bool Date::is_leap_year(Date::Year year) +{ + return g_date_is_leap_year(year); +} + +Glib::ustring Date::format_string(const Glib::ustring& format) const +{ + struct tm tm_data; + g_date_to_struct_tm(&gobject_, &tm_data); + + const std::string locale_format = locale_from_utf8(format); + gsize bufsize = std::max(2 * locale_format.size(), 128); + + do + { + const ScopedPtr buf (static_cast(g_malloc(bufsize))); + + // Set the first byte to something other than '\0', to be able to + // recognize whether strftime actually failed or just returned "". + buf.get()[0] = '\1'; + const gsize len = strftime(buf.get(), bufsize, locale_format.c_str(), &tm_data); + + if(len != 0 || buf.get()[0] == '\0') + { + g_assert(len < bufsize); + return locale_to_utf8(std::string(buf.get(), len)); + } + } + while((bufsize *= 2) <= 65536); + + // This error is quite unlikely (unless strftime is buggy). + g_warning("Glib::Date::format_string(): maximum size of strftime buffer exceeded, giving up"); + + return Glib::ustring(); +} + +void Date::to_struct_tm(struct tm& dest) const +{ + g_date_to_struct_tm(&gobject_, &dest); +} + +bool Date::valid() const +{ + return g_date_valid(&gobject_); +} + +//static +bool Date::valid_day(Date::Day day) +{ + return g_date_valid_day(day); +} + +//static +bool Date::valid_month(Date::Month month) +{ + return g_date_valid_month((GDateMonth) month); +} + +//static +bool Date::valid_year(Date::Year year) +{ + return g_date_valid_year(year); +} + +//static +bool Date::valid_weekday(Date::Weekday weekday) +{ + return g_date_valid_weekday((GDateWeekday) weekday); +} + +//static +bool Date::valid_julian(guint32 julian_day) +{ + return g_date_valid_julian(julian_day); +} + +//static +bool Date::valid_dmy(Date::Day day, Date::Month month, Date::Year year) +{ + return g_date_valid_dmy(day, (GDateMonth) month, year); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + diff --git a/libs/glibmm2/glibmm/date.h b/libs/glibmm2/glibmm/date.h new file mode 100644 index 0000000000..341a641b1a --- /dev/null +++ b/libs/glibmm2/glibmm/date.h @@ -0,0 +1,427 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_DATE_H +#define _GLIBMM_DATE_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + +#include +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { struct tm; } +#endif + + +namespace Glib +{ + +/** Julian calendar date. + */ +class Date +{ +public: + typedef guint8 Day; + typedef guint16 Year; + + /** @addtogroup glibmmEnums Enums and Flags */ + +/** + * @ingroup glibmmEnums + */ +enum Month +{ + BAD_MONTH, + JANUARY, + FEBRUARY, + MARCH, + APRIL, + MAY, + JUNE, + JULY, + AUGUST, + SEPTEMBER, + OCTOBER, + NOVEMBER, + DECEMBER +}; + + + /** + * @ingroup glibmmEnums + */ +enum Weekday +{ + BAD_WEEKDAY, + MONDAY, + TUESDAY, + WEDNESDAY, + THURSDAY, + FRIDAY, + SATURDAY, + SUNDAY +}; + + + /** + * @ingroup glibmmEnums + */ +enum DMY +{ + DAY, + MONTH, + YEAR +}; + + + static const Day BAD_DAY = 0; + static const Year BAD_YEAR = 0; + static const guint32 BAD_JULIAN = 0; + + Date(); + Date(Day day, Month month, Year year); + explicit Date(guint32 julian_day); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit Date(const GDate& castitem); +#endif + + void clear(); + /** Clear the date. The cleared dates will not represent an existing date, but will not contain garbage. + * @param month Month to set. + */ + + /** Parses a user-inputted string str, and try to figure out what date it represents, taking the current locale into account. If the string is successfully parsed, the date will be valid after the call. Otherwise, it will be invalid. + * This function is not appropriate for file formats and the like; it isn't very precise, and its exact behavior varies with the locale. It's intended to be a heuristic routine that guesses what the user means by a given string (and it does work pretty well in that capacity). + * @param str String to parse. + */ + void set_parse (const Glib::ustring& str); + + //TODO: Add set_time_current() - see the docs comment below.? + /** Sets the value of a date from a GTime (time_t) value. + * To set the value of a date to the current day, you could write: + * + *set_time(time(NULL)); + * + * @param time GTime value to set. + */ + void set_time(GTime time); + + /** Sets the month of the year. If the resulting day-month-year triplet is invalid, the date will be invalid. + * @param month Month to set. + */ + void set_month(Month month); + + /** Sets the day of the month. If the resulting day-month-year triplet is invalid, the date will be invalid. + * @param day Day to set. + */ + void set_day(Day day); + + /** Sets the year. If the resulting day-month-year triplet is invalid, the date will be invalid. + * @param year Year to set. + */ + void set_year(Year year); + + /** Sets the value of a day, month, and year.. If the resulting day-month-year triplet is invalid, the date will be invalid. + * @param day Day to set. + * @param month Month to set. + * @param year Year to set. + */ + void set_dmy(Day day, Month month, Year year); + + /** Sets the value of a GDate from a Julian day number. + * @param julian_day Julian day to set. + */ + void set_julian(guint32 julian_day); + + //TODO: Why return Date& (which is always *this) from these methods? + //Isn't it enough to also change the current instance? + //Maybe we need a copy constructor too. + //murrayc + + /** Add a number of days to a Date. + * @param n_days Days to add. + * @return Resulting Date + */ + Date& add_days(int n_days); + + /** Subtract n_days to a Date. + * @param n_days Days to subtract. + * @return Resulting Date + */ + Date& subtract_days(int n_days); + + /** Add n_months to a Date. + * @param n_months Months to add. + * @return Resulting Date + */ + Date& add_months(int n_months); + + /** Subtract n_months to a Date. + * @param n_months Months to subtract. + * @return Resulting Date + */ + Date& subtract_months(int n_months); + + /** Add n_days to a Date. + * @param n_years Years to add. + * @return Resulting Date + */ + Date& add_years(int n_years); + + /** Subtract n_years to a Date. + * @param n_years Years to subtract. + * @return Resulting Date + */ + Date& subtract_years(int n_years); + + /** Calculate days between two dates. + * @param rhs Date. + * @return Numbers of days. + */ + int days_between(const Date& rhs) const; + + /** Compare two dates. + * @param rhs Date to compare. + * @return Result of comparition. + */ + int compare(const Date& rhs) const; + + /** If date is prior to min_date, sets date equal to min_date. + * If date falls after max_date, sets date equal to max_date. All dates must be valid. + * See also clamp_min() and clamp_max(). + * @param min_date Date minimum value. + * @param max_date Date maximum value. + * @return Date in interval. + */ + Date& clamp(const Date& min_date, const Date& max_date); + + /** If date is prior to min_date, sets date equal to min_date. + * See also clamp(), and clamp_max(). + * @param min_date Date minimum value. + * @return Date in interval. + */ + Date& clamp_min(const Date& min_date); + + /** If date falls after max_date, sets date equal to max_date. + * See also clamp(), and clamp_min(). + * @param max_date Date maximum value. + * @return Date in interval. + */ + Date& clamp_max(const Date& max_date); + + /** Checks if date is less than or equal to other date, and swap the values if this is not the case. + * @param other Date ro compare. + * @return Date. + */ + void order(Date& other); + + /** Returns the day of the week for a Date. The date must be valid. + * @return Day of the week as a Date::Weekday. + */ + Weekday get_weekday() const; + + /** Returns the month of the year. The date must be valid. + * @return Month of the year as a Date::Month. + */ + Month get_month() const; + + /** Returns the year of a Date. The date must be valid. + * @return Year in which the date falls. + */ + Year get_year() const; + + /** Returns the day of the month. The date must be valid. + * @return Day of the month.. + */ + Day get_day() const; + + /** Returns the Julian day or "serial number" of the Date. + * The Julian day is simply the number of days since January 1, Year 1; + * i.e., January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2, etc. + * The date must be valid. + * @return Julian day. + */ + guint32 get_julian() const; + + /** Returns the day of the year, where Jan 1 is the first day of the year. + * The date must be valid. + * @return Julian day. + */ + unsigned int get_day_of_year() const; + + /** Returns the week of the year, where weeks are understood to start on Monday. + * If the date is before the first Monday of the year, return 0. + * The date must be valid. + * @return Week of the year. + */ + unsigned int get_monday_week_of_year() const; + + /** Returns the week of the year during which this date falls, if weeks are understood to being on Sunday. + * Can return 0 if the day is before the first Sunday of the year. + * The date must be valid. + * @return Week of the year. + */ + unsigned int get_sunday_week_of_year() const; + + /** Returns true if the date is on the first of a month. + * The date must be valid. + * @return true if the date is the first of the month. + */ + bool is_first_of_month() const; + + /** Returns true if the date is the last day of the month. + * The date must be valid. + * @return true if the date is the last day of the month. + */ + bool is_last_of_month() const; + + /** Returns the number of days in a month, taking leap years into account. + * @param month Month. + * @param year Year. + * @return Number of days in month during the year. + */ + static guint8 get_days_in_month(Month month, Year year); + + /** Returns the number of weeks in the year, where weeks are taken to start on Monday. Will be 52 or 53. + * (Years always have 52 7-day periods, plus 1 or 2 extra days depending on whether it's a leap year. This function is basically telling you how many Mondays are in the year, i.e. there are 53 Mondays if one of the extra days happens to be a Monday.) + * @param year Year to count weeks in. + * @return Number of weeks. + */ + static guint8 get_monday_weeks_in_year(Year year); + + /** Returns the number of weeks in the year, where weeks are taken to start on Sunday. Will be 52 or 53. + * (Years always have 52 7-day periods, plus 1 or 2 extra days depending on whether it's a leap year. This function is basically telling you how many Sundays are in the year, i.e. there are 53 Sundays if one of the extra days happens to be a Sunday.) + * @param year Year to count weeks in. + * @return Number of weeks. + */ + static guint8 get_sunday_weeks_in_year(Year year); + + /** Returns true if the year is a leap year. + * @param year Year to check. + * @return true if the year is a leap year. + */ + static bool is_leap_year(Year year); + + /** Convert date to string. + * @param format A format string as used by @c strftime(), in UTF-8 + * encoding. Only date formats are allowed, the result of time formats + * is undefined. + * @return The formatted date string. + * @throw Glib::ConvertError + */ + Glib::ustring format_string(const Glib::ustring& format) const; + + /** Fills in the date-related bits of a struct tm using the date value. Initializes the non-date parts with something sane but meaningless. + * @param dest Struct tm to fill. + */ + void to_struct_tm(struct tm& dest) const; + + /** Returns true if the Date represents an existing day. + * @return true if the date is valid. + */ + bool valid() const; + + /** Returns true if the day of the month is valid (a day is valid if it's between 1 and 31 inclusive). + * @param day Day to check. + * @return true if the day is valid. + */ + static bool valid_day(Day day); + + /** Returns true if the month value is valid. The 12 Date::Month enumeration values are the only valid months. + * @param month Month to check. + * @return true if the month is valid. + */ + static bool valid_month(Month month); + + + /** Returns true if the year is valid. + * Any year greater than 0 is valid, though there is a 16-bit limit to what Date will understand. + * @param year Year to check. + * @return true if the year is valid. + */ + static bool valid_year(Year year); + + /** Returns true if the weekday is valid. + * The 7 Date::Weekday enumeration values are the only valid. + * @param weekday Weekday to check. + * @return true if the weekday is valid. + */ + static bool valid_weekday(Weekday weekday); + + /** Returns true if the Julian day is valid. + * Anything greater than zero is basically a valid Julian, though there is a 32-bit limit. + * @param julian_day Julian day to check. + * @return true if the Julian day is valid. + */ + static bool valid_julian(guint32 julian_day); + + + /** Returns true if the day-month-year triplet forms a valid, existing day in the range of days Date understands (Year 1 or later, no more than a few thousand years in the future). + * @param day Day to check. + * @param month Month to check. + * @param year Year to check. + * @return true if the date is a valid one. + */ + static bool valid_dmy(Day day, Month month, Year year); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GDate* gobj() { return &gobject_; } + const GDate* gobj() const { return &gobject_; } +#endif + +private: + GDate gobject_; +}; + + +/** @relates Glib::Date */ +inline bool operator==(const Date& lhs, const Date& rhs) + { return (lhs.compare(rhs) == 0); } + +/** @relates Glib::Date */ +inline bool operator!=(const Date& lhs, const Date& rhs) + { return (lhs.compare(rhs) != 0); } + +/** @relates Glib::Date */ +inline bool operator<(const Date& lhs, const Date& rhs) + { return (lhs.compare(rhs) < 0); } + +/** @relates Glib::Date */ +inline bool operator>(const Date& lhs, const Date& rhs) + { return (lhs.compare(rhs) > 0); } + +/** @relates Glib::Date */ +inline bool operator<=(const Date& lhs, const Date& rhs) + { return (lhs.compare(rhs) <= 0); } + +/** @relates Glib::Date */ +inline bool operator>=(const Date& lhs, const Date& rhs) + { return (lhs.compare(rhs) >= 0); } + +} // namespace Glib + + +#endif /* _GLIBMM_DATE_H */ + diff --git a/libs/glibmm2/glibmm/debug.cc b/libs/glibmm2/glibmm/debug.cc new file mode 100644 index 0000000000..de181ebf24 --- /dev/null +++ b/libs/glibmm2/glibmm/debug.cc @@ -0,0 +1,21 @@ +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + diff --git a/libs/glibmm2/glibmm/debug.h b/libs/glibmm2/glibmm/debug.h new file mode 100644 index 0000000000..556b16f865 --- /dev/null +++ b/libs/glibmm2/glibmm/debug.h @@ -0,0 +1,85 @@ +// -*- c++ -*- +#ifndef _GLIBMM_DEBUG_H +#define _GLIBMM_DEBUG_H + +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +// Some stuff that's useful when debugging gtkmm internals: + +#ifdef GLIBMM_DEBUG_REFCOUNTING + +#include + +/* We can't use G_GNUC_PRETTY_FUNCTION because it's always disabled in C++, + * even though __PRETTY_FUNCTION__ works fine in C++ as well if you use it + * right (i.e. concatenation with string literals isn't allowed). + */ +#ifdef __GNUC__ +#define GLIBMM_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else +#define GLIBMM_GNUC_PRETTY_FUNCTION "" +#endif + +#define GLIBMM_DEBUG_REFERENCE(cppInstance, cInstance) \ + G_STMT_START{ \ + void *const cppInstance__ = (void*) (cppInstance); \ + void *const cInstance__ = (void*) (cInstance); \ + g_log(G_LOG_DOMAIN, \ + G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s):\n" \ + "ref: C++ instance: %p; C instance: %p, ref_count = %u, type = %s\n", \ + __FILE__, \ + __LINE__, \ + GLIBMM_GNUC_PRETTY_FUNCTION, \ + cppInstance__, \ + cInstance__, \ + G_OBJECT(cInstance__)->ref_count, \ + G_OBJECT_TYPE_NAME(cInstance__)); \ + }G_STMT_END + +#define GLIBMM_DEBUG_UNREFERENCE(cppInstance, cInstance) \ + G_STMT_START{ \ + void *const cppInstance__ = (void*) (cppInstance); \ + void *const cInstance__ = (void*) (cInstance); \ + g_log(G_LOG_DOMAIN, \ + G_LOG_LEVEL_DEBUG, \ + "file %s: line %d (%s):\n" \ + "unref: C++ instance: %p; C instance: %p, ref_count = %u, type = %s\n", \ + __FILE__, \ + __LINE__, \ + GLIBMM_GNUC_PRETTY_FUNCTION, \ + cppInstance__, \ + cInstance__, \ + G_OBJECT(cInstance__)->ref_count, \ + G_OBJECT_TYPE_NAME(cInstance__)); \ + }G_STMT_END + +#else + +#define GLIBMM_DEBUG_REFERENCE(cppInstance,cInstance) G_STMT_START{ (void)0; }G_STMT_END +#define GLIBMM_DEBUG_UNREFERENCE(cppInstance,cInstance) G_STMT_START{ (void)0; }G_STMT_END + +#endif /* GLIBMM_DEBUG_REFCOUNTING */ + +#endif /* _GLIBMM_DEBUG_H */ + diff --git a/libs/glibmm2/glibmm/dispatcher.cc b/libs/glibmm2/glibmm/dispatcher.cc new file mode 100644 index 0000000000..15c63ae322 --- /dev/null +++ b/libs/glibmm2/glibmm/dispatcher.cc @@ -0,0 +1,442 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifndef G_OS_WIN32 +#include + +#if defined(_tru64) //TODO: Use the real define +//EINTR is not defined on Tru64 +//I have tried including these +//#include +//#include +//#include + #ifndef EINTR + #define EINTR 0 + #endif +#endif + +#else +#include +#include +#include +#include +#endif /* G_OS_WIN32 */ + + +namespace +{ + +struct DispatchNotifyData +{ + unsigned long tag; + Glib::Dispatcher* dispatcher; + Glib::DispatchNotifier* notifier; + + DispatchNotifyData() + : tag (0), dispatcher (0), notifier (0) {} + + DispatchNotifyData(unsigned long tag_, Glib::Dispatcher* dispatcher_, Glib::DispatchNotifier* notifier_) + : tag (tag_), dispatcher (dispatcher_), notifier (notifier_) {} +}; + +static void warn_failed_pipe_io(const char* what, int err_no) +{ +#ifdef G_OS_WIN32 + const char *const message = g_win32_error_message(err_no); +#else + const char *const message = g_strerror(err_no); +#endif + g_critical("Error in inter-thread communication: %s() failed: %s", what, message); +} + +#ifndef G_OS_WIN32 +/* + * Try to set the close-on-exec flag of the file descriptor, + * so that it won't be leaked if a new process is spawned. + */ +static void fd_set_close_on_exec(int fd) +{ + const int flags = fcntl(fd, F_GETFD, 0); + g_return_if_fail(flags >= 0); + + fcntl(fd, F_SETFD, flags | FD_CLOEXEC); +} +#endif /* !G_OS_WIN32 */ + +/* + * One word: paranoia. + */ +#ifdef G_OS_WIN32 +static void fd_close_and_invalidate(HANDLE& fd) +{ + if(fd != 0) + { + if(!CloseHandle(fd)) + warn_failed_pipe_io("CloseHandle", GetLastError()); + + fd = 0; + } +} +#else /* !G_OS_WIN32 */ +static void fd_close_and_invalidate(int& fd) +{ + if(fd >= 0) + { + int result; + + do + result = close(fd); + while(result < 0 && errno == EINTR); + + if(result < 0) + warn_failed_pipe_io("close", errno); + + fd = -1; + } +} +#endif /* !G_OS_WIN32 */ + +} // anonymous namespace + + +namespace Glib +{ + +class DispatchNotifier +{ +public: + ~DispatchNotifier(); + + static DispatchNotifier* reference_instance(const Glib::RefPtr& context); + static void unreference_instance(DispatchNotifier* notifier); + + void send_notification(Dispatcher* dispatcher); + +protected: + // Only used by reference_instance(). Should be private, but that triggers + // a silly gcc warning even though DispatchNotifier has static methods. + explicit DispatchNotifier(const Glib::RefPtr& context); + +private: + static Glib::StaticPrivate thread_specific_instance_; + + Glib::RefPtr context_; + int ref_count_; +#ifdef G_OS_WIN32 + HANDLE fd_receiver_; + Glib::Mutex mutex_; + std::list notify_queue_; +#else + int fd_receiver_; + int fd_sender_; +#endif /* !G_OS_WIN32 */ + sigc::connection conn_io_handler_; + + void create_pipe(); + bool pipe_io_handler(Glib::IOCondition condition); + + // noncopyable + DispatchNotifier(const DispatchNotifier&); + DispatchNotifier& operator=(const DispatchNotifier&); +}; + + +/**** Glib::DispatchNotifier ***********************************************/ + +Glib::StaticPrivate +DispatchNotifier::thread_specific_instance_ = GLIBMM_STATIC_PRIVATE_INIT; + +DispatchNotifier::DispatchNotifier(const Glib::RefPtr& context) +: + context_ (context), + ref_count_ (0), +#ifdef G_OS_WIN32 + fd_receiver_ (0), + mutex_ (), + notify_queue_ () +#else + fd_receiver_ (-1), + fd_sender_ (-1) +#endif +{ + create_pipe(); + + try + { +#ifdef G_OS_WIN32 + conn_io_handler_ = context_->signal_io().connect( + sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), + GPOINTER_TO_INT(fd_receiver_), Glib::IO_IN); +#else /* !G_OS_WIN32 */ + conn_io_handler_ = context_->signal_io().connect( + sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), + fd_receiver_, Glib::IO_IN); +#endif /* !G_OS_WIN32 */ + } + catch(...) + { +#ifndef G_OS_WIN32 + fd_close_and_invalidate(fd_sender_); +#endif /* !G_OS_WIN32 */ + fd_close_and_invalidate(fd_receiver_); + + throw; + } +} + +DispatchNotifier::~DispatchNotifier() +{ + // Disconnect manually because we don't inherit from sigc::trackable + conn_io_handler_.disconnect(); + +#ifndef G_OS_WIN32 + fd_close_and_invalidate(fd_sender_); +#endif /* !G_OS_WIN32 */ + fd_close_and_invalidate(fd_receiver_); +} + +void DispatchNotifier::create_pipe() +{ +#ifdef G_OS_WIN32 + // On Win32 we are using synchronization object instead of pipe + // thus storing its handle as fd_receiver_. + fd_receiver_ = CreateEvent(0, FALSE, FALSE, 0); + + if(!fd_receiver_) + { + GError* const error = g_error_new(G_FILE_ERROR, G_FILE_ERROR_FAILED, + "Failed to create event for inter-thread communication: %s", + g_win32_error_message(GetLastError())); + throw Glib::FileError(error); + } +#else /* !G_OS_WIN32 */ + int filedes[2] = { -1, -1 }; + + if(pipe(filedes) < 0) + { + GError* const error = g_error_new(G_FILE_ERROR, g_file_error_from_errno(errno), + "Failed to create pipe for inter-thread communication: %s", + g_strerror(errno)); + throw Glib::FileError(error); + } + + fd_set_close_on_exec(filedes[0]); + fd_set_close_on_exec(filedes[1]); + + fd_receiver_ = filedes[0]; + fd_sender_ = filedes[1]; +#endif /* !G_OS_WIN32 */ +} + +// static +DispatchNotifier* DispatchNotifier::reference_instance(const Glib::RefPtr& context) +{ + DispatchNotifier* instance = thread_specific_instance_.get(); + + if(!instance) + { + instance = new DispatchNotifier(context); + thread_specific_instance_.set(instance); + } + else + { + // Prevent massive mess-up. + g_return_val_if_fail(instance->context_ == context, 0); + } + + ++instance->ref_count_; // initially 0 + + return instance; +} + +// static +void DispatchNotifier::unreference_instance(DispatchNotifier* notifier) +{ + DispatchNotifier *const instance = thread_specific_instance_.get(); + + // Yes, the notifier argument is only used to check for sanity. + g_return_if_fail(instance == notifier); + + if(--instance->ref_count_ <= 0) + { + g_return_if_fail(instance->ref_count_ == 0); // could be < 0 if messed up + + // This will cause deletion of the notifier object. + thread_specific_instance_.set(0); + } +} + +void DispatchNotifier::send_notification(Dispatcher* dispatcher) +{ +#ifdef G_OS_WIN32 + { + Glib::Mutex::Lock lock (mutex_); + notify_queue_.push_back(DispatchNotifyData(0xdeadbeef, dispatcher, this)); + } + + // Send notification event to GUI-thread. + if(!SetEvent(fd_receiver_)) + { + warn_failed_pipe_io("SetEvent", GetLastError()); + return; + } +#else /* !G_OS_WIN32 */ + DispatchNotifyData data (0xdeadbeef, dispatcher, this); + gssize n_written; + + do + n_written = write(fd_sender_, &data, sizeof(data)); + while(n_written < 0 && errno == EINTR); + + if(n_written < 0) + { + warn_failed_pipe_io("write", errno); + return; + } + + // All data must be written in a single call to write(), otherwise we can't + // guarantee reentrancy since another thread might be scheduled between two + // write() calls. The manpage is a bit unclear about this -- but I hope + // it's safe to assume immediate success for the tiny amount of data we're + // writing. + g_return_if_fail(n_written == sizeof(data)); +#endif /* !G_OS_WIN32 */ +} + +bool DispatchNotifier::pipe_io_handler(Glib::IOCondition) +{ +#ifdef G_OS_WIN32 + DispatchNotifyData data; + + for(;;) + { + { + Glib::Mutex::Lock lock (mutex_); + + if(notify_queue_.empty()) + break; + + data = notify_queue_.front(); + notify_queue_.pop_front(); + } + + g_return_val_if_fail(data.tag == 0xdeadbeef, true); + g_return_val_if_fail(data.notifier == this, true); + + // Actually, we wouldn't need the try/catch block because the Glib::Source + // C callback already does it for us. However, we do it anyway because the + // default return value is 'false', which is not what we want. + try + { + data.dispatcher->signal_(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +#else /* !G_OS_WIN32 */ + DispatchNotifyData data; + gsize n_read = 0; + + do + { + void * const buffer = reinterpret_cast(&data) + n_read; + const gssize result = read(fd_receiver_, buffer, sizeof(data) - n_read); + + if(result < 0) + { + if(errno == EINTR) + continue; + + warn_failed_pipe_io("read", errno); + return true; + } + + n_read += result; + } + while(n_read < sizeof(data)); + + g_return_val_if_fail(data.tag == 0xdeadbeef, true); + g_return_val_if_fail(data.notifier == this, true); + + // Actually, we wouldn't need the try/catch block because the Glib::Source + // C callback already does it for us. However, we do it anyway because the + // default return value is 'false', which is not what we want. + try + { + data.dispatcher->signal_(); // emit + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +#endif /* !G_OS_WIN32 */ + + return true; +} + + +/**** Glib::Dispatcher *****************************************************/ + +Dispatcher::Dispatcher() +: + signal_ (), + notifier_ (DispatchNotifier::reference_instance(MainContext::get_default())) +{} + +Dispatcher::Dispatcher(const Glib::RefPtr& context) +: + signal_ (), + notifier_ (DispatchNotifier::reference_instance(context)) +{} + +Dispatcher::~Dispatcher() +{ + DispatchNotifier::unreference_instance(notifier_); +} + +void Dispatcher::emit() +{ + notifier_->send_notification(this); +} + +void Dispatcher::operator()() +{ + emit(); +} + +sigc::connection Dispatcher::connect(const sigc::slot& slot) +{ + return signal_.connect(slot); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/dispatcher.h b/libs/glibmm2/glibmm/dispatcher.h new file mode 100644 index 0000000000..cecf606eeb --- /dev/null +++ b/libs/glibmm2/glibmm/dispatcher.h @@ -0,0 +1,102 @@ +// -*- c++ -*- +#ifndef _GLIBMM_DISPATCHER_H +#define _GLIBMM_DISPATCHER_H + +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +class DispatchNotifier; +#endif + +/** Signal class for inter-thread communication. + * @ingroup Threads + * Glib::Dispatcher works similar to sigc::signal. But unlike normal + * signals, the notification happens asynchronously through a pipe. This is + * a simple and efficient way of communicating between threads, and especially + * useful in a thread model with a single GUI thread. + * + * No mutex locking is involved, apart from the operating system's internal + * I/O locking. That implies some usage rules: + * + * @li Only one thread may connect to the signal and receive notification, but + * multiple senders are allowed even without locking. + * @li The GLib main loop must run in the receiving thread (this will be the + * GUI thread usually). + * @li The Dispatcher object must be instantiated by the receiver thread. + * @li The Dispatcher object should be instantiated before creating any of the + * sender threads, if you want to avoid extra locking. + * + * Notes about performance: + * + * @li After instantiation, Glib::Dispatcher will never lock any mutexes on its + * own. The interaction with the GLib main loop might involve locking on the + * @em receiver side. The @em sender side, however, is guaranteed not to lock, + * except for internal locking in the %write() system call. + * @li All Dispatcher instances of a receiver thread share the same pipe. That + * is, if you use Glib::Dispatcher only to notify the GUI thread, only one pipe + * is created no matter how many Dispatcher objects you have. + */ +class Dispatcher +{ +public: + /** Create new Dispatcher instance using the default main context. + * @throw Glib::FileError + */ + Dispatcher(); + /** Create new Dispatcher instance using an arbitrary main context. + * @throw Glib::FileError + */ + explicit Dispatcher(const Glib::RefPtr& context); + ~Dispatcher(); + + void emit(); + void operator()(); + + sigc::connection connect(const sigc::slot& slot); + +private: + sigc::signal signal_; + DispatchNotifier* notifier_; + + // noncopyable + Dispatcher(const Dispatcher&); + Dispatcher& operator=(const Dispatcher&); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + friend class Glib::DispatchNotifier; +#endif +}; + +/*! A Glib::Dispatcher example. + * @example thread/dispatcher.cc + */ + +} // namespace Glib + + +#endif /* _GLIBMM_DISPATCHER_H */ + diff --git a/libs/glibmm2/glibmm/error.cc b/libs/glibmm2/glibmm/error.cc new file mode 100644 index 0000000000..2e8f072322 --- /dev/null +++ b/libs/glibmm2/glibmm/error.cc @@ -0,0 +1,187 @@ +// -*- c++ -*- +/* $Id$ */ + +/* error.cc + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#include +#include +#include +#include + +GLIBMM_USING_STD(map) + + +namespace +{ + +typedef std::map ThrowFuncTable; + +static ThrowFuncTable* throw_func_table = 0; + +} // anonymous namespace + + +namespace Glib +{ + +Error::Error() +: + gobject_ (0) +{} + +Error::Error(GQuark domain, int code, const Glib::ustring& message) +: + gobject_ (g_error_new_literal(domain, code, message.c_str())) +{} + +Error::Error(GError* gobject, bool take_copy) +: + gobject_ ((take_copy && gobject) ? g_error_copy(gobject) : gobject) +{} + +Error::Error(const Error& other) +: + Exception(other), + gobject_ ((other.gobject_) ? g_error_copy(other.gobject_) : 0) +{} + +Error& Error::operator=(const Error& other) +{ + if(gobject_ != other.gobject_) + { + if(gobject_) + { + g_error_free(gobject_); + gobject_ = 0; + } + if(other.gobject_) + { + gobject_ = g_error_copy(other.gobject_); + } + } + return *this; +} + +Error::~Error() throw() +{ + if(gobject_) + g_error_free(gobject_); +} + +GQuark Error::domain() const +{ + g_return_val_if_fail(gobject_ != 0, 0); + + return gobject_->domain; +} + +int Error::code() const +{ + g_return_val_if_fail(gobject_ != 0, -1); + + return gobject_->code; +} + +Glib::ustring Error::what() const +{ + g_return_val_if_fail(gobject_ != 0, ""); + g_return_val_if_fail(gobject_->message != 0, ""); + + return gobject_->message; +} + +bool Error::matches(GQuark domain, int code) const +{ + return g_error_matches(gobject_, domain, code); +} + +GError* Error::gobj() +{ + return gobject_; +} + +const GError* Error::gobj() const +{ + return gobject_; +} + +void Error::propagate(GError** dest) +{ + g_propagate_error(dest, gobject_); + gobject_ = 0; +} + + +// static +void Error::register_init() +{ + if(!throw_func_table) + { + throw_func_table = new ThrowFuncTable(); + Glib::wrap_init(); // make sure that at least the Glib exceptions are registered + } +} + +// static +void Error::register_cleanup() +{ + if(throw_func_table) + { + delete throw_func_table; + throw_func_table = 0; + } +} + +// static +void Error::register_domain(GQuark domain, Error::ThrowFunc throw_func) +{ + g_assert(throw_func_table != 0); + + (*throw_func_table)[domain] = throw_func; +} + +// static, noreturn +void Error::throw_exception(GError* gobject) +{ + g_assert(gobject != 0); + + // Just in case Gtk::Main hasn't been instantiated yet. + if(!throw_func_table) + register_init(); + + if(const ThrowFunc throw_func = (*throw_func_table)[gobject->domain]) + { + (*throw_func)(gobject); + g_assert_not_reached(); + } + + g_warning("Glib::Error::throw_exception():\n " + "unknown error domain '%s': throwing generic Glib::Error exception\n", + (gobject->domain) ? g_quark_to_string(gobject->domain) : "(null)"); + + // Doesn't copy, because error-returning functions return a newly allocated GError for us. + throw Glib::Error(gobject); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/error.h b/libs/glibmm2/glibmm/error.h new file mode 100644 index 0000000000..d4c39e6d80 --- /dev/null +++ b/libs/glibmm2/glibmm/error.h @@ -0,0 +1,77 @@ +// -*- c++ -*- +#ifndef _GLIBMM_ERROR_H +#define _GLIBMM_ERROR_H +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GError GError; } +#endif + +#include +#include + + +namespace Glib +{ + +class Error : public Glib::Exception +{ +public: + Error(); + Error(GQuark domain, int code, const Glib::ustring& message); + explicit Error(GError* gobject, bool take_copy = false); + + Error(const Error& other); + Error& operator=(const Error& other); + + virtual ~Error() throw(); + + GQuark domain() const; + int code() const; + virtual Glib::ustring what() const; + + bool matches(GQuark domain, int code) const; + + GError* gobj(); + const GError* gobj() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + void propagate(GError** dest); + + typedef void (* ThrowFunc) (GError*); + + static void register_init(); + static void register_cleanup(); + static void register_domain(GQuark domain, ThrowFunc throw_func); + + static void throw_exception(GError* gobject) G_GNUC_NORETURN; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +protected: + GError* gobject_; +}; + +} // namespace Glib + + +#endif /* _GLIBMM_ERROR_H */ + diff --git a/libs/glibmm2/glibmm/exception.cc b/libs/glibmm2/glibmm/exception.cc new file mode 100644 index 0000000000..22345b2853 --- /dev/null +++ b/libs/glibmm2/glibmm/exception.cc @@ -0,0 +1,40 @@ +// -*- c++ -*- +/* $Id$ */ + +/* exception.cc + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +Exception::~Exception() throw() +{} + +Glib::ustring Exception::what() const +{ + g_assert_not_reached(); + return Glib::ustring(); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/exception.h b/libs/glibmm2/glibmm/exception.h new file mode 100644 index 0000000000..7f0dd43c9c --- /dev/null +++ b/libs/glibmm2/glibmm/exception.h @@ -0,0 +1,42 @@ +// -*- c++ -*- +#ifndef _GLIBMM_EXCEPTION_H +#define _GLIBMM_EXCEPTION_H +/* $Id$ */ + +/* exception.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +class Exception +{ +public: + virtual ~Exception() throw() = 0; + virtual Glib::ustring what() const = 0; +}; + +} // namespace Glib + + +#endif /* _GLIBMM_EXCEPTION_H */ + diff --git a/libs/glibmm2/glibmm/exceptionhandler.cc b/libs/glibmm2/glibmm/exceptionhandler.cc new file mode 100644 index 0000000000..cfe6892483 --- /dev/null +++ b/libs/glibmm2/glibmm/exceptionhandler.cc @@ -0,0 +1,159 @@ +// -*- c++ -*- +/* $Id$ */ + +/* exceptionhandler.cc + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +#include +#include +#include +#include + +GLIBMM_USING_STD(exception) +GLIBMM_USING_STD(list) + + +namespace +{ + +typedef sigc::signal HandlerList; + +// Each thread has its own list of exception handlers +// to avoid thread synchronization problems. +static Glib::StaticPrivate thread_specific_handler_list = GLIBMM_STATIC_PRIVATE_INIT; + + +static void glibmm_exception_warning(const GError* error) +{ + g_assert(error != 0); + + g_critical("\n" + "unhandled exception (type Glib::Error) in signal handler:\n" + "domain: %s\n" + "code : %d\n" + "what : %s\n", + g_quark_to_string(error->domain), error->code, + (error->message) ? error->message : "(null)"); +} + +static void glibmm_unexpected_exception() +{ + try + { + throw; // re-throw current exception + } + catch(const Glib::Error& error) + { + // Access the GError directly, to avoid possible exceptions from C++ code. + glibmm_exception_warning(error.gobj()); + + // For most failures that cause a Glib::Error exception, aborting the + // program seems too harsh. Instead, give control back to the main loop. + return; + } + catch(const std::exception& except) + { + g_error("\n" + "unhandled exception (type std::exception) in signal handler:\n" + "what: %s\n", except.what()); + } + catch(...) + { + g_error("\nunhandled exception (type unknown) in signal handler\n"); + } +} + +} // anonymous namespace + + +namespace Glib +{ + +sigc::connection add_exception_handler(const sigc::slot& slot) +{ + HandlerList* handler_list = thread_specific_handler_list.get(); + + if(!handler_list) + { + handler_list = new HandlerList(); + thread_specific_handler_list.set(handler_list); + } + + handler_list->slots().push_front(slot); + return handler_list->slots().begin(); +} + +// internal +void exception_handlers_invoke() throw() +{ + // This function will be called from our GLib signal handler proxies + // if an exception has been caught. It's not possible to throw C++ + // exceptions through C signal handlers. To handle this situation, the + // programmer can install slots to global Reusable Exception Handlers. + // + // A handler has to re-throw the current exception in a try block, and then + // catch the exceptions it knows about. Any unknown exceptions should just + // fall through, i.e. the handler must not do catch(...). + // + // We now invoke each of the installed slots until the exception has been + // handled. If there are no more handlers in the list and the exception + // is still unhandled, call glibmm_unexpected_exception(). + + if(HandlerList *const handler_list = thread_specific_handler_list.get()) + { + HandlerList::iterator pslot = handler_list->slots().begin(); + + while(pslot != handler_list->slots().end()) + { + // Calling an empty slot would mean ignoring the exception, + // thus we have to check for dead slots explicitly. + if(pslot->empty()) + { + pslot = handler_list->slots().erase(pslot); + continue; + } + + // Call the Reusable Exception Handler, which should re-throw + // the exception that's currently on the stack. + try + { + (*pslot)(); + } + catch(...) // unhandled, try next slot + { + ++pslot; + continue; + } + + // The exception has either been handled or ignored. + // Give control back to the GLib main loop. + return; + } + } + + // Critical: The exception is still unhandled. + glibmm_unexpected_exception(); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/exceptionhandler.h b/libs/glibmm2/glibmm/exceptionhandler.h new file mode 100644 index 0000000000..de1d68f48c --- /dev/null +++ b/libs/glibmm2/glibmm/exceptionhandler.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +#ifndef _GLIBMM_EXCEPTIONHANDLER_H +#define _GLIBMM_EXCEPTIONHANDLER_H + +/* $Id$ */ + +/* exceptionhandler.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +/** Specify a slot to be called when an exception is thrown by a signal handler. + */ +sigc::connection add_exception_handler(const sigc::slot& slot); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// internal +void exception_handlers_invoke() throw(); +#endif + +} // namespace Glib + + +#endif /* _GLIBMM_EXCEPTIONHANDLER_H */ + diff --git a/libs/glibmm2/glibmm/fileutils.cc b/libs/glibmm2/glibmm/fileutils.cc new file mode 100644 index 0000000000..ce7051faa0 --- /dev/null +++ b/libs/glibmm2/glibmm/fileutils.cc @@ -0,0 +1,217 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Glib +{ + +/**** Glib::Dir ************************************************************/ + +Dir::Dir(const std::string& path) +{ + GError* error = 0; + gobject_ = g_dir_open(path.c_str(), 0, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +Dir::Dir(GDir* gobject) +: + gobject_ (gobject) +{} + +Dir::~Dir() +{ + if(gobject_) + g_dir_close(gobject_); +} + +std::string Dir::read_name() +{ + const char *const name = g_dir_read_name(gobject_); + return (name) ? std::string(name) : std::string(); +} + +void Dir::rewind() +{ + g_dir_rewind(gobject_); +} + +void Dir::close() +{ + if(gobject_) + { + g_dir_close(gobject_); + gobject_ = 0; + } +} + +DirIterator Dir::begin() +{ + g_dir_rewind(gobject_); + return DirIterator(gobject_, g_dir_read_name(gobject_)); +} + +DirIterator Dir::end() +{ + return DirIterator(gobject_, 0); +} + + +/**** Glib::DirIterator ****************************************************/ + +DirIterator::DirIterator() +: + gobject_ (0), + current_ (0) +{} + +DirIterator::DirIterator(GDir* gobject, const char* current) +: + gobject_ (gobject), + current_ (current) +{} + +std::string DirIterator::operator*() const +{ + return (current_) ? std::string(current_) : std::string(); +} + +DirIterator& DirIterator::operator++() +{ + current_ = g_dir_read_name(gobject_); + return *this; +} + +void DirIterator::operator++(int) +{ + current_ = g_dir_read_name(gobject_); +} + +bool DirIterator::operator==(const DirIterator& rhs) const +{ + return (current_ == rhs.current_); +} + +bool DirIterator::operator!=(const DirIterator& rhs) const +{ + return (current_ != rhs.current_); +} + + +bool file_test(const std::string& filename, FileTest test) +{ + return g_file_test(filename.c_str(), static_cast(unsigned(test))); +} + +int mkstemp(std::string& filename_template) +{ + const ScopedPtr buf (g_strndup(filename_template.data(), filename_template.size())); + const int fileno = g_mkstemp(buf.get()); + + filename_template = buf.get(); + return fileno; +} + +int file_open_tmp(std::string& name_used, const std::string& prefix) +{ + std::string basename_template (prefix); + basename_template += "XXXXXX"; // this sillyness shouldn't be in the interface + + GError* error = 0; + ScopedPtr buf_name_used; + + const int fileno = g_file_open_tmp(basename_template.c_str(), buf_name_used.addr(), &error); + + if(error) + Glib::Error::throw_exception(error); + + name_used = buf_name_used.get(); + return fileno; +} + +int file_open_tmp(std::string& name_used) +{ + GError* error = 0; + ScopedPtr buf_name_used; + + const int fileno = g_file_open_tmp(0, buf_name_used.addr(), &error); + + if(error) + Glib::Error::throw_exception(error); + + name_used = buf_name_used.get(); + return fileno; +} + +std::string file_get_contents(const std::string& filename) +{ + ScopedPtr contents; + gsize length = 0; + GError* error = 0; + + g_file_get_contents(filename.c_str(), contents.addr(), &length, &error); + + if(error) + Glib::Error::throw_exception(error); + + return std::string(contents.get(), length); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::FileError::FileError(Glib::FileError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_FILE_ERROR, error_code, error_message) +{} + +Glib::FileError::FileError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::FileError::Code Glib::FileError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::FileError::throw_func(GError* gobject) +{ + throw Glib::FileError(gobject); +} + + diff --git a/libs/glibmm2/glibmm/fileutils.h b/libs/glibmm2/glibmm/fileutils.h new file mode 100644 index 0000000000..67f1106a64 --- /dev/null +++ b/libs/glibmm2/glibmm/fileutils.h @@ -0,0 +1,475 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_FILEUTILS_H +#define _GLIBMM_FILEUTILS_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GDir GDir; } +#endif + +#include +#include + +#include +#include + +GLIBMM_USING_STD(input_iterator_tag) +GLIBMM_USING_STD(string) + + +namespace Glib +{ + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** + * @ingroup glibmmEnums + * @par Bitwise operators: + * %FileTest operator|(FileTest, FileTest)
+ * %FileTest operator&(FileTest, FileTest)
+ * %FileTest operator^(FileTest, FileTest)
+ * %FileTest operator~(FileTest)
+ * %FileTest& operator|=(FileTest&, FileTest)
+ * %FileTest& operator&=(FileTest&, FileTest)
+ * %FileTest& operator^=(FileTest&, FileTest)
+ */ +enum FileTest +{ + FILE_TEST_IS_REGULAR = 1 << 0, + FILE_TEST_IS_SYMLINK = 1 << 1, + FILE_TEST_IS_DIR = 1 << 2, + FILE_TEST_IS_EXECUTABLE = 1 << 3, + FILE_TEST_EXISTS = 1 << 4 +}; + +/** @ingroup glibmmEnums */ +inline FileTest operator|(FileTest lhs, FileTest rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline FileTest operator&(FileTest lhs, FileTest rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline FileTest operator^(FileTest lhs, FileTest rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline FileTest operator~(FileTest flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup glibmmEnums */ +inline FileTest& operator|=(FileTest& lhs, FileTest rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline FileTest& operator&=(FileTest& lhs, FileTest rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline FileTest& operator^=(FileTest& lhs, FileTest rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +/** @defgroup FileUtils File Utilities + * Various file-related classes and functions. + */ + +/** Exception class for file-related errors. + * @ingroup FileUtils + */ +class FileError : public Glib::Error +{ +public: + enum Code + { + EXISTS, + IS_DIRECTORY, + ACCESS_DENIED, + NAME_TOO_LONG, + NO_SUCH_ENTITY, + NOT_DIRECTORY, + NO_SUCH_DEVICE, + NOT_DEVICE, + READONLY_FILESYSTEM, + TEXT_FILE_BUSY, + FAULTY_ADDRESS, + SYMLINK_LOOP, + NO_SPACE_LEFT, + NOT_ENOUGH_MEMORY, + TOO_MANY_OPEN_FILES, + FILE_TABLE_OVERFLOW, + BAD_FILE_DESCRIPTOR, + INVALID_ARGUMENT, + BROKEN_PIPE, + TRYAGAIN, + INTERRUPTED, + IO_ERROR, + NOT_OWNER, + NOSYS, + FAILED + }; + + FileError(Code error_code, const Glib::ustring& error_message); + explicit FileError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +/** @enum FileError::Code + * Values corresponding to errno codes returned from file operations + * on UNIX. + * Unlike errno codes, FileError::Code values are available on all + * systems, even Windows. The exact meaning of each code depends on what sort + * of file operation you were performing; the UNIX documentation gives more + * details. The following error code descriptions come from the GNU C Library + * manual, and are under the copyright of that manual. + * + * It's not very portable to make detailed assumptions about exactly which + * errors will be returned from a given operation. Some errors don't occur on + * some systems, etc., sometimes there are subtle differences in when a system + * will report a given error, etc. + */ + +/** @var FileError::Code FileError::EXISTS + * (EEXIST) Operation not permitted; only the owner of the file (or + * other resource) or processes with special privileges can perform the operation. + *

+ */ +/** @var FileError::Code FileError::IS_DIRECTORY + * (EISDIR) File is a directory; you cannot open a directory for writing, + * or create or remove hard links to it. + *

+ */ +/** @var FileError::Code FileError::ACCESS_DENIED + * (EACCES) Permission denied; the file permissions do not allow the + * attempted operation. + *

+ */ +/** @var FileError::Code FileError::NAME_TOO_LONG + * (ENAMETOOLONG) Filename too long. + *

+ */ +/** @var FileError::Code FileError::NO_SUCH_ENTITY + * (ENOENT) No such file or directory. This is a "file doesn't exist" + * error for ordinary files that are referenced in contexts where they are expected + * to already exist. + *

+ */ +/** @var FileError::Code FileError::NOT_DIRECTORY + * (ENOTDIR) A file that isn't a directory was specified when a directory + * is required. + *

+ */ +/** @var FileError::Code FileError::NO_SUCH_DEVICE + * (ENXIO) No such device or address. The system tried to use the device + * represented by a file you specified, and it couldn't find the device. This can + * mean that the device file was installed incorrectly, or that the physical device + * is missing or not correctly attached to the computer. + *

+ */ +/** @var FileError::Code FileError::NOT_DEVICE + * (ENODEV) This file is of a type that doesn't support mapping. + *

+ */ +/** @var FileError::Code FileError::READONLY_FILESYSTEM + * (EROFS) The directory containing the new link can't be modified + * because it's on a read-only file system. + *

+ */ +/** @var FileError::Code FileError::TEXT_FILE_BUSY + * (ETXTBSY) Text file busy. + *

+ */ +/** @var FileError::Code FileError::FAULTY_ADDRESS + * (EFAULT) You passed in a pointer to bad memory. (Glib won't + * reliably return this, don't pass in pointers to bad memory.) + *

+ */ +/** @var FileError::Code FileError::SYMLINK_LOOP + * (ELOOP) Too many levels of symbolic links were encountered in + * looking up a file name. This often indicates a cycle of symbolic links. + *

+ */ +/** @var FileError::Code FileError::NO_SPACE_LEFT + * (ENOSPC) No space left on device; write operation on a file failed + * because the disk is full. + *

+ */ +/** @var FileError::Code FileError::NOT_ENOUGH_MEMORY + * (ENOMEM) No memory available. The system cannot allocate more + * virtual memory because its capacity is full. + *

+ */ +/** @var FileError::Code FileError::TOO_MANY_OPEN_FILES + * (EMFILE) The current process has too many files open and can't + * open any more. Duplicate descriptors do count toward this limit. + *

+ */ +/** @var FileError::Code FileError::FILE_TABLE_OVERFLOW + * (ENFILE) There are too many distinct file openings in the + * entire system. + *

+ */ +/** @var FileError::Code FileError::BAD_FILE_DESCRIPTOR + * (EBADF) Bad file descriptor; for example, I/O on a descriptor + * that has been closed or reading from a descriptor open only for writing + * (or vice versa). + *

+ */ +/** @var FileError::Code FileError::INVALID_ARGUMENT + * (EINVAL) Invalid argument. This is used to indicate various kinds + * of problems with passing the wrong argument to a library function. + *

+ */ +/** @var FileError::Code FileError::BROKEN_PIPE + * (EPIPE) Broken pipe; there is no process reading from the other + * end of a pipe. Every library function that returns this error code also + * generates a SIGPIPE signal; this signal terminates the program + * if not handled or blocked. Thus, your program will never actually see + * this code unless it has handled or blocked SIGPIPE. + *

+ */ +/** @var FileError::Code FileError::TRYAGAIN + * (EAGAIN) Resource temporarily unavailable; the call might work + * if you try again later. + * We used TRYAGAIN instead of TRY_AGAIN, because that is a defined as a macro by a Unix header. + *

+ */ +/** @var FileError::Code FileError::INTERRUPTED + * (EINTR) Interrupted function call; an asynchronous signal occurred + * and prevented completion of the call. When this happens, you should try + * the call again. + *

+ */ +/** @var FileError::Code FileError::IO_ERROR + * (EIO) Input/output error; usually used for physical read or write + * errors. I.e. the disk or other physical device hardware is returning errors. + *

+ */ +/** @var FileError::Code FileError::NOT_OWNER + * (EPERM) Operation not permitted; only the owner of the file (or other + * resource) or processes with special privileges can perform the operation. + *

+ */ +/** @var FileError::Code FileError::FAILED + * Does not correspond to a UNIX error code; this is the standard "failed for + * unspecified reason" error code present in all Glib::Error error code + * enumerations. Returned if no specific code applies. + */ + +class Dir; + +/** The iterator type of Glib::Dir. + * @ingroup FileUtils + */ +class DirIterator +{ +public: + typedef std::input_iterator_tag iterator_category; + typedef std::string value_type; + typedef int difference_type; + typedef value_type reference; + typedef void pointer; + + DirIterator(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + DirIterator(GDir* gobject, const char* current); +#endif + + std::string operator*() const; + DirIterator& operator++(); + + /** @note DirIterator has input iterator semantics, which means real + * postfix increment is impossible. The return type is @c void to + * prevent surprising behaviour. + */ + void operator++(int); + + bool operator==(const DirIterator& rhs) const; + bool operator!=(const DirIterator& rhs) const; + +private: + GDir* gobject_; + const char* current_; +}; + + +/** Utility class representing an open directory. + * @ingroup FileUtils + * It's highly recommended to use the iterator interface. With iterators, + * reading an entire directory into a STL container is really easy: + * @code + * Glib::Dir dir (directory_path); + * std::list entries (dir.begin(), dir.end()); + * @endcode + * @note The encoding of the directory entries isn't necessarily UTF-8. + * Use Glib::filename_to_utf8() if you need to display them. + */ +class Dir +{ +public: + typedef DirIterator iterator; + typedef DirIterator const_iterator; + + /** Opens a directory for reading. The names of the files in the + * directory can then be retrieved using read_name(). + * @param path The path to the directory you are interested in. + * @throw Glib::FileError + */ + explicit Dir(const std::string& path); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit Dir(GDir* gobject); +#endif + + /** Closes the directory and deallocates all related resources. + */ + ~Dir(); + + /** Retrieves the name of the next entry in the directory. + * The '.' and '..' entries are omitted. + * @return The entry's name or "" if there are no more entries. + * @see begin(), end() + */ + std::string read_name(); + + /** Resets the directory. The next call to + * read_name() will return the first entry again. + */ + void rewind(); + + /** Closes the directory and deallocates all related resources. + * Note that close() is implicitely called by ~Dir(). Thus you don't + * need to call close() yourself unless you want to close the directory + * before the destructor runs. + */ + void close(); + + /** Get the begin of an input iterator sequence. + * @return An input iterator pointing to the first directory entry. + */ + DirIterator begin(); + + /** Get the end of an input iterator sequence. + * @return An input iterator pointing behind the last directory entry. + */ + DirIterator end(); + +private: + GDir* gobject_; + + // noncopyable + Dir(const Dir&); + Dir& operator=(const Dir&); +}; + + +/** Returns @c true if any of the tests in the bitfield @a test are true. + * @ingroup FileUtils + * For example, (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_DIR) will + * return @c true if the file exists; the check whether it's a directory + * doesn't matter since the existence test is true. With the current set of + * available tests, there's no point passing in more than one test at a time. + * + * Apart from Glib::FILE_TEST_IS_SYMLINK all tests follow symbolic + * links, so for a symbolic link to a regular file file_test() will return + * @c true for both Glib::FILE_TEST_IS_SYMLINK and + * Glib::FILE_TEST_IS_REGULAR. + * + * @note For a dangling symbolic link file_test() will return @c true for + * Glib::FILE_TEST_IS_SYMLINK and @c false for all other flags. + * + * @param filename A filename to test. + * @param test Bitfield of Glib::FileTest flags. + * @return Whether a test was true. + */ +bool file_test(const std::string& filename, FileTest test); + +/** Opens a temporary file. + * @ingroup FileUtils + * See the %mkstemp() documentation on most UNIX-like systems. This is a + * portability wrapper, which simply calls %mkstemp() on systems that have + * it, and implements it in GLib otherwise. + * @param filename_template A string that should match the rules for + * %mkstemp(), i.e. end in "XXXXXX". The X string + * will be modified to form the name of a file that didn't exist. + * @return A file handle (as from open()) to the file opened for reading + * and writing. The file is opened in binary mode on platforms where there + * is a difference. The file handle should be closed with close(). In + * case of errors, -1 is returned. + */ +int mkstemp(std::string& filename_template); + +/** Opens a file for writing in the preferred directory for temporary files + * (as returned by Glib::get_tmp_dir()). + * @ingroup FileUtils + * @a prefix should a basename template; it'll be suffixed by 6 characters + * in order to form a unique filename. No directory components are allowed. + * + * The actual name used is returned in @a name_used. + * + * @param prefix Template for file name, basename only. + * @retval name_used The actual name used. + * @return A file handle (as from open()) to the file opened for reading + * and writing. The file is opened in binary mode on platforms where there is a + * difference. The file handle should be closed with close(). + * @throw Glib::FileError + */ +int file_open_tmp(std::string& name_used, const std::string& prefix); + +/** Opens a file for writing in the preferred directory for temporary files + * (as returned by Glib::get_tmp_dir()). + * @ingroup FileUtils + * This function works like file_open_tmp(std::string&, const std::string&) + * but uses a default basename prefix. + * + * @retval name_used The actual name used. + * @return A file handle (as from open()) to the file opened for reading + * and writing. The file is opened in binary mode on platforms where there is a + * difference. The file handle should be closed with close(). + * @throw Glib::FileError + */ +int file_open_tmp(std::string& name_used); + +/** Reads an entire file into a string, with good error checking. + * @ingroup FileUtils + * @param filename A file to read contents from. + * @return The file contents. + * @throw Glib::FileError + */ +std::string file_get_contents(const std::string& filename); + +} // namespace Glib + + +#endif /* _GLIBMM_FILEUTILS_H */ + diff --git a/libs/glibmm2/glibmm/helperlist.h b/libs/glibmm2/glibmm/helperlist.h new file mode 100644 index 0000000000..50685e80ca --- /dev/null +++ b/libs/glibmm2/glibmm/helperlist.h @@ -0,0 +1,165 @@ +// -*- c++ -*- +#ifndef _GLIBMM_HELPERLIST_H +#define _GLIBMM_HELPERLIST_H +/* $Id$ */ + +/* helperlist.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Glib +{ + +// This class has some pure virtual methods which need to be implemented by derived classes. +template< typename T_Child, typename T_CppElement, typename T_Iterator > +class HelperList +{ +public: + HelperList() + : gparent_(0) + {} + + HelperList(GObject* gparent) + : gparent_(gparent) + {} + + virtual ~HelperList() + {} + + typedef T_Child value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + + typedef T_Iterator iterator; + typedef List_ConstIterator const_iterator; + typedef List_ReverseIterator reverse_iterator; + typedef List_ConstIterator const_reverse_iterator; + + typedef T_CppElement element_type; + + typedef size_t difference_type; + typedef size_t size_type; + + //These are implemented differently for each Helper List. + virtual iterator erase(iterator) = 0; + + virtual void erase(iterator start, iterator stop) + { + while(start != stop) + start = erase(start); //Implemented in derived class. + } + + virtual void remove(const_reference) = 0; + + size_type size() const + { + return g_list_length(glist()); + } + + inline size_type max_size() { return size_type(-1); } + inline bool empty() { return glist() == 0; } + + inline iterator begin() + {return begin_();} + inline iterator end() + {return end_();} + + inline const_iterator begin() const + { return const_iterator(begin_()); } + inline const_iterator end() const + { return const_iterator(end_()); } + + inline reverse_iterator rbegin() + { return reverse_iterator(end_()); } + inline reverse_iterator rend() + { return reverse_iterator(begin_()); } + + inline const_reverse_iterator rbegin() const + { return const_reverse_iterator(reverse_iterator(end_())); } + inline const_reverse_iterator rend() const + { return const_reverse_iterator(reverse_iterator(begin_())); } + + reference front() const + { + return *begin(); + } + + reference back() const + { + return *(--end()); + } + + reference operator[](size_type l) const + { + size_type j = 0; + iterator i; + for(i = begin(), j = 0; i != end(), j < l; ++i, ++j); + return (*i); + } + +// iterator find(const_reference w) +// { +// iterator i = begin(); +// for(i = begin(); i != end() && (*i != w); i++); +// return i; +// } +// +// iterator find(Widget& w) +// { +// iterator i; +// for (i = begin(); i != end() && ((*i)->$1() != &w); i++); +// return i; +// } + + //Derived classes might choose to reimplement these as public: + inline void pop_front() + { erase(begin()); } + inline void pop_back() + { erase(--end()); } + + void clear() + { erase(begin(), end()); } + + GObject* gparent() + { return gparent_; }; + const GObject* gparent() const + { return gparent_; }; + +protected: + virtual GList*& glist() const = 0; // front of list + + iterator begin_() const + { + return iterator(glist(), glist()); + } + + iterator end_() const + { + return iterator(glist(), (GList*)0); + } + + GObject* gparent_; +}; + + +} /* namespace Glib */ + +#endif /* _GLIBMM_HELPERLIST_H */ + diff --git a/libs/glibmm2/glibmm/i18n.h b/libs/glibmm2/glibmm/i18n.h new file mode 100644 index 0000000000..2758bb57c3 --- /dev/null +++ b/libs/glibmm2/glibmm/i18n.h @@ -0,0 +1,30 @@ +// -*- c++ -*- +#ifndef _GLIBMM_I18N_H +#define _GLIBMM_I18N_H + +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// Include this file to define internationalization macros such as _(). +// This file must be included by the application, after system headers such as . + +#include + +#endif /* _GLIBMM_I18N_H */ + diff --git a/libs/glibmm2/glibmm/init.cc b/libs/glibmm2/glibmm/init.cc new file mode 100644 index 0000000000..c2748c8805 --- /dev/null +++ b/libs/glibmm2/glibmm/init.cc @@ -0,0 +1,34 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2003 The glibmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Glib +{ + +void init() +{ + Glib::wrap_register_init(); + Glib::Error::register_init(); //also calls Glib::wrap_init(); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/init.h b/libs/glibmm2/glibmm/init.h new file mode 100644 index 0000000000..c913d3793a --- /dev/null +++ b/libs/glibmm2/glibmm/init.h @@ -0,0 +1,39 @@ +// -*- c++ -*- +#ifndef _GLIBMM_INIT_H +#define _GLIBMM_INIT_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Glib +{ + +/** Initialize glibmm. + * You may call this more than once. + * You do nott need to call this if you are using Glib::MainLoop or Gtk::Main, + * because they call it for you. + */ +void init(); + +} // namespace Glib + + + +#endif /* _GLIBMM_INIT_H */ + diff --git a/libs/glibmm2/glibmm/interface.cc b/libs/glibmm2/glibmm/interface.cc new file mode 100644 index 0000000000..d3ade45282 --- /dev/null +++ b/libs/glibmm2/glibmm/interface.cc @@ -0,0 +1,95 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +/**** Glib::Interface_Class ************************************************/ + +void Interface_Class::add_interface(GType instance_type) const +{ + //This check is distabled, because it checks whether any of the types's bases implement the interface, not just the specific type. + //if( !g_type_is_a(instance_type, gtype_) ) //For convenience, don't complain about calling this twice. + //{ + const GInterfaceInfo interface_info = + { + class_init_func_, + 0, // interface_finalize + 0, // interface_data + }; + + g_type_add_interface_static(instance_type, gtype_, &interface_info); + //} +} + + +/**** Interface Glib::Interface ********************************************/ + +Interface::Interface(const Interface_Class& interface_class) +{ + //gobject_ will be set in the Object constructor. + //Any instantiable class that derives from Interface should also inherit from Object. + + // If I understand it correctly, gobject_ shouldn't be 0 now. daniel. + // TODO: Make this a g_assert() if the assumption above is correct. + + g_return_if_fail(gobject_ != 0); + + if(custom_type_name_ && !is_anonymous_custom_()) + { + void *const instance_class = G_OBJECT_GET_CLASS(gobject_); + + if(!g_type_interface_peek(instance_class, interface_class.get_type())) + { + interface_class.add_interface(G_OBJECT_CLASS_TYPE(instance_class)); + } + } +} + +Interface::Interface(GObject* castitem) +{ + // Connect GObject and wrapper instances. + ObjectBase::initialize(castitem); +} + +Interface::~Interface() +{} + +GType Interface::get_type() +{ + return G_TYPE_INTERFACE; +} + +GType Interface::get_base_type() +{ + return G_TYPE_INTERFACE; +} + +RefPtr wrap_interface(GObject* object, bool take_copy) +{ + return Glib::RefPtr( wrap_auto(object, take_copy) ); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/interface.h b/libs/glibmm2/glibmm/interface.h new file mode 100644 index 0000000000..ce9bf509c8 --- /dev/null +++ b/libs/glibmm2/glibmm/interface.h @@ -0,0 +1,72 @@ +// -*- c++ -*- +#ifndef _GLIBMM_INTERFACE_H +#define _GLIBMM_INTERFACE_H + +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +class Interface_Class; +#endif + +// There is no base GInterface struct in Glib, though there is G_TYPE_INTERFACE enum value. +class Interface : virtual public Glib::ObjectBase +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Interface CppObjectType; + typedef Interface_Class CppClassType; + typedef GTypeInterface BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + explicit Interface(const Glib::Interface_Class& interface_class); + explicit Interface(GObject* castitem); + virtual ~Interface(); + + //void add_interface(GType gtype_implementer); + + // Hook for translating API + //static Glib::Interface* wrap_new(GTypeInterface*); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + inline GObject* gobj() { return gobject_; } + inline const GObject* gobj() const { return gobject_; } + +private: + // noncopyable + Interface(const Interface&); + Interface& operator=(const Interface&); +}; + +RefPtr wrap_interface(GObject* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GLIBMM_INTERFACE_H */ + diff --git a/libs/glibmm2/glibmm/iochannel.cc b/libs/glibmm2/glibmm/iochannel.cc new file mode 100644 index 0000000000..18e434da7a --- /dev/null +++ b/libs/glibmm2/glibmm/iochannel.cc @@ -0,0 +1,687 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + + +namespace +{ + +// Glib::IOChannel reference counting issues: +// +// Normally, you'd expect that the C++ object stays around as long as the +// C instance does. Also Glib::wrap() usually returns always the same C++ +// wrapper object for a single C instance. +// +// Unfortunately it isn't possible to implement these features if we didn't +// create the underlying GIOChannel. That is, when wrapping existing +// GIOChannel instances such as returned by e.g. g_io_channel_unix_new() or +// g_io_channel_new_file(). Neither is there a way to hook up a wrapper +// object in an existing GIOChannel, nor exists any destroy notification. +// +// So that means: If the IOChannel is implemented in C++ -- that is, our +// GlibmmIOChannel backend is used -- we use the GIOChannel reference +// counting mechanism. If the IOChannel backend is unknown, then the +// wrapper instance holds always exactly one reference to the GIOChannel. +// The wrapper object itself is then managed via our own refcounting +// mechanism. To do that a utility class ForeignIOChannel is introduced to +// override reference() and unreference(). + +class ForeignIOChannel : public Glib::IOChannel +{ +public: + ForeignIOChannel(GIOChannel* gobject, bool take_copy) + : Glib::IOChannel(gobject, take_copy), ref_count_(0) {} + + virtual void reference() const; + virtual void unreference() const; + +private: + mutable int ref_count_; +}; + +void ForeignIOChannel::reference() const +{ + ++ref_count_; +} + +void ForeignIOChannel::unreference() const +{ + if (!(--ref_count_)) delete this; +} + +} // anonymous namespace + + +namespace Glib +{ + +class GlibmmIOChannel +{ +public: + GIOChannel base; + Glib::IOChannel* wrapper; + + static const GIOFuncs vfunc_table; + + static GIOStatus io_read(GIOChannel* channel, char* buf, gsize count, + gsize* bytes_read, GError** err); + + static GIOStatus io_write(GIOChannel* channel, const char* buf, gsize count, + gsize* bytes_written, GError** err); + + static GIOStatus io_seek (GIOChannel* channel, gint64 offset, GSeekType type, GError** err); + static GIOStatus io_close(GIOChannel* channel, GError** err); + + static GSource* io_create_watch(GIOChannel* channel, GIOCondition condition); + static void io_free(GIOChannel* channel); + + static GIOStatus io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err); + static GIOFlags io_get_flags(GIOChannel* channel); +}; + +// static +const GIOFuncs GlibmmIOChannel::vfunc_table = +{ + &GlibmmIOChannel::io_read, + &GlibmmIOChannel::io_write, + &GlibmmIOChannel::io_seek, + &GlibmmIOChannel::io_close, + &GlibmmIOChannel::io_create_watch, + &GlibmmIOChannel::io_free, + &GlibmmIOChannel::io_set_flags, + &GlibmmIOChannel::io_get_flags, +}; + + +/**** GLib::IOChannel ******************************************************/ + +/* Construct a custom C++-implemented IOChannel. GlibmmIOChannel is an + * extended GIOChannel struct which allows us to hook up a pointer to this + * persistent wrapper instance. + */ +IOChannel::IOChannel() +: + gobject_ (static_cast(g_malloc(sizeof(GlibmmIOChannel)))) +{ + g_io_channel_init(gobject_); + gobject_->funcs = const_cast(&GlibmmIOChannel::vfunc_table); + + reinterpret_cast(gobject_)->wrapper = this; +} + +/* Construct an IOChannel wrapper for an already created GIOChannel. + * See the comment at the top of this file for an explanation of the + * problems with this approach. + */ +IOChannel::IOChannel(GIOChannel* gobject, bool take_copy) +: + gobject_ (gobject) +{ + // This ctor should never be called for GlibmmIOChannel instances. + g_assert(gobject != 0); + g_assert(gobject->funcs != &GlibmmIOChannel::vfunc_table); + + if(take_copy) + g_io_channel_ref(gobject_); +} + +IOChannel::~IOChannel() +{ + if(gobject_) + { + // Check whether this IOChannel is implemented in C++, i.e. whether it + // uses our GlibmmIOChannel forwarding backend. Normally, this will never + // be true because the wrapper should only be deleted in the io_free() + // callback, which clears gobject_ before deleting. But in case the ctor + // of a derived class threw an exception the GIOChannel must be destroyed + // prematurely. + // + if(gobject_->funcs == &GlibmmIOChannel::vfunc_table) + { + // Disconnect the wrapper object so that it won't be deleted twice. + reinterpret_cast(gobject_)->wrapper = 0; + } + + GIOChannel *const tmp_gobject = gobject_; + gobject_ = 0; + + g_io_channel_unref(tmp_gobject); + } +} + +Glib::RefPtr IOChannel::create_from_file(const std::string& filename, const std::string& mode) +{ + GError* error = 0; + GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(channel, false); +} + +Glib::RefPtr IOChannel::create_from_fd(int fd) +{ + return Glib::wrap(g_io_channel_unix_new(fd), false); +} + +#ifdef G_OS_WIN32 + +Glib::RefPtr IOChannel::create_from_win32_fd(int fd) +{ + return Glib::wrap(g_io_channel_win32_new_fd(fd), false); +} + +Glib::RefPtr IOChannel::create_from_win32_socket(int socket) +{ + return Glib::wrap(g_io_channel_win32_new_socket(socket), false); +} + +#endif /* G_OS_WIN32 */ + +IOStatus IOChannel::write(const Glib::ustring& str) +{ + gsize bytes_written = 0; + return write(str.data(), str.bytes(), bytes_written); +} + +IOStatus IOChannel::read_line(Glib::ustring& line) +{ + Glib::ScopedPtr buf; + GError* error = 0; + gsize bytes = 0; + + const GIOStatus status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &error); + + if(error) + Glib::Error::throw_exception(error); + + if(buf.get()) + line.assign(buf.get(), buf.get() + bytes); + else + line.erase(); + + return (IOStatus) status; +} + +IOStatus IOChannel::read_to_end(Glib::ustring& str) +{ + Glib::ScopedPtr buf; + GError* error = 0; + gsize bytes = 0; + + const GIOStatus status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &error); + + if(error) + Glib::Error::throw_exception(error); + + if(buf.get()) + str.assign(buf.get(), buf.get() + bytes); + else + str.erase(); + + return (IOStatus) status; +} + +IOStatus IOChannel::read(Glib::ustring& str, gsize count) +{ + Glib::ScopedPtr buf (g_new(char, count)); + GError* error = 0; + gsize bytes = 0; + + const GIOStatus status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &error); + + if(error) + Glib::Error::throw_exception(error); + + if(buf.get()) + str.assign(buf.get(), buf.get() + bytes); + else + str.erase(); + + return (IOStatus) status; +} + +IOStatus IOChannel::set_encoding(const std::string& encoding) +{ + GError* error = 0; + + const GIOStatus status = g_io_channel_set_encoding( + gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return (IOStatus) status; +} + +std::string IOChannel::get_encoding() const +{ + const char *const encoding = g_io_channel_get_encoding(gobject_); + return (encoding) ? std::string(encoding) : std::string(); +} + +void IOChannel::set_line_term(const std::string& term) +{ + if(term.empty()) + g_io_channel_set_line_term(gobj(), 0, 0); + else + g_io_channel_set_line_term(gobj(), term.data(), term.size()); +} + +std::string IOChannel::get_line_term() const +{ + int len = 0; + const char *const term = g_io_channel_get_line_term(gobject_, &len); + + return (term) ? std::string(term, len) : std::string(); +} + +Glib::RefPtr IOChannel::create_watch(IOCondition condition) +{ + // The corresponding unreference() takes place in the dtor + // of the Glib::RefPtr object below. + reference(); + return IOSource::create(Glib::RefPtr(this), condition); +} + +IOStatus IOChannel::read_vfunc(char*, gsize, gsize&) +{ + g_assert_not_reached(); + return IO_STATUS_ERROR; +} + +IOStatus IOChannel::write_vfunc(const char*, gsize, gsize&) +{ + g_assert_not_reached(); + return IO_STATUS_ERROR; +} + +IOStatus IOChannel::seek_vfunc(gint64, SeekType) +{ + g_assert_not_reached(); + return IO_STATUS_ERROR; +} + +IOStatus IOChannel::close_vfunc() +{ + g_assert_not_reached(); + return IO_STATUS_ERROR; +} + +Glib::RefPtr IOChannel::create_watch_vfunc(IOCondition) +{ + g_assert_not_reached(); + return Glib::RefPtr(); +} + +IOStatus IOChannel::set_flags_vfunc(IOFlags) +{ + g_assert_not_reached(); + return IO_STATUS_ERROR; +} + +IOFlags IOChannel::get_flags_vfunc() +{ + g_assert_not_reached(); + return IOFlags(0); +} + +void IOChannel::reference() const +{ + g_io_channel_ref(gobject_); +} + +void IOChannel::unreference() const +{ + g_io_channel_unref(gobject_); +} + +Glib::RefPtr wrap(GIOChannel* gobject, bool take_copy) +{ + IOChannel* cpp_object = 0; + + if(gobject) + { + if(gobject->funcs == &GlibmmIOChannel::vfunc_table) + { + cpp_object = reinterpret_cast(gobject)->wrapper; + + if(take_copy && cpp_object) + cpp_object->reference(); + } + else + { + cpp_object = new ForeignIOChannel(gobject, take_copy); + cpp_object->reference(); // the refcount is initially 0 + } + } + + return Glib::RefPtr(cpp_object); +} + + +/**** Glib::GlibmmIOChannel ************************************************/ + +// static +GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count, + gsize* bytes_read, GError** err) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + return (GIOStatus) wrapper->read_vfunc(buf, count, *bytes_read); + } + catch(Glib::Error& error) + { + error.propagate(err); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return G_IO_STATUS_ERROR; +} + +// static +GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count, + gsize* bytes_written, GError** err) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + return (GIOStatus) wrapper->write_vfunc(buf, count, *bytes_written); + } + catch(Glib::Error& error) + { + error.propagate(err); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return G_IO_STATUS_ERROR; +} + +// static +GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + return (GIOStatus) wrapper->seek_vfunc(offset, (SeekType) type); + } + catch(Glib::Error& error) + { + error.propagate(err); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return G_IO_STATUS_ERROR; +} + +// static +GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + return (GIOStatus) wrapper->close_vfunc(); + } + catch(Glib::Error& error) + { + error.propagate(err); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return G_IO_STATUS_ERROR; +} + +// static +GSource* GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition condition) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + const Glib::RefPtr source = wrapper->create_watch_vfunc((IOCondition) condition); + return (source) ? source->gobj_copy() : 0; + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return 0; +} + +// static +void GlibmmIOChannel::io_free(GIOChannel* channel) +{ + if(IOChannel *const wrapper = reinterpret_cast(channel)->wrapper) + { + wrapper->gobject_ = 0; + delete wrapper; + } + + g_free(channel); +} + +// static +GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + return (GIOStatus) wrapper->set_flags_vfunc((IOFlags) flags); + } + catch(Glib::Error& error) + { + error.propagate(err); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return G_IO_STATUS_ERROR; +} + +// static +GIOFlags GlibmmIOChannel::io_get_flags(GIOChannel* channel) +{ + IOChannel *const wrapper = reinterpret_cast(channel)->wrapper; + + try + { + return (GIOFlags) wrapper->get_flags_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return GIOFlags(0); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::IOChannelError::IOChannelError(Glib::IOChannelError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_IO_CHANNEL_ERROR, error_code, error_message) +{} + +Glib::IOChannelError::IOChannelError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::IOChannelError::Code Glib::IOChannelError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::IOChannelError::throw_func(GError* gobject) +{ + throw Glib::IOChannelError(gobject); +} + + +namespace Glib +{ + + +IOStatus IOChannel::read(gunichar& unichar) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_read_unichar(gobj(), &(unichar), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +IOStatus IOChannel::read(char* buf, gsize count, gsize& bytes_read) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_read_chars(gobj(), buf, count, &(bytes_read), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +IOStatus IOChannel::write(const char* buf, gssize count, gsize& bytes_written) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_write_chars(gobj(), buf, count, &(bytes_written), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +IOStatus IOChannel::write(gunichar unichar) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_write_unichar(gobj(), unichar, &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +IOStatus IOChannel::seek(gint64 offset, SeekType type) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_seek_position(gobj(), offset, ((GSeekType)(type)), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +IOStatus IOChannel::flush() +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_flush(gobj(), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +IOStatus IOChannel::close(bool flush) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_shutdown(gobj(), static_cast(flush), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +gsize IOChannel::get_buffer_size() const +{ + return g_io_channel_get_buffer_size(const_cast(gobj())); +} + +void IOChannel::set_buffer_size(gsize size) +{ + g_io_channel_set_buffer_size(gobj(), size); +} + +IOFlags IOChannel::get_flags() const +{ + return ((IOFlags)(g_io_channel_get_flags(const_cast(gobj())))); +} + +IOStatus IOChannel::set_flags(IOFlags flags) +{ + GError *error = 0; + IOStatus retvalue = ((IOStatus)(g_io_channel_set_flags(gobj(), ((GIOFlags)(flags)), &(error)))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +void IOChannel::set_buffered(bool buffered) +{ + g_io_channel_set_buffered(gobj(), static_cast(buffered)); +} + +bool IOChannel::get_buffered() const +{ + return g_io_channel_get_buffered(const_cast(gobj())); +} + +IOCondition IOChannel::get_buffer_condition() const +{ + return ((IOCondition)(g_io_channel_get_buffer_condition(const_cast(gobj())))); +} + +bool IOChannel::get_close_on_unref() const +{ + return g_io_channel_get_close_on_unref(const_cast(gobj())); +} + +void IOChannel::set_close_on_unref(bool do_close) +{ + g_io_channel_set_close_on_unref(gobj(), static_cast(do_close)); +} + + +} // namespace Glib + + diff --git a/libs/glibmm2/glibmm/iochannel.h b/libs/glibmm2/glibmm/iochannel.h new file mode 100644 index 0000000000..3d8f93b3a7 --- /dev/null +++ b/libs/glibmm2/glibmm/iochannel.h @@ -0,0 +1,695 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_IOCHANNEL_H +#define _GLIBMM_IOCHANNEL_H + + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include +#include + +#include +#include + +GLIBMM_USING_STD(string) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GIOChannel GIOChannel; } +#endif + + +namespace Glib +{ + +class Source; +class IOSource; + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** + * @ingroup glibmmEnums + */ +enum SeekType +{ + SEEK_TYPE_CUR, + SEEK_TYPE_SET, + SEEK_TYPE_END +}; + + +/** + * @ingroup glibmmEnums + */ +enum IOStatus +{ + IO_STATUS_ERROR, + IO_STATUS_NORMAL, + IO_STATUS_EOF, + IO_STATUS_AGAIN +}; + + +/** + * @ingroup glibmmEnums + * @par Bitwise operators: + * %IOFlags operator|(IOFlags, IOFlags)
+ * %IOFlags operator&(IOFlags, IOFlags)
+ * %IOFlags operator^(IOFlags, IOFlags)
+ * %IOFlags operator~(IOFlags)
+ * %IOFlags& operator|=(IOFlags&, IOFlags)
+ * %IOFlags& operator&=(IOFlags&, IOFlags)
+ * %IOFlags& operator^=(IOFlags&, IOFlags)
+ */ +enum IOFlags +{ + IO_FLAG_APPEND = 1 << 0, + IO_FLAG_NONBLOCK = 1 << 1, + IO_FLAG_IS_READABLE = 1 << 2, + IO_FLAG_IS_WRITEABLE = 1 << 3, + IO_FLAG_IS_SEEKABLE = 1 << 4, + IO_FLAG_GET_MASK = 0x0, + IO_FLAG_SET_MASK = 0x1 +}; + +/** @ingroup glibmmEnums */ +inline IOFlags operator|(IOFlags lhs, IOFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline IOFlags operator&(IOFlags lhs, IOFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline IOFlags operator^(IOFlags lhs, IOFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline IOFlags operator~(IOFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup glibmmEnums */ +inline IOFlags& operator|=(IOFlags& lhs, IOFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline IOFlags& operator&=(IOFlags& lhs, IOFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline IOFlags& operator^=(IOFlags& lhs, IOFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +/** Exception class for IOChannel errors. + */ +class IOChannelError : public Glib::Error +{ +public: + enum Code + { + FILE_TOO_BIG, + INVALID_ARGUMENT, + IO_ERROR, + IS_DIRECTORY, + NO_SPACE_LEFT, + NO_SUCH_DEVICE, + OVERFLOWN, + BROKEN_PIPE, + FAILED + }; + + IOChannelError(Code error_code, const Glib::ustring& error_message); + explicit IOChannelError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +class GlibmmIOChannel; +#endif + +/** IOChannel aims to provide portable I/O support for files, pipes + * and sockets, and to integrate them with the GLib main event loop. + * + * Note that IOChannels implement an automatic implicit character set + * conversion to the data stream, and usually will not pass by default + * binary data unchanged. To set the encoding of the channel, use e.g. + * set_encoding("ISO-8859-15"). To set the channel to no encoding, use + * set_encoding() without any arguments. + * + * You can create an IOChannel with one of the static create methods, or + * implement one yourself, in which case you have to 1) override all + * _vfunc() members. 2) set the GIOChannel flags in your constructor. + * + * @note This feature of being able to implement a custom Glib::IOChannel is + * deprecated in glibmm 2.2. The vfunc interface has not yet stabilized + * enough to allow that -- the C++ wrapper went in by pure accident. Besides, + * it isn't terribly useful either. Thus please refrain from overriding any + * IOChannel vfuncs. + */ +class IOChannel : public sigc::trackable +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef IOChannel CppObjectType; + typedef GIOChannel BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + virtual ~IOChannel(); + + /** Open a file @a filename as an I/O channel using mode @a mode. + * This channel will be closed when the last reference to it is dropped, + * so there is no need to call close() (though doing so will not cause + * problems, as long as no attempt is made to access the channel after + * it is closed). + * @param filename The name of the file to open. + * @param mode One of "r", "w", "a", + * "r+", "w+", "a+". These have the + * same meaning as in fopen(). + * @return An IOChannel for the opened file. + * @throw Glib::FileError + */ + static Glib::RefPtr create_from_file(const std::string& filename, const std::string& mode); + + + /** Creates an I/O channel from a file descriptor. + * On Unix, IOChannels created with this function work for any file + * descriptor or socket. + * + * On Win32, this can be used either for files opened with the MSVCRT (the + * Microsoft run-time C library) _open() or _pipe(), + * including file descriptors 0, 1 and 2 (corresponding to stdin, + * stdout and stderr), or for Winsock SOCKETs. If + * the parameter is a legal file descriptor, it is assumed to be such, + * otherwise it should be a SOCKET. This relies on SOCKETs + * and file descriptors not overlapping. If you want to be certain, call + * either create_from_win32_fd() or create_from_win32_socket() instead as + * appropriate. + * + * The term file descriptor as used in the context of Win32 refers to the + * emulated Unix-like file descriptors MSVCRT provides. The native + * corresponding concept is file HANDLE. There isn't as of yet + * a way to get IOChannels for Win32 file HANDLEs. + */ + static Glib::RefPtr create_from_fd(int fd); + + +/* defined(DOXYGEN_SHOULD_SKIP_THIS) actually does the opposite of what it looks like... */ +#if defined(G_OS_WIN32) || defined(DOXYGEN_SHOULD_SKIP_THIS) + + /** Create an I/O channel for C runtime (emulated Unix-like) file descriptors. + * After calling add_watch() on a I/O channel returned by this function, you + * shouldn't call read() on the file descriptor. This is because adding + * polling for a file descriptor is implemented on Win32 by starting a thread + * that sits blocked in a %read() from the file descriptor most of + * the time. All reads from the file descriptor should be done by this + * internal GLib thread. Your code should call only IOChannel::read(). + */ + static Glib::RefPtr create_from_win32_fd(int fd); + + + /** Create an I/O channel for a winsock socket. The parameter should be a + * SOCKET. Contrary to I/O channels for file descriptors (on Win32), + * you can use normal recv() or recvfrom() on sockets even + * if GLib is polling them. + */ + static Glib::RefPtr create_from_win32_socket(int socket); + + +#endif /* defined(G_OS_WIN32) || defined(DOXYGEN_SHOULD_SKIP_THIS) */ + + /** Read a single UCS-4 character. + * @retval unichar The Unicode character. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + + /** This function cannot be called on a channel with 0 encoding. + * @param thechar A location to return a character. + * @param error A location to return an error of type G::ConvertError + * or G::IOChannelError. + * @return A G::IOStatus. + */ + IOStatus read(gunichar& unichar); + + /** Read a character sequence into memory. + * @param buf A buffer to read data into. + * @param count The size of the buffer in bytes. Note that the buffer may + * not be complelely filled even if there is data in the buffer if the + * remaining data is not a complete character. + * @retval bytes_read The number of bytes read. This may be zero even on + * success if @a count < 6 and the channel's encoding is not "". + * This indicates that the next UTF-8 character is too wide for the buffer. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + + /** Replacement for g_io_channel_read() with the new API. + * @param buf A buffer to read data into. + * @param count The size of the buffer. Note that the buffer may + * not be complelely filled even if there is data + * in the buffer if the remaining data is not a + * complete character. + * @param bytes_read The number of bytes read. This may be zero even on + * success if count < 6 and the channel's encoding is non-0. + * This indicates that the next UTF-8 character is too wide for + * the buffer. + * @param error A location to return an error of type G::ConvertError + * or G::IOChannelError. + * @return The status of the operation. + */ + IOStatus read(char* buf, gsize count, gsize& bytes_read); + + /** Read a maximum of @a count bytes into @a str. + * @param count The maximum number of bytes to read. + * @retval str The characters that have been read. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + IOStatus read(Glib::ustring& str, gsize count); + + /** Read a whole line. + * Reads until the line separator is found, which is included + * in the result string. + * @retval line The line that was read. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + IOStatus read_line(Glib::ustring& line); + + + /** Reads all the remaining data from the file. + * @retval str The resulting string. + * @return Glib::IO_STATUS_NORMAL on success. This function never + * returns Glib::IO_STATUS_EOF. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + IOStatus read_to_end(Glib::ustring& str); + + + /** Write a string to the I/O channel. + * Note that this method does not return the number of characters written. + * If the channel is blocking and the returned value is + * Glib::IO_STATUS_NORMAL, the whole string was written. + * @param str the string to write. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + IOStatus write(const Glib::ustring& str); + + /** Write a memory area of @a count bytes to the I/O channel. + * @param buf The start of the memory area. + * @param count The number of bytes to write. + * @retval bytes_written The number of bytes written to the channel. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + + /** Replacement for g_io_channel_write() with the new API. + * + * On seekable channels with encodings other than 0 or UTF-8, generic + * mixing of reading and writing is not allowed. A call to g_io_channel_write_chars() + * may only be made on a channel from which data has been read in the + * cases described in the documentation for g_io_channel_set_encoding(). + * @param buf A buffer to write data from. + * @param count The size of the buffer. If -1, the buffer + * is taken to be a nul-terminated string. + * @param bytes_written The number of bytes written. This can be nonzero + * even if the return value is not G::IO_STATUS_NORMAL. + * If the return value is G::IO_STATUS_NORMAL and the + * channel is blocking, this will always be equal + * to @a count if @a count >= 0. + * @param error A location to return an error of type G::ConvertError + * or G::IOChannelError. + * @return The status of the operation. + */ + IOStatus write(const char* buf, gssize count, gsize& bytes_written); + + /** Write a single UCS-4 character to the I/O channel. + * @param unichar The character to write. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + + /** This function cannot be called on a channel with 0 encoding. + * @param thechar A character. + * @param error A location to return an error of type G::ConvertError + * or G::IOChannelError. + * @return A G::IOStatus. + */ + IOStatus write(gunichar unichar); + + /** Seek the I/O channel to a specific position. + * @param offset The offset in bytes from the position specified by @a type. + * @param type A SeekType. The type Glib::SEEK_TYPE_CUR is only allowed in + * those cases where a call to set_encoding() is allowed. See the + * documentation for set_encoding() for details. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + + /** Replacement for g_io_channel_seek() with the new API. + * @param offset The offset in bytes from the position specified by @a type . + * @param type A G::SeekType. The type G::SEEK_CUR is only allowed in those + * cases where a call to g_io_channel_set_encoding() + * is allowed. See the documentation for + * g_io_channel_set_encoding() for details. + * @param error A location to return an error of type G::IOChannelError. + * @return The status of the operation. + */ + IOStatus seek(gint64 offset, SeekType type = SEEK_TYPE_SET); + + /** Flush the buffers of the I/O channel. + * @return The status of the operation. + * @throw Glib::IOChannelError + * @throw Glib::ConvertError + */ + + /** Flushes the write buffer for the GIOChannel. + * @param error Location to store an error of type G::IOChannelError. + * @return The status of the operation: One of + * G::IO_CHANNEL_NORMAL, G::IO_CHANNEL_AGAIN, or + * G::IO_CHANNEL_ERROR. + */ + IOStatus flush(); + + /** Close the I/O channel. + * Any pending data to be written will be flushed if @a flush is true. + * The channel will not be freed until the last reference is dropped. + * Accessing the channel after closing it is considered an error. + * @param flush Whether to flush() pending data before closing the channel. + * @return The status of the operation. + * @throw Glib::IOChannelError + */ + + /** Close an IO channel. Any pending data to be written will be + * flushed if @a flush is true. The channel will not be freed until the + * last reference is dropped using g_io_channel_unref(). + * @param flush If true, flush pending. + * @param err Location to store a G::IOChannelError. + * @return The status of the operation. + */ + IOStatus close(bool flush = true); + + /** Get the IOChannel internal buffer size. + * @return The buffer size. + */ + + /** Gets the buffer size. + * @return The size of the buffer. + */ + gsize get_buffer_size() const; + + /** Set the internal IOChannel buffer size. + * @param size The buffer size the IOChannel should use. + */ + + /** Sets the buffer size. + * @param size The size of the buffer. 0 == pick a good size. + */ + void set_buffer_size(gsize size); + + /** Get the current flags for a IOChannel, including read-only + * flags such as Glib::IO_FLAG_IS_READABLE. + * + * The values of the flags Glib::IO_FLAG_IS_READABLE and + * Glib::IO_FLAG_IS_WRITEABLE are cached for internal use by the channel when + * it is created. If they should change at some later point (e.g. partial + * shutdown of a socket with the UNIX shutdown() function), the user + * should immediately call get_flags() to update the internal values of these + * flags. + * @return Bitwise combination of the flags set on the channel. + */ + + /** Gets the current flags for a G::IOChannel, including read-only + * flags such as G::IO_FLAG_IS_READABLE. + * + * The values of the flags G::IO_FLAG_IS_READABLE and G::IO_FLAG_IS_WRITEABLE + * are cached for internal use by the channel when it is created. + * If they should change at some later point (e.g. partial shutdown + * of a socket with the UNIX shutdown() function), the user + * should immediately call g_io_channel_get_flags() to update + * the internal values of these flags. + * @return The flags which are set on the channel. + */ + IOFlags get_flags() const; + + /** Set flags on the IOChannel. + * @param flags Bitwise combination of the flags to set. + * @return The operation result code. + * @throw Glib::IOChannelError + */ + + /** Sets the (writeable) flags in @a channel to ( @a flags & G::IO_CHANNEL_SET_MASK). + * @param flags The flags to set on the IO channel. + * @param error A location to return an error of type G::IOChannelError. + * @return The status of the operation. + */ + IOStatus set_flags(IOFlags flags); + + /** Set the buffering status of the I/O channel. + * The buffering state can only be set if the channel's encoding is + * "". For any other encoding, the channel must be buffered. + * + * A buffered channel can only be set unbuffered if the channel's internal + * buffers have been flushed. Newly created channels or channels which have + * returned Glib::IO_STATUS_EOF not require such a flush. For write-only + * channels, a call to flush() is sufficient. For all other channels, the + * buffers may be flushed by a call to seek(). This includes the possibility + * of seeking with seek type Glib::SEEK_TYPE_CUR and an offset of zero. Note + * that this means that socket-based channels cannot be set unbuffered once + * they have had data read from them. + * + * The default state of the channel is buffered. + * + * @param buffered Whether to set the channel buffered or unbuffered. + */ + + /** The buffering state can only be set if the channel's encoding + * is 0. For any other encoding, the channel must be buffered. + * + * A buffered channel can only be set unbuffered if the channel's + * internal buffers have been flushed. Newly created channels or + * channels which have returned G::IO_STATUS_EOF + * not require such a flush. For write-only channels, a call to + * g_io_channel_flush() is sufficient. For all other channels, + * the buffers may be flushed by a call to g_io_channel_seek_position(). + * This includes the possibility of seeking with seek type G::SEEK_CUR + * and an offset of zero. Note that this means that socket-based + * channels cannot be set unbuffered once they have had data + * read from them. + * + * On unbuffered channels, it is safe to mix read and write + * calls from the new and old APIs, if this is necessary for + * maintaining old code. + * + * The default state of the channel is buffered. + * @param buffered Whether to set the channel buffered or unbuffered. + */ + void set_buffered(bool buffered); + + /** Get the buffering status of the I/O channel. + * @return The buffering status of the channel. + */ + + /** Returns whether @a channel is buffered. + * @return true if the @a channel is buffered. + */ + bool get_buffered() const; + + /** Returns an IOCondition depending on whether there is data to be + * read/space to write data in the internal buffers in the I/O channel. + * Only the flags Glib::IO_IN and Glib::IO_OUT may be set. + * @return Bitwise combination of Glib::IOCondition flags. + */ + + /** This function returns a G::IOCondition depending on whether there + * is data to be read/space to write data in the + * internal buffers in the G::IOChannel. Only the flags G::IO_IN and + * G::IO_OUT may be set. + * @return A G::IOCondition. + */ + IOCondition get_buffer_condition() const; + + /** Returns whether the file/socket/whatever associated with the I/O channel + * will be closed when the channel receives its final unref and is destroyed. + * The default value of this is true for channels created by + * create_from_file(), and false for all other channels. + * @return Whether the channel will be closed on the final unref of the + * IOChannel object. + */ + + /** Returns whether the file/socket/whatever associated with @a channel + * will be closed when @a channel receives its final unref and is + * destroyed. The default value of this is true for channels created + * by g_io_channel_new_file(), and false for all other channels. + * @return Whether the channel will be closed on the final unref of + * the GIOChannel data structure. + */ + bool get_close_on_unref() const; + + /** Setting this flag to true for a channel you have already closed + * can cause problems. + * @param do_close Whether to close the channel on the final unref of the + * IOChannel object. The default value of this is true for channels + * created by create_from_file(), and false for all other channels. + */ + + /** Setting this flag to true for a channel you have already closed + * can cause problems. + * @param do_close Whether to close the channel on the final unref of + * the GIOChannel data structure. The default value of + * this is true for channels created by g_io_channel_new_file(), + * and false for all other channels. + */ + void set_close_on_unref(bool do_close); + + /** Sets the encoding for the input/output of the channel. + * The internal encoding is always UTF-8. The default encoding for the + * external file is UTF-8. The encoding "" is safe to use with + * binary data. + * + * The encoding can only be set if one of the following conditions + * is true: + * + * -# The channel was just created, and has not been written to or read from + * yet. + * -# The channel is write-only. + * -# The channel is a file, and the file pointer was just repositioned by a + * call to seek_position(). (This flushes all the internal buffers.) + * -# The current encoding is "" or UTF-8. + * -# One of the read methods has just returned Glib::IO_STATUS_EOF (or, in + * the case of read_to_end(), Glib::IO_STATUS_NORMAL). + * -# The read() method has returned Glib::IO_STATUS_AGAIN or thrown + * a Glib::Error exception. This may be useful in the case of + * ConvertError::ILLEGAL_SEQUENCE. Returning one of these statuses + * from read_line() or read_to_end() does not guarantee that + * the encoding can be changed. + * + * Channels which do not meet one of the above conditions cannot call + * seek_position() with a seek type of Glib::SEEK_TYPE_CUR and, if they + * are "seekable", cannot call write() after calling one of the API + * "read" methods. + * + * @param encoding The encoding name, or "" for binary. + * @return Glib::IO_STATUS_NORMAL if the encoding was successfully set. + * @throw Glib::IOChannelError + */ + IOStatus set_encoding(const std::string& encoding = std::string()); + + + /** Get the encoding of the I/O channel. + * @return The current encoding of the channel. + */ + std::string get_encoding() const; + + + void set_line_term(const std::string& term = std::string()); + + + std::string get_line_term() const; + + + /** Creates an IOSource object. + * Create a slot from a function to be called when condition is met + * for the channel with sigc::ptr_fun() or sigc::mem_fun() and pass + * it into the connect() function of the returned IOSource object. + * Polling of the channel will start when you attach a MainContext + * object to the returned IOSource object using its attach() function. + * + * Glib::signal_io().connect() is a simpler interface to the same + * functionality, for the case where you want to add the source to the + * default main context. + * @param condition The condition to watch for. + * @return An IOSource object that can be polled from a MainContext's event loop. + */ + Glib::RefPtr create_watch(IOCondition condition); + + + virtual void reference() const; + virtual void unreference() const; + + + GIOChannel* gobj() { return gobject_; } + const GIOChannel* gobj() const { return gobject_; } + +protected: + GIOChannel* gobject_; + + /** Constructor that should be used by derived classes. + * Use this constructor if you want to inherit from IOChannel. + * It will set up a GIOChannel that will call the vfuncs of your + * class even if it is being used from C code, and it will keep + * a reference to the C++ code while the GIOChannel exists. + */ + IOChannel(); + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + IOChannel(GIOChannel* gobject, bool take_copy); +#endif + + virtual IOStatus read_vfunc(char* buf, gsize count, gsize& bytes_read); + virtual IOStatus write_vfunc(const char* buf, gsize count, gsize& bytes_written); + virtual IOStatus seek_vfunc(gint64 offset, SeekType type); + virtual IOStatus close_vfunc(); + virtual IOStatus set_flags_vfunc(IOFlags flags); + virtual IOFlags get_flags_vfunc(); + virtual Glib::RefPtr create_watch_vfunc(IOCondition cond); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + friend class Glib::GlibmmIOChannel; +#endif + + +}; + +Glib::RefPtr wrap(GIOChannel* gobject, bool take_copy = false); + +} // namespace Glib + + +#endif /* _GLIBMM_IOCHANNEL_H */ + diff --git a/libs/glibmm2/glibmm/listhandle.h b/libs/glibmm2/glibmm/listhandle.h new file mode 100644 index 0000000000..94b366d91b --- /dev/null +++ b/libs/glibmm2/glibmm/listhandle.h @@ -0,0 +1,406 @@ +// -*- c++ -*- +#ifndef _GLIBMM_LISTHANDLE_H +#define _GLIBMM_LISTHANDLE_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +namespace Container_Helpers +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/* Create and fill a GList as efficient as possible. + * This requires bidirectional iterators. + */ +template +GList* create_list(Bi pbegin, Bi pend, Tr) +{ + GList* head = 0; + + while(pend != pbegin) + { + // Use & to force a warning if the iterator returns a temporary object. + const void *const item = Tr::to_c_type(*&*--pend); + head = g_list_prepend(head, const_cast(item)); + } + + return head; +} + +/* Create a GList from a 0-terminated input sequence. + * Build it in reverse order and reverse the whole list afterwards, + * because appending to the list would be horribly inefficient. + */ +template +GList* create_list(For pbegin, Tr) +{ + GList* head = 0; + + while(*pbegin) + { + // Use & to force a warning if the iterator returns a temporary object. + const void *const item = Tr::to_c_type(*&*pbegin); + head = g_list_prepend(head, const_cast(item)); + ++pbegin; + } + + return g_list_reverse(head); +} + + +/* Convert from any container that supports bidirectional iterators. + */ +template +struct ListSourceTraits +{ + static GList* get_data(const Cont& cont) + { return Glib::Container_Helpers::create_list(cont.begin(), cont.end(), Tr()); } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +/* Convert from a 0-terminated array. The Cont + * argument must be a pointer to the first element. + */ +template +struct ListSourceTraits +{ + static GList* get_data(const Cont* array) + { return (array) ? Glib::Container_Helpers::create_list(array, Tr()) : 0; } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +template +struct ListSourceTraits : ListSourceTraits +{}; + +/* Convert from a 0-terminated array. The Cont argument must be a pointer + * to the first element. For consistency, the array must be 0-terminated, + * even though the array size is known at compile time. + */ +template +struct ListSourceTraits +{ + static GList* get_data(const Cont* array) + { return Glib::Container_Helpers::create_list(array, array + (N - 1), Tr()); } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +template +struct ListSourceTraits : ListSourceTraits +{}; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** + * @ingroup ContHelpers + * If a method takes this as an argument, or has this as a return type, then you can use a standard + * container such as std::list or std::vector. + */ +template +class ListHandleIterator +{ +public: + typedef typename Tr::CppType CppType; + typedef typename Tr::CType CType; + + typedef std::forward_iterator_tag iterator_category; + typedef CppType value_type; + typedef ptrdiff_t difference_type; + typedef value_type reference; + typedef void pointer; + + explicit inline ListHandleIterator(const GList* node); + + inline value_type operator*() const; + inline ListHandleIterator & operator++(); + inline const ListHandleIterator operator++(int); + + inline bool operator==(const ListHandleIterator& rhs) const; + inline bool operator!=(const ListHandleIterator& rhs) const; + +private: + const GList* node_; +}; + +} // namespace Container_Helpers + + +/** + * @ingroup ContHandles + */ +template < class T, class Tr = Glib::Container_Helpers::TypeTraits > +class ListHandle +{ +public: + typedef typename Tr::CppType CppType; + typedef typename Tr::CType CType; + + typedef CppType value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef Glib::Container_Helpers::ListHandleIterator const_iterator; + typedef Glib::Container_Helpers::ListHandleIterator iterator; + + template inline + ListHandle(const Cont& container); + + // Take over ownership of an array created by GTK+ functions. + inline ListHandle(GList* glist, Glib::OwnershipType ownership); + + // Copying clears the ownership flag of the source handle. + inline ListHandle(const ListHandle& other); + + ~ListHandle(); + + inline const_iterator begin() const; + inline const_iterator end() const; + + template inline operator std::vector() const; + template inline operator std::deque() const; + template inline operator std::list() const; + + template inline + void assign_to(Cont& container) const; + + template inline + void copy(Out pdest) const; + + inline GList* data() const; + inline size_t size() const; + inline bool empty() const; + +private: + GList * plist_; + mutable Glib::OwnershipType ownership_; + + // No copy assignment. + ListHandle& operator=(const ListHandle&); +}; + + +/***************************************************************************/ +/* Inline implementation */ +/***************************************************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +namespace Container_Helpers +{ + +/**** Glib::Container_Helpers::ListHandleIterator<> ************************/ + +template inline +ListHandleIterator::ListHandleIterator(const GList* node) +: + node_ (node) +{} + +template inline +typename ListHandleIterator::value_type ListHandleIterator::operator*() const +{ + return Tr::to_cpp_type(static_cast(node_->data)); +} + +template inline +ListHandleIterator& ListHandleIterator::operator++() +{ + node_ = node_->next; + return *this; +} + +template inline +const ListHandleIterator ListHandleIterator::operator++(int) +{ + const ListHandleIterator tmp (*this); + node_ = node_->next; + return tmp; +} + +template inline +bool ListHandleIterator::operator==(const ListHandleIterator& rhs) const +{ + return (node_ == rhs.node_); +} + +template inline +bool ListHandleIterator::operator!=(const ListHandleIterator& rhs) const +{ + return (node_ != rhs.node_); +} + +} // namespace Container_Helpers + + +/**** Glib::ListHandle<> ***************************************************/ + +template + template +inline +ListHandle::ListHandle(const Cont& container) +: + plist_ (Glib::Container_Helpers::ListSourceTraits::get_data(container)), + ownership_ (Glib::Container_Helpers::ListSourceTraits::initial_ownership) +{} + +template inline +ListHandle::ListHandle(GList* glist, Glib::OwnershipType ownership) +: + plist_ (glist), + ownership_ (ownership) +{} + +template inline +ListHandle::ListHandle(const ListHandle& other) +: + plist_ (other.plist_), + ownership_ (other.ownership_) +{ + other.ownership_ = Glib::OWNERSHIP_NONE; +} + +template +ListHandle::~ListHandle() +{ + if(ownership_ != Glib::OWNERSHIP_NONE) + { + if(ownership_ != Glib::OWNERSHIP_SHALLOW) + { + // Deep ownership: release each container element. + for(GList* node = plist_; node != 0; node = node->next) + Tr::release_c_type(static_cast(node->data)); + } + g_list_free(plist_); + } +} + +template inline +typename ListHandle::const_iterator ListHandle::begin() const +{ + return Glib::Container_Helpers::ListHandleIterator(plist_); +} + +template inline +typename ListHandle::const_iterator ListHandle::end() const +{ + return Glib::Container_Helpers::ListHandleIterator(0); +} + +template + template +inline +ListHandle::operator std::vector() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::vector(this->begin(), this->end()); +#else + std::vector temp; + temp.reserve(this->size()); + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +ListHandle::operator std::deque() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::deque(this->begin(), this->end()); +#else + std::deque temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +ListHandle::operator std::list() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::list(this->begin(), this->end()); +#else + std::list temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +void ListHandle::assign_to(Cont& container) const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + container.assign(this->begin(), this->end()); +#else + Cont temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + container.swap(temp); +#endif +} + +template + template +inline +void ListHandle::copy(Out pdest) const +{ + std::copy(this->begin(), this->end(), pdest); +} + +template inline +GList* ListHandle::data() const +{ + return plist_; +} + +template inline +size_t ListHandle::size() const +{ + return g_list_length(plist_); +} + +template inline +bool ListHandle::empty() const +{ + return (plist_ == 0); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_LISTHANDLE_H */ + diff --git a/libs/glibmm2/glibmm/main.cc b/libs/glibmm2/glibmm/main.cc new file mode 100644 index 0000000000..45e1e0d684 --- /dev/null +++ b/libs/glibmm2/glibmm/main.cc @@ -0,0 +1,986 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +#include +#include + +GLIBMM_USING_STD(min) + + +namespace +{ + +class SourceConnectionNode +{ +public: + explicit inline SourceConnectionNode(const sigc::slot_base& slot); + + static void* notify(void* data); + static void destroy_notify_callback(void* data); + + inline void install(GSource* source); + inline sigc::slot_base* get_slot(); + +private: + sigc::slot_base slot_; + GSource* source_; +}; + +inline +SourceConnectionNode::SourceConnectionNode(const sigc::slot_base& slot) +: + slot_ (slot), + source_ (0) +{ + slot_.set_parent(this, &SourceConnectionNode::notify); +} + +void* SourceConnectionNode::notify(void* data) +{ + SourceConnectionNode *const self = static_cast(data); + + // if there is no object, this call was triggered from destroy_notify_handler(), + // because we set self->source_ to 0 there: + if (self->source_) + { + GSource* s = self->source_; + self->source_ = 0; + g_source_destroy(s); + + // Destroying the object triggers execution of destroy_notify_handler(), + // eiter immediately or later, so we leave that to do the deletion. + } + + return 0; +} + +// static +void SourceConnectionNode::destroy_notify_callback(void* data) +{ + SourceConnectionNode *const self = static_cast(data); + + if (self) + { + // The GLib side is disconnected now, thus the GSource* is no longer valid. + self->source_ = 0; + + delete self; + } +} + +inline +void SourceConnectionNode::install(GSource* source) +{ + source_ = source; +} + +inline +sigc::slot_base* SourceConnectionNode::get_slot() +{ + return &slot_; +} + + +/* We use the callback data member of GSource to store both a pointer to our + * wrapper and a pointer to the connection node that is currently being used. + * The one and only SourceCallbackData object of a Glib::Source is constructed + * in the ctor of Glib::Source and destroyed after the GSource object when the + * reference counter of the GSource object reaches zero! + */ +struct SourceCallbackData +{ + explicit inline SourceCallbackData(Glib::Source* wrapper_); + + void set_node(SourceConnectionNode* node_); + + static void destroy_notify_callback(void* data); + + Glib::Source* wrapper; + SourceConnectionNode* node; +}; + +inline +SourceCallbackData::SourceCallbackData(Glib::Source* wrapper_) +: + wrapper (wrapper_), + node (0) +{} + +void SourceCallbackData::set_node(SourceConnectionNode* node_) +{ + if(node) + SourceConnectionNode::destroy_notify_callback(node); + + node = node_; +} + +// static +void SourceCallbackData::destroy_notify_callback(void* data) +{ + SourceCallbackData *const self = static_cast(data); + + if(self->node) + SourceConnectionNode::destroy_notify_callback(self->node); + + if(self->wrapper) + Glib::Source::destroy_notify_callback(self->wrapper); + + delete self; +} + + +/* Retrieve the callback data from a wrapped GSource object. + */ +static SourceCallbackData* glibmm_source_get_callback_data(GSource* source) +{ + g_return_val_if_fail(source->callback_funcs->get != 0, 0); + + GSourceFunc func; + void* user_data = 0; + + // Retrieve the callback function and data. + (*source->callback_funcs->get)(source->callback_data, source, &func, &user_data); + + return static_cast(user_data); +} + +/* Glib::Source doesn't use the callback function installed with + * g_source_set_callback(). Instead, it invokes the sigc++ slot + * directly from dispatch_vfunc(), which is both simpler and more + * efficient. + * For correctness, provide a pointer to this dummy callback rather + * than some random pointer. That also allows for sanity checks + * here as well as in Source::dispatch_vfunc(). + */ +static gboolean glibmm_dummy_source_callback(void*) +{ + g_assert_not_reached(); + return 0; +} + +/* Only used by SignalTimeout::connect() and SignalIdle::connect(). + * These don't use Glib::Source, to avoid the unnecessary overhead + * of a completely unused wrapper object. + */ +static gboolean glibmm_source_callback(void* data) +{ + SourceConnectionNode *const conn_data = static_cast(data); + + try + { + // Recreate the specific slot from the generic slot node. + return (*static_cast*>(conn_data->get_slot()))(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + return 0; +} + +static gboolean glibmm_iosource_callback(GIOChannel*, GIOCondition condition, void* data) +{ + SourceCallbackData *const callback_data = static_cast(data); + g_return_val_if_fail(callback_data->node != 0, 0); + + try + { + // Recreate the specific slot from the generic slot node. + return (*static_cast*>(callback_data->node->get_slot())) + ((Glib::IOCondition) condition); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + return 0; +} + +} // anonymous namespace + + +namespace Glib +{ + +/**** Glib::PollFD *********************************************************/ + +PollFD::PollFD() +{ + gobject_.fd = 0; + gobject_.events = 0; + gobject_.revents = 0; +} + +PollFD::PollFD(int fd) +{ + gobject_.fd = fd; + gobject_.events = 0; + gobject_.revents = 0; +} + +PollFD::PollFD(int fd, IOCondition events) +{ + gobject_.fd = fd; + gobject_.events = events; + gobject_.revents = 0; +} + + +/**** Glib::SignalTimeout **************************************************/ + +inline +SignalTimeout::SignalTimeout(GMainContext* context) +: + context_ (context) +{} + +sigc::connection SignalTimeout::connect(const sigc::slot& slot, + unsigned int interval, int priority) +{ + SourceConnectionNode *const conn_node = new SourceConnectionNode(slot); + const sigc::connection connection (*conn_node->get_slot()); + + GSource *const source = g_timeout_source_new(interval); + + if(priority != G_PRIORITY_DEFAULT) + g_source_set_priority(source, priority); + + g_source_set_callback( + source, &glibmm_source_callback, conn_node, + &SourceConnectionNode::destroy_notify_callback); + + g_source_attach(source, context_); + g_source_unref(source); // GMainContext holds a reference + + conn_node->install(source); + return connection; +} + +SignalTimeout signal_timeout() +{ + return SignalTimeout(0); // 0 means default context +} + + +/**** Glib::SignalIdle *****************************************************/ + +inline +SignalIdle::SignalIdle(GMainContext* context) +: + context_ (context) +{} + +sigc::connection SignalIdle::connect(const sigc::slot& slot, int priority) +{ + SourceConnectionNode *const conn_node = new SourceConnectionNode(slot); + const sigc::connection connection (*conn_node->get_slot()); + + GSource *const source = g_idle_source_new(); + + if(priority != G_PRIORITY_DEFAULT) + g_source_set_priority(source, priority); + + g_source_set_callback( + source, &glibmm_source_callback, conn_node, + &SourceConnectionNode::destroy_notify_callback); + + g_source_attach(source, context_); + g_source_unref(source); // GMainContext holds a reference + + conn_node->install(source); + return connection; +} + +SignalIdle signal_idle() +{ + return SignalIdle(0); // 0 means default context +} + + +/**** Glib::SignalIO *******************************************************/ + +inline +SignalIO::SignalIO(GMainContext* context) +: + context_ (context) +{} + +sigc::connection SignalIO::connect(const sigc::slot& slot, + int fd, IOCondition condition, int priority) +{ + const Glib::RefPtr source = IOSource::create(fd, condition); + + if(priority != G_PRIORITY_DEFAULT) + source->set_priority(priority); + + const sigc::connection connection = source->connect(slot); + + g_source_attach(source->gobj(), context_); + + return connection; +} + +sigc::connection SignalIO::connect(const sigc::slot& slot, + const Glib::RefPtr& channel, + IOCondition condition, int priority) +{ + const Glib::RefPtr source = IOSource::create(channel, condition); + + if(priority != G_PRIORITY_DEFAULT) + source->set_priority(priority); + + const sigc::connection connection = source->connect(slot); + + g_source_attach(source->gobj(), context_); + + return connection; +} + +SignalIO signal_io() +{ + return SignalIO(0); // 0 means default context +} + + +/**** Glib::MainContext ****************************************************/ + +// static +Glib::RefPtr MainContext::create() +{ + return Glib::RefPtr(reinterpret_cast(g_main_context_new())); +} + +// static +Glib::RefPtr MainContext::get_default() +{ + return Glib::wrap(g_main_context_default(), true); +} + +bool MainContext::iteration(bool may_block) +{ + return g_main_context_iteration(gobj(), may_block); +} + +bool MainContext::pending() +{ + return g_main_context_pending(gobj()); +} + +void MainContext::wakeup() +{ + g_main_context_wakeup(gobj()); +} + +bool MainContext::acquire() +{ + return g_main_context_acquire(gobj()); +} + +bool MainContext::wait(Glib::Cond& cond, Glib::Mutex& mutex) +{ + return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj()); +} + +void MainContext::release() +{ + g_main_context_release(gobj()); +} + +bool MainContext::prepare(int& priority) +{ + return g_main_context_prepare(gobj(), &priority); +} + +bool MainContext::prepare() +{ + return g_main_context_prepare(gobj(), 0); +} + +void MainContext::query(int max_priority, int& timeout, std::vector& fds) +{ + if(fds.empty()) + fds.resize(8); // rather bogus number, but better than 0 + + for(;;) + { + const int size_before = fds.size(); + const int size_needed = g_main_context_query( + gobj(), max_priority, &timeout, reinterpret_cast(&fds.front()), size_before); + + fds.resize(size_needed); + + if(size_needed <= size_before) + break; + } +} + +bool MainContext::check(int max_priority, std::vector& fds) +{ + if(!fds.empty()) + return g_main_context_check(gobj(), max_priority, reinterpret_cast(&fds.front()), fds.size()); + else + return false; +} + +void MainContext::dispatch() +{ + g_main_context_dispatch(gobj()); +} + +void MainContext::set_poll_func(GPollFunc poll_func) +{ + g_main_context_set_poll_func(gobj(), poll_func); +} + +GPollFunc MainContext::get_poll_func() +{ + return g_main_context_get_poll_func(gobj()); +} + +void MainContext::add_poll(PollFD& fd, int priority) +{ + g_main_context_add_poll(gobj(), fd.gobj(), priority); +} + +void MainContext::remove_poll(PollFD& fd) +{ + g_main_context_remove_poll(gobj(), fd.gobj()); +} + +SignalTimeout MainContext::signal_timeout() +{ + return SignalTimeout(gobj()); +} + +SignalIdle MainContext::signal_idle() +{ + return SignalIdle(gobj()); +} + +SignalIO MainContext::signal_io() +{ + return SignalIO(gobj()); +} + +void MainContext::reference() const +{ + g_main_context_ref(reinterpret_cast(const_cast(this))); +} + +void MainContext::unreference() const +{ + g_main_context_unref(reinterpret_cast(const_cast(this))); +} + +GMainContext* MainContext::gobj() +{ + return reinterpret_cast(this); +} + +const GMainContext* MainContext::gobj() const +{ + return reinterpret_cast(this); +} + +GMainContext* MainContext::gobj_copy() const +{ + reference(); + return const_cast(gobj()); +} + +Glib::RefPtr wrap(GMainContext* gobject, bool take_copy) +{ + if(take_copy && gobject) + g_main_context_ref(gobject); + + return Glib::RefPtr(reinterpret_cast(gobject)); +} + + +/**** Glib::MainLoop *******************************************************/ + +Glib::RefPtr MainLoop::create(bool is_running) +{ + return Glib::RefPtr( + reinterpret_cast(g_main_loop_new(0, is_running))); +} + +Glib::RefPtr MainLoop::create(const Glib::RefPtr& context, bool is_running) +{ + return Glib::RefPtr( + reinterpret_cast(g_main_loop_new(Glib::unwrap(context), is_running))); +} + +void MainLoop::run() +{ + g_main_loop_run(gobj()); +} + +void MainLoop::quit() +{ + g_main_loop_quit(gobj()); +} + +bool MainLoop::is_running() +{ + return g_main_loop_is_running(gobj()); +} + +Glib::RefPtr MainLoop::get_context() +{ + return Glib::wrap(g_main_loop_get_context(gobj()), true); +} + +//static: +int MainLoop::depth() +{ + return g_main_depth(); +} + +void MainLoop::reference() const +{ + g_main_loop_ref(reinterpret_cast(const_cast(this))); +} + +void MainLoop::unreference() const +{ + g_main_loop_unref(reinterpret_cast(const_cast(this))); +} + +GMainLoop* MainLoop::gobj() +{ + return reinterpret_cast(this); +} + +const GMainLoop* MainLoop::gobj() const +{ + return reinterpret_cast(this); +} + +GMainLoop* MainLoop::gobj_copy() const +{ + reference(); + return const_cast(gobj()); +} + +Glib::RefPtr wrap(GMainLoop* gobject, bool take_copy) +{ + if(take_copy && gobject) + g_main_loop_ref(gobject); + + return Glib::RefPtr(reinterpret_cast(gobject)); +} + + +/**** Glib::Source *********************************************************/ + +// static +const GSourceFuncs Source::vfunc_table_ = +{ + &Source::prepare_vfunc, + &Source::check_vfunc, + &Source::dispatch_vfunc, + 0, // finalize_vfunc // We can't use finalize_vfunc because there is no way + // to store a pointer to our wrapper anywhere in GSource so + // that it persists until finalize_vfunc would be called from here. + 0, // closure_callback + 0, // closure_marshal +}; + +unsigned int Source::attach(const Glib::RefPtr& context) +{ + return g_source_attach(gobject_, Glib::unwrap(context)); +} + +unsigned int Source::attach() +{ + return g_source_attach(gobject_, 0); +} + +void Source::destroy() +{ + g_source_destroy(gobject_); +} + +void Source::set_priority(int priority) +{ + g_source_set_priority(gobject_, priority); +} + +int Source::get_priority() const +{ + return g_source_get_priority(gobject_); +} + +void Source::set_can_recurse(bool can_recurse) +{ + g_source_set_can_recurse(gobject_, can_recurse); +} + +bool Source::get_can_recurse() const +{ + return g_source_get_can_recurse(gobject_); +} + +unsigned int Source::get_id() const +{ + return g_source_get_id(gobject_); +} + +Glib::RefPtr Source::get_context() +{ + return Glib::wrap(g_source_get_context(gobject_), true); +} + +GSource* Source::gobj_copy() const +{ + return g_source_ref(gobject_); +} + +void Source::reference() const +{ + g_source_ref(gobject_); +} + +void Source::unreference() const +{ + g_source_unref(gobject_); +} + +Source::Source() +: + gobject_ (g_source_new(const_cast(&vfunc_table_), sizeof(GSource))) +{ + g_source_set_callback( + gobject_, &glibmm_dummy_source_callback, + new SourceCallbackData(this), // our persistant callback data object + &SourceCallbackData::destroy_notify_callback); +} + +Source::Source(GSource* cast_item, GSourceFunc callback_func) +: + gobject_ (cast_item) +{ + g_source_set_callback( + gobject_, callback_func, + new SourceCallbackData(this), // our persistant callback data object + &SourceCallbackData::destroy_notify_callback); +} + +Source::~Source() +{ + // The dtor should be invoked by destroy_notify_callback() only, which clears + // gobject_ before deleting. However, we might also get to this point if + // a derived ctor threw an exception, and then we need to unref manually. + + if(gobject_) + { + SourceCallbackData *const data = glibmm_source_get_callback_data(gobject_); + data->wrapper = 0; + + GSource *const tmp_gobject = gobject_; + gobject_ = 0; + + g_source_unref(tmp_gobject); + } +} + +sigc::connection Source::connect_generic(const sigc::slot_base& slot) +{ + SourceConnectionNode *const conn_node = new SourceConnectionNode(slot); + const sigc::connection connection (*conn_node->get_slot()); + + // Don't override the callback data. Reuse the existing one + // calling SourceCallbackData::set_node() to register conn_node. + SourceCallbackData *const data = glibmm_source_get_callback_data(gobject_); + data->set_node(conn_node); + + conn_node->install(gobject_); + return connection; +} + +void Source::add_poll(Glib::PollFD& poll_fd) +{ + g_source_add_poll(gobject_, poll_fd.gobj()); +} + +void Source::remove_poll(Glib::PollFD& poll_fd) +{ + g_source_remove_poll(gobject_, poll_fd.gobj()); +} + +void Source::get_current_time(Glib::TimeVal& current_time) +{ + g_source_get_current_time(gobject_, ¤t_time); +} + +inline // static +Source* Source::get_wrapper(GSource* source) +{ + SourceCallbackData *const data = glibmm_source_get_callback_data(source); + return data->wrapper; +} + +// static +gboolean Source::prepare_vfunc(GSource* source, int* timeout) +{ + try + { + Source *const self = get_wrapper(source); + return self->prepare(*timeout); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + return 0; +} + +// static +gboolean Source::check_vfunc(GSource* source) +{ + try + { + Source *const self = get_wrapper(source); + return self->check(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + return 0; +} + +// static +gboolean Source::dispatch_vfunc(GSource*, GSourceFunc callback, void* user_data) +{ + SourceCallbackData *const callback_data = static_cast(user_data); + + g_return_val_if_fail(callback == &glibmm_dummy_source_callback, 0); + g_return_val_if_fail(callback_data != 0 && callback_data->node != 0, 0); + + try + { + Source *const self = callback_data->wrapper; + return self->dispatch(callback_data->node->get_slot()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + return 0; +} + +// static +void Source::destroy_notify_callback(void* data) +{ + if(data) + { + Source *const self = static_cast(data); + + // gobject_ is already invalid at this point. + self->gobject_ = 0; + + // No exception checking: if the dtor throws, you're out of luck anyway. + delete self; + } +} + + +/**** Glib::TimeoutSource **************************************************/ + +// static +Glib::RefPtr TimeoutSource::create(unsigned int interval) +{ + return Glib::RefPtr(new TimeoutSource(interval)); +} + +sigc::connection TimeoutSource::connect(const sigc::slot& slot) +{ + return connect_generic(slot); +} + +TimeoutSource::TimeoutSource(unsigned int interval) +: + interval_ (interval) +{ + expiration_.assign_current_time(); + expiration_.add_milliseconds(std::min(G_MAXLONG, interval_)); +} + +TimeoutSource::~TimeoutSource() +{} + +bool TimeoutSource::prepare(int& timeout) +{ + Glib::TimeVal current_time; + get_current_time(current_time); + + Glib::TimeVal remaining = expiration_; + remaining.subtract(current_time); + + if(remaining.negative()) + { + // Already expired. + timeout = 0; + } + else + { + const unsigned long milliseconds = + static_cast(remaining.tv_sec) * 1000U + + static_cast(remaining.tv_usec) / 1000U; + + // Set remaining milliseconds. + timeout = std::min(G_MAXINT, milliseconds); + + // Check if the system time has been set backwards. (remaining > interval) + remaining.add_milliseconds(- std::min(G_MAXLONG, interval_) - 1); + if(!remaining.negative()) + { + // Oh well. Reset the expiration time to now + interval; + // this at least avoids hanging for long periods of time. + expiration_ = current_time; + expiration_.add_milliseconds(interval_); + timeout = std::min(G_MAXINT, interval_); + } + } + + return (timeout == 0); +} + +bool TimeoutSource::check() +{ + Glib::TimeVal current_time; + get_current_time(current_time); + + return (expiration_ <= current_time); +} + +bool TimeoutSource::dispatch(sigc::slot_base* slot) +{ + const bool again = (*static_cast*>(slot))(); + + if(again) + { + get_current_time(expiration_); + expiration_.add_milliseconds(std::min(G_MAXLONG, interval_)); + } + + return again; +} + + +/**** Glib::IdleSource *****************************************************/ + +// static +Glib::RefPtr IdleSource::create() +{ + return Glib::RefPtr(new IdleSource()); +} + +sigc::connection IdleSource::connect(const sigc::slot& slot) +{ + return connect_generic(slot); +} + +IdleSource::IdleSource() +{ + set_priority(PRIORITY_DEFAULT_IDLE); +} + +IdleSource::~IdleSource() +{} + +bool IdleSource::prepare(int& timeout) +{ + timeout = 0; + return true; +} + +bool IdleSource::check() +{ + return true; +} + +bool IdleSource::dispatch(sigc::slot_base* slot) +{ + return (*static_cast*>(slot))(); +} + + +/**** Glib::IOSource *******************************************************/ + +// static +Glib::RefPtr IOSource::create(int fd, IOCondition condition) +{ + return Glib::RefPtr(new IOSource(fd, condition)); +} + +Glib::RefPtr IOSource::create(const Glib::RefPtr& channel, IOCondition condition) +{ + return Glib::RefPtr(new IOSource(channel, condition)); +} + +sigc::connection IOSource::connect(const sigc::slot& slot) +{ + return connect_generic(slot); +} + +IOSource::IOSource(int fd, IOCondition condition) +: + poll_fd_ (fd, condition) +{ + add_poll(poll_fd_); +} + +IOSource::IOSource(const Glib::RefPtr& channel, IOCondition condition) +: + Source(g_io_create_watch(channel->gobj(), (GIOCondition) condition), + (GSourceFunc) &glibmm_iosource_callback) +{} + +IOSource::~IOSource() +{} + +bool IOSource::prepare(int& timeout) +{ + timeout = -1; + return false; +} + +bool IOSource::check() +{ + return ((poll_fd_.get_revents() & poll_fd_.get_events()) != 0); +} + +bool IOSource::dispatch(sigc::slot_base* slot) +{ + return (*static_cast*>(slot)) + (poll_fd_.get_revents()); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/main.h b/libs/glibmm2/glibmm/main.h new file mode 100644 index 0000000000..4165be3620 --- /dev/null +++ b/libs/glibmm2/glibmm/main.h @@ -0,0 +1,697 @@ +// -*- c++ -*- +#ifndef _GLIBMM_MAIN_H +#define _GLIBMM_MAIN_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#include +#include + +#include +#include +#include + +GLIBMM_USING_STD(vector) + + +namespace Glib +{ + +class Cond; +class Mutex; +class IOChannel; + + +/** @defgroup MainLoop The Main Event Loop + * Manages all available sources of events. + * @{ + */ + +enum +{ + /*! Use this for high priority event sources. It is not used within + * GLib or GTK+.

+ */ + PRIORITY_HIGH = -100, + + /*! Use this for default priority event sources. In glibmm this + * priority is used by default when installing timeout handlers with + * SignalTimeout::connect(). In GDK this priority is used for events + * from the X server.

+ */ + PRIORITY_DEFAULT = 0, + + /*! Use this for high priority idle functions. GTK+ uses + * PRIORITY_HIGH_IDLE + 10 for resizing operations, and + * PRIORITY_HIGH_IDLE + 20 for redrawing operations. + * (This is done to ensure that any pending resizes are processed before + * any pending redraws, so that widgets are not redrawn twice unnecessarily.) + *

+ */ + PRIORITY_HIGH_IDLE = 100, + + /*! Use this for default priority idle functions. In glibmm this priority is + * used by default when installing idle handlers with SignalIdle::connect(). + *

+ */ + PRIORITY_DEFAULT_IDLE = 200, + + /*! Use this for very low priority background tasks. It is not used within + * GLib or GTK+. + */ + PRIORITY_LOW = 300 +}; + + +/** A bitwise combination representing an I/O condition to watch for on an + * event source. + * The flags correspond to those used by the %poll() system call + * on UNIX (see man 2 poll). To test for individual flags, do + * something like this: + * @code + * if((condition & Glib::IO_OUT) != 0) + * do_some_output(); + * @endcode + * @par Bitwise operators: + * IOCondition operator|(IOCondition, IOCondition)
+ * IOCondition operator&(IOCondition, IOCondition)
+ * IOCondition operator^(IOCondition, IOCondition)
+ * IOCondition operator~(IOCondition)
+ * IOCondition& operator|=(IOCondition&, IOCondition)
+ * IOCondition& operator&=(IOCondition&, IOCondition)
+ * IOCondition& operator^=(IOCondition&, IOCondition)
+ */ +enum IOCondition +{ + IO_IN = G_IO_IN, /*!< @hideinitializer There is data to read. */ + IO_OUT = G_IO_OUT, /*!< @hideinitializer Data can be written (without blocking). */ + IO_PRI = G_IO_PRI, /*!< @hideinitializer There is urgent data to read. */ + IO_ERR = G_IO_ERR, /*!< @hideinitializer %Error condition. */ + IO_HUP = G_IO_HUP, /*!< @hideinitializer Hung up (the connection has been broken, + usually for pipes and sockets). */ + IO_NVAL = G_IO_NVAL /*!< @hideinitializer Invalid request. The file descriptor is not open. */ +}; + +inline IOCondition operator|(IOCondition lhs, IOCondition rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +inline IOCondition operator&(IOCondition lhs, IOCondition rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +inline IOCondition operator^(IOCondition lhs, IOCondition rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +inline IOCondition operator~(IOCondition flags) + { return static_cast(~static_cast(flags)); } + +inline IOCondition& operator|=(IOCondition& lhs, IOCondition rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +inline IOCondition& operator&=(IOCondition& lhs, IOCondition rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +inline IOCondition& operator^=(IOCondition& lhs, IOCondition rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +class PollFD +{ +public: + PollFD(); + explicit PollFD(int fd); + PollFD(int fd, IOCondition events); + + void set_fd(int fd) { gobject_.fd = fd; } + int get_fd() const { return gobject_.fd; } + + void set_events(IOCondition events) { gobject_.events = events; } + IOCondition get_events() const { return static_cast(gobject_.events); } + + void set_revents(IOCondition revents) { gobject_.revents = revents; } + IOCondition get_revents() const { return static_cast(gobject_.revents); } + + GPollFD* gobj() { return &gobject_; } + const GPollFD* gobj() const { return &gobject_; } + +private: + GPollFD gobject_; +}; + + +class SignalTimeout +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit inline SignalTimeout(GMainContext* context); +#endif + + /** Connects a timeout handler. + * @code + * Glib::signal_timeout().connect(sigc::ptr_fun(&timeout_handler), 1000); + * @endcode + * is equivalent to: + * @code + * const Glib::RefPtr timeout_source = Glib::TimeoutSource::create(1000); + * timeout_source->connect(sigc::ptr_fun(&timeout_handler)); + * timeout_source->attach(Glib::MainContext::get_default()); + * @endcode + * @param slot A slot to call when @a interval elapsed. + * @param interval The timeout in milliseconds. + * @param priority The priority of the new event source. + * @return A connection handle, which can be used to disconnect the handler. + */ + sigc::connection connect(const sigc::slot& slot, unsigned int interval, + int priority = PRIORITY_DEFAULT); +private: + GMainContext* context_; + + // no copy assignment + SignalTimeout& operator=(const SignalTimeout&); +}; + + +class SignalIdle +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit inline SignalIdle(GMainContext* context); +#endif + + /** Connects an idle handler. + * @code + * Glib::signal_idle().connect(sigc::ptr_fun(&idle_handler)); + * @endcode + * is equivalent to: + * @code + * const Glib::RefPtr idle_source = Glib::IdleSource::create(); + * idle_source->connect(sigc::ptr_fun(&idle_handler)); + * idle_source->attach(Glib::MainContext::get_default()); + * @endcode + * @param slot A slot to call when the main loop is idle. + * @param priority The priority of the new event source. + * @return A connection handle, which can be used to disconnect the handler. + */ + sigc::connection connect(const sigc::slot& slot, int priority = PRIORITY_DEFAULT_IDLE); + +private: + GMainContext* context_; + + // no copy assignment + SignalIdle& operator=(const SignalIdle&); +}; + + +class SignalIO +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit inline SignalIO(GMainContext* context); +#endif + + /** Connects an I/O handler. + * @code + * Glib::signal_io().connect(sigc::ptr_fun(&io_handler), fd, Glib::IO_IN | Glib::IO_HUP); + * @endcode + * is equivalent to: + * @code + * const Glib::RefPtr io_source = Glib::IOSource::create(fd, Glib::IO_IN | Glib::IO_HUP); + * io_source->connect(sigc::ptr_fun(&io_handler)); + * io_source->attach(Glib::MainContext::get_default()); + * @endcode + * @param slot A slot to call when polling @a fd results in an event that matches @a condition. + * The event will be passed as a parameter to @a slot. + * If @a io_handler returns false the signal is disconnected. + * @param fd The file descriptor (or a @c HANDLE on Win32 systems) to watch. + * @param condition The conditions to watch for. + * @param priority The priority of the new event source. + * @return A connection handle, which can be used to disconnect the handler. + */ + sigc::connection connect(const sigc::slot& slot, int fd, + IOCondition condition, int priority = PRIORITY_DEFAULT); + + /** Connects an I/O channel. + * @code + * Glib::signal_io().connect(sigc::ptr_fun(&io_handler), channel, Glib::IO_IN | Glib::IO_HUP); + * @endcode + * is equivalent to: + * @code + * const Glib::RefPtr io_source = Glib::IOSource::create(channel, Glib::IO_IN | Glib::IO_HUP); + * io_source->connect(sigc::ptr_fun(&io_handler)); + * io_source->attach(Glib::MainContext::get_default()); + * @endcode + * @param slot A slot to call when polling @a channel results in an event that matches @a condition. + * The event will be passed as a parameter to @a slot. + * If @a io_handler returns false the signal is disconnected. + * @param channel The IOChannel object to watch. + * @param condition The conditions to watch for. + * @param priority The priority of the new event source. + * @return A connection handle, which can be used to disconnect the handler. + */ + sigc::connection connect(const sigc::slot& slot, const Glib::RefPtr& channel, + IOCondition condition, int priority = PRIORITY_DEFAULT); + +private: + GMainContext* context_; + + // no copy assignment + SignalIO& operator=(const SignalIO&); +}; + + +/** Convenience timeout signal. + * @return A signal proxy; you want to use SignalTimeout::connect(). + */ +SignalTimeout signal_timeout(); + +/** Convenience idle signal. + * @return A signal proxy; you want to use SignalIdle::connect(). + */ +SignalIdle signal_idle(); + +/** Convenience I/O signal. + * @return A signal proxy; you want to use SignalIO::connect(). + */ +SignalIO signal_io(); + + +/** Main context. + */ +class MainContext +{ +public: + typedef Glib::MainContext CppObjectType; + typedef GMainContext BaseObjectType; + + /** Creates a new MainContext. + * @return The new MainContext. + */ + static Glib::RefPtr create(); + /** Returns the default main context. + * This is the main context used for main loop functions when a main loop is not explicitly specified. + * @return The new MainContext. + */ + static Glib::RefPtr get_default(); + + /** Runs a single iteration for the given main loop. + * This involves checking to see if any event sources are ready to be processed, then if no events sources are ready and may_block is true, waiting for a source to become ready, then dispatching the highest priority events sources that are ready. Note that even when may_block is true, it is still possible for iteration() to return FALSE, since the the wait may be interrupted for other reasons than an event source becoming ready. + * @param may_block Whether the call may block. + * @return true if events were dispatched. + */ + bool iteration(bool may_block); + + /** Checks if any sources have pending events for the given context. + * @return true if events are pending. + */ + bool pending(); + + /** If context is currently waiting in a poll(), interrupt the poll(), and continue the iteration process. + */ + void wakeup(); + + /** Tries to become the owner of the specified context. + * If some other context is the owner of the context, returns FALSE immediately. Ownership is properly recursive: the owner can require ownership again and will release ownership when release() is called as many times as acquire(). + * You must be the owner of a context before you can call prepare(), query(), check(), dispatch(). + * @return true if the operation succeeded, and this thread is now the owner of context. + */ + bool acquire(); + + + /** Tries to become the owner of the specified context, as with acquire(). But if another thread is the owner, atomically drop mutex and wait on cond until that owner releases ownership or until cond is signaled, then try again (once) to become the owner. + * @param cond A condition variable. + * @param mutex A mutex, currently held. + * @return true if the operation succeeded, and this thread is now the owner of context. + */ + bool wait(Glib::Cond& cond, Glib::Mutex& mutex); + + /** Releases ownership of a context previously acquired by this thread with acquire(). If the context was acquired multiple times, the only release ownership when release() is called as many times as it was acquired. + */ + void release(); + + + + /** Prepares to poll sources within a main loop. The resulting information for polling is determined by calling query(). + * @param priority Location to store priority of highest priority source already ready. + * @return true if some source is ready to be dispatched prior to polling. + */ + bool prepare(int& priority); + /** Prepares to poll sources within a main loop. The resulting information for polling is determined by calling query(). + * @return true if some source is ready to be dispatched prior to polling. + */ + bool prepare(); + + /** Determines information necessary to poll this main loop. + * @param max_priority Maximum priority source to check. + * @param timeout Location to store timeout to be used in polling. + * @param fds Location to store Glib::PollFD records that need to be polled. + * @return the number of records actually stored in fds, or, if more than n_fds records need to be stored, the number of records that need to be stored. + */ + void query(int max_priority, int& timeout, std::vector& fds); + + /** Passes the results of polling back to the main loop. + * @param max_priority Maximum numerical priority of sources to check. + * @param fds Vector of Glib::PollFD's that was passed to the last call to query() + * @return true if some sources are ready to be dispatched. + */ + bool check(int max_priority, std::vector& fds); + + /** Dispatches all pending sources. + */ + void dispatch(); + + //TODO: Use slot instead? + /** Sets the function to use to handle polling of file descriptors. It will be used instead of the poll() system call (or GLib's replacement function, which is used where poll() isn't available). + * This function could possibly be used to integrate the GLib event loop with an external event loop. + * @param poll_func The function to call to poll all file descriptors. + */ + void set_poll_func(GPollFunc poll_func); + + /** Gets the poll function set by g_main_context_set_poll_func(). + * @return The poll function + */ + GPollFunc get_poll_func(); + + /** Adds a file descriptor to the set of file descriptors polled for this context. This will very seldomly be used directly. Instead a typical event source will use Glib::Source::add_poll() instead. + * @param fd A PollFD structure holding information about a file descriptor to watch. + * @param priority The priority for this file descriptor which should be the same as the priority used for Glib::Source::attach() to ensure that the file descriptor is polled whenever the results may be needed. + */ + void add_poll(PollFD& fd, int priority); + + /** Removes file descriptor from the set of file descriptors to be polled for a particular context. + * @param fd A PollFD structure holding information about a file descriptor. + */ + void remove_poll(PollFD& fd); + + /** Timeout signal, attached to this MainContext. + * @return A signal proxy; you want to use SignalTimeout::connect(). + */ + SignalTimeout signal_timeout(); + + /** Idle signal, attached to this MainContext. + * @return A signal proxy; you want to use SignalIdle::connect(). + */ + SignalIdle signal_idle(); + + /** I/O signal, attached to this MainContext. + * @return A signal proxy; you want to use SignalIO::connect(). + */ + SignalIO signal_io(); + + void reference() const; + void unreference() const; + + GMainContext* gobj(); + const GMainContext* gobj() const; + GMainContext* gobj_copy() const; + +private: + // Glib::MainContext can neither be constructed nor deleted. + MainContext(); + void operator delete(void*, size_t); + + // noncopyable + MainContext(const MainContext& other); + MainContext& operator=(const MainContext& other); + +}; + +/** @relates Glib::MainContext */ +Glib::RefPtr wrap(GMainContext* gobject, bool take_copy = false); + + +class MainLoop +{ +public: + typedef Glib::MainLoop CppObjectType; + typedef GMainLoop BaseObjectType; + + static Glib::RefPtr create(bool is_running = false); + static Glib::RefPtr create(const Glib::RefPtr& context, + bool is_running = false); + + /** Runs a main loop until quit() is called on the loop. + * If this is called for the thread of the loop's MainContext, it will process events from the loop, otherwise it will simply wait. + */ + void run(); + + /** Stops a MainLoop from running. Any calls to run() for the loop will return. + */ + void quit(); + + /** Checks to see if the main loop is currently being run via run(). + * @return true if the mainloop is currently being run. + */ + bool is_running(); + + /** Returns the MainContext of loop. + * @return The MainContext of loop. + */ + Glib::RefPtr get_context(); + + //TODO: C++ize the (big) g_main_depth docs here. + static int depth(); + + /** Increases the reference count on a MainLoop object by one. + */ + void reference() const; + + /** Decreases the reference count on a MainLoop object by one. + * If the result is zero, free the loop and free all associated memory. + */ + void unreference() const; + + GMainLoop* gobj(); + const GMainLoop* gobj() const; + GMainLoop* gobj_copy() const; + +private: + // Glib::MainLoop can neither be constructed nor deleted. + MainLoop(); + void operator delete(void*, size_t); + + MainLoop(const MainLoop&); + MainLoop& operator=(const MainLoop&); +}; + +/** @relates Glib::MainLoop */ +Glib::RefPtr wrap(GMainLoop* gobject, bool take_copy = false); + + +class Source +{ +public: + typedef Glib::Source CppObjectType; + typedef GSource BaseObjectType; + + static Glib::RefPtr create() /* = 0 */; + + /** Adds a Source to a context so that it will be executed within that context. + * @param context A MainContext. + * @return The ID for the source within the MainContext. + */ + unsigned int attach(const Glib::RefPtr& context); + + /** Adds a Source to a context so that it will be executed within that context. + * The default context will be used. + * @return The ID for the source within the MainContext. + */ + unsigned int attach(); + + //TODO: Does this destroy step make sense in C++? Should it just be something that happens in a destructor? + + /** Removes a source from its MainContext, if any, and marks it as destroyed. + * The source cannot be subsequently added to another context. + */ + void destroy(); + + /** Sets the priority of a source. While the main loop is being run, a source will be dispatched if it is ready to be dispatched and no sources at a higher (numerically smaller) priority are ready to be dispatched. + * @param priority The new priority. + */ + void set_priority(int priority); + + /** Gets the priority of a source. + * @return The priority of the source. + */ + int get_priority() const; + + /** Sets whether a source can be called recursively. + * If @a can_recurse is true, then while the source is being dispatched then this source will be processed normally. Otherwise, all processing of this source is blocked until the dispatch function returns. + * @param can_recurse Whether recursion is allowed for this source. + */ + void set_can_recurse(bool can_recurse); + + /** Checks whether a source is allowed to be called recursively. see set_can_recurse(). + * @return Whether recursion is allowed. + */ + bool get_can_recurse() const; + + /** Returns the numeric ID for a particular source. + * The ID of a source is unique within a particular main loop context. The reverse mapping from ID to source is done by MainContext::find_source_by_id(). + * @return The ID for the source. + */ + unsigned int get_id() const; + + //TODO: Add a const version of this method? + /** Gets the MainContext with which the source is associated. + * Calling this function on a destroyed source is an error. + * @return The MainContext with which the source is associated, or a null RefPtr if the context has not yet been added to a source. + */ + Glib::RefPtr get_context(); + + GSource* gobj() { return gobject_; } + const GSource* gobj() const { return gobject_; } + GSource* gobj_copy() const; + + void reference() const; + void unreference() const; + +protected: + /** Construct an object that uses the virtual functions prepare(), check() and dispatch(). + */ + Source(); + + /** Wrap an existing GSource object and install the given callback function. + * The constructed object doesn't use the virtual functions prepare(), check() and dispatch(). + * This constructor is for use by derived types that need to wrap a GSource object. + * The callback function can be a static member function. But beware - + * depending on the actual implementation of the GSource's virtual functions + * the expected type of the callback function can differ from GSourceFunc. + */ + Source(GSource* cast_item, GSourceFunc callback_func); + + virtual ~Source(); + + sigc::connection connect_generic(const sigc::slot_base& slot); + + /** Adds a file descriptor to the set of file descriptors polled for this source. + * The event source's check function will typically test the revents field in the PollFD and return true if events need to be processed. + * @param poll_fd A PollFD object holding information about a file descriptor to watch. + */ + void add_poll(PollFD& poll_fd); + + /** Removes a file descriptor from the set of file descriptors polled for this source. + * @param poll_fd A PollFD object previously passed to add_poll(). + */ + void remove_poll(PollFD& poll_fd); + + /** Gets the "current time" to be used when checking this source. The advantage of calling this function over calling get_current_time() directly is that when checking multiple sources, GLib can cache a single value instead of having to repeatedly get the system time. + * @param current_time Glib::TimeVal in which to store current time + */ + void get_current_time(Glib::TimeVal& current_time); + + virtual bool prepare(int& timeout) = 0; + virtual bool check() = 0; + virtual bool dispatch(sigc::slot_base* slot) = 0; + +private: + GSource* gobject_; + +#ifndef DOXGEN_SHOULD_SKIP_THIS + + static inline Source* get_wrapper(GSource* source); + + static const GSourceFuncs vfunc_table_; + + static gboolean prepare_vfunc(GSource* source, int* timeout); + static gboolean check_vfunc(GSource* source); + static gboolean dispatch_vfunc(GSource* source, GSourceFunc callback, void* user_data); +public: + static void destroy_notify_callback(void* data); +private: + +#endif /* DOXGEN_SHOULD_SKIP_THIS */ + + // noncopyable + Source(const Source&); + Source& operator=(const Source&); +}; + + +class TimeoutSource : public Glib::Source +{ +public: + typedef Glib::TimeoutSource CppObjectType; + + static Glib::RefPtr create(unsigned int interval); + sigc::connection connect(const sigc::slot& slot); + +protected: + explicit TimeoutSource(unsigned int interval); + virtual ~TimeoutSource(); + + virtual bool prepare(int& timeout); + virtual bool check(); + virtual bool dispatch(sigc::slot_base* slot); + +private: + Glib::TimeVal expiration_; + unsigned int interval_; +}; + + +class IdleSource : public Glib::Source +{ +public: + typedef Glib::IdleSource CppObjectType; + + static Glib::RefPtr create(); + sigc::connection connect(const sigc::slot& slot); + +protected: + IdleSource(); + virtual ~IdleSource(); + + virtual bool prepare(int& timeout); + virtual bool check(); + virtual bool dispatch(sigc::slot_base* slot_data); +}; + + +class IOSource : public Glib::Source +{ +public: + typedef Glib::IOSource CppObjectType; + + static Glib::RefPtr create(int fd, IOCondition condition); + static Glib::RefPtr create(const Glib::RefPtr& channel, IOCondition condition); + sigc::connection connect(const sigc::slot& slot); + +protected: + IOSource(int fd, IOCondition condition); + IOSource(const Glib::RefPtr& channel, IOCondition condition); + virtual ~IOSource(); + + virtual bool prepare(int& timeout); + virtual bool check(); + virtual bool dispatch(sigc::slot_base* slot); + +private: + PollFD poll_fd_; +}; + +/** @} group MainLoop */ + +} // namespace Glib + + +#endif /* _GLIBMM_MAIN_H */ + diff --git a/libs/glibmm2/glibmm/markup.cc b/libs/glibmm2/glibmm/markup.cc new file mode 100644 index 0000000000..b0690406f6 --- /dev/null +++ b/libs/glibmm2/glibmm/markup.cc @@ -0,0 +1,350 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Glib +{ + +namespace Markup +{ + +Glib::ustring escape_text(const Glib::ustring& text) +{ + const Glib::ScopedPtr buf (g_markup_escape_text(text.data(), text.bytes())); + return Glib::ustring(buf.get()); +} + + +/**** Glib::Markup::AttributeKeyLess ***************************************/ + +bool AttributeKeyLess::operator()(const Glib::ustring& lhs, const Glib::ustring& rhs) const +{ + return (lhs.raw() < rhs.raw()); +} + + +/**** Glib::Markup::ParserCallbacks ****************************************/ + +class ParserCallbacks +{ +public: + static const GMarkupParser vfunc_table; + + static void start_element(GMarkupParseContext* context, + const char* element_name, + const char** attribute_names, + const char** attribute_values, + void* user_data, + GError** error); + + static void end_element(GMarkupParseContext* context, + const char* element_name, + void* user_data, + GError** error); + + static void text(GMarkupParseContext* context, + const char* text, + gsize text_len, + void* user_data, + GError** error); + + static void passthrough(GMarkupParseContext* context, + const char* passthrough_text, + gsize text_len, + void* user_data, + GError** error); + + static void error(GMarkupParseContext* context, + GError* error, + void* user_data); +}; + + +const GMarkupParser ParserCallbacks::vfunc_table = +{ + &ParserCallbacks::start_element, + &ParserCallbacks::end_element, + &ParserCallbacks::text, + &ParserCallbacks::passthrough, + &ParserCallbacks::error, +}; + +void ParserCallbacks::start_element(GMarkupParseContext* context, + const char* element_name, + const char** attribute_names, + const char** attribute_values, + void* user_data, + GError** error) +{ + ParseContext& cpp_context = *static_cast(user_data); + g_return_if_fail(context == cpp_context.gobj()); + + try + { + Parser::AttributeMap attributes; + + if(attribute_names && attribute_values) + { + const char *const * pname = attribute_names; + const char *const * pvalue = attribute_values; + + for(; *pname && *pvalue; ++pname, ++pvalue) + attributes.insert(Parser::AttributeMap::value_type(*pname, *pvalue)); + + g_return_if_fail(*pname == 0 && *pvalue == 0); + } + + cpp_context.get_parser()->on_start_element(cpp_context, element_name, attributes); + } + catch(MarkupError& err) + { + err.propagate(error); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void ParserCallbacks::end_element(GMarkupParseContext* context, + const char* element_name, + void* user_data, + GError** error) +{ + ParseContext& cpp_context = *static_cast(user_data); + g_return_if_fail(context == cpp_context.gobj()); + + try + { + cpp_context.get_parser()->on_end_element(cpp_context, element_name); + } + catch(MarkupError& err) + { + err.propagate(error); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void ParserCallbacks::text(GMarkupParseContext* context, + const char* text, + gsize text_len, + void* user_data, + GError** error) +{ + ParseContext& cpp_context = *static_cast(user_data); + g_return_if_fail(context == cpp_context.gobj()); + + try + { + cpp_context.get_parser()->on_text(cpp_context, Glib::ustring(text, text + text_len)); + } + catch(MarkupError& err) + { + err.propagate(error); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void ParserCallbacks::passthrough(GMarkupParseContext* context, + const char* passthrough_text, + gsize text_len, + void* user_data, + GError** error) +{ + ParseContext& cpp_context = *static_cast(user_data); + g_return_if_fail(context == cpp_context.gobj()); + + try + { + cpp_context.get_parser()->on_passthrough( + cpp_context, Glib::ustring(passthrough_text, passthrough_text + text_len)); + } + catch(MarkupError& err) + { + err.propagate(error); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void ParserCallbacks::error(GMarkupParseContext* context, + GError* error, + void* user_data) +{ + ParseContext& cpp_context = *static_cast(user_data); + + g_return_if_fail(context == cpp_context.gobj()); + g_return_if_fail(error->domain == G_MARKUP_ERROR); + + try + { + cpp_context.get_parser()->on_error(cpp_context, MarkupError(g_error_copy(error))); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + + +/**** Glib::Markup::Parser *************************************************/ + +Parser::Parser() +{} + +Parser::~Parser() +{} + +void Parser::on_start_element(ParseContext&, const Glib::ustring&, const Parser::AttributeMap&) +{} + +void Parser::on_end_element(ParseContext&, const Glib::ustring&) +{} + +void Parser::on_text(ParseContext&, const Glib::ustring&) +{} + +void Parser::on_passthrough(ParseContext&, const Glib::ustring&) +{} + +void Parser::on_error(ParseContext&, const MarkupError&) +{} + + +/**** Glib::Markup::ParseContext *******************************************/ + +ParseContext::ParseContext(Parser& parser, ParseFlags flags) +: + parser_ (&parser), + gobject_ (g_markup_parse_context_new(&ParserCallbacks::vfunc_table, (GMarkupParseFlags) flags, + this, &ParseContext::destroy_notify_callback)) +{} + +ParseContext::~ParseContext() +{ + parser_ = 0; + g_markup_parse_context_free(gobject_); +} + +void ParseContext::parse(const Glib::ustring& text) +{ + GError* error = 0; + g_markup_parse_context_parse(gobject_, text.data(), text.bytes(), &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void ParseContext::parse(const char* text_begin, const char* text_end) +{ + GError* error = 0; + g_markup_parse_context_parse(gobject_, text_begin, text_end - text_begin, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void ParseContext::end_parse() +{ + GError* error = 0; + g_markup_parse_context_end_parse(gobject_, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +Glib::ustring ParseContext::get_element() const +{ + const char *const element_name = g_markup_parse_context_get_element(gobject_); + return (element_name) ? Glib::ustring(element_name) : Glib::ustring(); +} + +int ParseContext::get_line_number() const +{ + int line_number = 0; + g_markup_parse_context_get_position(gobject_, &line_number, 0); + return line_number; +} + +int ParseContext::get_char_number() const +{ + int char_number = 0; + g_markup_parse_context_get_position(gobject_, 0, &char_number); + return char_number; +} + +// static +void ParseContext::destroy_notify_callback(void* data) +{ + ParseContext *const self = static_cast(data); + + // Detect premature destruction. + g_return_if_fail(self->parser_ == 0); +} + +} // namespace Markup + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::MarkupError::MarkupError(Glib::MarkupError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_MARKUP_ERROR, error_code, error_message) +{} + +Glib::MarkupError::MarkupError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::MarkupError::Code Glib::MarkupError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::MarkupError::throw_func(GError* gobject) +{ + throw Glib::MarkupError(gobject); +} + + diff --git a/libs/glibmm2/glibmm/markup.h b/libs/glibmm2/glibmm/markup.h new file mode 100644 index 0000000000..83076f15b8 --- /dev/null +++ b/libs/glibmm2/glibmm/markup.h @@ -0,0 +1,420 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_MARKUP_H +#define _GLIBMM_MARKUP_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +#include +#include + +GLIBMM_USING_STD(map) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GMarkupParseContext GMarkupParseContext; } +#endif + + +namespace Glib +{ + +/** @defgroup Markup Simple XML Subset Parser + * + * The Glib::Markup parser is intended to parse a simple markup format that's a + * subset of XML. This is a small, efficient, easy-to-use parser. It should not + * be used if you expect to interoperate with other applications generating + * full-scale XML. However, it's very useful for application data files, config + * files, etc. where you know your application will be the only one writing the + * file. Full-scale XML parsers should be able to parse the subset used by + * Glib::Markup parser, so you can easily migrate to full-scale XML at a later + * time if the need arises. + * + * Glib::Markup is not guaranteed to signal an error on all invalid XML; + * the parser may accept documents that an XML parser would not. However, + * invalid XML documents are not considered valid Glib::Markup documents. + * + * @par Simplifications to XML include: + * + * - Only UTF-8 encoding is allowed. + * - No user-defined entities. + * - Processing instructions, comments and the doctype declaration are "passed + * through" but are not interpreted in any way. + * - No DTD or validation. + * + * @par The markup format does support: + * + * - Elements + * - Attributes + * - 5 standard entities: \& \< \> \" \' + * - Character references + * - Sections marked as CDATA + * + * @{ + */ + +/** %Exception class for markup parsing errors. + */ +class MarkupError : public Glib::Error +{ +public: + enum Code + { + BAD_UTF8, + EMPTY, + PARSE, + UNKNOWN_ELEMENT, + UNKNOWN_ATTRIBUTE, + INVALID_CONTENT + }; + + MarkupError(Code error_code, const Glib::ustring& error_message); + explicit MarkupError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +/*! @var MarkupError::Code MarkupError::BAD_UTF8 + * Text being parsed was not valid UTF-8. + */ +/*! @var MarkupError::Code MarkupError::EMPTY + * Document contained nothing, or only whitespace. + */ +/*! @var MarkupError::Code MarkupError::PARSE + * Document was ill-formed. + */ +/*! @var MarkupError::Code MarkupError::UNKNOWN_ELEMENT + * This error should be set by Glib::Markup::Parser virtual methods; + * element wasn't known. + */ +/*! @var MarkupError::Code MarkupError::UNKNOWN_ATTRIBUTE + * This error should be set by Glib::Markup::Parser virtual methods; + * attribute wasn't known. + */ +/*! @var MarkupError::Code MarkupError::INVALID_CONTENT + * This error should be set by Glib::Markup::Parser virtual methods; + * something was wrong with contents of the document, e.g. invalid attribute value. + */ + +/** @} group Markup */ + + +namespace Markup +{ + +class ParseContext; + +/** @ingroup Markup */ +typedef Glib::MarkupError Error; + + +/** Escapes text so that the markup parser will parse it verbatim. + * Less than, greater than, ampersand, etc. are replaced with the corresponding + * entities. This function would typically be used when writing out a file to + * be parsed with the markup parser. + * @ingroup Markup + * @param text Some valid UTF-8 text. + * @return Escaped text. + */ +Glib::ustring escape_text(const Glib::ustring& text); + + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** There are no flags right now. Pass Glib::Markup::ParseFlags(0) for + * the flags argument to all functions (this should be the default argument + * anyway). + * @ingroup glibmmEnums + * @par Bitwise operators: + * %ParseFlags operator|(ParseFlags, ParseFlags)
+ * %ParseFlags operator&(ParseFlags, ParseFlags)
+ * %ParseFlags operator^(ParseFlags, ParseFlags)
+ * %ParseFlags operator~(ParseFlags)
+ * %ParseFlags& operator|=(ParseFlags&, ParseFlags)
+ * %ParseFlags& operator&=(ParseFlags&, ParseFlags)
+ * %ParseFlags& operator^=(ParseFlags&, ParseFlags)
+ */ +enum ParseFlags +{ + DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0 +}; + +/** @ingroup glibmmEnums */ +inline ParseFlags operator|(ParseFlags lhs, ParseFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline ParseFlags operator&(ParseFlags lhs, ParseFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline ParseFlags operator^(ParseFlags lhs, ParseFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline ParseFlags operator~(ParseFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup glibmmEnums */ +inline ParseFlags& operator|=(ParseFlags& lhs, ParseFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline ParseFlags& operator&=(ParseFlags& lhs, ParseFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline ParseFlags& operator^=(ParseFlags& lhs, ParseFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +/*! @var Markup::ParseFlags DO_NOT_USE_THIS_UNSUPPORTED_FLAG + * Flag you should not use. + */ + + +/** Binary predicate used by Markup::Parser::AttributeMap. + * @ingroup Markup + * Unlike operator<(const ustring& lhs, const ustring& rhs) + * which would be used by the default std::less<> predicate, + * the AttributeKeyLess predicate is locale-independent. This is both + * more correct and much more efficient. + */ +class AttributeKeyLess +{ +public: + typedef Glib::ustring first_argument_type; + typedef Glib::ustring second_argument_type; + typedef bool result_type; + + bool operator()(const Glib::ustring& lhs, const Glib::ustring& rhs) const; +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +class ParserCallbacks; +#endif + +/** The abstract markup parser base class. + * @ingroup Markup + * To implement a parser for your markup format, derive from + * Glib::Markup::Parser and implement the virtual methods. + * + * You don't have to override all of the virtual methods. If a particular + * method is not implement the data passed to it will be ignored. Except for + * the error method, any of these callbacks can throw an error exception; in + * particular the MarkupError::UNKNOWN_ELEMENT, + * MarkupError::UNKNOWN_ATTRIBUTE, and MarkupError::INVALID_CONTENT errors + * are intended to be thrown from these overridden methods. If you throw an + * error from a method, Glib::Markup::ParseContext::parse() will report that + * error back to its caller. + */ +class Parser : public sigc::trackable +{ +public: + typedef std::map AttributeMap; + + virtual ~Parser() = 0; + +protected: + /** Constructs a Parser object. + * Note that Markup::Parser is an abstract class which can't be instantiated + * directly. To implement the parser for your markup format, derive from + * Markup::Parser and implement the virtual methods. + */ + Parser(); + + /** Called for open tags \. + * This virtual method is invoked when the opening tag of an element is seen. + * @param context The Markup::ParseContext object the parsed data belongs to. + * @param element_name The name of the element. + * @param attributes A map of attribute name/value pairs. + * @throw Glib::MarkupError An exception you should throw if + * something went wrong, for instance if an unknown attribute name was + * encountered. In particular the MarkupError::UNKNOWN_ELEMENT, + * MarkupError::UNKNOWN_ATTRIBUTE, and MarkupError::INVALID_CONTENT + * errors are intended to be thrown from user-implemented methods. + */ + virtual void on_start_element(ParseContext& context, + const Glib::ustring& element_name, + const AttributeMap& attributes); + + /** Called for close tags \. + * This virtual method is invoked when the closing tag of an element is seen. + * @param context The Markup::ParseContext object the parsed data belongs to. + * @param element_name The name of the element. + * @throw Glib::MarkupError An exception you should throw if + * something went wrong, for instance if an unknown attribute name was + * encountered. In particular the MarkupError::UNKNOWN_ELEMENT, + * MarkupError::UNKNOWN_ATTRIBUTE, and MarkupError::INVALID_CONTENT + * errors are intended to be thrown from user-implemented methods. + */ + virtual void on_end_element(ParseContext& context, const Glib::ustring& element_name); + + /** Called for character data. + * This virtual method is invoked when some text is seen (text is always + * inside an element). + * @param context The Markup::ParseContext object the parsed data belongs to. + * @param text The parsed text in UTF-8 encoding. + * @throw Glib::MarkupError An exception you should throw if + * something went wrong, for instance if an unknown attribute name was + * encountered. In particular the MarkupError::UNKNOWN_ELEMENT, + * MarkupError::UNKNOWN_ATTRIBUTE, and MarkupError::INVALID_CONTENT + * errors are intended to be thrown from user-implemented methods. + */ + virtual void on_text(ParseContext& context, const Glib::ustring& text); + + /** Called for strings that should be re-saved verbatim in this same + * position, but are not otherwise interpretable. + * This virtual method is invoked for comments, processing instructions and + * doctype declarations; if you're re-writing the parsed document, write the + * passthrough text back out in the same position. + * @param context The Markup::ParseContext object the parsed data belongs to. + * @param passthrough_text The text that should be passed through. + * @throw Glib::MarkupError An exception you should throw if + * something went wrong, for instance if an unknown attribute name was + * encountered. In particular the MarkupError::UNKNOWN_ELEMENT, + * MarkupError::UNKNOWN_ATTRIBUTE, and MarkupError::INVALID_CONTENT + * errors are intended to be thrown from user-implemented methods. + */ + virtual void on_passthrough(ParseContext& context, const Glib::ustring& passthrough_text); + + /** Called on error, including one thrown by an overridden virtual method. + * @param context The Markup::ParseContext object the parsed data belongs to. + * @param error A MarkupError object with detailed information about the error. + */ + virtual void on_error(ParseContext& context, const MarkupError& error); + +private: + // noncopyable + Parser(const Parser&); + Parser& operator=(const Parser&); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + friend class Glib::Markup::ParserCallbacks; +#endif +}; + + +/** A parse context is used to parse marked-up documents. + * @ingroup Markup + * You can feed any number of documents into a context, as long as no errors + * occur; once an error occurs, the parse context can't continue to parse text + * (you have to destroy it and create a new parse context). + */ +class ParseContext : public sigc::trackable +{ +public: + /** Creates a new parse context. + * @param parser A Markup::Parser instance. + * @param flags Bitwise combination of Markup::ParseFlags. + */ + explicit ParseContext(Parser& parser, ParseFlags flags = ParseFlags(0)); + virtual ~ParseContext(); + + /** Feed some data to the ParseContext. + * The data need not be valid UTF-8; an error will be signalled if it's + * invalid. The data need not be an entire document; you can feed a document + * into the parser incrementally, via multiple calls to this function. + * Typically, as you receive data from a network connection or file, you feed + * each received chunk of data into this function, aborting the process if an + * error occurs. Once an error is reported, no further data may be fed to the + * ParseContext; all errors are fatal. + * @param text Chunk of text to parse. + * @throw Glib::MarkupError + */ + void parse(const Glib::ustring& text); + + /** Feed some data to the ParseContext. + * The data need not be valid UTF-8; an error will be signalled if it's + * invalid. The data need not be an entire document; you can feed a document + * into the parser incrementally, via multiple calls to this function. + * Typically, as you receive data from a network connection or file, you feed + * each received chunk of data into this function, aborting the process if an + * error occurs. Once an error is reported, no further data may be fed to the + * ParseContext; all errors are fatal. + * @param text_begin Begin of chunk of text to parse. + * @param text_end End of chunk of text to parse. + * @throw Glib::MarkupError + */ + void parse(const char* text_begin, const char* text_end); + + /** Signals to the ParseContext that all data has been fed into the parse + * context with parse(). This method reports an error if the document isn't + * complete, for example if elements are still open. + * @throw Glib::MarkupError + */ + void end_parse(); + + /** Retrieves the name of the currently open element. + * @return The name of the currently open element, or "". + */ + Glib::ustring get_element() const; + + /** Retrieves the current line number. + * Intended for use in error messages; there are no strict semantics for what + * constitutes the "current" line number other than "the best number we could + * come up with for error messages." + */ + int get_line_number() const; + + /** Retrieves the number of the current character on the current line. + * Intended for use in error messages; there are no strict semantics for what + * constitutes the "current" character number other than "the best number we + * could come up with for error messages." + */ + int get_char_number() const; + + Parser* get_parser() { return parser_; } + const Parser* get_parser() const { return parser_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GMarkupParseContext* gobj() { return gobject_; } + const GMarkupParseContext* gobj() const { return gobject_; } +#endif + +private: + Markup::Parser* parser_; + GMarkupParseContext* gobject_; + + // noncopyable + ParseContext(const ParseContext&); + ParseContext& operator=(const ParseContext&); + + static void destroy_notify_callback(void* data); +}; + +} // namespace Markup + +} // namespace Glib + + +#endif /* _GLIBMM_MARKUP_H */ + diff --git a/libs/glibmm2/glibmm/miscutils.cc b/libs/glibmm2/glibmm/miscutils.cc new file mode 100644 index 0000000000..b25318fca7 --- /dev/null +++ b/libs/glibmm2/glibmm/miscutils.cc @@ -0,0 +1,243 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#include +#include +#include + + +namespace Glib +{ + +Glib::ustring get_application_name() +{ + if(const char *const application_name = g_get_application_name()) + { + // Lets be a bit more strict than the original GLib function and ensure + // we always return valid UTF-8. gtkmm coders surely won't expect invalid + // UTF-8 in a Glib::ustring returned by a glibmm function. + + if(g_utf8_validate(application_name, -1, 0)) + return Glib::ustring(application_name); + + char *const appname_utf8 = g_filename_to_utf8(application_name, -1, 0, 0, 0); + g_return_val_if_fail(appname_utf8 != 0, ""); + + return Glib::ustring(ScopedPtr(appname_utf8).get()); + } + + return Glib::ustring(); +} + +void set_application_name(const Glib::ustring& application_name) +{ + g_set_application_name(application_name.c_str()); +} + +std::string get_prgname() +{ + const char *const prgname = g_get_prgname(); + return (prgname) ? std::string(prgname) : std::string(); +} + +void set_prgname(const std::string& prgname) +{ + g_set_prgname(prgname.c_str()); +} + +std::string getenv(const std::string& variable, bool& found) +{ + const char *const value = g_getenv(variable.c_str()); + found = (value != 0); + return (value) ? std::string(value) : std::string(); +} + +std::string getenv(const std::string& variable) +{ + const char *const value = g_getenv(variable.c_str()); + return (value) ? std::string(value) : std::string(); +} + +bool setenv(const std::string& variable, const std::string& value, bool overwrite) +{ + return g_setenv(variable.c_str(), value.c_str(), overwrite); +} + +void unsetenv(const std::string& variable) +{ + g_unsetenv(variable.c_str()); +} + +std::string get_user_name() +{ + return std::string(g_get_user_name()); +} + +std::string get_real_name() +{ + return std::string(g_get_real_name()); +} + +std::string get_home_dir() +{ + return std::string(g_get_home_dir()); +} + +std::string get_tmp_dir() +{ + return std::string(g_get_tmp_dir()); +} + +std::string get_current_dir() +{ + const ScopedPtr buf (g_get_current_dir()); + return std::string(buf.get()); +} + +bool path_is_absolute(const std::string& filename) +{ + return g_path_is_absolute(filename.c_str()); +} + +std::string path_skip_root(const std::string& filename) +{ + // g_path_skip_root() returns a pointer _into_ the argument string, + // or NULL if there was no root component. + + if(const char *const ptr = g_path_skip_root(filename.c_str())) + return std::string(ptr); + else + return std::string(); +} + +std::string path_get_basename(const std::string& filename) +{ + const ScopedPtr buf (g_path_get_basename(filename.c_str())); + return std::string(buf.get()); +} + +std::string path_get_dirname(const std::string& filename) +{ + const ScopedPtr buf (g_path_get_dirname(filename.c_str())); + return std::string(buf.get()); +} + +std::string build_filename(const Glib::ArrayHandle& elements) +{ + return build_path(G_DIR_SEPARATOR_S, elements); +} + +std::string build_filename(const std::string& elem1, const std::string& elem2) +{ + const char *const elements[] = { elem1.c_str(), elem2.c_str(), 0 }; + return build_path(G_DIR_SEPARATOR_S, elements); +} + +/* Yes, this reimplements the functionality of g_build_path() -- because + * it takes a varargs list, and calling it several times would result + * in different behaviour. + */ +std::string build_path(const std::string& separator, const Glib::ArrayHandle& elements) +{ + std::string result; + result.reserve(256); //TODO: Explain why this magic number is useful. murrayc + + const char *const sep = separator.c_str(); + const size_t seplen = separator.length(); + + bool is_first = true; + bool have_leading = false; + const char* single_element = 0; + const char* last_trailing = 0; + + const char *const *const elements_begin = elements.data(); + const char *const *const elements_end = elements_begin + elements.size(); + + for(const char *const * pelement = elements_begin; pelement != elements_end; ++pelement) + { + const char* start = *pelement; + + if(*start == '\0') + continue; // ignore empty elements + + if(seplen != 0) + { + while(strncmp(start, sep, seplen) == 0) + start += seplen; + } + + const char* end = start + strlen(start); + + if(seplen != 0) + { + while(end >= start + seplen && strncmp(end - seplen, sep, seplen) == 0) + end -= seplen; + + last_trailing = end; + + while(last_trailing >= *pelement + seplen && strncmp(last_trailing - seplen, sep, seplen) == 0) + last_trailing -= seplen; + + if(!have_leading) + { + // If the leading and trailing separator strings are in the + // same element and overlap, the result is exactly that element. + // + if(last_trailing <= start) + single_element = *pelement; + + result.append(*pelement, start); + have_leading = true; + } + else + single_element = 0; + } + + if(end == start) + continue; + + if(!is_first) + result += separator; + + result.append(start, end); + is_first = false; + } + + if(single_element) + result = single_element; + else if(last_trailing) + result += last_trailing; + + return result; +} + +std::string find_program_in_path(const std::string& program) +{ + if(char *const buf = g_find_program_in_path(program.c_str())) + return std::string(ScopedPtr(buf).get()); + else + return std::string(); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/miscutils.h b/libs/glibmm2/glibmm/miscutils.h new file mode 100644 index 0000000000..8087add39f --- /dev/null +++ b/libs/glibmm2/glibmm/miscutils.h @@ -0,0 +1,272 @@ +// -*- c++ -*- +#ifndef _GLIBMM_MISCUTILS_H +#define _GLIBMM_MISCUTILS_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +/** @defgroup MiscUtils Miscellaneous Utility Functions + * Miscellaneous Utility Functions -- a selection of portable utility functions. + * @{ + */ + +/** Gets a human-readable name for the application, + * as set by Glib::set_application_name(). + * This name should be localized if possible, and is intended for display to + * the user. Contrast with Glib::get_prgname(), which gets a non-localized + * name. If Glib::set_application_name() has not been called, returns the + * result of Glib::get_prgname() (which may be empty if Glib::set_prgname() + * has also not been called). + * + * @return Human-readable application name. May return "". + */ +Glib::ustring get_application_name(); + +/** Sets a human-readable name for the application. + * This name should be localized if possible, and is intended for display to + * the user. Contrast with Glib::set_prgname(), which sets a non-localized + * name. Glib::set_prgname() will be called automatically by + * gtk_init(), but Glib::set_application_name() will not. + * + * Note that for thread safety reasons, this function can only be called once. + * + * The application name will be used in contexts such as error messages, + * or when displaying an application's name in the task list. + * + * @param application_name Localized name of the application. + */ +void set_application_name(const Glib::ustring& application_name); + +/** Gets the name of the program. + * If you are using GDK or GTK+ the program name is set in gdk_init(), + * which is called by gtk_init(). The program name is found by taking + * the last component of argv[0]. + * @return The name of the program. + */ +std::string get_prgname(); + +/** Sets the name of the program. + * @param prgname The name of the program. + */ +void set_prgname(const std::string& prgname); + +/** Returns the value of an environment variable. The name and value + * are in the GLib file name encoding. On Unix, this means the actual + * bytes which might or might not be in some consistent character set + * and encoding. On Windows, it is in UTF-8. On Windows, in case the + * environment variable's value contains references to other + * environment variables, they are expanded. + * + * @param variable The environment variable to get. + * @retval found true Whether the environment variable has been found. + * @return The value of the environment variable, or "" if not found. + */ +std::string getenv(const std::string& variable, bool& found); + +/** Returns the value of an environment variable. The name and value + * are in the GLib file name encoding. On Unix, this means the actual + * bytes which might or might not be in some consistent character set + * and encoding. On Windows, it is in UTF-8. On Windows, in case the + * environment variable's value contains references to other + * environment variables, they are expanded. + * + * @param variable The environment variable to get. + * @return The value of the environment variable, or "" if not found. + */ +std::string getenv(const std::string& variable); + + +/** Sets an environment variable. Both the variable's name and value + * should be in the GLib file name encoding. On Unix, this means that + * they can be any sequence of bytes. On Windows, they should be in + * UTF-8. + * + * Note that on some systems, when variables are overwritten, the memory + * used for the previous variables and its value isn't reclaimed. + * + * @param variable The environment variable to set. It must not contain '='. + * @param value The value to which the variable should be set. + * @param overwrite Whether to change the variable if it already exists. + * @result false if the environment variable couldn't be set. + */ +bool setenv(const std::string& variable, const std::string& value, bool overwrite = true); + +/** Removes an environment variable from the environment. + * + * Note that on some systems, when variables are overwritten, the memory + * used for the previous variables and its value isn't reclaimed. + * Furthermore, this function can't be guaranteed to operate in a + * threadsafe way. + * + * @param variable: the environment variable to remove. It must not contain '='. + **/ +void unsetenv(const std::string& variable); + +/** Gets the user name of the current user. + * @return The name of the current user. + */ +std::string get_user_name(); + +/** Gets the real name of the user. + * This usually comes from the user's entry in the passwd file. + * @return The user's real name. + */ +std::string get_real_name(); + +/** Gets the current user's home directory. + * @return The current user's home directory. + */ +std::string get_home_dir(); + +/** Gets the directory to use for temporary files. + * This is found from inspecting the environment variables TMPDIR, + * TMP, and TEMP in that order. If none of those are defined + * "/tmp" is returned on UNIX and "C:\\" on Windows. + * @return The directory to use for temporary files. + */ +std::string get_tmp_dir(); + +/** Gets the current directory. + * @return The current directory. + */ +std::string get_current_dir(); + +/** Returns @c true if the given @a filename is an absolute file name, i.e.\ it + * contains a full path from the root directory such as "/usr/local" + * on UNIX or "C:\\windows" on Windows systems. + * @param filename A file name. + * @return Whether @a filename is an absolute path. + */ +bool path_is_absolute(const std::string& filename); + +/** Returns the remaining part of @a filename after the root component, + * i.e.\ after the "/" on UNIX or "C:\\" on Windows. + * If @a filename is not an absolute path, "" will be returned. + * @param filename A file name. + * @return The file name without the root component, or "". + */ +std::string path_skip_root(const std::string& filename); + +/** Gets the name of the file without any leading directory components. + * @param filename The name of the file. + * @return The name of the file without any leading directory components. + */ +std::string path_get_basename(const std::string& filename); + +/** Gets the directory components of a file name. + * If the file name has no directory components "." is returned. + * @param filename The name of the file. + * @return The directory components of the file. + */ +std::string path_get_dirname(const std::string& filename); + +/** Creates a filename from a series of elements using the correct + * separator for filenames. + * This function behaves identically to Glib::build_path(G_DIR_SEPARATOR_S, + * elements). No attempt is made to force the resulting filename to be an + * absolute path. If the first element is a relative path, the result will + * be a relative path. + * @param elements A container holding the elements of the path to build. + * Any STL compatible container type is accepted. + * @return The resulting path. + */ +std::string build_filename(const Glib::ArrayHandle& elements); + +/** Creates a filename from two elements using the correct separator for filenames. + * No attempt is made to force the resulting filename to be an absolute path. + * If the first element is a relative path, the result will be a relative path. + * @param elem1 First path element. + * @param elem2 Second path element. + * @return The resulting path. + */ +std::string build_filename(const std::string& elem1, const std::string& elem2); + +/** Creates a path from a series of elements using @a separator as the + * separator between elements. + * + * At the boundary between two elements, any trailing occurrences of + * @a separator in the first element, or leading occurrences of @a separator + * in the second element are removed and exactly one copy of the separator is + * inserted. + * + * Empty elements are ignored. + * + * The number of leading copies of the separator on the result is + * the same as the number of leading copies of the separator on + * the first non-empty element. + * + * The number of trailing copies of the separator on the result is the same + * as the number of trailing copies of the separator on the last non-empty + * element. (Determination of the number of trailing copies is done without + * stripping leading copies, so if the separator is "ABA", + * "ABABA" has 1 trailing copy.) + * + * However, if there is only a single non-empty element, and there + * are no characters in that element not part of the leading or + * trailing separators, then the result is exactly the original value + * of that element. + * + * Other than for determination of the number of leading and trailing + * copies of the separator, elements consisting only of copies + * of the separator are ignored. + * + * @param separator A string used to separate the elements of the path. + * @param elements A container holding the elements of the path to build. + * Any STL compatible container type is accepted. + * @return The resulting path. + */ +std::string build_path(const std::string& separator, + const Glib::ArrayHandle& elements); + +/** Locates the first executable named @a program in the user's path, in the + * same way that execvp() would locate it. + * Returns a string with the absolute path name, or "" if the program + * is not found in the path. If @a program is already an absolute path, + * returns a copy of @a program if @a program exists and is executable, and + * "" otherwise. + * + * On Windows, if @a program does not have a file type suffix, tries to append + * the suffixes in the PATHEXT environment variable (if that doesn't + * exist, the suffixes .com, .exe, and .bat) in turn, and then look for the + * resulting file name in the same way as CreateProcess() would. This means + * first in the directory where the program was loaded from, then in the + * current directory, then in the Windows 32-bit system directory, then in the + * Windows directory, and finally in the directories in the PATH + * environment variable. If the program is found, the return value contains + * the full name including the type suffix. + * + * @param program A program name. + * @return An absolute path, or "". + */ +std::string find_program_in_path(const std::string& program); + +/** @} group MiscUtils */ + +} // namespace Glib + + +#endif /* _GLIBMM_FILEUTILS_H */ + diff --git a/libs/glibmm2/glibmm/module.cc b/libs/glibmm2/glibmm/module.cc new file mode 100644 index 0000000000..3bc621ff73 --- /dev/null +++ b/libs/glibmm2/glibmm/module.cc @@ -0,0 +1,93 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Glib +{ + +Module::Module(const std::string& file_name, ModuleFlags flags) +: + gobject_ (g_module_open(file_name.c_str(), (GModuleFlags) flags)) +{} + +Module::~Module() +{ + if(gobject_) + g_module_close(gobject_); +} + +Module::operator bool() const +{ + return (gobject_ != 0); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + + +bool Module::get_supported() +{ + return g_module_supported(); +} + +void Module::make_resident() +{ + g_module_make_resident(gobj()); +} + +std::string Module::get_last_error() +{ + return Glib::convert_const_gchar_ptr_to_stdstring(g_module_error()); +} + +bool Module::get_symbol(const std::string& symbol_name, void*& symbol) const +{ + return g_module_symbol(const_cast(gobj()), symbol_name.c_str(), &(symbol)); +} + +std::string Module::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_stdstring(g_module_name(const_cast(gobj()))); +} + +std::string Module::build_path(const std::string& directory, const std::string& module_name) +{ + return Glib::convert_return_gchar_ptr_to_stdstring(g_module_build_path(directory.c_str(), module_name.c_str())); +} + + +} // namespace Glib + + diff --git a/libs/glibmm2/glibmm/module.h b/libs/glibmm2/glibmm/module.h new file mode 100644 index 0000000000..0c73bc9a81 --- /dev/null +++ b/libs/glibmm2/glibmm/module.h @@ -0,0 +1,221 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_MODULE_H +#define _GLIBMM_MODULE_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +GLIBMM_USING_STD(string) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GModule GModule; } +#endif + + +namespace Glib +{ + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** + * @ingroup glibmmEnums + * @par Bitwise operators: + * %ModuleFlags operator|(ModuleFlags, ModuleFlags)
+ * %ModuleFlags operator&(ModuleFlags, ModuleFlags)
+ * %ModuleFlags operator^(ModuleFlags, ModuleFlags)
+ * %ModuleFlags operator~(ModuleFlags)
+ * %ModuleFlags& operator|=(ModuleFlags&, ModuleFlags)
+ * %ModuleFlags& operator&=(ModuleFlags&, ModuleFlags)
+ * %ModuleFlags& operator^=(ModuleFlags&, ModuleFlags)
+ */ +enum ModuleFlags +{ + MODULE_BIND_LAZY = 1 << 0, + MODULE_BIND_MASK = 0x01 +}; + +/** @ingroup glibmmEnums */ +inline ModuleFlags operator|(ModuleFlags lhs, ModuleFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline ModuleFlags operator&(ModuleFlags lhs, ModuleFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline ModuleFlags operator^(ModuleFlags lhs, ModuleFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline ModuleFlags operator~(ModuleFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup glibmmEnums */ +inline ModuleFlags& operator|=(ModuleFlags& lhs, ModuleFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline ModuleFlags& operator&=(ModuleFlags& lhs, ModuleFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline ModuleFlags& operator^=(ModuleFlags& lhs, ModuleFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +//TODO: Replace get_last_error() with exceptions? +//Provide operator()? + +/** Dynamic Loading of Modules + * These functions provide a portable way to dynamically load object + * files (commonly known as 'plug-ins'). The current implementation + * supports all systems that provide an implementation of dlopen() + * (e.g. Linux/Sun), as well as HP-UX via its shl_load() mechanism, + * and Windows platforms via DLLs. + */ +class Module +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Module CppObjectType; + typedef GModule BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + + /** Opens a module. + * + * First of all it tries to open file_name as a module. If that + * fails and file_name has the ".la"-suffix (and is a libtool + * archive) it tries to open the corresponding module. If that fails + * and it doesn't have the proper module suffix for the platform + * (G_MODULE_SUFFIX), this suffix will be appended and the + * corresponding module will be opended. If that fails and file_name + * doesn't have the ".la"-suffix, this suffix is appended and + * it tries to open the corresponding module. + * + * Use operator bool() to see whether the operation succeeded. For instance, + * @code + * Glib::Module module("plugins/helloworld"); + * if(module) + * { + * void* func = 0; + * bool found = get_symbol("some_function", func); + * } + * @endcode + * + * @param file_name The library filename to open + * @param flags Flags to configure the load process + */ + explicit Module(const std::string& file_name, ModuleFlags flags = ModuleFlags(0)); + + /** Close a module. The module will be removed from memory, unless + * make_resident has been called. + */ + virtual ~Module(); + + /** Check whether the module was found. + */ + operator bool() const; + + /** Checks if modules are supported on the current platform. + * @returns true if available, false otherwise + */ + + static bool get_supported(); + + /** Ensures that a module will never be unloaded. Any calls to the + * Glib::Module destructor will not unload the module. + */ + + void make_resident(); + + /** Gets a string describing the last module error. + * @returns The error string + */ + + static std::string get_last_error(); + + /** Gets a symbol pointer from the module. + * @param symbol_name The name of the symbol to lookup + * @param symbol A pointer to set to the symbol + * @returns True if the symbol was found, false otherwise. + */ + + bool get_symbol(const std::string& symbol_name, void*& symbol) const; + + /** Get the name of the module. + * @returns The name of the module + */ + + std::string get_name() const; + + /** A portable way to build the filename of a module. The + * platform-specific prefix and suffix are added to the filename, if + * needed, and the result is added to the directory, using the + * correct separator character. + * + * The directory should specify the directory where the module can + * be found. It can be an empty string to indicate that the + * module is in a standard platform-specific directory, though this + * is not recommended since the wrong module may be found. + * + * For example, calling g_module_build_path() on a Linux + * system with a directory of /lib and a module_name of + * "mylibrary" will return /lib/libmylibrary.so. On a + * Windows system, using \\Windows as the directory it will + * return \\Windows\\mylibrary.dll. + * + * @param directory The directory the module is in + * @param module_name The name of the module + * @returns The system-specific filename of the module + */ + // TODO: add an override which doesn't take a directory + // TODO: check what happens when directory is "" + + static std::string build_path(const std::string& directory, const std::string& module_name); + + GModule* gobj() { return gobject_; } + const GModule* gobj() const { return gobject_; } + +protected: + GModule* gobject_; + +private: + // noncopyable + Module(const Module&); + Module& operator=(const Module&); + + +}; + +} // namespace Glib + + +#endif /* _GLIBMM_MODULE_H */ + diff --git a/libs/glibmm2/glibmm/object.cc b/libs/glibmm2/glibmm/object.cc new file mode 100644 index 0000000000..007002b779 --- /dev/null +++ b/libs/glibmm2/glibmm/object.cc @@ -0,0 +1,312 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +#include +#include +#include + +#include + +#include + +//Weak references: +//I'm not sure what the point of these are apart from being a hacky way out of circular references, +//but maybe we could make it easier to use them by making a Java Reference Object -style class like so: +// Glib::WeakRef weakrefSomeObject(object1); +// ... +// if(weakrefSomeObject->isStillAlive()) +// { +// weakrefSomeObject->some_method(); +// } +// else +// { +// //Deal with it, maybe recreating the object. +// } +// +// Without this, the coder has to define his own signal handler which sets his own isStillAlive boolean. +// weakrefSomeObject<> could still have its own signal_destroyed signal so that coders can choose to deal +// with the destruction as soon as it happens instead of just checking later before they try to use it. + + +namespace Glib +{ + +ConstructParams::ConstructParams(const Glib::Class& glibmm_class_) +: + glibmm_class (glibmm_class_), + n_parameters (0), + parameters (0) +{} + +/* The implementation is mostly copied from gobject.c, with some minor tweaks. + * Basically, it looks up each property name to get its GType, and then uses + * G_VALUE_COLLECT() to store the varargs argument in a GValue of the correct + * type. + */ +ConstructParams::ConstructParams(const Glib::Class& glibmm_class_, + const char* first_property_name, ...) +: + glibmm_class (glibmm_class_), + n_parameters (0), + parameters (0) +{ + va_list var_args; + va_start(var_args, first_property_name); + + GObjectClass *const g_class = + static_cast(g_type_class_ref(glibmm_class.get_type())); + + unsigned int n_alloced_params = 0; + char* collect_error = 0; // output argument of G_VALUE_COLLECT() + + for(const char* name = first_property_name; + name != 0; + name = va_arg(var_args, char*)) + { + GParamSpec *const pspec = g_object_class_find_property(g_class, name); + + if(!pspec) + { + g_warning("Glib::ConstructParams::ConstructParams(): " + "object class `%s' has no property named `%s'", + g_type_name(glibmm_class.get_type()), name); + break; + } + + if(n_parameters >= n_alloced_params) + parameters = g_renew(GParameter, parameters, n_alloced_params += 8); + + GParameter& param = parameters[n_parameters]; + + param.name = name; + param.value.g_type = 0; + + // Fill the GValue with the current vararg, and move on to the next one. + g_value_init(¶m.value, G_PARAM_SPEC_VALUE_TYPE(pspec)); + G_VALUE_COLLECT(¶m.value, var_args, 0, &collect_error); + + if(collect_error) + { + g_warning("Glib::ConstructParams::ConstructParams(): %s", collect_error); + g_free(collect_error); + g_value_unset(¶m.value); + break; + } + + ++n_parameters; + } + + g_type_class_unref(g_class); + + va_end(var_args); +} + +ConstructParams::~ConstructParams() +{ + while(n_parameters > 0) + g_value_unset(¶meters[--n_parameters].value); + + g_free(parameters); +} + +/* + * Some compilers require the existance of a copy constructor in certain + * usage contexts. This implementation is fully functional, but unlikely + * to be ever actually called due to optimization. + */ +ConstructParams::ConstructParams(const ConstructParams& other) +: + glibmm_class (other.glibmm_class), + n_parameters (other.n_parameters), + parameters (g_new(GParameter, n_parameters)) +{ + for(unsigned int i = 0; i < n_parameters; ++i) + { + parameters[i].name = other.parameters[i].name; + parameters[i].value.g_type = 0; + + g_value_init(¶meters[i].value, G_VALUE_TYPE(&other.parameters[i].value)); + g_value_copy(&other.parameters[i].value, ¶meters[i].value); + } +} + + +/**** Glib::Object_Class ***************************************************/ + +const Glib::Class& Object_Class::init() +{ + if(!gtype_) + { + class_init_func_ = &Object_Class::class_init_function; + register_derived_type(G_TYPE_OBJECT); + } + + return *this; +} + +void Object_Class::class_init_function(void*, void*) +{} + +Object* Object_Class::wrap_new(GObject* object) +{ + return new Object(object); +} + + +/**** Glib::Object *********************************************************/ + +// static data +Object::CppClassType Object::object_class_; + +Object::Object() +{ + // This constructor is ONLY for derived classes that are NOT wrappers of + // derived C objects. For instance, Gtk::Object should NOT use this + // constructor. + + //g_warning("Object::Object(): Did you really mean to call this?"); + + // If Glib::ObjectBase has been constructed with a custom typeid, we derive + // a new GType on the fly. This works because ObjectBase is a virtual base + // class, therefore its constructor is always executed first. + + GType object_type = G_TYPE_OBJECT; // the default -- not very useful + + if(custom_type_name_ && !is_anonymous_custom_()) + { + object_class_.init(); + object_type = object_class_.clone_custom_type(custom_type_name_); //A type that is derived from GObject. + } + + // Create a new GObject with the specified array of construct properties. + // This works with custom types too, since those inherit the properties of + // their base class. + + void *const new_object = g_object_newv(object_type, 0, 0); + + // Connect the GObject and Glib::Object instances. + ObjectBase::initialize(static_cast(new_object)); + +} + +Object::Object(const Glib::ConstructParams& construct_params) +{ + GType object_type = construct_params.glibmm_class.get_type(); + + // If Glib::ObjectBase has been constructed with a custom typeid, we derive + // a new GType on the fly. This works because ObjectBase is a virtual base + // class, therefore its constructor is always executed first. + + if(custom_type_name_ && !is_anonymous_custom_()) + object_type = construct_params.glibmm_class.clone_custom_type(custom_type_name_); + + // Create a new GObject with the specified array of construct properties. + // This works with custom types too, since those inherit the properties of + // their base class. + + void *const new_object = g_object_newv( + object_type, construct_params.n_parameters, construct_params.parameters); + + // Connect the GObject and Glib::Object instances. + ObjectBase::initialize(static_cast(new_object)); +} + +Object::Object(GObject* castitem) +{ + //I disabled this check because libglademm really does need to do this. + //(actually it tells libglade to instantiate "gtkmm_" types. + //The 2nd instance bug will be caught elsewhere anyway. +/* + static const char gtkmm_prefix[] = "gtkmm__"; + const char *const type_name = G_OBJECT_TYPE_NAME(castitem); + + if(strncmp(type_name, gtkmm_prefix, sizeof(gtkmm_prefix) - 1) == 0) + { + g_warning("Glib::Object::Object(GObject*): " + "An object of type '%s' was created directly via g_object_new(). " + "The Object::Object(const Glib::ConstructParams&) constructor " + "should be used instead.\n" + "This could happen if the C instance lived longer than the C++ instance, so that " + "a second C++ instance was created automatically to wrap it. That would be a gtkmm bug that you should report.", + type_name); + } +*/ + + // Connect the GObject and Glib::Object instances. + ObjectBase::initialize(castitem); +} + +Object::~Object() +{ + cpp_destruction_in_progress_ = true; +} + +/* +RefPtr Object::create() +{ + // Derived classes will actually return RefPtr<>s that contain useful instances. + return RefPtr(); +} +*/ + +GType Object::get_type() +{ + return object_class_.init().get_type(); +} + +GType Object::get_base_type() +{ + return G_TYPE_OBJECT; +} + +// Data services +void* Object::get_data(const QueryQuark& id) +{ + return g_object_get_qdata(gobj(),id); +} + +void Object::set_data(const Quark& id, void* data) +{ + g_object_set_qdata(gobj(),id,data); +} + +void Object::set_data(const Quark& id, void* data, DestroyNotify destroy) +{ + g_object_set_qdata_full(gobj(), id, data, destroy); +} + +void Object::remove_data(const QueryQuark& id) +{ + // missing in glib?? + g_return_if_fail(id.id() > 0); + g_datalist_id_remove_data(&gobj()->qdata, id); +} + +void* Object::steal_data(const QueryQuark& id) +{ + return g_object_steal_qdata(gobj(), id); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/object.h b/libs/glibmm2/glibmm/object.h new file mode 100644 index 0000000000..3f196f9cc5 --- /dev/null +++ b/libs/glibmm2/glibmm/object.h @@ -0,0 +1,282 @@ +// -*- c++ -*- +#ifndef _GLIBMM_OBJECT_H +#define _GLIBMM_OBJECT_H +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include /* Could be private, but that would be tedious. */ +#include //Because its specializations may be here. +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ +typedef struct _GObject GObject; +typedef struct _GObjectClass GObjectClass; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +class Class; +class Object_Class; +class GSigConnectionNode; + +/* ConstructParams::ConstructParams() takes a varargs list of properties + * and values, like g_object_new() does. This list will then be converted + * to a GParameter array, for use with g_object_newv(). No overhead is + * involved, since g_object_new() is just a wrapper around g_object_newv() + * as well. + * + * The advantage of an auxilary ConstructParams object over g_object_new() + * is that the actual construction is always done in the Glib::Object ctor. + * This allows for neat tricks like easy creation of derived custom types, + * without adding special support to each ctor of every class. + * + * The comments in object.cc and objectbase.cc should explain in detail + * how this works. + */ +class ConstructParams +{ +public: + const Glib::Class& glibmm_class; + unsigned int n_parameters; + GParameter* parameters; + + explicit ConstructParams(const Glib::Class& glibmm_class_); + ConstructParams(const Glib::Class& glibmm_class_, const char* first_property_name, ...); + ~ConstructParams(); + + // This is only used by the C++ compiler (since g++ 3.4) to create temporary instances. + // Apparently the compiler will actually optimize away the use of this. + // See bug #132300. + ConstructParams(const ConstructParams& other); + +private: + // noncopyable + ConstructParams& operator=(const ConstructParams&); +}; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +class Object : virtual public ObjectBase +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Object CppObjectType; + typedef Object_Class CppClassType; + typedef GObject BaseObjectType; + typedef GObjectClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +protected: + Object(); //For use by C++-only sub-types. + explicit Object(const Glib::ConstructParams& construct_params); + explicit Object(GObject* castitem); + virtual ~Object(); //It should only be deleted by the callback. + +public: + //static RefPtr create(); //You must reimplement this in each derived class. + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + //GObject* gobj_copy(); //Give a ref-ed copy to someone. Use for direct struct access. + + // Glib::Objects contain a list > + // to store run time data added to the object at run time. + //TODO: Use slots instead: + void* get_data(const QueryQuark &key); + void set_data(const Quark &key, void* data); + typedef void (*DestroyNotify) (gpointer data); + void set_data(const Quark &key, void* data, DestroyNotify notify); + void remove_data(const QueryQuark& quark); + // same as remove without notifying + void* steal_data(const QueryQuark& quark); + + // convenience functions + //template + //void set_data_typed(const Quark& quark, const T& data) + // { set_data(quark, new T(data), delete_typed); } + + //template + //T& get_data_typed(const QueryQuark& quark) + // { return *static_cast(get_data(quark)); } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Glib::Object_Class; + static CppClassType object_class_; + + // noncopyable + Object(const Object&); + Object& operator=(const Object&); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + // Glib::Object can not be dynamic because it lacks a float state. + //virtual void set_manage(); +}; + + +//For some (proably, more spec-compliant) compilers, these specializations must +//be next to the objects that they use. +#ifndef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION +#ifndef DOXYGEN_SHOULD_SKIP_THIS /* hide the specializations */ + +namespace Container_Helpers +{ + +/** Partial specialization for pointers to GObject instances. + * @ingroup ContHelpers + * The C++ type is always a Glib::RefPtr<>. + */ +template +struct TypeTraits< Glib::RefPtr > +{ + typedef Glib::RefPtr CppType; + typedef typename T::BaseObjectType * CType; + typedef typename T::BaseObjectType * CTypeNonConst; + + static CType to_c_type (const CppType& ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) + { + //return Glib::wrap(ptr, true); + + //We copy/paste the wrap() implementation here, + //because we can not use a specific Glib::wrap(CType) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = (GObject*)const_cast(ptr); + return Glib::RefPtr( dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */)) ); + //We use dynamic_cast<> in case of multiple inheritance. + } + + static void release_c_type (CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(0, ptr); + g_object_unref(ptr); + } +}; + +//This confuse the SUN Forte compiler, so we ifdef it out: +#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +/** Partial specialization for pointers to const GObject instances. + * @ingroup ContHelpers + * The C++ type is always a Glib::RefPtr<>. + */ +template +struct TypeTraits< Glib::RefPtr > +{ + typedef Glib::RefPtr CppType; + typedef const typename T::BaseObjectType * CType; + typedef typename T::BaseObjectType * CTypeNonConst; + + static CType to_c_type (const CppType& ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) + { + //return Glib::wrap(ptr, true); + + //We copy/paste the wrap() implementation here, + //because we can not use a specific Glib::wrap(CType) overload here, + //because that would be "dependent", and g++ 3.4 does not allow that. + //The specific Glib::wrap() overloads don't do anything special anyway. + GObject* cobj = (GObject*)(ptr); + return Glib::RefPtr( dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */)) ); + //We use dynamic_cast<> in case of multiple inheritance. + } + + static void release_c_type (CType ptr) + { + GLIBMM_DEBUG_UNREFERENCE(0, ptr); + g_object_unref(const_cast(ptr)); + } +}; + +#endif //GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +} //namespace Container_Helpers + + +template inline +PtrT Value_Pointer::get_(Glib::Object*) const +{ + return dynamic_cast(get_object()); +} + + +/** Partial specialization for RefPtr<> to Glib::Object. + * @ingroup glibmmValue + */ +template +class Value< Glib::RefPtr > : public ValueBase_Object +{ +public: + typedef Glib::RefPtr CppType; + typedef typename T::BaseObjectType* CType; + + static GType value_type() { return T::get_base_type(); } + + void set(const CppType& data) { set_object(data.operator->()); } + CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } +}; + +//The SUN Forte Compiler has a problem with this: +#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +/** Partial specialization for RefPtr<> to const Glib::Object. + * @ingroup glibmmValue + */ +template +class Value< Glib::RefPtr > : public ValueBase_Object +{ +public: + typedef Glib::RefPtr CppType; + typedef typename T::BaseObjectType* CType; + + static GType value_type() { return T::get_base_type(); } + + void set(const CppType& data) { set_object(const_cast(data.operator->())); } + CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } +}; +#endif //GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + + +#endif //DOXYGEN_SHOULD_SKIP_THIS +#endif //GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + +} // namespace Glib + +#endif /* _GLIBMM_OBJECT_H */ + diff --git a/libs/glibmm2/glibmm/objectbase.cc b/libs/glibmm2/glibmm/objectbase.cc new file mode 100644 index 0000000000..1bb14e79fd --- /dev/null +++ b/libs/glibmm2/glibmm/objectbase.cc @@ -0,0 +1,271 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#include +#include + + +namespace +{ + +// Used by the Glib::ObjectBase default ctor. Using an explicitly defined +// char array rather than a string literal allows for fast pointer comparison, +// which is otherwise not guaranteed to work. + +const char anonymous_custom_type_name[] = "gtkmm__anonymous_custom_type"; + +} // anonymous namespace + + +namespace Glib +{ + +/**** Glib::ObjectBase *****************************************************/ + +ObjectBase::ObjectBase() +: + gobject_ (0), + custom_type_name_ (anonymous_custom_type_name), + cpp_destruction_in_progress_ (false) +{} + +ObjectBase::ObjectBase(const char* custom_type_name) +: + gobject_ (0), + custom_type_name_ (custom_type_name), + cpp_destruction_in_progress_ (false) +{} + +ObjectBase::ObjectBase(const std::type_info& custom_type_info) +: + gobject_ (0), + custom_type_name_ (custom_type_info.name()), + cpp_destruction_in_progress_ (false) +{} + +// initialize() actually initializes the wrapper. Glib::ObjectBase is used +// as virtual base class, which means the most-derived class' ctor invokes +// the Glib::ObjectBase ctor -- thus it's useless for Glib::Object. +// +void ObjectBase::initialize(GObject* castitem) +{ + if(gobject_) + { + // initialize() might be called twice when used with MI, e.g. by the ctors + // of Glib::Object and Glib::Interface. However, they must both refer to + // the same underlying GObject instance. + // + g_assert(gobject_ == castitem); + + // TODO: Think about it. Will this really be called twice? + g_printerr("ObjectBase::initialize() called twice for the same GObject\n"); + + return; // Don't initialize the wrapper twice. + } + + //g_print("%s : %s\n", G_GNUC_PRETTY_FUNCTION, G_OBJECT_TYPE_NAME(castitem)); + + gobject_ = castitem; + _set_current_wrapper(castitem); +} + +ObjectBase::~ObjectBase() +{ + // Normally, gobject_ should always be 0 at this point, because: + // + // a) Gtk::Object handles memory management on its own and always resets + // the gobject_ pointer in its destructor. + // + // b) Glib::Object instances that aren't Gtk::Objects will always be + // deleted by the destroy_notify_() virtual method. Calling delete + // on a Glib::Object is a programming error. + // + // The *only* situation where gobject_ is validly not 0 at this point + // happens if a derived class's ctor throws an exception. In that case + // we have to call g_object_unref() on our own. + // + if(GObject *const gobject = gobject_) + { +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("(Glib::ObjectBase::~ObjectBase): gobject_ = %p", (void*) gobject_); +#endif + + gobject_ = 0; + +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("(Glib::ObjectBase::~ObjectBase): before g_object_steal_qdata()"); +#endif + + // Remove the pointer to the wrapper from the underlying instance. + // This does _not_ cause invocation of the destroy_notify callback. + g_object_steal_qdata(gobject, quark_); + +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("(Glib::ObjectBase::~ObjectBase): calling g_object_unref()"); +#endif + + g_object_unref(gobject); + } +} + +void ObjectBase::reference() const +{ + GLIBMM_DEBUG_REFERENCE(this, gobject_); + g_object_ref(gobject_); +} + +void ObjectBase::unreference() const +{ + GLIBMM_DEBUG_UNREFERENCE(this, gobject_); + g_object_unref(gobject_); +} + +GObject* ObjectBase::gobj_copy() const +{ + reference(); + return gobject_; +} + +void ObjectBase::_set_current_wrapper(GObject* object) +{ + // Store a pointer to this wrapper in the underlying instance, so that we + // never create a second wrapper for the same underlying instance. Also, + // specify a callback that will tell us when it's time to delete this C++ + // wrapper instance: + + if(object) + { + if(!g_object_get_qdata(object, Glib::quark_)) + { + g_object_set_qdata_full(object, Glib::quark_, this, &destroy_notify_callback_); + } + else + { + g_warning("This object, of type %s, already has a wrapper.\n" + "You should use wrap() instead of a constructor.", + G_OBJECT_TYPE_NAME(object)); + } + } +} + +// static +ObjectBase* ObjectBase::_get_current_wrapper(GObject* object) +{ + if(object) + return static_cast(g_object_get_qdata(object, Glib::quark_)); + else + return 0; +} + +// static +void ObjectBase::destroy_notify_callback_(void* data) +{ + //GLIBMM_LIFECYCLE + + // This method is called (indirectly) from g_object_run_dispose(). + // Get the C++ instance associated with the C instance: + ObjectBase* cppObject = static_cast(data); //Previously set with g_object_set_qdata_full(). + +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("ObjectBase::destroy_notify_callback_: cppObject = %p, gobject_ = %p, gtypename = %s", + (void*) cppObject, (void*) cppObject->gobject_, cppObject->gobject_); +#endif + + if(cppObject) //This will be 0 if the C++ destructor has already run. + { + cppObject->destroy_notify_(); //Virtual - it does different things for GObject and GtkObject. + } +} + +void ObjectBase::destroy_notify_() +{ + // The C instance is about to be disposed, making it unusable. Now is a + // good time to delete the C++ wrapper of the C instance. There is no way + // to force the disposal of the GObject (though GtkObject has + // gtk_object_destroy()), So this is the *only* place where we delete the + // C++ wrapper. + // + // This will only happen after the last unreference(), which will be done by + // the RefPtr<> destructor. There should be no way to access the wrapper or + // the undobjecterlying instance after that, so it's OK to delete this. + +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("Glib::ObjectBase::destroy_notify_: gobject_ = %p", (void*) gobject_); +#endif + + gobject_ = 0; // Make sure we don't unref it again in the dtor. + + delete this; +} + +bool ObjectBase::is_anonymous_custom_() const +{ + // Doing high-speed pointer comparison is OK here. + return (custom_type_name_ == anonymous_custom_type_name); +} + +bool ObjectBase::is_derived_() const +{ + // gtkmmproc-generated classes initialize this to 0 by default. + return (custom_type_name_ != 0); +} + +void ObjectBase::set_manage() +{ + // This is a private method and Gtk::manage() is a template function. + // Thus this will probably never run, unless you do something like: + // + // manage(static_cast(refptr.operator->())); + + g_error("Glib::ObjectBase::set_manage(): " + "only Gtk::Object instances can be managed"); +} + +bool ObjectBase::_cpp_destruction_is_in_progress() const +{ + return cpp_destruction_in_progress_; +} + +void ObjectBase::set_property_value(const Glib::ustring& property_name, const Glib::ValueBase& value) +{ + g_object_set_property(gobj(), property_name.c_str(), value.gobj()); +} + +void ObjectBase::get_property_value(const Glib::ustring& property_name, Glib::ValueBase& value) const +{ + g_object_get_property(const_cast(gobj()), property_name.c_str(), value.gobj()); +} + + +bool _gobject_cppinstance_already_deleted(GObject* gobject) +{ + //This function is used to prevent calling wrap() on a GTK+ instance whose gtkmm instance has been deleted. + + if(gobject) + return (bool)g_object_get_qdata(gobject, Glib::quark_cpp_wrapper_deleted_); //true means that something is odd. + else + return false; //Nothing is particularly wrong. +} + + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/objectbase.h b/libs/glibmm2/glibmm/objectbase.h new file mode 100644 index 0000000000..bddfdcf6ca --- /dev/null +++ b/libs/glibmm2/glibmm/objectbase.h @@ -0,0 +1,171 @@ +// -*- c++ -*- +#ifndef _GLIBMM_OBJECTBASE_H +#define _GLIBMM_OBJECTBASE_H + +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + +GLIBMM_USING_STD(type_info) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GObject GObject; } +#endif + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +class GSigConnectionNode; +#endif + +//This inherits virtually from sigc::trackable so that people can multiply inherit glibmm classes from other sigc::trackable-derived classes. +//See bugzilla.gnome.org bug # 116280 +class ObjectBase : virtual public sigc::trackable +{ +protected: + // Glib::ObjectBase is used as virtual base class. This means the ObjectBase + // ctor runs before all others -- either implicitly or explicitly. Each of + // the available ctors initializes custom_type_name_ in a different way: + // + // 1) default: custom_type_name_ = "gtkmm__anonymous_custom_type" + // 2) const char*: custom_type_name_ = custom_type_name + // 3) type_info: custom_type_name_ = custom_type_info.name() + // + // All classes generated by gtkmmproc use ctor 2) with custom_type_name = 0, + // which essentially means it's not a custom type. This is used to optimize + // vfunc and signal handler callbacks -- since the C++ virtual methods are + // not overridden, invocation can be skipped. + // + // The default ctor 1) is called implicitly from the ctor of user-derived + // classes -- yes, even if e.g. Gtk::Button calls ctor 2), a derived ctor + // always overrides this choice. The language itself ensures that the ctor + // is only invoked once. + // + // Ctor 3) is a special feature to allow creation of derived types on the + // fly, without having to use g_object_new() manually. This feature is + // sometimes necessary, e.g. to implement a custom Gtk::CellRenderer. The + // neat trick with the virtual base class ctor makes it possible to reuse + // the same direct base class' ctor as with non-custom types. + + ObjectBase(); + explicit ObjectBase(const char* custom_type_name); + explicit ObjectBase(const std::type_info& custom_type_info); + + virtual ~ObjectBase() = 0; + + // Called by Glib::Object and Glib::Interface constructors. See comments there. + void initialize(GObject* castitem); + +public: + + /// You probably want to use a specific property_*() accessor method instead. + void set_property_value(const Glib::ustring& property_name, const Glib::ValueBase& value); + + /// You probably want to use a specific property_*() accessor method instead. + void get_property_value(const Glib::ustring& property_name, Glib::ValueBase& value) const; + + /// You probably want to use a specific property_*() accessor method instead. + template + void set_property(const Glib::ustring& property_name, const PropertyType& value); + + /// You probably want to use a specific property_*() accessor method instead. + template + void get_property(const Glib::ustring& property_name, PropertyType& value) const; + + + virtual void reference() const; + virtual void unreference() const; + + inline GObject* gobj() { return gobject_; } + inline const GObject* gobj() const { return gobject_; } + + // Give a ref-ed copy to someone. Use for direct struct access. + GObject* gobj_copy() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static ObjectBase* _get_current_wrapper(GObject* object); + bool _cpp_destruction_is_in_progress() const; +#endif + +protected: + GObject* gobject_; // the GLib/GDK/GTK+ object instance + const char* custom_type_name_; + bool cpp_destruction_in_progress_; + + bool is_anonymous_custom_() const; + bool is_derived_() const; + + static void destroy_notify_callback_(void* data); + virtual void destroy_notify_(); + + void _set_current_wrapper(GObject* object); + +private: + // noncopyable + ObjectBase(const ObjectBase&); + ObjectBase& operator=(const ObjectBase&); + + virtual void set_manage(); // calls g_error() + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + friend class Glib::GSigConnectionNode; // for GSigConnectionNode::notify() +#endif +}; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +template +void ObjectBase::set_property(const Glib::ustring& property_name, const PropertyType& value) +{ + Glib::Value property_value; + property_value.init(Glib::Value::value_type()); + + property_value.set(value); + this->set_property_value(property_name, property_value); +} + +template +void ObjectBase::get_property(const Glib::ustring& property_name, PropertyType& value) const +{ + Glib::Value property_value; + property_value.init(Glib::Value::value_type()); + + this->get_property_value(property_name, property_value); + + value = property_value.get(); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +bool _gobject_cppinstance_already_deleted(GObject* gobject); + +} // namespace Glib + + +#endif /* _GLIBMM_OBJECTBASE_H */ + diff --git a/libs/glibmm2/glibmm/optioncontext.cc b/libs/glibmm2/glibmm/optioncontext.cc new file mode 100644 index 0000000000..5a96ad414d --- /dev/null +++ b/libs/glibmm2/glibmm/optioncontext.cc @@ -0,0 +1,141 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Glib +{ + + +OptionContext::OptionContext(const Glib::ustring& parameter_string) +: gobject_( g_option_context_new(parameter_string.c_str()) ), + has_ownership_(true) +{ +} + +OptionContext::OptionContext(GOptionContext* castitem, bool take_ownership) +: gobject_(castitem), + has_ownership_(take_ownership) +{ +} + +OptionContext::~OptionContext() +{ + if(has_ownership_) + g_option_context_free(gobj()); + + gobject_ = 0; +} + +void OptionContext::add_group(OptionGroup& group) +{ + //Strangely, GObjectContext actually takes ownership of the GOptionGroup, deleting it later. + g_option_context_add_group(gobj(), (group).gobj_give_ownership()); +} + +void OptionContext::set_main_group(OptionGroup& group) +{ + //Strangely, GObjectContext actually takes ownership of the GOptionGroup, deleting it later. + g_option_context_set_main_group(gobj(), (group).gobj_give_ownership()); +} + + +/* +OptionGroup OptionContext::get_main_group() const +{ + const GOptionGroup* cobj = g_option_context_get_main_group(const_cast( gobj()) ); + OptionGroup cppObj(const_cast(cobj), true); // take_copy + return cppObj; +} + +*/ + + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::OptionError::OptionError(Glib::OptionError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_OPTION_ERROR, error_code, error_message) +{} + +Glib::OptionError::OptionError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::OptionError::Code Glib::OptionError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::OptionError::throw_func(GError* gobject) +{ + throw Glib::OptionError(gobject); +} + + +namespace Glib +{ + + +void OptionContext::set_help_enabled(bool help_enabled) +{ + g_option_context_set_help_enabled(gobj(), static_cast(help_enabled)); +} + +bool OptionContext::get_help_enabled() const +{ + return g_option_context_get_help_enabled(const_cast(gobj())); +} + +void OptionContext::set_ignore_unknown_options(bool ignore_unknown) +{ + g_option_context_set_ignore_unknown_options(gobj(), static_cast(ignore_unknown)); +} + +bool OptionContext::get_ignore_unknown_options() const +{ + return g_option_context_get_ignore_unknown_options(const_cast(gobj())); +} + +bool OptionContext::parse(int& argc, char**& argv) +{ + GError *error = 0; + bool retvalue = g_option_context_parse(gobj(), &argc, &(argv), &(error)); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + + +} // namespace Glib + + diff --git a/libs/glibmm2/glibmm/optioncontext.h b/libs/glibmm2/glibmm/optioncontext.h new file mode 100644 index 0000000000..e621648935 --- /dev/null +++ b/libs/glibmm2/glibmm/optioncontext.h @@ -0,0 +1,197 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_OPTIONCONTEXT_H +#define _GLIBMM_OPTIONCONTEXT_H + + +/* $Id$ */ + +/* Copyright (C) 2004 The glibmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GOptionContext GOptionContext; } +#endif + + +namespace Glib +{ + +/** Exception class for options. + */ +class OptionError : public Glib::Error +{ +public: + enum Code + { + UNKNOWN_OPTION, + BAD_VALUE, + FAILED + }; + + OptionError(Code error_code, const Glib::ustring& error_message); + explicit OptionError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +/** An OptionContext defines which options are accepted by the commandline option parser. + */ +class OptionContext +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef OptionContext CppObjectType; + typedef GOptionContext BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + +public: + + /** Creates a new option context. + * @param parameter_string A string which is displayed in the first line of --help output, after programname [OPTION...] + */ + explicit OptionContext(const Glib::ustring& parameter_string = Glib::ustring()); + + //Note that, unlike Glib::Wrap(), this would create a second C++ instance for the same C instance, + //so it should be used carefully. For instance you could not access data in a derived class via this second instance. + explicit OptionContext(GOptionContext* castitem, bool take_ownership = false); + virtual ~OptionContext(); + + + /** Enables or disables automatic generation of <option>--help</option> + * output. By default, g_option_context_parse() recognizes + * <option>--help</option>, <option>-?</option>, <option>--help-all</option> + * and <option>--help-</option><replaceable>groupname</replaceable> and creates + * suitable output to stdout. + * + * Since: 2.6 + * @param help_enabled true to enable <option>--help</option>, false to disable it. + */ + void set_help_enabled(bool help_enabled = true); + + /** Returns whether automatic <option>--help</option> generation + * is turned on for @a context . See g_option_context_set_help_enabled(). + * @return true if automatic help generation is turned on. + * + * Since: 2.6. + */ + bool get_help_enabled() const; + + /** Sets whether to ignore unknown options or not. If an argument is + * ignored, it is left in the @a argv array after parsing. By default, + * g_option_context_parse() treats unknown options as error. + * + * This setting does not affect non-option arguments (i.e. arguments + * which don't start with a dash). But note that GOption cannot reliably + * determine whether a non-option belongs to a preceding unknown option. + * + * Since: 2.6 + * @param ignore_unknown true to ignore unknown options, false to produce + * an error when unknown options are met. + */ + void set_ignore_unknown_options(bool ignore_unknown = true); + + /** Returns whether unknown options are ignored or not. See + * g_option_context_set_ignore_unknown_options(). + * @return true if unknown options are ignored. + * + * Since: 2.6. + */ + bool get_ignore_unknown_options() const; + + + /** Parses the command line arguments, recognizing options + * which have been added to @a context . A side-effect of + * calling this function is that g_set_prgname() will be + * called. + * + * If the parsing is successful, any parsed arguments are + * removed from the array and @a argc and @a argv are updated + * accordingly. In case of an error, @a argc and @a argv are + * left unmodified. + * + * If automatic <option>--help</option> support is enabled + * (see g_option_context_set_help_enabled()), and the + * @a argv array contains one of the recognized help options, + * this function will produce help output to stdout and + * call exit (0). + * @param argc A pointer to the number of command line arguments. + * @param argv A pointer to the array of command line arguments. + * @param error A return location for errors. + * @return true if the parsing was successful, + * false if an error occurred + * + * Since: 2.6. + */ + bool parse(int& argc, char**& argv); + + //g_option_context_add_main_entries(), just creates a group internally, adds them to it, and does a set_main_group() + //- a group without callbacks seems to do some simple default parsing. + + + /** Adds an OptionGroup to the context, so that parsing with context will recognize the options in the group. + * Note that the group will not be copied, so it should exist for as long as the context exists. + * + * @param group The group to add. + */ + void add_group(OptionGroup& group); + + + /** Sets an OptionGroup as the main group of the context. This has the same effect as calling add_group(), the only + * difference is that the options in the main group are treated differently when generating --help output. + * Note that the group will not be copied, so it should exist for as long as the context exists. + * + * @param group The group to add. + */ + void set_main_group(OptionGroup& group); + + + //We don't need this (hopefully), and the memory management would be really awkward. + //OptionGroup& get_main_group(); + //const OptionGroup& get_main_group() const; + + + GOptionContext* gobj() { return gobject_; } + const GOptionContext* gobj() const { return gobject_; } + +protected: + + GOptionContext* gobject_; + bool has_ownership_; + + +}; + + +} // namespace Glib + + +#endif /* _GLIBMM_OPTIONCONTEXT_H */ + diff --git a/libs/glibmm2/glibmm/optionentry.cc b/libs/glibmm2/glibmm/optionentry.cc new file mode 100644 index 0000000000..7fd5c53c49 --- /dev/null +++ b/libs/glibmm2/glibmm/optionentry.cc @@ -0,0 +1,149 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace Glib +{ + +OptionEntry::OptionEntry() +: gobject_( new GOptionEntry() ) +{ + gobject_ = g_new0(GOptionEntry, 1); +} + +OptionEntry::~OptionEntry() +{ + g_free(const_cast(gobject_->long_name)); + g_free(const_cast(gobject_->description)); + g_free(const_cast(gobject_->arg_description)); + g_free(gobject_); +} + +OptionEntry::OptionEntry(const OptionEntry& src) +{ + gobject_ = g_new0(GOptionEntry, 1); + + operator=(src); +} + +OptionEntry& OptionEntry::operator=(const OptionEntry& src) +{ + if(this != &src) + { + if(gobject_->long_name) + g_free(const_cast(gobject_->long_name)); + + gobject_->long_name = g_strdup(src.gobject_->long_name); + + gobject_->short_name = src.gobject_->short_name; //It's just one char. + + gobject_->flags = src.gobject_->flags; + gobject_->arg = src.gobject_->arg; + gobject_->arg_data = src.gobject_->arg_data; //Shared, because it's not owned by any instance of this class anyway. + + if(gobject_->description) + g_free(const_cast(gobject_->description)); + + gobject_->description = g_strdup(src.gobject_->description); + + if(gobject_->arg_description) + g_free(const_cast(gobject_->arg_description)); + + gobject_->arg_description = g_strdup(src.gobject_->arg_description); + } + + return *this; +} + + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + + +Glib::ustring OptionEntry::get_long_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->long_name); +} + +void OptionEntry::set_long_name(const Glib::ustring& value) +{ + gobj()->long_name = g_strdup((value).c_str()); +} + +gchar OptionEntry::get_short_name() const +{ + return gobj()->short_name; +} + +void OptionEntry::set_short_name(const gchar& value) +{ + gobj()->short_name = value; +} + +int OptionEntry::get_flags() const +{ + return gobj()->flags; +} + +void OptionEntry::set_flags(const int& value) +{ + gobj()->flags = value; +} + +Glib::ustring OptionEntry::get_description() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->description); +} + +void OptionEntry::set_description(const Glib::ustring& value) +{ + gobj()->description = g_strdup((value).c_str()); +} + +Glib::ustring OptionEntry::get_arg_description() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->arg_description); +} + +void OptionEntry::set_arg_description(const Glib::ustring& value) +{ + gobj()->arg_description = g_strdup((value).c_str()); +} + + +} // namespace Glib + + diff --git a/libs/glibmm2/glibmm/optionentry.h b/libs/glibmm2/glibmm/optionentry.h new file mode 100644 index 0000000000..f7ce6a4a1f --- /dev/null +++ b/libs/glibmm2/glibmm/optionentry.h @@ -0,0 +1,108 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_OPTIONENTRY_H +#define _GLIBMM_OPTIONENTRY_H + + +/* $Id$ */ + +/* Copyright (C) 2004 The glibmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GOptionEntry GOptionEntry; } +#endif + + +namespace Glib +{ + +/** An OptionEntry defines a single option. To have an effect, it must be added to an OptionGroup with + * OptionGroup::add_entry(). + * + * The long name of an option can be used to specify it in a commandline as --long_name. + * Every option must have a long name. To resolve conflicts if multiple option groups contain the same long name, it is also + * possible to specify the option as --groupname-long_name. + * + * If an option has a short name, it can be specified as -short_name in a commandline. + * + * The description for the option is shown in the --help output. + * + * The arg_descripton is the placeholder to use for the extra argument parsed by the option in --help output. + */ +class OptionEntry +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef OptionEntry CppObjectType; + typedef GOptionEntry BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + +public: + + //Copied from goption.h, instead of generated, so that we can put it inside the class. + enum Flags + { + FLAG_HIDDEN = 1 << 0, + FLAG_IN_MAIN = 1 << 1, + FLAG_REVERSE = 1 << 2 + } GOptionFlags; + + OptionEntry(); + OptionEntry(const OptionEntry& src); + virtual ~OptionEntry(); + + OptionEntry& operator=(const OptionEntry& src); + + + Glib::ustring get_long_name() const; + void set_long_name(const Glib::ustring& value); + + gchar get_short_name() const; + void set_short_name(const gchar& value); + + int get_flags() const; + void set_flags(const int& value); + + //TODO: G_OPTION_ARG_CALLBACK, + + Glib::ustring get_description() const; + void set_description(const Glib::ustring& value); + + Glib::ustring get_arg_description() const; + void set_arg_description(const Glib::ustring& value); + + GOptionEntry* gobj() { return gobject_; } + const GOptionEntry* gobj() const { return gobject_; } + +protected: + + GOptionEntry* gobject_; + + +}; + +} // namespace Glib + + +#endif /* _GLIBMM_OPTIONENTRY_H */ + diff --git a/libs/glibmm2/glibmm/optiongroup.cc b/libs/glibmm2/glibmm/optiongroup.cc new file mode 100644 index 0000000000..f8f35d2f29 --- /dev/null +++ b/libs/glibmm2/glibmm/optiongroup.cc @@ -0,0 +1,453 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +//#include +#include + +namespace Glib +{ + +namespace //anonymous +{ + +extern "C" +{ + +static gboolean g_callback_pre_parse(GOptionContext* context, GOptionGroup* /* group */, gpointer data, GError** /* TODO error */) +{ + OptionContext cppContext(context, false /* take_ownership */); + //OptionGroup cppGroup(group, true /* take_copy */); //Maybe this should be option_group. + + OptionGroup* option_group = static_cast(data); + if(option_group) + return option_group->on_pre_parse(cppContext, *option_group); + else + return false; +} + +static gboolean g_callback_post_parse(GOptionContext* context, GOptionGroup* /* group */, gpointer data, GError** /* TODO error */) +{ + OptionContext cppContext(context, false /* take_ownership */); + //OptionGroup cppGroup(group, true /* take_copy */); //Maybe this should be option_group. + + OptionGroup* option_group = static_cast(data); + if(option_group) + { + return option_group->on_post_parse(cppContext, *option_group); + } + else + return false; +} + +static void g_callback_error(GOptionContext* context, GOptionGroup* /* group */, gpointer data, GError** /* TODO error*/) +{ + OptionContext cppContext(context, false /* take_ownership */); + //OptionGroup cppGroup(group); //Maybe this should be option_group. + + OptionGroup* option_group = static_cast(data); + if(option_group) + return option_group->on_error(cppContext, *option_group); +} + +} /* extern "C" */ + +} //anonymous namespace + + +OptionGroup::OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description) +: gobject_( g_option_group_new(name.c_str(), description.c_str(), help_description.c_str(), this, 0 /* destroy_func */) ), + has_ownership_(true) +{ + //Connect callbacks, so that derived classes can override the virtual methods: + g_option_group_set_parse_hooks(gobj(), &g_callback_pre_parse, &g_callback_post_parse); + g_option_group_set_error_hook(gobj(), &g_callback_error); +} + +OptionGroup::OptionGroup(GOptionGroup* castitem) +: gobject_(castitem), + has_ownership_(true) +{ + //Always takes ownership - never takes copy. +} + + +OptionGroup::~OptionGroup() +{ + //Free any C types that were allocated during add_entry(): + for(type_map_entries::iterator iter = map_entries_.begin(); iter != map_entries_.end(); ++iter) + { + CppOptionEntry& cpp_entry = iter->second; + cpp_entry.release_c_arg(); + } + + if(has_ownership_) + { + g_option_group_free(gobj()); + gobject_ = 0; + } +} + +void OptionGroup::add_entry(const OptionEntry& entry) +{ + //It does not copy the entry, so it needs to live as long as the group. + + //g_option_group_add_entries takes an array, with the last item in the array having a null long_name. + //Hopefully this will be properly documented eventually - see bug # + + //Create a temporary array, just so we can give the correct thing to g_option_group_add_entries: + GOptionEntry array[2]; + array[0] = *(entry.gobj()); //Copy contents. + GLIBMM_INITIALIZE_STRUCT(array[1], GOptionEntry); + + g_option_group_add_entries(gobj(), array); +} + +void OptionGroup::add_entry(const OptionEntry& entry, bool& arg) +{ + add_entry_with_wrapper(entry, G_OPTION_ARG_NONE /* Actually a boolean on/off, depending on whether the argument name was given, without argument parameters. */, &arg); +} + +void OptionGroup::add_entry(const OptionEntry& entry, int& arg) +{ + add_entry_with_wrapper(entry, G_OPTION_ARG_INT, &arg); +} + +void OptionGroup::add_entry(const OptionEntry& entry, Glib::ustring& arg) +{ + add_entry_with_wrapper(entry, G_OPTION_ARG_STRING, &arg); +} + +void OptionGroup::add_entry(const OptionEntry& entry, vecustrings& arg) +{ + add_entry_with_wrapper(entry, G_OPTION_ARG_STRING_ARRAY, &arg); +} + +void OptionGroup::add_entry_filename(const OptionEntry& entry, std::string& arg) +{ + add_entry_with_wrapper(entry, G_OPTION_ARG_FILENAME, &arg); +} + +void OptionGroup::add_entry_filename(const OptionEntry& entry, vecstrings& arg) +{ + add_entry_with_wrapper(entry, G_OPTION_ARG_FILENAME_ARRAY, &arg); +} + +void OptionGroup::add_entry_with_wrapper(const OptionEntry& entry, GOptionArg arg_type, void* cpp_arg) +{ + const Glib::ustring name = entry.get_long_name(); + type_map_entries::iterator iterFind = map_entries_.find(name); + if( iterFind == map_entries_.end() ) //If we have not added this entry already + { + CppOptionEntry cppEntry; + cppEntry.carg_type_ = arg_type; + cppEntry.allocate_c_arg(); + + cppEntry.cpparg_ = cpp_arg; + + //Remember the C++/C mapping so that we can use it later: + map_entries_[name] = cppEntry; + + //Give the information to the C API: + cppEntry.entry_ = new OptionEntry(entry); //g_option_group_add_entry() does not take its own copy, so we must keep the instance alive.*/ + cppEntry.entry_->gobj()->arg = arg_type; + cppEntry.entry_->gobj()->arg_data = cppEntry.carg_; + + add_entry(*(cppEntry.entry_)); + } +} + + +bool OptionGroup::on_pre_parse(OptionContext& /* context */, OptionGroup& /* group */) +{ + + return true; +} + +bool OptionGroup::on_post_parse(OptionContext& /* context */, OptionGroup& /* group */) +{ + //Call this at the start of overrides. + + //TODO: Maybe put this in the C callback: + + //The C args have now been given values by GOption. + //Convert C values to C++ values: + + for(type_map_entries::iterator iter = map_entries_.begin(); iter != map_entries_.end(); ++iter) + { + CppOptionEntry& cpp_entry = iter->second; + cpp_entry.convert_c_to_cpp(); + } + + return true; +} + +void OptionGroup::on_error(OptionContext& /* context */, OptionGroup& /* group */) +{ +} + + +OptionGroup::CppOptionEntry::CppOptionEntry() +: carg_type_(G_OPTION_ARG_NONE), carg_(0), cpparg_(0), entry_(0) +{} + +void OptionGroup::CppOptionEntry::allocate_c_arg() +{ + //Create an instance of the appropriate C type. + //This will be destroyed in the OptionGroup destructor. + switch(carg_type_) + { + case G_OPTION_ARG_STRING: //The char* will be for UTF8 strins. + case G_OPTION_ARG_FILENAME: //The char* will be for strings in the current locale's encoding. + { + char** typed_arg = new char*; + *typed_arg = 0; //The C code will allocate a char* and put it here, for us to g_free() later. + carg_ = typed_arg; + + break; + } + case G_OPTION_ARG_INT: + { + int* typed_arg = new int; + *typed_arg = 0; + carg_ = typed_arg; + + break; + } + case G_OPTION_ARG_STRING_ARRAY: + case G_OPTION_ARG_FILENAME_ARRAY: + { + char*** typed_arg = new char**; + *typed_arg = 0; + carg_ = typed_arg; + + break; + } + case G_OPTION_ARG_NONE: /* Actually a boolean. */ + { + gboolean* typed_arg = new gboolean; + *typed_arg = 0; + carg_ = typed_arg; + + break; + } + default: + { + break; + } + } +} + +void OptionGroup::CppOptionEntry::release_c_arg() +{ + //Delete the instances that we created in allocate_c_arg(). + //Notice that we delete the type that we created, but not the value to which it points. + if(carg_) + { + switch(carg_type_) + { + case G_OPTION_ARG_STRING: + case G_OPTION_ARG_FILENAME: + { + char** typed_arg = (char**)carg_; + g_free(*typed_arg); //Free the char* string at type_arg, which was allocated by the C code. + delete typed_arg; //Delete the char** that we allocated in allocate_c_arg; + + break; + } + case G_OPTION_ARG_INT: + { + int* typed_arg = (int*)carg_; + delete typed_arg; + + break; + } + case G_OPTION_ARG_STRING_ARRAY: + case G_OPTION_ARG_FILENAME_ARRAY: + { + delete (char**)carg_; + break; + } + case G_OPTION_ARG_NONE: /* Actually a boolean. */ + { + gboolean* typed_arg = (gboolean*)carg_; + delete typed_arg; + + break; + } + default: + { + /* TODO: + G_OPTION_ARG_CALLBACK, +*/ + break; + } + } + + carg_ = 0; + } + + if(entry_) + delete entry_; +} + +void OptionGroup::CppOptionEntry::convert_c_to_cpp() +{ + switch(carg_type_) + { + case G_OPTION_ARG_STRING: + { + char** typed_arg = (char**)carg_; + Glib::ustring* typed_cpp_arg = (Glib::ustring*)cpparg_; + if(typed_arg && typed_cpp_arg) + { + char* pch = *typed_arg; + (*typed_cpp_arg) = Glib::convert_const_gchar_ptr_to_ustring(pch); + + break; + } + } + case G_OPTION_ARG_FILENAME: + { + char** typed_arg = (char**)carg_; + std::string* typed_cpp_arg = (std::string*)cpparg_; + if(typed_arg && typed_cpp_arg) + { + char* pch = *typed_arg; + (*typed_cpp_arg) = Glib::convert_const_gchar_ptr_to_stdstring(pch); + + break; + } + } + case G_OPTION_ARG_INT: + { + *((int*)cpparg_) = *((int*)carg_); + break; + } + case G_OPTION_ARG_STRING_ARRAY: + { + char*** typed_arg = (char***)carg_; + vecustrings* typed_cpp_arg = (vecustrings*)cpparg_; + if(typed_arg && typed_cpp_arg) + { + typed_cpp_arg->clear(); + + //The C array seems to be null-terminated. + //Glib::StringArrayHandle array_handle(*typed_arg, Glib::OWNERSHIP_NONE); + + //The SUN Forte compiler complains about this: + // "optiongroup.cc", line 354: Error: Cannot assign Glib::ArrayHandle> to std::vector without + // "std::vector::operator=(const std::vector&)";. + // + //(*typed_cpp_arg) = array_handle; + // + //And the Tru64 compiler does not even like us to instantiate the StringArrayHandle: + // + // cxx: Error: ../../glib/glibmm/containerhandle_shared.h, line 149: the operand + // of a pointer dynamic_cast must be a pointer to a complete class type + // return dynamic_cast(Glib::wrap_auto(cobj, false /* take_copy */)); + + //for(Glib::StringArrayHandle::iterator iter = array_handle.begin(); iter != array_handle.end(); ++iter) + //{ + // typed_cpp_arg->push_back(*iter); + //} + + //So we do this: + + char** char_array_next = *typed_arg; + while(char_array_next && *char_array_next) + { + typed_cpp_arg->push_back(*char_array_next); + ++char_array_next; + } + } + + break; + } + case G_OPTION_ARG_FILENAME_ARRAY: + { + char*** typed_arg = (char***)carg_; + vecustrings* typed_cpp_arg = (vecustrings*)cpparg_; + if(typed_arg && typed_cpp_arg) + { + typed_cpp_arg->clear(); + + //See comments above about the SUN Forte and Tru64 compilers. + + char** char_array_next = *typed_arg; + while(char_array_next && *char_array_next) + { + typed_cpp_arg->push_back(*char_array_next); + ++char_array_next; + } + } + + break; + } + case G_OPTION_ARG_NONE: /* Actually a boolean. */ + { + *((bool*)cpparg_) = *((gboolean*)carg_); + break; + } + default: + { + /* TODO: + G_OPTION_ARG_CALLBACK, + */ + break; + } + } +} + +GOptionGroup* OptionGroup::gobj_give_ownership() +{ + has_ownership_ = false; + return gobj(); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + + +void OptionGroup::set_translation_domain(const Glib::ustring& domain) +{ + g_option_group_set_translation_domain(gobj(), domain.c_str()); +} + + +} // namespace Glib + + diff --git a/libs/glibmm2/glibmm/optiongroup.h b/libs/glibmm2/glibmm/optiongroup.h new file mode 100644 index 0000000000..3d8ce78779 --- /dev/null +++ b/libs/glibmm2/glibmm/optiongroup.h @@ -0,0 +1,141 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_OPTIONGROUP_H +#define _GLIBMM_OPTIONGROUP_H + + +/* $Id$ */ + +/* Copyright (C) 2004 The glibmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include //TODO: Try to hide this. + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GOptionGroup GOptionGroup; } +#endif //DOXYGEN_SHOULD_SKIP_THIS + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +class OptionEntry; +class OptionContext; +#endif //DOXYGEN_SHOULD_SKIP_THIS + +/** An OptionGroup defines the options in a single group. + * Libraries which need to parse commandline options are expected to provide a function that allows their OptionGroups to + * be added to the application's OptionContext. + */ +class OptionGroup +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef OptionGroup CppObjectType; + typedef GOptionGroup BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + +public: + OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description = Glib::ustring()); + + /** This always takes ownership of the underlying GOptionGroup, + * so it is only useful with C functions that return newly-allocated GOptionGroups. + */ + explicit OptionGroup(GOptionGroup* castitem); + + virtual ~OptionGroup(); + + + virtual bool on_pre_parse(OptionContext& context, OptionGroup& group); + virtual bool on_post_parse(OptionContext& context, OptionGroup& group); + virtual void on_error(OptionContext& context, OptionGroup& group); + + + void add_entry(const OptionEntry& entry); + + + typedef std::vector vecustrings; + typedef std::vector vecstrings; + + void add_entry(const OptionEntry& entry, bool& arg); + void add_entry(const OptionEntry& entry, int& arg); + void add_entry(const OptionEntry& entry, Glib::ustring& arg); + void add_entry_filename(const OptionEntry& entry, std::string& arg); + void add_entry(const OptionEntry& entry, vecustrings& arg); + void add_entry_filename(const OptionEntry& entry, vecstrings& arg); + +/* TODO: +void g_option_group_set_translate_func (GOptionGroup *group, + GTranslateFunc func, + gpointer data, + GDestroyNotify destroy_notify); +*/ + + /** A convenience function to use gettext() for translating + * user-visible strings. + * + * Since: 2.6 + * @param domain The domain to use. + */ + void set_translation_domain(const Glib::ustring& domain); + + GOptionGroup* gobj() { return gobject_; } + const GOptionGroup* gobj() const { return gobject_; } + GOptionGroup* gobj_give_ownership(); + +protected: + + class CppOptionEntry + { + public: + CppOptionEntry(); + + void allocate_c_arg(); + void convert_c_to_cpp(); + void release_c_arg(); + + GOptionArg carg_type_; + void* carg_; + void* cpparg_; + OptionEntry* entry_; + }; + + void add_entry_with_wrapper(const OptionEntry& entry, GOptionArg arg_type, void* cpp_arg); + + //Map of entry names to CppOptionEntry: + typedef std::map type_map_entries; + type_map_entries map_entries_; + + GOptionGroup* gobject_; + bool has_ownership_; //Whether the gobject_ belongs to this C++ instance. + + +}; + +} // namespace Glib + + +#endif /* _GLIBMM_OPTIONGROUP_H */ + diff --git a/libs/glibmm2/glibmm/pattern.cc b/libs/glibmm2/glibmm/pattern.cc new file mode 100644 index 0000000000..a655259563 --- /dev/null +++ b/libs/glibmm2/glibmm/pattern.cc @@ -0,0 +1,66 @@ +// -*- c++ -*- +/* $Id$ */ + +/* pattern.cc + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +PatternSpec::PatternSpec(const Glib::ustring& pattern) +: + gobject_ (g_pattern_spec_new(pattern.c_str())) +{} + +PatternSpec::PatternSpec(GPatternSpec* gobject) +: + gobject_ (gobject) +{} + +PatternSpec::~PatternSpec() +{ + g_pattern_spec_free(gobject_); +} + +bool PatternSpec::match(const Glib::ustring& str) const +{ + return g_pattern_match(gobject_, str.bytes(), str.c_str(), 0); +} + +bool PatternSpec::match(const Glib::ustring& str, const Glib::ustring& str_reversed) const +{ + return g_pattern_match(gobject_, str.bytes(), str.c_str(), str_reversed.c_str()); +} + +bool PatternSpec::operator==(const PatternSpec& rhs) const +{ + return g_pattern_spec_equal(gobject_, rhs.gobject_); +} + +bool PatternSpec::operator!=(const PatternSpec& rhs) const +{ + return !g_pattern_spec_equal(gobject_, rhs.gobject_); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/pattern.h b/libs/glibmm2/glibmm/pattern.h new file mode 100644 index 0000000000..bf09a3a1bf --- /dev/null +++ b/libs/glibmm2/glibmm/pattern.h @@ -0,0 +1,69 @@ +// -*- c++ -*- +#ifndef _GLIBMM_PATTERN_H +#define _GLIBMM_PATTERN_H + +/* $Id$ */ + +/* pattern.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +extern "C" { typedef struct _GPatternSpec GPatternSpec; } + +#include + + +namespace Glib +{ + +/** @defgroup PatternMatching Glob-style Pattern Matching + * Match strings against patterns containing '*' (wildcard) and '?' (joker). + * @{ + */ + +class PatternSpec +{ +public: + explicit PatternSpec(const Glib::ustring& pattern); + explicit PatternSpec(GPatternSpec* gobject); + ~PatternSpec(); + + bool match(const Glib::ustring& str) const; + bool match(const Glib::ustring& str, const Glib::ustring& str_reversed) const; + + bool operator==(const PatternSpec& rhs) const; + bool operator!=(const PatternSpec& rhs) const; + + GPatternSpec* gobj() { return gobject_; } + const GPatternSpec* gobj() const { return gobject_; } + +private: + GPatternSpec* gobject_; + + // noncopyable + PatternSpec(const PatternSpec&); + PatternSpec& operator=(const PatternSpec&); +}; + +/** @} group PatternMatching */ + +} // namespace Glib + + +#endif /* _GLIBMM_PATTERN_H */ + diff --git a/libs/glibmm2/glibmm/private/convert_p.h b/libs/glibmm2/glibmm/private/convert_p.h new file mode 100644 index 0000000000..b8819e5c70 --- /dev/null +++ b/libs/glibmm2/glibmm/private/convert_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_CONVERT_P_H +#define _GLIBMM_CONVERT_P_H +#endif /* _GLIBMM_CONVERT_P_H */ + diff --git a/libs/glibmm2/glibmm/private/date_p.h b/libs/glibmm2/glibmm/private/date_p.h new file mode 100644 index 0000000000..8c09c9b7f5 --- /dev/null +++ b/libs/glibmm2/glibmm/private/date_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_DATE_P_H +#define _GLIBMM_DATE_P_H +#endif /* _GLIBMM_DATE_P_H */ + diff --git a/libs/glibmm2/glibmm/private/fileutils_p.h b/libs/glibmm2/glibmm/private/fileutils_p.h new file mode 100644 index 0000000000..2d15adfee7 --- /dev/null +++ b/libs/glibmm2/glibmm/private/fileutils_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_FILEUTILS_P_H +#define _GLIBMM_FILEUTILS_P_H +#endif /* _GLIBMM_FILEUTILS_P_H */ + diff --git a/libs/glibmm2/glibmm/private/interface_p.h b/libs/glibmm2/glibmm/private/interface_p.h new file mode 100644 index 0000000000..805d8db3e5 --- /dev/null +++ b/libs/glibmm2/glibmm/private/interface_p.h @@ -0,0 +1,24 @@ +// -*- c++ -*- + +#ifndef _GLIBMM_INTERFACE_P_H +#define _GLIBMM_INTERFACE_P_H + +#include + + +namespace Glib +{ + +class Interface_Class : public Glib::Class +{ +public: + typedef Interface CppObjectType; + typedef GTypeInterface BaseClassType; + + void add_interface(GType instance_type) const; +}; + +} // namespace Glib + +#endif /* _GLIBMM_INTERFACE_P_H */ + diff --git a/libs/glibmm2/glibmm/private/iochannel_p.h b/libs/glibmm2/glibmm/private/iochannel_p.h new file mode 100644 index 0000000000..a66f0a8483 --- /dev/null +++ b/libs/glibmm2/glibmm/private/iochannel_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_IOCHANNEL_P_H +#define _GLIBMM_IOCHANNEL_P_H +#endif /* _GLIBMM_IOCHANNEL_P_H */ + diff --git a/libs/glibmm2/glibmm/private/markup_p.h b/libs/glibmm2/glibmm/private/markup_p.h new file mode 100644 index 0000000000..2abb186965 --- /dev/null +++ b/libs/glibmm2/glibmm/private/markup_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_MARKUP_P_H +#define _GLIBMM_MARKUP_P_H +#endif /* _GLIBMM_MARKUP_P_H */ + diff --git a/libs/glibmm2/glibmm/private/module_p.h b/libs/glibmm2/glibmm/private/module_p.h new file mode 100644 index 0000000000..f06c0782f6 --- /dev/null +++ b/libs/glibmm2/glibmm/private/module_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_MODULE_P_H +#define _GLIBMM_MODULE_P_H +#endif /* _GLIBMM_MODULE_P_H */ + diff --git a/libs/glibmm2/glibmm/private/object_p.h b/libs/glibmm2/glibmm/private/object_p.h new file mode 100644 index 0000000000..20a711898f --- /dev/null +++ b/libs/glibmm2/glibmm/private/object_p.h @@ -0,0 +1,28 @@ +// -*- c++ -*- + +#ifndef _GLIBMM_OBJECT_P_H +#define _GLIBMM_OBJECT_P_H + +#include + +namespace Glib +{ + +class Object_Class : public Glib::Class +{ +public: + typedef Object CppObjectType; + typedef GObject BaseObjectType; + typedef GObjectClass BaseClassType; + + static void class_init_function(void* g_class, void* class_data); + + const Glib::Class& init(); + + static Glib::Object* wrap_new(GObject*); +}; + +} // namespace Glib + +#endif /* _GLIBMM_OBJECT_P_H */ + diff --git a/libs/glibmm2/glibmm/private/optioncontext_p.h b/libs/glibmm2/glibmm/private/optioncontext_p.h new file mode 100644 index 0000000000..a0499f001f --- /dev/null +++ b/libs/glibmm2/glibmm/private/optioncontext_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_OPTIONCONTEXT_P_H +#define _GLIBMM_OPTIONCONTEXT_P_H +#endif /* _GLIBMM_OPTIONCONTEXT_P_H */ + diff --git a/libs/glibmm2/glibmm/private/optionentry_p.h b/libs/glibmm2/glibmm/private/optionentry_p.h new file mode 100644 index 0000000000..df59695279 --- /dev/null +++ b/libs/glibmm2/glibmm/private/optionentry_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_OPTIONENTRY_P_H +#define _GLIBMM_OPTIONENTRY_P_H +#endif /* _GLIBMM_OPTIONENTRY_P_H */ + diff --git a/libs/glibmm2/glibmm/private/optiongroup_p.h b/libs/glibmm2/glibmm/private/optiongroup_p.h new file mode 100644 index 0000000000..7bbc139ea4 --- /dev/null +++ b/libs/glibmm2/glibmm/private/optiongroup_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_OPTIONGROUP_P_H +#define _GLIBMM_OPTIONGROUP_P_H +#endif /* _GLIBMM_OPTIONGROUP_P_H */ + diff --git a/libs/glibmm2/glibmm/private/shell_p.h b/libs/glibmm2/glibmm/private/shell_p.h new file mode 100644 index 0000000000..6d9c6258a8 --- /dev/null +++ b/libs/glibmm2/glibmm/private/shell_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_SHELL_P_H +#define _GLIBMM_SHELL_P_H +#endif /* _GLIBMM_SHELL_P_H */ + diff --git a/libs/glibmm2/glibmm/private/spawn_p.h b/libs/glibmm2/glibmm/private/spawn_p.h new file mode 100644 index 0000000000..fddcf2bf86 --- /dev/null +++ b/libs/glibmm2/glibmm/private/spawn_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_SPAWN_P_H +#define _GLIBMM_SPAWN_P_H +#endif /* _GLIBMM_SPAWN_P_H */ + diff --git a/libs/glibmm2/glibmm/private/thread_p.h b/libs/glibmm2/glibmm/private/thread_p.h new file mode 100644 index 0000000000..8767041773 --- /dev/null +++ b/libs/glibmm2/glibmm/private/thread_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_THREAD_P_H +#define _GLIBMM_THREAD_P_H +#endif /* _GLIBMM_THREAD_P_H */ + diff --git a/libs/glibmm2/glibmm/private/unicode_p.h b/libs/glibmm2/glibmm/private/unicode_p.h new file mode 100644 index 0000000000..6ee135feda --- /dev/null +++ b/libs/glibmm2/glibmm/private/unicode_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_UNICODE_P_H +#define _GLIBMM_UNICODE_P_H +#endif /* _GLIBMM_UNICODE_P_H */ + diff --git a/libs/glibmm2/glibmm/property.cc b/libs/glibmm2/glibmm/property.cc new file mode 100644 index 0000000000..e801e0c1bd --- /dev/null +++ b/libs/glibmm2/glibmm/property.cc @@ -0,0 +1,198 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +// Temporary hack till GLib gets fixed. +#undef G_STRLOC +#define G_STRLOC __FILE__ ":" G_STRINGIFY(__LINE__) + + +namespace +{ + +// OK guys, please don't kill me for that. Let me explain what happens here. +// +// The task: +// --------- +// a) Autogenerate a property ID number for each custom property. This is an +// unsigned integer, which doesn't have to be assigned continuously. I.e., +// it can be everything but 0. +// b) If more than one object of the same class is instantiated, then of course +// the already installed properties must be used. That means, a property ID +// must not be associated with a single Glib::Property<> instance. Rather, +// the ID has to be associated with the class somehow. +// c) With only a GObject pointer and a property ID (and perhaps GParamSpec* +// if necessary), it must be possible to acquire a reference to the property +// wrapper instance. +// +// The current solution: +// --------------------- +// a) Assign an ID to a Glib::PropertyBase by calculating its offset in bytes +// relative to the beginning of the object's memory. dynamic_cast +// is used to retrieve a pointer to the very beginning of an instance. +// b) Recalculate a specific PropertyBase pointer by adding the property ID +// (i.e. the byte offset) to the object start pointer. The result is then +// just casted to PropertyBase*. +// +// Drawbacks: +// ---------- +// a) It's a low-level hack. Should be portable, yes, but we can only do very +// limited error checking. +// b) All Glib::Property<> instances are absolutely required to be direct data +// members of the class that implements the property. That seems a natural +// thing to do, but it's questionable whether it should be a requirement. +// +// Advantages: +// ----------- +// a) Although low-level, it's extremely easy to implement. The nasty code is +// concentrated in only two non-exposed utility functions, and it works +// just fine. +// b) It's efficient, and the memory footprint is very small too. +// c) I actually tried other ways, too, but ran into dead-ends everywhere. +// It's probably possible to implement this without calculating offsets, +// but it'll be very complicated, and involve a lot of qdata pointers to +// property tables andwhatnot. +// +// We can reimplement this later if necessary. + +unsigned int property_to_id(Glib::ObjectBase& object, Glib::PropertyBase& property) +{ + void *const base_ptr = dynamic_cast(&object); + void *const prop_ptr = &property; + + const ptrdiff_t offset = static_cast(prop_ptr) - static_cast(base_ptr); + + g_return_val_if_fail(offset > 0 && offset < G_MAXINT, 0); + + return static_cast(offset); +} + +Glib::PropertyBase& property_from_id(Glib::ObjectBase& object, unsigned int property_id) +{ + void *const base_ptr = dynamic_cast(&object); + void *const prop_ptr = static_cast(base_ptr) + property_id; + + return *static_cast(prop_ptr); +} + +} // anonymous namespace + + +namespace Glib +{ + +void custom_get_property_callback(GObject* object, unsigned int property_id, + GValue* value, GParamSpec* param_spec) +{ + if(Glib::ObjectBase *const wrapper = Glib::ObjectBase::_get_current_wrapper(object)) + { + PropertyBase& property = property_from_id(*wrapper, property_id); + + if((property.object_ == wrapper) && (property.param_spec_ == param_spec)) + g_value_copy(property.value_.gobj(), value); + else + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, param_spec); + } +} + +void custom_set_property_callback(GObject* object, unsigned int property_id, + const GValue* value, GParamSpec* param_spec) +{ + if(Glib::ObjectBase *const wrapper = Glib::ObjectBase::_get_current_wrapper(object)) + { + PropertyBase& property = property_from_id(*wrapper, property_id); + + if((property.object_ == wrapper) && (property.param_spec_ == param_spec)) + { + g_value_copy(value, property.value_.gobj()); + g_object_notify(object, g_param_spec_get_name(param_spec)); + } + else + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, param_spec); + } +} + + +/**** Glib::PropertyBase ***************************************************/ + +PropertyBase::PropertyBase(Glib::Object& object, GType value_type) +: + object_ (&object), + value_ (), + param_spec_ (0) +{ + value_.init(value_type); +} + +PropertyBase::~PropertyBase() +{ + if(param_spec_) + g_param_spec_unref(param_spec_); +} + +bool PropertyBase::lookup_property(const Glib::ustring& name) +{ + g_assert(param_spec_ == 0); + + param_spec_ = g_object_class_find_property(G_OBJECT_GET_CLASS(object_->gobj()), name.c_str()); + + if(param_spec_) + { + g_assert(G_PARAM_SPEC_VALUE_TYPE(param_spec_) == G_VALUE_TYPE(value_.gobj())); + g_param_spec_ref(param_spec_); + } + + return (param_spec_ != 0); +} + +void PropertyBase::install_property(GParamSpec* param_spec) +{ + g_return_if_fail(param_spec != 0); + + const unsigned int property_id = property_to_id(*object_, *this); + + g_object_class_install_property(G_OBJECT_GET_CLASS(object_->gobj()), property_id, param_spec); + + param_spec_ = param_spec; + g_param_spec_ref(param_spec_); +} + +const char* PropertyBase::get_name_internal() const +{ + const char *const name = g_param_spec_get_name(param_spec_); + g_return_val_if_fail(name != 0, ""); + return name; +} + +Glib::ustring PropertyBase::get_name() const +{ + return Glib::ustring(get_name_internal()); +} + +void PropertyBase::notify() +{ + g_object_notify(object_->gobj(), g_param_spec_get_name(param_spec_)); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/property.h b/libs/glibmm2/glibmm/property.h new file mode 100644 index 0000000000..f25ef84d1f --- /dev/null +++ b/libs/glibmm2/glibmm/property.h @@ -0,0 +1,171 @@ +// -*- c++ -*- +#ifndef _GLIBMM_PROPERTY_H +#define _GLIBMM_PROPERTY_H +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +#ifdef GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC +//For the AIX xlC compiler, I can not find a way to do this without putting the functions in the global namespace. murrayc +extern "C" +{ +#endif //GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC + +void custom_get_property_callback(GObject* object, unsigned int property_id, + GValue* value, GParamSpec* param_spec); + +void custom_set_property_callback(GObject* object, unsigned int property_id, + const GValue* value, GParamSpec* param_spec); + +#ifdef GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC +} //extern "C" +#endif //GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +class PropertyBase +{ +public: + Glib::ustring get_name() const; + void notify(); + +protected: + Glib::Object* object_; + Glib::ValueBase value_; + GParamSpec* param_spec_; + + PropertyBase(Glib::Object& object, GType value_type); + ~PropertyBase(); + + bool lookup_property(const Glib::ustring& name); + void install_property(GParamSpec* param_spec); + + const char* get_name_internal() const; + +private: + // noncopyable + PropertyBase(const PropertyBase&); + PropertyBase& operator=(const PropertyBase&); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + friend void Glib::custom_get_property_callback(GObject* object, unsigned int property_id, + GValue* value, GParamSpec* param_spec); + + friend void Glib::custom_set_property_callback(GObject* object, unsigned int property_id, + const GValue* value, GParamSpec* param_spec); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ +}; + + +template +class Property : public PropertyBase +{ +public: + typedef T PropertyType; + typedef Glib::Value ValueType; + + Property(Glib::Object& object, const Glib::ustring& name); + Property(Glib::Object& object, const Glib::ustring& name, const PropertyType& default_value); + + inline void set_value(const PropertyType& data); + inline PropertyType get_value() const; + + inline Property& operator=(const PropertyType& data); + inline operator PropertyType() const; + + inline Glib::PropertyProxy get_proxy(); +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/**** Glib::Property ****************************************************/ + +template +Property::Property(Glib::Object& object, const Glib::ustring& name) +: + PropertyBase(object, ValueType::value_type()) +{ + if(!lookup_property(name)) + install_property(static_cast(value_).create_param_spec(name)); +} + +template +Property::Property(Glib::Object& object, const Glib::ustring& name, + const typename Property::PropertyType& default_value) +: + PropertyBase(object, ValueType::value_type()) +{ + static_cast(value_).set(default_value); + + if(!lookup_property(name)) + install_property(static_cast(value_).create_param_spec(name)); +} + +template inline +void Property::set_value(const typename Property::PropertyType& data) +{ + static_cast(value_).set(data); + this->notify(); +} + +template inline +typename Property::PropertyType Property::get_value() const +{ + return static_cast(value_).get(); +} + +template inline +Property& Property::operator=(const typename Property::PropertyType& data) +{ + static_cast(value_).set(data); + this->notify(); + return *this; +} + +template inline +Property::operator T() const +{ + return static_cast(value_).get(); +} + +template inline +Glib::PropertyProxy Property::get_proxy() +{ + return Glib::PropertyProxy(object_, get_name_internal()); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_PROPERTY_H */ + diff --git a/libs/glibmm2/glibmm/propertyproxy.cc b/libs/glibmm2/glibmm/propertyproxy.cc new file mode 100644 index 0000000000..c20f36bc3e --- /dev/null +++ b/libs/glibmm2/glibmm/propertyproxy.cc @@ -0,0 +1,24 @@ +// -*- c++ -*- +/* $Id$ */ + +/* propertyproxy.cc + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + diff --git a/libs/glibmm2/glibmm/propertyproxy.h b/libs/glibmm2/glibmm/propertyproxy.h new file mode 100644 index 0000000000..bfba551611 --- /dev/null +++ b/libs/glibmm2/glibmm/propertyproxy.h @@ -0,0 +1,163 @@ +// -*- c++ -*- +#ifndef _GLIBMM_PROPERTYPROXY_H +#define _GLIBMM_PROPERTYPROXY_H +/* $Id$ */ + +/* propertyproxy.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +/** A PropertyProxy can be used to get and set the value of an object's property. + * There are usually also get and set methods on the class itself, which you might find more convenient. + * With the PropertyProxy, you may use either get_value() and set_value(), or operator=() and + * operator PropertyType(), like so: + * @code + * int height = cellrenderer.property_height(); + * cellrenderer.property_editable() = true; + * @endcode + * + * You may also receive notification when a property's value changes, by connecting to signal_changed(). + */ +template +class PropertyProxy : public PropertyProxy_Base +{ +public: + typedef T PropertyType; + + PropertyProxy(ObjectBase* obj, const char* name) + : PropertyProxy_Base(obj, name) {} + + /** Set the value of this property. + * @param data The new value for the property. + */ + void set_value(const PropertyType& data); + + /** Get the value of this property. + * @result The current value of the property. + */ + PropertyType get_value() const; + + /** Set the value of this property back to its default value + */ + void reset_value() + { reset_property_(); } + + PropertyProxy& operator=(const PropertyType& data) + { this->set_value(data); return *this; } + + operator PropertyType() const + { return this->get_value(); } +}; + + +/** See PropertyProxy(). + * This property can be written, but not read, so there is no get_value() method. + */ +template +class PropertyProxy_WriteOnly : public PropertyProxy_Base +{ +public: + typedef T PropertyType; + + PropertyProxy_WriteOnly(ObjectBase* obj, const char* name) + : PropertyProxy_Base(obj, name) {} + + /** Set the value of this property. + * @param data The new value for the property. + */ + void set_value(const PropertyType& data) + { + PropertyProxy_Base& base = *this; + // The downcast to PropertyProxy is safe, and avoids code duplication. + static_cast&>(base).set_value(data); + } + + /** Set the value of this property back to its default value + */ + void reset_value() + { reset_property_(); } + + PropertyProxy_WriteOnly& operator=(const PropertyType& data) + { this->set_value(data); return *this; } +}; + +/** See PropertyProxy(). + * This property can be read, but not written, so there is no set_value() method. + */ +template +class PropertyProxy_ReadOnly : public PropertyProxy_Base +{ +public: + typedef T PropertyType; + + //obj is const, because this should be returned by const accessors. + PropertyProxy_ReadOnly(const ObjectBase* obj, const char* name) + : PropertyProxy_Base(const_cast(obj), name) {} + + /** Get the value of this property. + * @result The current value of the property. + */ + PropertyType get_value() const + { + const PropertyProxy_Base& base = *this; + // The downcast to PropertyProxy is safe, and avoids code duplication. + return static_cast&>(base).get_value(); + } + + operator PropertyType() const + { return this->get_value(); } +}; + + +/**** Template Implementation **********************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +template +void PropertyProxy::set_value(const T& data) +{ + Glib::Value value; + value.init(Glib::Value::value_type()); + + value.set(data); + set_property_(value); +} + +template +T PropertyProxy::get_value() const +{ + Glib::Value value; + value.init(Glib::Value::value_type()); + + get_property_(value); + return value.get(); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_PROPERTYPROXY_H */ + diff --git a/libs/glibmm2/glibmm/propertyproxy_base.cc b/libs/glibmm2/glibmm/propertyproxy_base.cc new file mode 100644 index 0000000000..d10c8cd352 --- /dev/null +++ b/libs/glibmm2/glibmm/propertyproxy_base.cc @@ -0,0 +1,151 @@ +// -*- c++ -*- +/* $Id$ */ + +/* propertyproxy_base.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +namespace Glib +{ + +/** PropertyProxyConnectionNode is a connection node for use with SignalProxyProperty. + * It's like ProxyConnectionNode, but it contains the property name too. + */ +class PropertyProxyConnectionNode : public SignalProxyConnectionNode +{ +public: + friend class SignalProxyProperty; + + PropertyProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject, const gchar* property_name); + +protected: + //This will be examined in the callback. + //Should be a static string literal. + const gchar* property_name_; +}; + +PropertyProxyConnectionNode::PropertyProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject, const gchar* property_name) +: SignalProxyConnectionNode(slot, gobject), + property_name_(property_name) +{ +} + +//SignalProxyProperty implementation: + +SignalProxyProperty::SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name) +: SignalProxyBase(obj), + property_name_(property_name) +{ +} + +SignalProxyProperty::~SignalProxyProperty() +{ +} + +sigc::connection SignalProxyProperty::connect(const SlotType& sl) +{ + // create a proxy to hold our connection info + PropertyProxyConnectionNode* pConnectionNode = new PropertyProxyConnectionNode(sl, obj_->gobj(), property_name_ ); + + // connect it to gtk+ + // pConnectionNode will be passed as the data argument to the callback. + // The callback will then call the virtual Object::property_change_notify() method, + // which will contain a switch/case statement which will examine the property name. + pConnectionNode->connection_id_ = g_signal_connect_data(obj_->gobj(), + "notify", (GCallback)(&callback), pConnectionNode, + &PropertyProxyConnectionNode::destroy_notify_handler, + G_CONNECT_AFTER); + + return sigc::connection(pConnectionNode->slot_); +} + +void SignalProxyProperty::callback(GObject*, GParamSpec* pspec, gpointer data) //static +{ + if(pspec && data) + { + //Get the name of the property that has changed: + const char* property_name_changed = pspec->name; + + //Get the name of the property that we are waiting for: + PropertyProxyConnectionNode* conn = static_cast(data); + const char* property_name_monitored = conn->property_name_; + + //If it's the correct property, then call the signal handler: + if(strcmp(property_name_changed, property_name_monitored) == 0) + { + if(sigc::slot_base *const slot = data_to_slot(data)) + (*static_cast*>(slot))(); + } + } +} + + +//PropertyProxy_Base implementation: + +PropertyProxy_Base::PropertyProxy_Base(ObjectBase* obj, const char* property_name) +: + obj_ (obj), + property_name_ (property_name) +{} + +PropertyProxy_Base::PropertyProxy_Base(const PropertyProxy_Base& other) +: + obj_ (other.obj_), + property_name_ (other.property_name_) +{} + +SignalProxyProperty PropertyProxy_Base::signal_changed() +{ + return SignalProxyProperty(obj_, property_name_); +} + +void PropertyProxy_Base::set_property_(const Glib::ValueBase& value) +{ + g_object_set_property(obj_->gobj(), property_name_, value.gobj()); +} + +void PropertyProxy_Base::get_property_(Glib::ValueBase& value) const +{ + g_object_get_property(obj_->gobj(), property_name_, value.gobj()); +} + +void PropertyProxy_Base::reset_property_() +{ + // Get information about the parameter: + const GParamSpec *const pParamSpec = + g_object_class_find_property(G_OBJECT_GET_CLASS(obj_->gobj()), property_name_); + + g_return_if_fail(pParamSpec != 0); + + Glib::ValueBase value; + value.init(G_PARAM_SPEC_VALUE_TYPE(pParamSpec)); + + // An explicit reset is not needed, because ValueBase:init() + // has already initialized it to the default value for this type. + // value.reset(); + + g_object_set_property(obj_->gobj(), property_name_, value.gobj()); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/propertyproxy_base.h b/libs/glibmm2/glibmm/propertyproxy_base.h new file mode 100644 index 0000000000..036291df39 --- /dev/null +++ b/libs/glibmm2/glibmm/propertyproxy_base.h @@ -0,0 +1,84 @@ +// -*- c++ -*- +#ifndef _GLIBMM_PROPERTYPROXY_BASE_H +#define _GLIBMM_PROPERTYPROXY_BASE_H +/* $Id$ */ + +/* propertyproxy_base.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +class ObjectBase; + +/// Use the connect() method, with sigc::ptr_fun() or sig::mem_fun() to connect signals to signal handlers. +class SignalProxyProperty : public SignalProxyBase +{ +public: + friend class PropertyProxy_Base; + + SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name); + ~SignalProxyProperty(); + + typedef sigc::slot SlotType; + sigc::connection connect(const SlotType& sl); + +protected: + static void callback(GObject* object, GParamSpec* pspec, gpointer data); + + const char* property_name_; //Should be a static string literal. + +private: + SignalProxyProperty& operator=(const SignalProxyProperty&); // not implemented +}; + + +class PropertyProxy_Base +{ +public: + PropertyProxy_Base(ObjectBase* obj, const char* property_name); + PropertyProxy_Base(const PropertyProxy_Base& other); + + ///This signal will be emitted when the property changes. + SignalProxyProperty signal_changed(); + + ObjectBase* get_object() const { return obj_; } + const char* get_name() const { return property_name_; } + +protected: + void set_property_(const Glib::ValueBase& value); + void get_property_(Glib::ValueBase& value) const; + void reset_property_(); + + ObjectBase* obj_; //The C++ wrapper instance of which this PropertyProxy is a member. + const char* property_name_; //Should be a static string literal. + +private: + //Declared as private, but not implemented to prevent any automatically generated implementation. + PropertyProxy_Base& operator=(const PropertyProxy_Base&); +}; + +} // namespace Glib + +#endif /* _GLIBMM_PROPERTYPROXY_BASE_H */ + diff --git a/libs/glibmm2/glibmm/quark.cc b/libs/glibmm2/glibmm/quark.cc new file mode 100644 index 0000000000..ea01f470b0 --- /dev/null +++ b/libs/glibmm2/glibmm/quark.cc @@ -0,0 +1,66 @@ +/* $Id$ */ + +/* quark.cc + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Glib +{ + +QueryQuark::QueryQuark(const GQuark& q) + : quark_(q) +{} + +QueryQuark::QueryQuark(const ustring& s) +: quark_(g_quark_try_string(s.c_str())) +{} + +QueryQuark::QueryQuark(const char* s) +: quark_(g_quark_try_string(s)) +{} + +QueryQuark& QueryQuark::operator=(const QueryQuark& q) +{ quark_=q.quark_; + return *this; +} + +QueryQuark::operator ustring() const +{ + return ustring(g_quark_to_string(quark_)); +} + + +Quark::Quark(const ustring& s) +: QueryQuark(g_quark_from_string(s.c_str())) +{} + +Quark::Quark(const char* s) +: QueryQuark(g_quark_from_string(s)) +{} + +Quark::~Quark() +{} + + +GQuark quark_ = 0; +GQuark quark_cpp_wrapper_deleted_ = 0; + +} /* namespace Glib */ diff --git a/libs/glibmm2/glibmm/quark.h b/libs/glibmm2/glibmm/quark.h new file mode 100644 index 0000000000..d2f450fe07 --- /dev/null +++ b/libs/glibmm2/glibmm/quark.h @@ -0,0 +1,88 @@ +// -*- c++ -*- +#ifndef _GLIBMM_QUARK_H +#define _GLIBMM_QUARK_H +/* $Id$ */ + +/* quark.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +/** Quarks are unique IDs in Glib for strings for use in + * hash table lookups. Each Quark is unique but may change + * between runs. + * + * QueryQuark is a converter class for looking up but not + * allocating an ID. An id means the quark lookup failed. + * + * Quark is used for actions for which the id should live on + * While QueryQuark should be used for queries. + * ie. + * void set_data (const Quark&, void * data); + * void* get_data (const QueryQuark&); + */ +class QueryQuark +{ + public: + QueryQuark(const GQuark& q); + QueryQuark(const ustring& s); + QueryQuark(const char*s); + ~QueryQuark() {} + QueryQuark& operator=(const QueryQuark& q); + operator ustring() const; + + operator GQuark() const {return quark_;} + GQuark id() const {return quark_;} + + private: + GQuark quark_; +}; + +class Quark: public QueryQuark +{ + public: + Quark(const ustring& s); + Quark(const char* s); + ~Quark(); +}; + +/** @relates Glib::QueryQuark */ +inline bool operator==(const QueryQuark& a, const QueryQuark& b) + { return a.id() == b.id(); } + +/** @relates Glib::QueryQuark */ +inline bool operator!=(const QueryQuark& a, const QueryQuark& b) + { return a.id() != b.id(); } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// TODO: Put this somewhere else. +// (internal) The quark for C++ wrappers. +extern GLIBMM_API GQuark quark_; +extern GLIBMM_API GQuark quark_cpp_wrapper_deleted_; +#endif + +} /* namespace Glib */ + +#endif /* _GLIBMM_QUARK_H */ + diff --git a/libs/glibmm2/glibmm/random.cc b/libs/glibmm2/glibmm/random.cc new file mode 100644 index 0000000000..d4475616b5 --- /dev/null +++ b/libs/glibmm2/glibmm/random.cc @@ -0,0 +1,76 @@ +// -*- c++ -*- +/* $Id$ */ + +/* random.cc + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +Rand::Rand() +: + gobject_ (g_rand_new()) +{} + +Rand::Rand(guint32 seed) +: + gobject_ (g_rand_new_with_seed(seed)) +{} + +Rand::~Rand() +{ + g_rand_free(gobject_); +} + +void Rand::set_seed(guint32 seed) +{ + g_rand_set_seed(gobject_, seed); +} + +bool Rand::get_bool() +{ + return g_rand_boolean(gobject_); +} + +guint32 Rand::get_int() +{ + return g_rand_int(gobject_); +} + +gint32 Rand::get_int_range(gint32 begin, gint32 end) +{ + return g_rand_int_range(gobject_, begin, end); +} + +double Rand::get_double() +{ + return g_rand_double(gobject_); +} + +double Rand::get_double_range(double begin, double end) +{ + return g_rand_double_range(gobject_, begin, end); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/random.h b/libs/glibmm2/glibmm/random.h new file mode 100644 index 0000000000..4a4ce84420 --- /dev/null +++ b/libs/glibmm2/glibmm/random.h @@ -0,0 +1,73 @@ +// -*- c++ -*- +#ifndef _GLIBMM_RANDOM_H +#define _GLIBMM_RANDOM_H + +/* $Id$ */ + +/* random.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +extern "C" { typedef struct _GRand GRand; } + + +namespace Glib +{ + +/** @defgroup Random Random Numbers + * Pseudo random number generator. + * @{ + */ + +class Rand +{ +public: + Rand(); + explicit Rand(guint32 seed); + ~Rand(); + + void set_seed(guint32 seed); + + bool get_bool(); + + guint32 get_int(); + gint32 get_int_range(gint32 begin, gint32 end); + + double get_double(); + double get_double_range(double begin, double end); + + GRand* gobj() { return gobject_; } + const GRand* gobj() const { return gobject_; } + +private: + GRand* gobject_; + + // noncopyable + Rand(const Rand&); + Rand& operator=(const Rand&); +}; + +/** @} group Random */ + +} // namespace Glib + + +#endif /* _GLIBMM_RANDOM_H */ + diff --git a/libs/glibmm2/glibmm/refptr.h b/libs/glibmm2/glibmm/refptr.h new file mode 100644 index 0000000000..d375f7a52b --- /dev/null +++ b/libs/glibmm2/glibmm/refptr.h @@ -0,0 +1,318 @@ +// -*- c++ -*- +#ifndef _GLIBMM_REFPTR_H +#define _GLIBMM_REFPTR_H + +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +namespace Glib +{ + +/** RefPtr<> is a reference-counting shared smartpointer. + * + * Some objects in gtkmm are obtained from a shared + * store. Consequently you cannot instantiate them yourself. Instead they + * return a RefPtr which behaves much like an ordinary pointer in that members + * can be reached with the usual object_ptr->member notation. + * Unlike most other smart pointers, RefPtr doesn't support dereferencing + * through *object_ptr. + * + * Reference counting means that a shared reference count is incremented each + * time a RefPtr is copied, and decremented each time a RefPtr is destroyed, + * for instance when it leaves its scope. When the reference count reaches + * zero, the contained object is deleted, meaning you don't need to remember + * to delete the object. + * + * RefPtr<> can store any class that has reference() and unreference() methods. + * In gtkmm, that is anything derived from Glib::ObjectBase, such as + * Gdk::Pixmap. + * + * See the "Memory Management" section in the "Programming with gtkmm" + * book for further information. + */ +template +class RefPtr +{ +public: + /** Default constructor + * + * Afterwards it will be null and use of -> will cause a segmentation fault. + */ + inline RefPtr(); + + /// Destructor - decrements reference count. + inline ~RefPtr(); + + /// For use only by the ::create() methods. + explicit inline RefPtr(T_CppObject* pCppObject); + + /** Copy constructor + * + * This increments the shared reference count. + */ + inline RefPtr(const RefPtr& src); + + /** Copy constructor (from different, but castable type). + * + * Increments the reference count. + */ + template + inline RefPtr(const RefPtr& src); + + /** Swap the contents of two RefPtr<>. + * This method swaps the internal pointers to T_CppObject. This can be + * done safely without involving a reference/unreference cycle and is + * therefore highly efficient. + */ + inline void swap(RefPtr& other); + + /// Copy from another RefPtr: + inline RefPtr& operator=(const RefPtr& src); + + /** Copy from different, but castable type). + * + * Increments the reference count. + */ + template + inline RefPtr& operator=(const RefPtr& src); + + /// Tests whether the RefPtr<> point to the same underlying instance. + inline bool operator==(const RefPtr& src) const; + + /// See operator==(). + inline bool operator!=(const RefPtr& src) const; + + /** Dereferencing. + * + * Use the methods of the underlying instance like so: + * refptr->memberfun(). + */ + inline T_CppObject* operator->() const; + + /** Test whether the RefPtr<> points to any underlying instance. + * + * Mimics usage of ordinary pointers: + * @code + * if (ptr) + * do_something(); + * @endcode + */ + inline operator bool() const; + + /// Set underlying instance to 0, decrementing reference count of existing instance appropriately. + inline void clear(); + + + /** Dynamic cast to derived class. + * + * The RefPtr can't be cast with the usual notation so instead you can use + * @code + * ptr_derived = RefPtr::cast_dynamic(ptr_base); + * @endcode + */ + template + static inline RefPtr cast_dynamic(const RefPtr& src); + + /** Static cast to derived class. + * + * Like the dynamic cast; the notation is + * @code + * ptr_derived = RefPtr::cast_static(ptr_base); + * @endcode + */ + template + static inline RefPtr cast_static(const RefPtr& src); + +private: + T_CppObject* pCppObject_; +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +// RefPtr<>::operator->() comes first here since it's used by other methods. +// If it would come after them it wouldn't be inlined. + +template inline +T_CppObject* RefPtr::operator->() const +{ + return pCppObject_; +} + +template inline +RefPtr::RefPtr() +: + pCppObject_ (0) +{} + +template inline +RefPtr::~RefPtr() +{ + if(pCppObject_) + pCppObject_->unreference(); // This could cause pCppObject to be deleted. +} + +template inline +RefPtr::RefPtr(T_CppObject* pCppObject) +: + pCppObject_ (pCppObject) +{} + +template inline +RefPtr::RefPtr(const RefPtr& src) +: + pCppObject_ (src.pCppObject_) +{ + if(pCppObject_) + pCppObject_->reference(); +} + +// The templated ctor allows copy construction from any object that's +// castable. Thus, it does downcasts: +// base_ref = derived_ref +template + template +inline +RefPtr::RefPtr(const RefPtr& src) +: + // A different RefPtr<> will not allow us access to pCppObject_. We need + // to add a get_underlying() for this, but that would encourage incorrect + // use, so we use the less well-known operator->() accessor: + pCppObject_ (src.operator->()) +{ + if(pCppObject_) + pCppObject_->reference(); +} + +template inline +void RefPtr::swap(RefPtr& other) +{ + T_CppObject *const temp = pCppObject_; + pCppObject_ = other.pCppObject_; + other.pCppObject_ = temp; +} + +template inline +RefPtr& RefPtr::operator=(const RefPtr& src) +{ + // In case you haven't seen the swap() technique to implement copy + // assignment before, here's what it does: + // + // 1) Create a temporary RefPtr<> instance via the copy ctor, thereby + // increasing the reference count of the source object. + // + // 2) Swap the internal object pointers of *this and the temporary + // RefPtr<>. After this step, *this already contains the new pointer, + // and the old pointer is now managed by temp. + // + // 3) The destructor of temp is executed, thereby unreferencing the + // old object pointer. + // + // This technique is described in Herb Sutter's "Exceptional C++", and + // has a number of advantages over conventional approaches: + // + // - Code reuse by calling the copy ctor. + // - Strong exception safety for free. + // - Self assignment is handled implicitely. + // - Simplicity. + // - It just works and is hard to get wrong; i.e. you can use it without + // even thinking about it to implement copy assignment whereever the + // object data is managed indirectly via a pointer, which is very common. + + RefPtr temp (src); + this->swap(temp); + return *this; +} + +template + template +inline +RefPtr& RefPtr::operator=(const RefPtr& src) +{ + RefPtr temp (src); + this->swap(temp); + return *this; +} + +template inline +bool RefPtr::operator==(const RefPtr& src) const +{ + return (pCppObject_ == src.pCppObject_); +} + +template inline +bool RefPtr::operator!=(const RefPtr& src) const +{ + return (pCppObject_ != src.pCppObject_); +} + +template inline +RefPtr::operator bool() const +{ + return (pCppObject_ != 0); +} + +template inline +void RefPtr::clear() +{ + RefPtr temp; // swap with an empty RefPtr<> to clear *this + this->swap(temp); +} + +template + template +inline +RefPtr RefPtr::cast_dynamic(const RefPtr& src) +{ + T_CppObject *const pCppObject = dynamic_cast(src.operator->()); + + if(pCppObject) + pCppObject->reference(); + + return RefPtr(pCppObject); +} + +template + template +inline +RefPtr RefPtr::cast_static(const RefPtr& src) +{ + T_CppObject *const pCppObject = static_cast(src.operator->()); + + if(pCppObject) + pCppObject->reference(); + + return RefPtr(pCppObject); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +/** @relates Glib::RefPtr */ +template inline +void swap(RefPtr& lhs, RefPtr& rhs) +{ + lhs.swap(rhs); +} + +} // namespace Glib + + +#endif /* _GLIBMM_REFPTR_H */ + diff --git a/libs/glibmm2/glibmm/sarray.h b/libs/glibmm2/glibmm/sarray.h new file mode 100644 index 0000000000..01d7ee204e --- /dev/null +++ b/libs/glibmm2/glibmm/sarray.h @@ -0,0 +1,108 @@ +// -*- c++ -*- +#ifndef _GLIBMM_SARRAY_H +#define _GLIBMM_SARRAY_H + +/* $Id$ */ + +/* array.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +namespace Glib { typedef Glib::ArrayHandle SArray; } + +#if 0 + +namespace Glib +{ + +template <> +inline void cpp_type_to_c_type(const ustring& cpp_value, type_constpch& ref_c_value) +{ + ref_c_value = cpp_value.c_str(); +} + +template <> +inline void cpp_type_to_c_type(const std::string& cpp_value, type_constpch& ref_c_value) +{ + ref_c_value = cpp_value.c_str(); +} + +typedef Array SArray; + +/* +class SArray: public Array +{ +public: + typedef const char* T_c; + typedef Array type_base; + + SArray(const SArray& src); + + // copy other containers + template + SArray(const T_container& t) + { + owned_ = Array_Helpers::Traits::get_owned(); + size_ = Array_Helpers::Traits::get_size(t); + pData_ = Array_Helpers::Traits::get_data(t); + } + + SArray(const T_c* pValues, size_type size); + + // copy a sequence + template + SArray(Iterator b, Iterator e); + + operator std::vector() const; + operator std::vector() const; + operator std::vector() const; + + operator std::deque() const; + operator std::deque() const; + operator std::deque() const; + + operator std::list() const; + operator std::list() const; + operator std::list() const; +}; + + +//template +//SArray::SArray(const T_container& t) +//: type_base(t) +//{ +//} + + +template +SArray::SArray(Iterator b, Iterator e) +: type_base(b, e) +{ +} +*/ + +} // namespace Glib + +#endif /* #if 0 */ + +#endif // _GLIBMM_SARRAY_H + diff --git a/libs/glibmm2/glibmm/shell.cc b/libs/glibmm2/glibmm/shell.cc new file mode 100644 index 0000000000..adb3473dde --- /dev/null +++ b/libs/glibmm2/glibmm/shell.cc @@ -0,0 +1,93 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +/**** shell utility functions **********************************************/ + +Glib::ArrayHandle shell_parse_argv(const std::string& command_line) +{ + char** argv = 0; + int argc = 0; + GError* error = 0; + + g_shell_parse_argv(command_line.c_str(), &argc, &argv, &error); + + if(error) + Glib::Error::throw_exception(error); + + return Glib::ArrayHandle(argv, argc, Glib::OWNERSHIP_DEEP); +} + +std::string shell_quote(const std::string& unquoted_string) +{ + const ScopedPtr buf (g_shell_quote(unquoted_string.c_str())); + return std::string(buf.get()); +} + +std::string shell_unquote(const std::string& quoted_string) +{ + GError* error = 0; + char *const buf = g_shell_unquote(quoted_string.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return std::string(ScopedPtr(buf).get()); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::ShellError::ShellError(Glib::ShellError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_SHELL_ERROR, error_code, error_message) +{} + +Glib::ShellError::ShellError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::ShellError::Code Glib::ShellError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::ShellError::throw_func(GError* gobject) +{ + throw Glib::ShellError(gobject); +} + + diff --git a/libs/glibmm2/glibmm/shell.h b/libs/glibmm2/glibmm/shell.h new file mode 100644 index 0000000000..55512f57b2 --- /dev/null +++ b/libs/glibmm2/glibmm/shell.h @@ -0,0 +1,123 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_SHELL_H +#define _GLIBMM_SHELL_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +#include +#include + +#include +GLIBMM_USING_STD(string) + + +namespace Glib +{ + +/** @defgroup ShellUtils Shell-related Utilities + * Shell-like command line handling. + * @{ + */ + +/** Exception class for shell utility errors. + */ +class ShellError : public Glib::Error +{ +public: + enum Code + { + BAD_QUOTING, + EMPTY_STRING, + FAILED + }; + + ShellError(Code error_code, const Glib::ustring& error_message); + explicit ShellError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +/** Parses a command line into an argument vector, in much the same way the + * shell would, but without many of the expansions the shell would perform + * (variable expansion, globs, operators, filename expansion, etc.\ are not + * supported). The results are defined to be the same as those you would + * get from a UNIX98 /bin/sh, as long as the input contains none of the + * unsupported shell expansions. If the input does contain such expansions, + * they are passed through literally. + * @param command_line Command line to parse. + * @return Array of args (The generic ArrayHandle will be implicitly + * converted to any STL compatible container type). + * @throw Glib::ShellError + */ +Glib::ArrayHandle shell_parse_argv(const std::string& command_line); + +/** Quotes a string so that the shell (/bin/sh) will interpret the quoted + * string to mean @a unquoted_string. If you pass a filename to the shell, + * for example, you should first quote it with this function. The quoting + * style used is undefined (single or double quotes may be used). + * @param unquoted_string A literal string. + * @return A quoted string. + */ +std::string shell_quote(const std::string& unquoted_string); + +/** Unquotes a string as the shell (/bin/sh) would. Only handles quotes; if + * a string contains file globs, arithmetic operators, variables, backticks, + * redirections, or other special-to-the-shell features, the result will be + * different from the result a real shell would produce (the variables, + * backticks, etc. will be passed through literally instead of being expanded). + * This function is guaranteed to succeed if applied to the result of + * shell_quote(). If it fails, it throws a Glib::ShellError exception. The + * @a quoted_string need not actually contain quoted or escaped text; + * shell_unquote() simply goes through the string and unquotes/unescapes + * anything that the shell would. Both single and double quotes are handled, + * as are escapes including escaped newlines. + * + * Shell quoting rules are a bit strange. Single quotes preserve the literal + * string exactly. Escape sequences are not allowed; not even \\' -- + * if you want a ' in the quoted text, you have to do something like + * 'foo'\\''bar'. Double quotes allow $, `, + * ", \\, and newline to be escaped with backslash. + * Otherwise double quotes preserve things literally. + * + * @param quoted_string Shell-quoted string. + * @return An unquoted string. + * @throw Glib::ShellError + */ +std::string shell_unquote(const std::string& quoted_string); + +/** @} group ShellUtils */ + +} // namespace Glib + + +#endif /* _GLIBMM_SHELL_H */ + diff --git a/libs/glibmm2/glibmm/signalproxy.cc b/libs/glibmm2/glibmm/signalproxy.cc new file mode 100644 index 0000000000..67f7a9290b --- /dev/null +++ b/libs/glibmm2/glibmm/signalproxy.cc @@ -0,0 +1,105 @@ +// -*- c++ -*- + +/* $Id$ */ + +/* signalproxy.cc + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Glib +{ + +// SignalProxyBase implementation: + +SignalProxyBase::SignalProxyBase(Glib::ObjectBase* obj) +: + obj_ (obj) +{} + + +// SignalProxyNormal implementation: + +SignalProxyNormal::SignalProxyNormal(Glib::ObjectBase* obj, const SignalProxyInfo* info) +: + SignalProxyBase (obj), + info_ (info) +{} + +SignalProxyNormal::~SignalProxyNormal() +{} + +sigc::slot_base& +SignalProxyNormal::connect_(const sigc::slot_base& slot, bool after) +{ + return connect_impl_(info_->callback, slot, after); +} + +sigc::slot_base& +SignalProxyNormal::connect_notify_(const sigc::slot_base& slot, bool after) +{ + return connect_impl_(info_->notify_callback, slot, after); +} + +sigc::slot_base& +SignalProxyNormal::connect_impl_(GCallback callback, const sigc::slot_base& slot, bool after) +{ + // create a proxy to hold our connection info + SignalProxyConnectionNode *const pConnectionNode = + new SignalProxyConnectionNode(slot, obj_->gobj()); + + // connect it to glib + // pConnectionNode will be passed in the data argument to the callback. + pConnectionNode->connection_id_ = g_signal_connect_data( + obj_->gobj(), info_->signal_name, callback, pConnectionNode, + &SignalProxyConnectionNode::destroy_notify_handler, + static_cast((after) ? G_CONNECT_AFTER : 0)); + + return pConnectionNode->slot_; +} + +void SignalProxyNormal::emission_stop() +{ + g_signal_stop_emission_by_name(obj_->gobj(), info_->signal_name); +} + +// static +void SignalProxyNormal::slot0_void_callback(GObject* self, void* data) +{ + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper(self)) + { + try + { + if(sigc::slot_base *const slot = data_to_slot(data)) + (*static_cast*>(slot))(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/signalproxy.h b/libs/glibmm2/glibmm/signalproxy.h new file mode 100644 index 0000000000..43c8fc3fb8 --- /dev/null +++ b/libs/glibmm2/glibmm/signalproxy.h @@ -0,0 +1,394 @@ +// -*- c++ -*- +/* This is a generated file, do not edit. Generated from signalproxy.h.m4 */ + +#ifndef _GLIBMM_SIGNALPROXY_H +#define _GLIBMM_SIGNALPROXY_H + +extern "C" +{ + typedef void (*GCallback) (void); + typedef struct _GObject GObject; +} + +#include +#include + + +namespace Glib +{ + +// Forward declarations +class ObjectBase; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +struct SignalProxyInfo +{ + const char* signal_name; + GCallback callback; + GCallback notify_callback; +}; + +#endif //DOXYGEN_SHOULD_SKIP_THIS + +// This base class is used by SignalProxyNormal and SignalProxyProperty. +class SignalProxyBase +{ +public: + SignalProxyBase(Glib::ObjectBase* obj); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static inline sigc::slot_base* data_to_slot(void* data) + { + SignalProxyConnectionNode *const pConnectionNode = static_cast(data); + + // Return 0 if the connection is blocked. + return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : 0; + } +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +protected: + ObjectBase* obj_; + +private: + SignalProxyBase& operator=(const SignalProxyBase&); // not implemented +}; + + +// shared portion of a Signal +/** The SignalProxy provides an API similar to sigc::signal that can be used to + * connect sigc::slots to glib signals. + * + * This holds the name of the glib signal and the object + * which might emit it. Actually, proxies are controlled by + * the template derivatives, which serve as gatekeepers for the + * types allowed on a particular signal. + * + */ +class SignalProxyNormal : public SignalProxyBase +{ +public: + ~SignalProxyNormal(); + + /// stops the current signal emmision (not in libsigc++) + void emission_stop(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // This callback for SignalProxy0 + // is defined here to avoid code duplication. + static void slot0_void_callback(GObject*, void* data); +#endif + +protected: + + /** Create a proxy for a signal that can be emitted by @a obj. + * @param obj The object that can emit the signal. + * @param info Information about the signal, including its name, and the C callbacks that should be called by glib. + */ + SignalProxyNormal(Glib::ObjectBase* obj, const SignalProxyInfo* info); + + /** Connects a signal to a generic signal handler. This is called by connect() in derived SignalProxy classes. + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::slot_base& connect_(const sigc::slot_base& slot, bool after); + + /** Connects a signal to a signal handler without a return value. + * This is called by connect() in derived SignalProxy classes. + * + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::slot_base& connect_notify_(const sigc::slot_base& slot, bool after); + +private: + const SignalProxyInfo* info_; + + //TODO: We could maybe replace both connect_ and connect_notify_ with this in future, because they don't do anything extra. + /** This is called by connect_ and connect_impl_. + */ + sigc::slot_base& connect_impl_(GCallback callback, const sigc::slot_base& slot, bool after); + + // no copy assignment + SignalProxyNormal& operator=(const SignalProxyNormal&); +}; + + + + + +/**** Glib::SignalProxy0 ***************************************************/ + +/** Proxy for signals with 0 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy0 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy0(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +/**** Glib::SignalProxy1 ***************************************************/ + +/** Proxy for signals with 1 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy1 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy1(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +/**** Glib::SignalProxy2 ***************************************************/ + +/** Proxy for signals with 2 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy2 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy2(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +/**** Glib::SignalProxy3 ***************************************************/ + +/** Proxy for signals with 3 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy3 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy3(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +/**** Glib::SignalProxy4 ***************************************************/ + +/** Proxy for signals with 4 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy4 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy4(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +/**** Glib::SignalProxy5 ***************************************************/ + +/** Proxy for signals with 5 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy5 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy5(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +/**** Glib::SignalProxy6 ***************************************************/ + +/** Proxy for signals with 6 arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() to connect signals to signal handlers. + */ +template +class SignalProxy6 : public SignalProxyNormal +{ +public: + typedef sigc::slot SlotType; + typedef sigc::slot VoidSlotType; + + SignalProxy6(ObjectBase* obj, const SignalProxyInfo* info) + : SignalProxyNormal(obj, info) {} + + /** Connects a signal to a signal handler. + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { return sigc::connection(connect_(slot, after)); } + + /** Connects a signal to a signal handler without a return value. + * By default, the signal handler will be called before the default signal handler, + * in which case any return value would be replaced anyway by that of the later signal handler. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * @param slot The signal handler, which should have a void return type, usually created with sigc::mem_fun(), or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal handler. + */ + sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) + { return sigc::connection(connect_notify_(slot, after)); } +}; + + +} // namespace Glib + + +#endif /* _GLIBMM_SIGNALPROXY_H */ + diff --git a/libs/glibmm2/glibmm/signalproxy_connectionnode.cc b/libs/glibmm2/glibmm/signalproxy_connectionnode.cc new file mode 100644 index 0000000000..dc1c1c3103 --- /dev/null +++ b/libs/glibmm2/glibmm/signalproxy_connectionnode.cc @@ -0,0 +1,94 @@ +// -*- c++ -*- + +/* $Id$ */ + +/* signalproxy_connectionnode.cc + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +SignalProxyConnectionNode::SignalProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject) +: + connection_id_ (0), + slot_ (slot), + object_ (gobject) +{ + //The cleanup callback will be called when the connection is disconnected. + slot_.set_parent(this, &SignalProxyConnectionNode::notify /* cleanup callback */); +} + +// notify is a message coming up from the slot to be passed back to Gtk+ +// disconnect is a message coming up from the Gtk+ to be passed down to SigC++ +//static +void* SignalProxyConnectionNode::notify(void* data) +{ + // notification from libsigc++. + SignalProxyConnectionNode* conn = static_cast(data); + + // If there is no object, this call was triggered from destroy_notify_handler(), + // because we set conn->object to 0 there: + if(conn && conn->object_) + { + GObject* o = conn->object_; + conn->object_ = 0; + + if(g_signal_handler_is_connected(o, conn->connection_id_)) //We check first, because during destruction, GTK+ sometimes seems to disconnect them for us, before we expect it to. See bug #87912 + { + // Disconnecting triggers execution of destroy_notify_handler(), eiter immediately or later: + // When the signal handler is currently running. (for instance, if the callback disconnects its own connection) + // In that case, destroy_notify_handler() will be called after this whole function has returned. + // Anyway. destroy_notify_handler() will always be called, so we leave that to do the deletion. + + + //Forget the connection: + gulong connection_id = conn->connection_id_; + conn->connection_id_ = 0; + + g_signal_handler_disconnect(o, connection_id); + } + } + + return 0; // apparently unused in libsigc++ +} + +//static +void SignalProxyConnectionNode::destroy_notify_handler(gpointer data, GClosure*) +{ + //glib calls this when it has finished with a glib signal connection, + //either when the emitting object dies, or when the connection has been disconnected. + + // notification from gtk+. + SignalProxyConnectionNode* conn = static_cast(data); + + if(conn) + { + // the object has already lost track of this object. + conn->object_ = 0; + + delete conn; // if there are connection objects referring to slot_ they are notified during destruction of slot_ + } +} + +} /* namespace Glib */ + diff --git a/libs/glibmm2/glibmm/signalproxy_connectionnode.h b/libs/glibmm2/glibmm/signalproxy_connectionnode.h new file mode 100644 index 0000000000..d3cfff81f0 --- /dev/null +++ b/libs/glibmm2/glibmm/signalproxy_connectionnode.h @@ -0,0 +1,70 @@ +// -*- c++ -*- +#ifndef _GLIBMM_SIGNALPROXY_CONNECTIONNODE_H +#define _GLIBMM_SIGNALPROXY_CONNECTIONNODE_H + +/* $Id$ */ + +/* signalproxy_connectionnode.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +typedef struct _GObject GObject; + +namespace Glib +{ + +/** SignalProxyConnectionNode is a connection node for use with SignalProxy. + * It lives between the layer of Gtk+ and libsigc++. + * It is very much an internal class. + */ +class SignalProxyConnectionNode +{ +public: + + /** @param slot The signal handler for the glib signal. + * @param gobject The GObject that might emit this glib signal + */ + SignalProxyConnectionNode(const sigc::slot_base& slot, GObject* gobject); + + /** Callback that is executed when the slot becomes invalid. + * This callback is registered in the slot. + * @param data The SignalProxyConnectionNode object (@p this). + */ + static void* notify(void* data); + + /** Callback that is executed when the glib closure is destroyed. + * @param data The SignalProxyConnectionNode object (@p this). + * @param closure The glib closure object. + */ + static void destroy_notify_handler(gpointer data, GClosure* closure); + + gulong connection_id_; + sigc::slot_base slot_; + +protected: + GObject* object_; +}; + +} /* namespace Glib */ + + +#endif /* _GLIBMM_SIGNALPROXY_CONNECTIONNODE_H */ + diff --git a/libs/glibmm2/glibmm/slisthandle.h b/libs/glibmm2/glibmm/slisthandle.h new file mode 100644 index 0000000000..7034914ed3 --- /dev/null +++ b/libs/glibmm2/glibmm/slisthandle.h @@ -0,0 +1,405 @@ +// -*- c++ -*- +#ifndef _GLIBMM_SLISTHANDLE_H +#define _GLIBMM_SLISTHANDLE_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +namespace Container_Helpers +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/* Create and fill a GSList as efficient as possible. + * This requires bidirectional iterators. + */ +template +GSList* create_slist(Bi pbegin, Bi pend, Tr) +{ + GSList* head = 0; + + while(pend != pbegin) + { + // Use & to force a warning if the iterator returns a temporary object. + const void *const item = Tr::to_c_type(*&*--pend); + head = g_slist_prepend(head, const_cast(item)); + } + + return head; +} + +/* Create a GSList from a 0-terminated input sequence. + * Build it in reverse order and reverse the whole list afterwards, + * because appending to the list would be horribly inefficient. + */ +template +GSList* create_slist(For pbegin, Tr) +{ + GSList* head = 0; + + while(*pbegin) + { + // Use & to force a warning if the iterator returns a temporary object. + const void *const item = Tr::to_c_type(*&*pbegin); + head = g_slist_prepend(head, const_cast(item)); + ++pbegin; + } + + return g_slist_reverse(head); +} + + +/* Convert from any container that supports bidirectional iterators. + */ +template +struct SListSourceTraits +{ + static GSList* get_data(const Cont& cont) + { return Glib::Container_Helpers::create_slist(cont.begin(), cont.end(), Tr()); } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +/* Convert from a 0-terminated array. The Cont + * argument must be a pointer to the first element. + */ +template +struct SListSourceTraits +{ + static GSList* get_data(const Cont* array) + { return (array) ? Glib::Container_Helpers::create_slist(array, Tr()) : 0; } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +template +struct SListSourceTraits : SListSourceTraits +{}; + +/* Convert from a 0-terminated array. The Cont argument must be a pointer + * to the first element. For consistency, the array must be 0-terminated, + * even though the array size is known at compile time. + */ +template +struct SListSourceTraits +{ + static GSList* get_data(const Cont* array) + { return Glib::Container_Helpers::create_slist(array, array + (N - 1), Tr()); } + + static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; +}; + +template +struct SListSourceTraits : SListSourceTraits +{}; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** + * @ingroup ContHelpers + * If a method takes this as an argument, or has this as a return type, then you can use a standard + * container such as std::list or std::vector. + */ +template +class SListHandleIterator +{ +public: + typedef typename Tr::CppType CppType; + typedef typename Tr::CType CType; + + typedef std::forward_iterator_tag iterator_category; + typedef CppType value_type; + typedef ptrdiff_t difference_type; + typedef value_type reference; + typedef void pointer; + + explicit inline SListHandleIterator(const GSList* node); + + inline value_type operator*() const; + inline SListHandleIterator & operator++(); + inline const SListHandleIterator operator++(int); + + inline bool operator==(const SListHandleIterator& rhs) const; + inline bool operator!=(const SListHandleIterator& rhs) const; + +private: + const GSList* node_; +}; + +} // namespace Container_Helpers + + +/** + * @ingroup ContHandles + */ +template < class T, class Tr = Glib::Container_Helpers::TypeTraits > +class SListHandle +{ +public: + typedef typename Tr::CppType CppType; + typedef typename Tr::CType CType; + + typedef CppType value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef Glib::Container_Helpers::SListHandleIterator const_iterator; + typedef Glib::Container_Helpers::SListHandleIterator iterator; + + template inline + SListHandle(const Cont& container); + + // Take over ownership of a GSList created by GTK+ functions. + inline SListHandle(GSList* glist, Glib::OwnershipType ownership); + + // Copying clears the ownership flag of the source handle. + inline SListHandle(const SListHandle& other); + + ~SListHandle(); + + inline const_iterator begin() const; + inline const_iterator end() const; + + template inline operator std::vector() const; + template inline operator std::deque() const; + template inline operator std::list() const; + + template inline + void assign_to(Cont& container) const; + template inline + void copy(Out pdest) const; + + inline GSList* data() const; + inline size_t size() const; + inline bool empty() const; + +private: + GSList * pslist_; + mutable Glib::OwnershipType ownership_; + + // No copy assignment. + SListHandle& operator=(const SListHandle&); +}; + + +/***************************************************************************/ +/* Inline implementation */ +/***************************************************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +namespace Container_Helpers +{ + +/**** Glib::Container_Helpers::SListHandleIterator<> ***********************/ + +template inline +SListHandleIterator::SListHandleIterator(const GSList* node) +: + node_ (node) +{} + +template inline +typename SListHandleIterator::value_type SListHandleIterator::operator*() const +{ + return Tr::to_cpp_type(static_cast(node_->data)); +} + +template inline +SListHandleIterator& SListHandleIterator::operator++() +{ + node_ = node_->next; + return *this; +} + +template inline +const SListHandleIterator SListHandleIterator::operator++(int) +{ + const SListHandleIterator tmp (*this); + node_ = node_->next; + return tmp; +} + +template inline +bool SListHandleIterator::operator==(const SListHandleIterator& rhs) const +{ + return (node_ == rhs.node_); +} + +template inline +bool SListHandleIterator::operator!=(const SListHandleIterator& rhs) const +{ + return (node_ != rhs.node_); +} + +} // namespace Container_Helpers + + +/**** Glib::SListHandle<> **************************************************/ + +template + template +inline +SListHandle::SListHandle(const Cont& container) +: + pslist_ (Glib::Container_Helpers::SListSourceTraits::get_data(container)), + ownership_ (Glib::Container_Helpers::SListSourceTraits::initial_ownership) +{} + +template inline +SListHandle::SListHandle(GSList* gslist, Glib::OwnershipType ownership) +: + pslist_ (gslist), + ownership_ (ownership) +{} + +template inline +SListHandle::SListHandle(const SListHandle& other) +: + pslist_ (other.pslist_), + ownership_ (other.ownership_) +{ + other.ownership_ = Glib::OWNERSHIP_NONE; +} + +template +SListHandle::~SListHandle() +{ + if(ownership_ != Glib::OWNERSHIP_NONE) + { + if(ownership_ != Glib::OWNERSHIP_SHALLOW) + { + // Deep ownership: release each container element. + for(GSList* node = pslist_; node != 0; node = node->next) + Tr::release_c_type(static_cast(node->data)); + } + g_slist_free(pslist_); + } +} + +template inline +typename SListHandle::const_iterator SListHandle::begin() const +{ + return Glib::Container_Helpers::SListHandleIterator(pslist_); +} + +template inline +typename SListHandle::const_iterator SListHandle::end() const +{ + return Glib::Container_Helpers::SListHandleIterator(0); +} + +template + template +inline +SListHandle::operator std::vector() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::vector(this->begin(), this->end()); +#else + std::vector temp; + temp.reserve(this->size()); + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +SListHandle::operator std::deque() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::deque(this->begin(), this->end()); +#else + std::deque temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +SListHandle::operator std::list() const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + return std::list(this->begin(), this->end()); +#else + std::list temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + return temp; +#endif +} + +template + template +inline +void SListHandle::assign_to(Cont& container) const +{ +#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS + container.assign(this->begin(), this->end()); +#else + Cont temp; + Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); + container.swap(temp); +#endif +} + +template + template +inline +void SListHandle::copy(Out pdest) const +{ + std::copy(this->begin(), this->end(), pdest); +} + +template inline +GSList* SListHandle::data() const +{ + return pslist_; +} + +template inline +size_t SListHandle::size() const +{ + return g_slist_length(pslist_); +} + +template inline +bool SListHandle::empty() const +{ + return (pslist_ == 0); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_SLISTHANDLE_H */ + diff --git a/libs/glibmm2/glibmm/spawn.cc b/libs/glibmm2/glibmm/spawn.cc new file mode 100644 index 0000000000..cbc204cd70 --- /dev/null +++ b/libs/glibmm2/glibmm/spawn.cc @@ -0,0 +1,311 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace +{ + +extern "C" +{ + +/* Helper callback to invoke the actual sigc++ slot. + * We don't need to worry about (un)referencing, since the + * child process gets its own copy of the parent's memory anyway. + */ +void child_setup_callback(void* user_data) +{ + try + { + (*reinterpret_cast*>(user_data))(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void copy_output_buf(std::string* dest, const char* buf) +{ + if(dest) + { + if(buf) + *dest = buf; + else + dest->erase(); + } +} + +} //extern "C" + +} //anonymous namespace + + +namespace Glib +{ + +/**** process spawning functions *******************************************/ + +void spawn_async_with_pipes(const std::string& working_directory, + const Glib::ArrayHandle& argv, + const Glib::ArrayHandle& envp, + SpawnFlags flags, + const sigc::slot& child_setup, + Pid* child_pid, + int* standard_input, + int* standard_output, + int* standard_error) +{ + const bool setup_slot = !child_setup.empty(); + sigc::slot child_setup_ = child_setup; + GError* error = 0; + + g_spawn_async_with_pipes( + working_directory.c_str(), + const_cast(argv.data()), + const_cast(envp.data()), + static_cast(unsigned(flags)), + (setup_slot) ? &child_setup_callback : 0, + (setup_slot) ? &child_setup_ : 0, + child_pid, + standard_input, standard_output, standard_error, + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void spawn_async_with_pipes(const std::string& working_directory, + const Glib::ArrayHandle& argv, + SpawnFlags flags, + const sigc::slot& child_setup, + Pid* child_pid, + int* standard_input, + int* standard_output, + int* standard_error) +{ + const bool setup_slot = !child_setup.empty(); + sigc::slot child_setup_ = child_setup; + GError* error = 0; + + g_spawn_async_with_pipes( + working_directory.c_str(), + const_cast(argv.data()), 0, + static_cast(unsigned(flags)), + (setup_slot) ? &child_setup_callback : 0, + (setup_slot) ? &child_setup_ : 0, + child_pid, + standard_input, standard_output, standard_error, + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void spawn_async(const std::string& working_directory, + const Glib::ArrayHandle& argv, + const Glib::ArrayHandle& envp, + SpawnFlags flags, + const sigc::slot& child_setup, + Pid* child_pid) +{ + const bool setup_slot = !child_setup.empty(); + sigc::slot child_setup_ = child_setup; + GError* error = 0; + + g_spawn_async( + working_directory.c_str(), + const_cast(argv.data()), + const_cast(envp.data()), + static_cast(unsigned(flags)), + (setup_slot) ? &child_setup_callback : 0, + (setup_slot) ? &child_setup_ : 0, + child_pid, + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void spawn_async(const std::string& working_directory, + const Glib::ArrayHandle& argv, + SpawnFlags flags, + const sigc::slot& child_setup, + Pid* child_pid) +{ + const bool setup_slot = !child_setup.empty(); + sigc::slot child_setup_ = child_setup; + GError* error = 0; + + g_spawn_async( + working_directory.c_str(), + const_cast(argv.data()), 0, + static_cast(unsigned(flags)), + (setup_slot) ? &child_setup_callback : 0, + (setup_slot) ? &child_setup_ : 0, + child_pid, + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void spawn_sync(const std::string& working_directory, + const Glib::ArrayHandle& argv, + const Glib::ArrayHandle& envp, + SpawnFlags flags, + const sigc::slot& child_setup, + std::string* standard_output, + std::string* standard_error, + int* exit_status) +{ + const bool setup_slot = !child_setup.empty(); + sigc::slot child_setup_ = child_setup; + + Glib::ScopedPtr buf_standard_output; + Glib::ScopedPtr buf_standard_error; + GError* error = 0; + + g_spawn_sync( + working_directory.c_str(), + const_cast(argv.data()), + const_cast(envp.data()), + static_cast(unsigned(flags)), + (setup_slot) ? &child_setup_callback : 0, + (setup_slot) ? &child_setup_ : 0, + (standard_output) ? buf_standard_output.addr() : 0, + (standard_error) ? buf_standard_error.addr() : 0, + exit_status, + &error); + + if(error) + Glib::Error::throw_exception(error); + + copy_output_buf(standard_output, buf_standard_output.get()); + copy_output_buf(standard_error, buf_standard_error.get()); +} + +void spawn_sync(const std::string& working_directory, + const Glib::ArrayHandle& argv, + SpawnFlags flags, + const sigc::slot& child_setup, + std::string* standard_output, + std::string* standard_error, + int* exit_status) +{ + const bool setup_slot = !child_setup.empty(); + sigc::slot child_setup_ = child_setup; + + Glib::ScopedPtr buf_standard_output; + Glib::ScopedPtr buf_standard_error; + GError* error = 0; + + g_spawn_sync( + working_directory.c_str(), + const_cast(argv.data()), 0, + static_cast(unsigned(flags)), + (setup_slot) ? &child_setup_callback : 0, + (setup_slot) ? &child_setup_ : 0, + (standard_output) ? buf_standard_output.addr() : 0, + (standard_error) ? buf_standard_error.addr() : 0, + exit_status, + &error); + + if(error) + Glib::Error::throw_exception(error); + + copy_output_buf(standard_output, buf_standard_output.get()); + copy_output_buf(standard_error, buf_standard_error.get()); +} + +void spawn_command_line_async(const std::string& command_line) +{ + GError* error = 0; + g_spawn_command_line_async(command_line.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void spawn_command_line_sync(const std::string& command_line, + std::string* standard_output, + std::string* standard_error, + int* exit_status) +{ + Glib::ScopedPtr buf_standard_output; + Glib::ScopedPtr buf_standard_error; + GError* error = 0; + + g_spawn_command_line_sync( + command_line.c_str(), + (standard_output) ? buf_standard_output.addr() : 0, + (standard_error) ? buf_standard_error.addr() : 0, + exit_status, + &error); + + if(error) + Glib::Error::throw_exception(error); + + copy_output_buf(standard_output, buf_standard_output.get()); + copy_output_buf(standard_error, buf_standard_error.get()); +} + +void spawn_close_pid(Pid pid) +{ + g_spawn_close_pid(pid); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::SpawnError::SpawnError(Glib::SpawnError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_SPAWN_ERROR, error_code, error_message) +{} + +Glib::SpawnError::SpawnError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::SpawnError::Code Glib::SpawnError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::SpawnError::throw_func(GError* gobject) +{ + throw Glib::SpawnError(gobject); +} + + diff --git a/libs/glibmm2/glibmm/spawn.h b/libs/glibmm2/glibmm/spawn.h new file mode 100644 index 0000000000..df7a43a594 --- /dev/null +++ b/libs/glibmm2/glibmm/spawn.h @@ -0,0 +1,203 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_SPAWN_H +#define _GLIBMM_SPAWN_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include + +#include +GLIBMM_USING_STD(string) + + +namespace Glib +{ + +typedef GPid Pid; + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** + * @ingroup glibmmEnums + * @par Bitwise operators: + * %SpawnFlags operator|(SpawnFlags, SpawnFlags)
+ * %SpawnFlags operator&(SpawnFlags, SpawnFlags)
+ * %SpawnFlags operator^(SpawnFlags, SpawnFlags)
+ * %SpawnFlags operator~(SpawnFlags)
+ * %SpawnFlags& operator|=(SpawnFlags&, SpawnFlags)
+ * %SpawnFlags& operator&=(SpawnFlags&, SpawnFlags)
+ * %SpawnFlags& operator^=(SpawnFlags&, SpawnFlags)
+ */ +enum SpawnFlags +{ + SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0, + SPAWN_DO_NOT_REAP_CHILD = 1 << 1, + SPAWN_SEARCH_PATH = 1 << 2, + SPAWN_STDOUT_TO_DEV_NULL = 1 << 3, + SPAWN_STDERR_TO_DEV_NULL = 1 << 4, + SPAWN_CHILD_INHERITS_STDIN = 1 << 5, + SPAWN_FILE_AND_ARGV_ZERO = 1 << 6 +}; + +/** @ingroup glibmmEnums */ +inline SpawnFlags operator|(SpawnFlags lhs, SpawnFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline SpawnFlags operator&(SpawnFlags lhs, SpawnFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline SpawnFlags operator^(SpawnFlags lhs, SpawnFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline SpawnFlags operator~(SpawnFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup glibmmEnums */ +inline SpawnFlags& operator|=(SpawnFlags& lhs, SpawnFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline SpawnFlags& operator&=(SpawnFlags& lhs, SpawnFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline SpawnFlags& operator^=(SpawnFlags& lhs, SpawnFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +/** @defgroup Spawn Spawning Processes + * Process launching with fork()/exec(). + * @{ + */ + +/** Exception class for errors occuring when spawning processes. + */ +class SpawnError : public Glib::Error +{ +public: + enum Code + { + FORK, + READ, + CHDIR, + ACCES, + PERM, + TOOBIG, + NOEXEC, + NAMETOOLONG, + NOENT, + NOMEM, + NOTDIR, + LOOP, + TXTBUSY, + IO, + NFILE, + MFILE, + INVAL, + ISDIR, + LIBBAD + }; + + SpawnError(Code error_code, const Glib::ustring& error_message); + explicit SpawnError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +void spawn_async_with_pipes(const std::string& working_directory, + const Glib::ArrayHandle& argv, + const Glib::ArrayHandle& envp, + SpawnFlags flags = SpawnFlags(0), + const sigc::slot& child_setup = sigc::slot(), + Pid* child_pid = 0, + int* standard_input = 0, + int* standard_output = 0, + int* standard_error = 0); + +void spawn_async_with_pipes(const std::string& working_directory, + const Glib::ArrayHandle& argv, + SpawnFlags flags = SpawnFlags(0), + const sigc::slot& child_setup = sigc::slot(), + Pid* child_pid = 0, + int* standard_input = 0, + int* standard_output = 0, + int* standard_error = 0); + +void spawn_async(const std::string& working_directory, + const Glib::ArrayHandle& argv, + const Glib::ArrayHandle& envp, + SpawnFlags flags = SpawnFlags(0), + const sigc::slot& child_setup = sigc::slot(), + Pid* child_pid = 0); + +void spawn_async(const std::string& working_directory, + const Glib::ArrayHandle& argv, + SpawnFlags flags = SpawnFlags(0), + const sigc::slot& child_setup = sigc::slot(), + Pid* child_pid = 0); + +void spawn_sync(const std::string& working_directory, + const Glib::ArrayHandle& argv, + const Glib::ArrayHandle& envp, + SpawnFlags flags = SpawnFlags(0), + const sigc::slot& child_setup = sigc::slot(), + std::string* standard_output = 0, + std::string* standard_error = 0, + int* exit_status = 0); + +void spawn_sync(const std::string& working_directory, + const Glib::ArrayHandle& argv, + SpawnFlags flags = SpawnFlags(0), + const sigc::slot& child_setup = sigc::slot(), + std::string* standard_output = 0, + std::string* standard_error = 0, + int* exit_status = 0); + +void spawn_command_line_async(const std::string& command_line); + +void spawn_command_line_sync(const std::string& command_line, + std::string* standard_output = 0, + std::string* standard_error = 0, + int* exit_status = 0); + +void spawn_close_pid(Pid pid); + +/** @} group Spawn */ + +} // namespace Glib + + +#endif /* _GLIBMM_SPAWN_H */ + diff --git a/libs/glibmm2/glibmm/streamiochannel.cc b/libs/glibmm2/glibmm/streamiochannel.cc new file mode 100644 index 0000000000..985931dec8 --- /dev/null +++ b/libs/glibmm2/glibmm/streamiochannel.cc @@ -0,0 +1,188 @@ +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +GLIBMM_USING_STD(ios) + + +namespace Glib +{ + +// static +Glib::RefPtr StreamIOChannel::create(std::istream& stream) +{ + return Glib::RefPtr(new StreamIOChannel(&stream, 0)); +} + +// static +Glib::RefPtr StreamIOChannel::create(std::ostream& stream) +{ + return Glib::RefPtr(new StreamIOChannel(0, &stream)); +} + +// static +Glib::RefPtr StreamIOChannel::create(std::iostream& stream) +{ + return Glib::RefPtr(new StreamIOChannel(&stream, &stream)); +} + +StreamIOChannel::StreamIOChannel(std::istream* stream_in, std::ostream* stream_out) +: + stream_in_ (stream_in), + stream_out_ (stream_out) +{ + get_flags_vfunc(); // initialize GIOChannel flag bits +} + +StreamIOChannel::~StreamIOChannel() +{} + +IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read) +{ + g_return_val_if_fail(stream_in_ != 0, IO_STATUS_ERROR); + + stream_in_->clear(); + stream_in_->read(buf, count); + bytes_read = stream_in_->gcount(); + + if(stream_in_->eof()) + return IO_STATUS_EOF; + + if(stream_in_->fail()) + throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Reading from stream failed"); + + return IO_STATUS_NORMAL; +} + +IOStatus StreamIOChannel::write_vfunc(const char* buf, gsize count, gsize& bytes_written) +{ + g_return_val_if_fail(stream_out_ != 0, IO_STATUS_ERROR); + + bytes_written = 0; + + stream_out_->clear(); + stream_out_->write(buf, count); + + if(stream_out_->fail()) + throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Writing to stream failed"); + + bytes_written = count; // all or nothing ;) + + return IO_STATUS_NORMAL; +} + +IOStatus StreamIOChannel::seek_vfunc(gint64 offset, SeekType type) +{ + std::ios::seekdir direction = std::ios::beg; + + switch(type) + { + case SEEK_TYPE_SET: direction = std::ios::beg; break; + case SEEK_TYPE_CUR: direction = std::ios::cur; break; + case SEEK_TYPE_END: direction = std::ios::end; break; + } + + bool failed = false; + + if(stream_in_) + { + stream_in_->clear(); + stream_in_->seekg(offset, direction); + failed = stream_in_->fail(); + } + if(stream_out_) + { + stream_out_->clear(); + stream_out_->seekp(offset, direction); + failed = (failed || stream_out_->fail()); + } + + if(failed) + throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Seeking into stream failed"); + + return Glib::IO_STATUS_NORMAL; +} + +IOStatus StreamIOChannel::close_vfunc() +{ + bool failed = false; + + if(std::fstream *const stream = dynamic_cast(stream_in_)) + { + stream->clear(); + stream->close(); + failed = stream->fail(); + } + else if(std::ifstream *const stream = dynamic_cast(stream_in_)) + { + stream->clear(); + stream->close(); + failed = stream->fail(); + } + else if(std::ofstream *const stream = dynamic_cast(stream_out_)) + { + stream->clear(); + stream->close(); + failed = stream->fail(); + } + else + { + throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, + "Attempt to close non-file stream"); + } + + if(failed) + throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Failed to close stream"); + + return IO_STATUS_NORMAL; +} + +IOStatus StreamIOChannel::set_flags_vfunc(IOFlags) +{ + return IO_STATUS_NORMAL; +} + +IOFlags StreamIOChannel::get_flags_vfunc() +{ + gobj()->is_seekable = 1; + gobj()->is_readable = (stream_in_ != 0); + gobj()->is_writeable = (stream_out_ != 0); + + IOFlags flags = IO_FLAG_IS_SEEKABLE; + + if(stream_in_) + flags |= IO_FLAG_IS_READABLE; + if(stream_out_) + flags |= IO_FLAG_IS_WRITEABLE; + + return flags; +} + +Glib::RefPtr StreamIOChannel::create_watch_vfunc(IOCondition) +{ + g_warning("Glib::StreamIOChannel::create_watch_vfunc() not implemented"); + return Glib::RefPtr(); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/streamiochannel.h b/libs/glibmm2/glibmm/streamiochannel.h new file mode 100644 index 0000000000..7165de9096 --- /dev/null +++ b/libs/glibmm2/glibmm/streamiochannel.h @@ -0,0 +1,67 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GLIBMM_STREAMIOCHANNEL_H +#define _GLIBMM_STREAMIOCHANNEL_H + +#include +#include +#include + +GLIBMM_USING_STD(istream) +GLIBMM_USING_STD(ostream) +GLIBMM_USING_STD(iostream) + + +namespace Glib +{ + +/** This whole class is deprecated in glibmm 2.2. + * See the Glib::IOChannel documentation for an explanation. + */ +class StreamIOChannel : public Glib::IOChannel +{ +public: + virtual ~StreamIOChannel(); + + static Glib::RefPtr create(std::istream& stream); + static Glib::RefPtr create(std::ostream& stream); + static Glib::RefPtr create(std::iostream& stream); + +protected: + std::istream* stream_in_; + std::ostream* stream_out_; + + StreamIOChannel(std::istream* stream_in, std::ostream* stream_out); + + virtual IOStatus read_vfunc(char* buf, gsize count, gsize& bytes_read); + virtual IOStatus write_vfunc(const char* buf, gsize count, gsize& bytes_written); + virtual IOStatus seek_vfunc(gint64 offset, SeekType type); + virtual IOStatus close_vfunc(); + virtual IOStatus set_flags_vfunc(IOFlags flags); + virtual IOFlags get_flags_vfunc(); + virtual Glib::RefPtr create_watch_vfunc(IOCondition cond); +}; + +} // namespace Glib + + +#endif /* _GLIBMM_STREAMIOCHANNEL_H */ + diff --git a/libs/glibmm2/glibmm/stringutils.cc b/libs/glibmm2/glibmm/stringutils.cc new file mode 100644 index 0000000000..7113c014b8 --- /dev/null +++ b/libs/glibmm2/glibmm/stringutils.cc @@ -0,0 +1,117 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + +GLIBMM_USING_STD(out_of_range) +GLIBMM_USING_STD(overflow_error) +GLIBMM_USING_STD(underflow_error) + + +bool Glib::str_has_prefix(const std::string& str, const std::string& prefix) +{ + return g_str_has_prefix(str.c_str(), prefix.c_str()); +} + +bool Glib::str_has_suffix(const std::string& str, const std::string& suffix) +{ + return g_str_has_suffix(str.c_str(), suffix.c_str()); +} + +double Glib::Ascii::strtod(const std::string& str) +{ + std::string::size_type dummy; + return Glib::Ascii::strtod(str, dummy, 0); +} + +double Glib::Ascii::strtod(const std::string& str, + std::string::size_type& end_index, + std::string::size_type start_index) +{ + if(start_index > str.size()) + throw std::out_of_range("out of range (strtod): start_index > str.size()"); + + const char *const bufptr = str.c_str(); + char* endptr = 0; + + const double result = g_ascii_strtod(bufptr + start_index, &endptr); + const int err_no = errno; + + if(err_no != 0) + { + g_return_val_if_fail(err_no == ERANGE, result); + + if(result > 0.0) + throw std::overflow_error("overflow (strtod): positive number too large"); + + if(result < 0.0) + throw std::overflow_error("overflow (strtod): negative number too large"); + + throw std::underflow_error("underflow (strtod): number too small"); + } + + if(endptr) + end_index = endptr - bufptr; + else + end_index = str.size(); + + return result; +} + +std::string Glib::Ascii::dtostr(double d) +{ + char buf[G_ASCII_DTOSTR_BUF_SIZE]; + + return g_ascii_dtostr(buf, sizeof(buf), d); +} + +std::string Glib::strescape(const std::string& source) +{ + const Glib::ScopedPtr buf (g_strescape(source.c_str(), 0)); + return buf.get(); +} + +std::string Glib::strescape(const std::string& source, const std::string& exceptions) +{ + const Glib::ScopedPtr buf (g_strescape(source.c_str(), exceptions.c_str())); + return buf.get(); +} + +std::string Glib::strcompress(const std::string& source) +{ + const Glib::ScopedPtr buf (g_strcompress(source.c_str())); + return buf.get(); +} + +Glib::ustring Glib::strerror(int errnum) +{ + return g_strerror(errnum); +} + +Glib::ustring Glib::strsignal(int signum) +{ + return g_strsignal(signum); +} + diff --git a/libs/glibmm2/glibmm/stringutils.h b/libs/glibmm2/glibmm/stringutils.h new file mode 100644 index 0000000000..c6920e0830 --- /dev/null +++ b/libs/glibmm2/glibmm/stringutils.h @@ -0,0 +1,184 @@ +// -*- c++ -*- +#ifndef _GLIBMM_STRINGUTILS_H +#define _GLIBMM_STRINGUTILS_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +/** @defgroup StringUtils String Utility Functions + * + * This section describes a number of utility functions for creating + * and manipulating strings, as well as other string-related stuff. + */ + +/** Looks whether the string @a str begins with @a prefix. + * @ingroup StringUtils + * @param str A string. + * @param prefix The prefix to look for. + * @return true if @a str begins with @a prefix, false otherwise. + */ +bool str_has_prefix(const std::string& str, const std::string& prefix); + +/** Looks whether the string @a str ends with @a suffix. + * @ingroup StringUtils + * @param str A string. + * @param suffix The suffix to look for. + * @return true if @a str ends with @a suffix, false otherwise. + */ +bool str_has_suffix(const std::string& str, const std::string& suffix); + + +namespace Ascii +{ + +/** Converts a string to a double value. + * @ingroup StringUtils + * This function behaves like the standard %strtod() function does in + * the C locale. It does this without actually changing the current + * locale, since that would not be thread-safe. + * + * This function is typically used when reading configuration files or other + * non-user input that should be locale independent. To handle input from the + * user you should normally use locale-sensitive C++ streams. + * + * To convert from a string to double in a locale-insensitive way, use + * Glib::Ascii::dtostr(). + * + * @param str The string to convert to a numeric value. + * @return The double value. + * @throw std::overflow_error Thrown if the correct value would cause overflow. + * @throw std::underflow_error Thrown if the correct value would cause underflow. + */ +double strtod(const std::string& str); + +/** Converts a string to a double value. + * @ingroup StringUtils + * This function behaves like the standard %strtod() function does in + * the C locale. It does this without actually changing the current + * locale, since that would not be thread-safe. + * + * This function is typically used when reading configuration files or other + * non-user input that should be locale independent. To handle input from the + * user you should normally use locale-sensitive C++ streams. + * + * To convert from a string to double in a locale-insensitive way, use + * Glib::Ascii::dtostr(). + * + * @param str The string to convert to a numeric value. + * @param start_index The index of the first character that should be used in the conversion. + * @retval end_index The index of the character after the last character used in the conversion. + * @return The double value. + * @throw std::out_of_range Thrown if @a start_index is out of range. + * @throw std::overflow_error Thrown if the correct value would cause overflow. + * @throw std::underflow_error Thrown if the correct value would cause underflow. + */ +double strtod(const std::string& str, + std::string::size_type& end_index, + std::string::size_type start_index = 0); + +/** Converts a double to a string, using the '.' as decimal point. + * @ingroup StringUtils + * This functions generates enough precision that converting the string back + * using Glib::Ascii::strtod() gives the same machine-number (on machines with + * IEEE compatible 64bit doubles). + * + * @param d The double value to convert. + * @return The converted string. + */ +std::string dtostr(double d); + +} // namespace Ascii + + +/** Escapes all special characters in the string. + * @ingroup StringUtils + * Escapes the special characters '\\b', '\\f', '\\n', + * '\\r', '\\t', '\\' and '"' in the string + * @a source by inserting a '\\' before them. Additionally all characters + * in the range 0x01 - 0x1F (everything below SPACE) + * and in the range 0x80 - 0xFF (all non-ASCII chars) + * are replaced with a '\\' followed by their octal representation. + * + * Glib::strcompress() does the reverse conversion. + * + * @param source A string to escape. + * @return A copy of @a source with certain characters escaped. See above. + */ +std::string strescape(const std::string& source); + +/** Escapes all special characters in the string. + * @ingroup StringUtils + * Escapes the special characters '\\b', '\\f', '\\n', + * '\\r', '\\t', '\\' and '"' in the string + * @a source by inserting a '\\' before them. Additionally all characters + * in the range 0x01 - 0x1F (everything below SPACE) + * and in the range 0x80 - 0xFF (all non-ASCII chars) + * are replaced with a '\\' followed by their octal representation. + * Characters supplied in @a exceptions are not escaped. + * + * Glib::strcompress() does the reverse conversion. + * + * @param source A string to escape. + * @param exceptions A string of characters not to escape in @a source. + * @return A copy of @a source with certain characters escaped. See above. + */ +std::string strescape(const std::string& source, const std::string& exceptions); + +/** Replaces all escaped characters with their one byte equivalent. + * @ingroup StringUtils + * This function does the reverse conversion of Glib::strescape(). + * + * @param source A string to compress. + * @return A copy of @a source with all escaped characters compressed. + */ +std::string strcompress(const std::string& source); + +/** Returns a string corresponding to the given error code, e.g.\ "no such process". + * @ingroup StringUtils + * This function is included since not all platforms support the + * %strerror() function. + * + * @param errnum The system error number. See the standard C errno documentation. + * @return A string describing the error code. If the error code is unknown, + * "unknown error (\)" is returned. + */ +Glib::ustring strerror(int errnum); + +/** Returns a string describing the given signal, e.g.\ "Segmentation fault". + * @ingroup StringUtils + * This function is included since not all platforms support the + * %strsignal() function. + * + * @param signum The signal number. See the signal() documentation. + * @return A string describing the signal. If the signal is unknown, + * "unknown signal (\)" is returned. + */ +Glib::ustring strsignal(int signum); + +} // namespace Glib + + +#endif /* _GLIBMM_STRINGUTILS_H */ + diff --git a/libs/glibmm2/glibmm/thread.cc b/libs/glibmm2/glibmm/thread.cc new file mode 100644 index 0000000000..1910c6fa38 --- /dev/null +++ b/libs/glibmm2/glibmm/thread.cc @@ -0,0 +1,399 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ + +extern "C" +{ + +static void* call_thread_entry_slot(void* data) +{ + sigc::slot_base *const slot = reinterpret_cast(data); + + try + { + // Recreate the specific slot, and drop the reference obtained by create(). + (*static_cast*>(slot))(); + } + catch(Glib::Thread::Exit&) + { + // Just exit from the thread. The Thread::Exit exception + // is our sane C++ replacement of g_thread_exit(). + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete slot; + return 0; +} + +} //extern "C" + +} // anonymous namespace + + +namespace Glib +{ + +// internal +void thread_init_impl() +{ + // Make sure the exception map is initialized before creating any thread. + Glib::Error::register_init(); +} + + +/**** Glib::Thread *********************************************************/ + +// static +Thread* Thread::create(const sigc::slot& slot, bool joinable) +{ + // Make a copy of slot on the heap + sigc::slot_base *const slot_copy = new sigc::slot(slot); + + GError* error = 0; + + GThread *const thread = g_thread_create( + &call_thread_entry_slot, slot_copy, joinable, &error); + + if(error) + { + delete slot_copy; + Glib::Error::throw_exception(error); + } + + return reinterpret_cast(thread); +} + +// static +Thread* Thread::create(const sigc::slot& slot, unsigned long stack_size, + bool joinable, bool bound, ThreadPriority priority) +{ + // Make a copy of slot on the heap + sigc::slot_base *const slot_copy = new sigc::slot(slot); + + GError* error = 0; + + GThread *const thread = g_thread_create_full( + &call_thread_entry_slot, slot_copy, stack_size, joinable, + bound, (GThreadPriority) priority, &error); + + if(error) + { + delete slot_copy; + Glib::Error::throw_exception(error); + } + + return reinterpret_cast(thread); +} + +// static +Thread* Thread::self() +{ + return reinterpret_cast(g_thread_self()); +} + +bool Thread::joinable() const +{ + return gobject_.joinable; +} + +void Thread::join() +{ + g_thread_join(&gobject_); +} + +void Thread::set_priority(ThreadPriority priority) +{ + g_thread_set_priority(&gobject_, (GThreadPriority) priority); +} + +ThreadPriority Thread::get_priority() const +{ + return (ThreadPriority) gobject_.priority; +} + +// static +void Thread::yield() +{ + g_thread_yield(); +} + +Thread* wrap(GThread* gobject) +{ + return reinterpret_cast(gobject); +} + + +/**** Glib::StaticMutex ****************************************************/ + +void StaticMutex::lock() +{ + g_static_mutex_lock(&gobject_); +} + +bool StaticMutex::trylock() +{ + return g_static_mutex_trylock(&gobject_); +} + +void StaticMutex::unlock() +{ + g_static_mutex_unlock(&gobject_); +} + +StaticMutex::operator Mutex&() +{ + // If GStaticMutex is implemented as struct (e.g. on Linux), its first struct + // member (runtime_mutex) is a GMutex pointer. If the gthread implementation + // is native (i.e. the vtable pointer passed to g_thread_init() was 0), then + // the runtime_mutex pointer is unused, and the rest of the GStaticMutex + // struct resembles the mutex data. + // + // On Win32, GStaticMutex is just a typedef to struct _GMutex*. Either way, + // the first sizeof(GMutex*) bytes of GStaticMutex always resemble a GMutex + // pointer. The gthread implementation relies on that, and we'll also do so. + + GMutex*& runtime_mutex = reinterpret_cast(gobject_); + + // Fortunately, it cannot hurt if we set this to the GMutex pointer returned + // by g_static_mutex_get_mutex(). Either we just overwrite it with the same + // value, or it was unused anyway. Doing that allows casting the pointer + // location to a Glib::Mutex reference (its only data member is a GMutex*). + + runtime_mutex = g_static_mutex_get_mutex(&gobject_); + + return reinterpret_cast(runtime_mutex); +} + + +/**** Glib::Mutex **********************************************************/ + +Mutex::Mutex() +: + gobject_ (g_mutex_new()) +{} + +Mutex::~Mutex() +{ + g_mutex_free(gobject_); +} + +void Mutex::lock() +{ + g_mutex_lock(gobject_); +} + +bool Mutex::trylock() +{ + return g_mutex_trylock(gobject_); +} + +void Mutex::unlock() +{ + g_mutex_unlock(gobject_); +} + + +/**** Glib::StaticRecMutex *************************************************/ + +void StaticRecMutex::lock() +{ + g_static_rec_mutex_lock(&gobject_); +} + +bool StaticRecMutex::trylock() +{ + return g_static_rec_mutex_trylock(&gobject_); +} + +void StaticRecMutex::unlock() +{ + g_static_rec_mutex_unlock(&gobject_); +} + +void StaticRecMutex::lock_full(unsigned int depth) +{ + g_static_rec_mutex_lock_full(&gobject_, depth); +} + +unsigned int StaticRecMutex::unlock_full() +{ + return g_static_rec_mutex_unlock_full(&gobject_); +} + +StaticRecMutex::operator RecMutex&() +{ + return static_cast(*this); +} + + +/**** Glib::RecMutex *******************************************************/ + +RecMutex::RecMutex() +{ + g_static_rec_mutex_init(&gobject_); + + // GLib doesn't have GRecMutex, only GStaticRecMutex. Force initialization + // of the mutex now, to mimic the behaviour of a (hypothetical) GRecMutex. + g_static_mutex_get_mutex(&gobject_.mutex); +} + +RecMutex::~RecMutex() +{ + g_static_rec_mutex_free(&gobject_); +} + + +/**** Glib::StaticRWLock ***************************************************/ + +void StaticRWLock::reader_lock() +{ + g_static_rw_lock_reader_lock(&gobject_); +} + +bool StaticRWLock::reader_trylock() +{ + return g_static_rw_lock_reader_trylock(&gobject_); +} + +void StaticRWLock::reader_unlock() +{ + g_static_rw_lock_reader_unlock(&gobject_); +} + +void StaticRWLock::writer_lock() +{ + g_static_rw_lock_writer_lock(&gobject_); +} + +bool StaticRWLock::writer_trylock() +{ + return g_static_rw_lock_writer_trylock(&gobject_); +} + +void StaticRWLock::writer_unlock() +{ + g_static_rw_lock_writer_unlock(&gobject_); +} + +StaticRWLock::operator RWLock&() +{ + return static_cast(*this); +} + + +/**** Glib::RWLock *********************************************************/ + +RWLock::RWLock() +{ + g_static_rw_lock_init(&gobject_); + + // GLib doesn't have GRWLock, only GStaticRWLock. Force initialization + // of the mutex and the condition variables now, to mimic the behaviour + // of a (hypothetical) GRWLock. + + if(g_static_mutex_get_mutex(&gobject_.mutex)) + { + gobject_.read_cond = g_cond_new(); + gobject_.write_cond = g_cond_new(); + } +} + +RWLock::~RWLock() +{ + g_static_rw_lock_free(&gobject_); +} + + +/**** Glib::Cond ***********************************************************/ + +Cond::Cond() +: + gobject_ (g_cond_new()) +{} + +Cond::~Cond() +{ + g_cond_free(gobject_); +} + +void Cond::signal() +{ + g_cond_signal(gobject_); +} + +void Cond::broadcast() +{ + g_cond_broadcast(gobject_); +} + +void Cond::wait(Mutex& mutex) +{ + g_cond_wait(gobject_, mutex.gobj()); +} + +bool Cond::timed_wait(Mutex& mutex, const Glib::TimeVal& abs_time) +{ + return g_cond_timed_wait(gobject_, mutex.gobj(), const_cast(&abs_time)); +} + + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + + +Glib::ThreadError::ThreadError(Glib::ThreadError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (G_THREAD_ERROR, error_code, error_message) +{} + +Glib::ThreadError::ThreadError(GError* gobject) +: + Glib::Error (gobject) +{} + +Glib::ThreadError::Code Glib::ThreadError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Glib::ThreadError::throw_func(GError* gobject) +{ + throw Glib::ThreadError(gobject); +} + + diff --git a/libs/glibmm2/glibmm/thread.h b/libs/glibmm2/glibmm/thread.h new file mode 100644 index 0000000000..a4fa61da0b --- /dev/null +++ b/libs/glibmm2/glibmm/thread.h @@ -0,0 +1,1082 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_THREAD_H +#define _GLIBMM_THREAD_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +#include +#include +#include + +/* Shadow THREAD_PRIORITY_NORMAL macro (from winbase.h). + */ +#if defined(THREAD_PRIORITY_NORMAL) && !defined(GLIBMM_MACRO_SHADOW_THREAD_PRIORITY_NORMAL) +enum { GLIBMM_MACRO_DEFINITION_THREAD_PRIORITY_NORMAL = THREAD_PRIORITY_NORMAL }; +#undef THREAD_PRIORITY_NORMAL +enum { THREAD_PRIORITY_NORMAL = GLIBMM_MACRO_DEFINITION_THREAD_PRIORITY_NORMAL }; +#define THREAD_PRIORITY_NORMAL THREAD_PRIORITY_NORMAL +#define GLIBMM_MACRO_SHADOW_THREAD_PRIORITY_NORMAL 1 +#endif + + +/** Initializer macro for Glib::StaticMutex. + * @relates Glib::StaticMutex + * @hideinitializer + */ +#define GLIBMM_STATIC_MUTEX_INIT { G_STATIC_MUTEX_INIT } + +/** Initializer macro for Glib::StaticRecMutex. + * @relates Glib::StaticRecMutex + * @hideinitializer + */ +#define GLIBMM_STATIC_REC_MUTEX_INIT { G_STATIC_REC_MUTEX_INIT } + +/** Initializer macro for Glib::StaticRWLock. + * @relates Glib::StaticRWLock + * @hideinitializer + */ +#define GLIBMM_STATIC_RW_LOCK_INIT { G_STATIC_RW_LOCK_INIT } + +/** Initializer macro for Glib::StaticPrivate. + * @relates Glib::StaticPrivate + * @hideinitializer + */ +#define GLIBMM_STATIC_PRIVATE_INIT { G_STATIC_PRIVATE_INIT } + + +namespace Glib +{ + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** Specifies the priority of a thread. + * @note It is not guaranteed, that threads with different priorities really + * behave accordingly. On some systems (e.g. Linux) only root can + * increase priorities. On other systems (e.g. Solaris) there doesn't seem to + * be different scheduling for different priorities. All in all try to avoid + * being dependent on priorities. + * @ingroup glibmmEnums + */ +enum ThreadPriority +{ + THREAD_PRIORITY_LOW, + THREAD_PRIORITY_NORMAL, + THREAD_PRIORITY_HIGH, + THREAD_PRIORITY_URGENT +}; + + +/*! @var ThreadPriority THREAD_PRIORITY_LOW + * A priority lower than normal. + */ +/*! @var ThreadPriority THREAD_PRIORITY_NORMAL + * The default priority. + */ +/*! @var ThreadPriority THREAD_PRIORITY_HIGH + * A priority higher than normal. + */ +/*! @var ThreadPriority THREAD_PRIORITY_URGENT + * The highest priority. + */ + + +/** @defgroup Threads Threads + * Thread abstraction; including threads, different mutexes, + * conditions and thread private data. + * @{ + */ + +enum NotLock { NOT_LOCK }; +enum TryLock { TRY_LOCK }; + +/** Initializes the GLib thread system. + * Before you use a thread related function in glibmm, you should initialize + * the thread system. This is done by calling Glib::thread_init(). + * + * @note You should only call thread_init() with a non-0 parameter + * if you really know what you are doing. + * + * @note thread_init() must not be called directly or indirectly as + * a callback from glibmm. Also no mutexes may be currently locked while + * calling thread_init(). + * + * thread_init() might only be called once. On the second call it will + * abort with an error. If you want to make sure that the thread system + * is initialized, you can do that too: + * @code + * if(!Glib::thread_supported()) Glib::thread_init(); + * @endcode + * After that line either the thread system is initialized, or the program + * will abort if no thread system is available in GLib, i.e. either + * @c G_THREADS_ENABLED is not defined or @c G_THREADS_IMPL_NONE is defined. + * + * If no thread system is available and @a vtable is 0 or if not all + * elements of @a vtable are non-0, then thread_init() will abort. + * + * @note To use thread_init() in your program, you have to link with the + * libraries that the command pkg-config --libs gthread-2.0 + * outputs. This is not the case for all the other thread related functions + * of glibmm. Those can be used without having to link with the thread + * libraries. (You @em have to link with gthread-2.0 if you actually + * want to use threads in your application, though.) + * + * @param vtable A function table of type @c GThreadFunctions, that provides + * the entry points to the thread system to be used. + */ +inline void thread_init(GThreadFunctions* vtable = 0); + +/** Returns whether the thread system is initialized. + * @return @c true, if the thread system is initialized. + */ +inline bool thread_supported(); + + +class Mutex; +class RecMutex; +class RWLock; +struct StaticMutex; +struct StaticRecMutex; +struct StaticRWLock; + + +/** Exception class for thread-related errors. + */ +class ThreadError : public Glib::Error +{ +public: + enum Code + { + AGAIN + }; + + ThreadError(Code error_code, const Glib::ustring& error_message); + explicit ThreadError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + + +/** Represents a running thread. + * An instance of this class can only be obtained with create(), self(), + * or wrap(GThread*). It's not possible to delete a Thread object. If the + * thread is @em not joinable, its resources will be freed automatically + * when it exits. Otherwise, if the thread @em is joinable, you must call + * join() to avoid a memory leak. + * + * @note g_thread_exit() is not wrapped, because that function exits a thread + * without any cleanup. That's especially dangerous in C++ code, since the + * destructors of automatic objects won't be invoked. Instead, you can throw + * a Thread::Exit exception, which will be caught by the internal thread + * entry function. + * + * @note You might have noticed that the thread entry slot doesn't have the + * usual void* return value. If you want to return any data from your thread + * you can pass an additional output argument to the thread's entry slot. + */ +class Thread +{ +public: + class Exit; + + /** Creates a new thread with the priority THREAD_PRIORITY_NORMAL. + * If @a joinable is @c true, you can wait for this thread's termination by + * calling join(). Otherwise the thread will just disappear, when ready. + * + * The new thread executes the function or method @a slot points to. You can + * pass additional arguments using sigc::bind(). If the thread was created + * successfully, it is returned, otherwise a ThreadError exception is thrown. + * + * @param slot A slot to execute in the new thread. + * @param joinable Should this thread be joinable? + * @return The new Thread* on success. + * @throw Glib::ThreadError + */ + static Thread* create(const sigc::slot& slot, bool joinable); + + /** Creates a new thread with the priority @a priority. The stack gets the + * size @a stack_size or the default value for the current platform, if + * @a stack_size is 0. + * + * If @a joinable is @c true, you can wait for this thread's termination by + * calling join(). Otherwise the thread will just disappear, when ready. + * If @a bound is @c true, this thread will be scheduled in the system scope, + * otherwise the implementation is free to do scheduling in the process + * scope. The first variant is more expensive resource-wise, but generally + * faster. On some systems (e.g. Linux) all threads are bound. + * + * The new thread executes the function or method @a slot points to. You can + * pass additional arguments using sigc::bind(). If the thread was created + * successfully, it is returned. + * + * @note It is not guaranteed, that threads with different priorities really + * behave accordingly. On some systems (e.g. Linux) only root can increase + * priorities. On other systems (e.g. Solaris) there doesn't seem to be + * different scheduling for different priorities. All in all try to avoid + * being dependent on priorities. Use Glib::THREAD_PRIORITY_NORMAL + * here as a default. + * + * @note Only use the extended + * create(const sigc::slot&, unsigned long, bool, bool, ThreadPriority) + * function, when you really can't use the simple + * create(const sigc::slot&, bool) + * instead. The latter overload does not take @a stack_size, @a bound and + * @a priority as arguments, as they should only be used for cases, where + * it is inevitable. + * + * @param slot A slot to execute in the new thread. + * @param stack_size A stack size for the new thread, or 0. + * @param joinable Should this thread be joinable? + * @param bound Should this thread be bound to a system thread? + * @param priority A priority for the thread. + * @return The new Thread* on success. + * @throw Glib::ThreadError + */ + static Thread* create(const sigc::slot& slot, unsigned long stack_size, + bool joinable, bool bound, ThreadPriority priority); + + /** Returns the Thread* corresponding to the calling thread. + * @return The current thread. + */ + static Thread* self(); + + /** Returns whether the thread is joinable. + * @return Whether the thread is joinable. + */ + bool joinable() const; + + /** Waits until the thread finishes. + * Waits until the thread finishes, i.e. the slot, as given to create(), + * returns or g_thread_exit() is called by the thread. (Calling + * g_thread_exit() in a C++ program should be avoided.) All resources of + * the thread including the Glib::Thread object are released. The thread + * must have been created with joinable = true. + */ + void join(); + + /** Changes the priority of the thread to @a priority. + * @note It is not guaranteed, that threads with different priorities really + * behave accordingly. On some systems (e.g. Linux) only @c root can + * increase priorities. On other systems (e.g. Solaris) there doesn't seem + * to be different scheduling for different priorities. All in all try to + * avoid being dependent on priorities. + * @param priority A new priority for the thread. + */ + void set_priority(ThreadPriority priority); + + /** Returns the priority of the thread. + * @return The thread's priority. + */ + ThreadPriority get_priority() const; + + /** Gives way to other threads waiting to be scheduled. + * This function is often used as a method to make busy wait less evil. But + * in most cases, you will encounter, there are better methods to do that. + * So in general you shouldn't use this function. + */ + static void yield(); + + GThread* gobj() { return &gobject_; } + const GThread* gobj() const { return &gobject_; } + +private: + GThread gobject_; + + // Glib::Thread can neither be constructed nor deleted. + Thread(); + void operator delete(void*, size_t); + + // noncopyable + Thread(const Thread&); + Thread& operator=(const Thread&); +}; + +/** %Exception class used to exit from a thread. + * @code + * throw Glib::Thread::Exit(); + * @endcode + * Write this if you want to exit from a thread created by Thread::create(). + * Of course you must make sure not to catch Thread::Exit by accident, i.e. + * when using catch(...) somewhere in your code. + */ +class Thread::Exit +{}; + +/** @relates Glib::Thread */ +Thread* wrap(GThread* gobject); + + +/** Like Glib::Mutex, but can be defined at compile time. + * Use @c GLIBMM_STATIC_MUTEX_INIT to initialize a StaticMutex: + * @code + * Glib::StaticMutex mutex = GLIBMM_STATIC_MUTEX_INIT; + * @endcode + * A StaticMutex can be used without calling Glib::thread_init(), it will + * silently do nothing then. That will also work when using the implicit + * conversion to Mutex&, thus you can safely use Mutex::Lock with a + * StaticMutex. + */ +struct StaticMutex +{ + void lock(); + bool trylock(); + void unlock(); + + operator Mutex&(); + + GStaticMutex* gobj() { return &gobject_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Must be public to allow initialization at compile time. + GStaticMutex gobject_; +#endif +}; + +/** Represents a mutex (mutual exclusion). + * It can be used to protect data against shared access. Try to use + * Mutex::Lock instead of calling lock() and unlock() directly -- + * it will make your life much easier. + * + * @note Before creating a Glib::Mutex, Glib::thread_init() has to be called. + * + * @note Glib::Mutex is not recursive, i.e. a thread will deadlock, if it + * already has locked the mutex while calling lock(). Use Glib::RecMutex + * instead, if you need recursive mutexes. + */ +class Mutex +{ +public: + class Lock; + + Mutex(); + ~Mutex(); + + /** Locks the mutex. + * If mutex is already locked by another thread, the current thread will + * block until mutex is unlocked by the other thread. + * @see Mutex::Lock + */ + void lock(); + + /** Tries to lock the mutex. + * If the mutex is already locked by another thread, it immediately returns + * @c false. Otherwise it locks the mutex and returns @c true. + * @return Whether the mutex could be locked. + * @see Mutex::Lock + */ + bool trylock(); + + /** Unlocks the mutex. + * If another thread is blocked in a lock() call for this mutex, it will be + * woken and can lock the mutex itself. + * @see Mutex::Lock + */ + void unlock(); + + GMutex* gobj() { return gobject_; } + +private: + GMutex* gobject_; + + // noncopyable + Mutex(const Mutex&); + Mutex& operator=(const Mutex&); +}; + +/** Utility class for exception-safe mutex locking. + * @par Usage example: + * @code + * { + * Glib::Mutex::Lock lock (mutex); // calls mutex.lock() + * do_something(); + * } // the destructor calls mutex.unlock() + * @endcode + * As you can see, the compiler takes care of the unlocking. This is not + * only exception safe but also much less error-prone. You could even + * return while still holding the lock and it will be released + * properly. + */ +class Mutex::Lock +{ +public: + explicit inline Lock(Mutex& mutex); + inline Lock(Mutex& mutex, NotLock); + inline Lock(Mutex& mutex, TryLock); + inline ~Lock(); + + inline void acquire(); + inline bool try_acquire(); + inline void release(); + inline bool locked() const; + +private: + Mutex& mutex_; + bool locked_; + + // noncopyable + Lock(const Mutex::Lock&); + Mutex::Lock& operator=(const Mutex::Lock&); +}; + + +/** Like Glib::RecMutex, but can be defined at compile time. + * Use @c GLIBMM_STATIC_REC_MUTEX_INIT to initialize a StaticRecMutex: + * @code + * Glib::StaticRecMutex mutex = GLIBMM_STATIC_REC_MUTEX_INIT; + * @endcode + * A StaticRecMutex can be used without calling Glib::thread_init(), it will + * silently do nothing then. That will also work when using the implicit + * conversion to RecMutex&, thus you can safely use RecMutex::Lock with a + * StaticRecMutex. + */ +struct StaticRecMutex +{ + void lock(); + bool trylock(); + void unlock(); + + void lock_full(unsigned int depth); + unsigned int unlock_full(); + + operator RecMutex&(); + + GStaticRecMutex* gobj() { return &gobject_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Must be public to allow initialization at compile time. + GStaticRecMutex gobject_; +#endif +}; + +class RecMutex : public StaticRecMutex +{ +public: + class Lock; + + RecMutex(); + ~RecMutex(); + +private: + // noncopyable + RecMutex(const RecMutex&); + RecMutex& operator=(const RecMutex&); +}; + +/** Utility class for exception-safe locking of recursive mutexes. + */ +class RecMutex::Lock +{ +public: + explicit inline Lock(RecMutex& mutex); + inline Lock(RecMutex& mutex, NotLock); + inline Lock(RecMutex& mutex, TryLock); + inline ~Lock(); + + inline void acquire(); + inline bool try_acquire(); + inline void release(); + inline bool locked() const; + +private: + RecMutex& mutex_; + bool locked_; + + // noncopyable + Lock(const RecMutex::Lock&); + RecMutex::Lock& operator=(const RecMutex::Lock&); +}; + + +/** Like Glib::RWLock, but can be defined at compile time. + * Use @c GLIBMM_STATIC_RW_LOCK_INIT to initialize a StaticRWLock: + * @code + * Glib::StaticRWLock rw_lock = GLIBMM_STATIC_RW_LOCK_INIT; + * @endcode + * A StaticRWLock can be used without calling Glib::thread_init(), it will + * silently do nothing then. That will also work when using the implicit + * conversion to RWLock&, thus you can safely use RWLock::ReaderLock and + * RWLock::WriterLock with a StaticRWLock. + */ +struct StaticRWLock +{ + void reader_lock(); + bool reader_trylock(); + void reader_unlock(); + + void writer_lock(); + bool writer_trylock(); + void writer_unlock(); + + operator RWLock&(); + + GStaticRWLock* gobj() { return &gobject_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Must be public to allow initialization at compile time. + GStaticRWLock gobject_; +#endif +}; + +class RWLock : public StaticRWLock +{ +public: + class ReaderLock; + class WriterLock; + + RWLock(); + ~RWLock(); + +private: + // noncopyable + RWLock(const RWLock&); + RWLock& operator=(const RWLock&); +}; + +/** Utility class for exception-safe locking of read/write locks. + */ +class RWLock::ReaderLock +{ +public: + explicit inline ReaderLock(RWLock& rwlock); + inline ReaderLock(RWLock& rwlock, NotLock); + inline ReaderLock(RWLock& rwlock, TryLock); + inline ~ReaderLock(); + + inline void acquire(); + inline bool try_acquire(); + inline void release(); + inline bool locked() const; + +private: + RWLock& rwlock_; + bool locked_; + + // noncopyable + ReaderLock(const RWLock::ReaderLock&); + RWLock::ReaderLock& operator=(const RWLock::ReaderLock&); +}; + +/** Utility class for exception-safe locking of read/write locks. + */ +class RWLock::WriterLock +{ +public: + explicit inline WriterLock(RWLock& rwlock); + inline WriterLock(RWLock& rwlock, NotLock); + inline WriterLock(RWLock& rwlock, TryLock); + inline ~WriterLock(); + + inline void acquire(); + inline bool try_acquire(); + inline void release(); + inline bool locked() const; + +private: + RWLock& rwlock_; + bool locked_; + + // noncopyable + WriterLock(const RWLock::WriterLock&); + RWLock::WriterLock& operator=(const RWLock::WriterLock&); +}; + +/** An opaque data structure to represent a condition. + * A @a Cond is an object that threads can block on, if they find a certain + * condition to be false. If other threads change the state of this condition + * they can signal the @a Cond, such that the waiting thread is woken up. + * @par Usage example: + * @code + * Glib::Cond data_cond; + * Glib::Mutex data_mutex; + * void* current_data = NULL; + * + * void push_data (void* data) + * { + * data_mutex.lock(); + * current_data = data; + * data_cond.signal(); + * data_mutex.unlock(); + * } + * + * void* pop_data () + * { + * void* data; + * + * data_mutex.lock(); + * while (!current_data) + * data_cond.wait(data_mutex); + * data = current_data; + * current_data = NULL; + * data_mutex.unlock(); + * return data; + * } + * @endcode +*/ +class Cond +{ +public: + Cond(); + ~Cond(); + + /** If threads are waiting for this @a Cond, exactly one of them is woken up. + * It is good practice to hold the same lock as the waiting thread, while calling + * this method, though not required. + * + * @note This method can also be used if @a Glib::thread_init() has not yet been + * called and will do nothing then. + */ + void signal(); + + /** If threads are waiting for this @a Cond, all of them are woken up. + * It is good practice to hold the same lock as the waiting thread, while calling + * this method, though not required. + * + * @note This method can also be used if @a Glib::thread_init() has not yet been + * called and will do nothing then. + */ + void broadcast(); + + /** Waits until this thread is woken up on this @a Cond. + * The mutex is unlocked before falling asleep and locked again before resuming. + * + * This method can also be used if @a Glib::thread_init() has not yet been + * called and will immediately return then. + * + * @param mutex a @a Mutex that is currently locked. + * + * @note It is important to use the @a wait() and @a timed_wait() methods + * only inside a loop, which checks for the condition to be true as it is not + * guaranteed that the waiting thread will find it fulfilled, even if the signaling + * thread left the condition in that state. This is because another thread can have + * altered the condition, before the waiting thread got the chance to be woken up, + * even if the condition itself is protected by a @a Mutex. + */ + void wait(Mutex& mutex); + + /** Waits until this thread is woken up on this @a Cond, but not longer than until the time, that is specified by @a abs_time. + * The mutex is unlocked before falling asleep and locked again before resuming. + * + * This function can also be used, if @a Glib::thread_init() has not yet been + * called and will immediately return @c true then. + * + * @param mutex a @a Mutex that is currently locked. + * @param abs_time a max time to wait. + * + * @note It is important to use the @a wait() and @a timed_wait() methods + * only inside a loop, which checks for the condition to be true as it is not + * guaranteed that the waiting thread will find it fulfilled, even if the signaling + * thread left the condition in that state. This is because another thread can have + * altered the condition, before the waiting thread got the chance to be woken up, + * even if the condition itself is protected by a @a Mutex. + */ + bool timed_wait(Mutex& mutex, const Glib::TimeVal& abs_time); + + GCond* gobj() { return gobject_; } + +private: + GCond* gobject_; + + // noncopyable + Cond(const Cond&); + Cond& operator=(const Cond&); +}; + + +template +struct StaticPrivate +{ + typedef void (*DestroyNotifyFunc) (void*); + + static void delete_ptr(void* data); + + inline T* get(); + inline void set(T* data, DestroyNotifyFunc notify_func = &StaticPrivate::delete_ptr); + + GStaticPrivate* gobj() { return &gobject_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Must be public to allow initialization at compile time. + GStaticPrivate gobject_; +#endif +}; + +template +class Private +{ +public: + typedef void (*DestructorFunc) (void*); + + static void delete_ptr(void* data); + + explicit inline Private(DestructorFunc destructor_func = &Private::delete_ptr); + inline T* get(); + inline void set(T* data); + + GPrivate* gobj() { return gobject_; } + +private: + GPrivate* gobject_; + + // noncopyable + Private(const Private&); + Private& operator=(const Private&); +}; + +/** @} group Threads */ + +/*! A glibmm thread example. + * @example thread/thread.cc + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/***************************************************************************/ +/* inline implementation */ +/***************************************************************************/ + +// internal +void thread_init_impl(); + +/* This function must be inline, to avoid an unnecessary dependency on + * libgthread even if the thread system is not used. libgthread might + * not even be available if GLib was compiled without thread support. + */ +inline +void thread_init(GThreadFunctions* vtable) +{ + g_thread_init(vtable); + Glib::thread_init_impl(); +} + +inline +bool thread_supported() +{ + //MSVC++ needs the != 0 to avoid an int -> bool cast warning. + return (g_thread_supported() != 0); +} + + +/**** Glib::Mutex::Lock ****************************************************/ + +inline +Mutex::Lock::Lock(Mutex& mutex) +: + mutex_ (mutex), + locked_ (true) +{ + mutex_.lock(); +} + +inline +Mutex::Lock::Lock(Mutex& mutex, NotLock) +: + mutex_ (mutex), + locked_ (false) +{} + +inline +Mutex::Lock::Lock(Mutex& mutex, TryLock) +: + mutex_ (mutex), + locked_ (mutex.trylock()) +{} + +inline +Mutex::Lock::~Lock() +{ + if(locked_) + mutex_.unlock(); +} + +inline +void Mutex::Lock::acquire() +{ + mutex_.lock(); + locked_ = true; +} + +inline +bool Mutex::Lock::try_acquire() +{ + locked_ = mutex_.trylock(); + return locked_; +} + +inline +void Mutex::Lock::release() +{ + mutex_.unlock(); + locked_ = false; +} + +inline +bool Mutex::Lock::locked() const +{ + return locked_; +} + + +/**** Glib::RecMutex::Lock *************************************************/ + +inline +RecMutex::Lock::Lock(RecMutex& mutex) +: + mutex_ (mutex), + locked_ (true) +{ + mutex_.lock(); +} + +inline +RecMutex::Lock::Lock(RecMutex& mutex, NotLock) +: + mutex_ (mutex), + locked_ (false) +{} + +inline +RecMutex::Lock::Lock(RecMutex& mutex, TryLock) +: + mutex_ (mutex), + locked_ (mutex.trylock()) +{} + +inline +RecMutex::Lock::~Lock() +{ + if(locked_) + mutex_.unlock(); +} + +inline +void RecMutex::Lock::acquire() +{ + mutex_.lock(); + locked_ = true; +} + +inline +bool RecMutex::Lock::try_acquire() +{ + locked_ = mutex_.trylock(); + return locked_; +} + +inline +void RecMutex::Lock::release() +{ + mutex_.unlock(); + locked_ = false; +} + +inline +bool RecMutex::Lock::locked() const +{ + return locked_; +} + + +/**** Glib::RWLock::ReaderLock *********************************************/ + +inline +RWLock::ReaderLock::ReaderLock(RWLock& rwlock) +: + rwlock_ (rwlock), + locked_ (true) +{ + rwlock_.reader_lock(); +} + +inline +RWLock::ReaderLock::ReaderLock(RWLock& rwlock, NotLock) +: + rwlock_ (rwlock), + locked_ (false) +{} + +inline +RWLock::ReaderLock::ReaderLock(RWLock& rwlock, TryLock) +: + rwlock_ (rwlock), + locked_ (rwlock.reader_trylock()) +{} + +inline +RWLock::ReaderLock::~ReaderLock() +{ + if(locked_) + rwlock_.reader_unlock(); +} + +inline +void RWLock::ReaderLock::acquire() +{ + rwlock_.reader_lock(); + locked_ = true; +} + +inline +bool RWLock::ReaderLock::try_acquire() +{ + locked_ = rwlock_.reader_trylock(); + return locked_; +} + +inline +void RWLock::ReaderLock::release() +{ + rwlock_.reader_unlock(); + locked_ = false; +} + +inline +bool RWLock::ReaderLock::locked() const +{ + return locked_; +} + + +/**** Glib::RWLock::WriterLock *********************************************/ + +inline +RWLock::WriterLock::WriterLock(RWLock& rwlock) +: + rwlock_ (rwlock), + locked_ (true) +{ + rwlock_.writer_lock(); +} + +inline +RWLock::WriterLock::WriterLock(RWLock& rwlock, NotLock) +: + rwlock_ (rwlock), + locked_ (false) +{} + +inline +RWLock::WriterLock::WriterLock(RWLock& rwlock, TryLock) +: + rwlock_ (rwlock), + locked_ (rwlock.writer_trylock()) +{} + +inline +RWLock::WriterLock::~WriterLock() +{ + if(locked_) + rwlock_.writer_unlock(); +} + +inline +void RWLock::WriterLock::acquire() +{ + rwlock_.writer_lock(); + locked_ = true; +} + +inline +bool RWLock::WriterLock::try_acquire() +{ + locked_ = rwlock_.writer_trylock(); + return locked_; +} + +inline +void RWLock::WriterLock::release() +{ + rwlock_.writer_unlock(); + locked_ = false; +} + +inline +bool RWLock::WriterLock::locked() const +{ + return locked_; +} + + +/**** Glib::StaticPrivate **************************************************/ + +// static +template +void StaticPrivate::delete_ptr(void* data) +{ + delete static_cast(data); +} + +template inline +T* StaticPrivate::get() +{ + return static_cast(g_static_private_get(&gobject_)); +} + +template inline +void StaticPrivate::set(T* data, typename StaticPrivate::DestroyNotifyFunc notify_func) +{ + g_static_private_set(&gobject_, data, notify_func); +} + + +/**** Glib::Private ********************************************************/ + +// static +template +void Private::delete_ptr(void* data) +{ + delete static_cast(data); +} + +template inline +Private::Private(typename Private::DestructorFunc destructor_func) +: + gobject_ (g_private_new(destructor_func)) +{} + +template inline +T* Private::get() +{ + return static_cast(g_private_get(gobject_)); +} + +template inline +void Private::set(T* data) +{ + g_private_set(gobject_, data); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_THREAD_H */ + diff --git a/libs/glibmm2/glibmm/threadpool.cc b/libs/glibmm2/glibmm/threadpool.cc new file mode 100644 index 0000000000..db9b089c9a --- /dev/null +++ b/libs/glibmm2/glibmm/threadpool.cc @@ -0,0 +1,245 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +GLIBMM_USING_STD(list) + + +namespace Glib +{ + +// internal +class ThreadPool::SlotList +{ +public: + SlotList(); + ~SlotList(); + + sigc::slot* push(const sigc::slot& slot); + sigc::slot pop(sigc::slot* slot_ptr); + + void lock_and_unlock(); + +private: + Glib::Mutex mutex_; + std::list< sigc::slot > list_; + + // noncopyable + SlotList(const ThreadPool::SlotList&); + ThreadPool::SlotList& operator=(const ThreadPool::SlotList&); +}; + +ThreadPool::SlotList::SlotList() +{} + +ThreadPool::SlotList::~SlotList() +{} + +sigc::slot* ThreadPool::SlotList::push(const sigc::slot& slot) +{ + Mutex::Lock lock (mutex_); + + list_.push_back(slot); + return &list_.back(); +} + +sigc::slot ThreadPool::SlotList::pop(sigc::slot* slot_ptr) +{ + sigc::slot slot; + + { + Mutex::Lock lock (mutex_); + + std::list< sigc::slot >::iterator pslot = list_.begin(); + while(pslot != list_.end() && slot_ptr != &*pslot) + ++pslot; + + if(pslot != list_.end()) + { + slot = *pslot; + list_.erase(pslot); + } + } + + return slot; +} + +void ThreadPool::SlotList::lock_and_unlock() +{ + mutex_.lock(); + mutex_.unlock(); +} + +} // namespace Glib + + +namespace +{ + +static void call_thread_entry_slot(void* data, void* user_data) +{ + try + { + Glib::ThreadPool::SlotList *const slot_list = + static_cast(user_data); + + sigc::slot slot (slot_list->pop(static_cast*>(data))); + + slot(); + } + catch(Glib::Thread::Exit&) + { + // Just exit from the thread. The Thread::Exit exception + // is our sane C++ replacement of g_thread_exit(). + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +} // anonymous namespace + + +namespace Glib +{ + +ThreadPool::ThreadPool(int max_threads, bool exclusive) +: + gobject_ (0), + slot_list_ (new SlotList()) +{ + GError* error = 0; + + gobject_ = g_thread_pool_new( + &call_thread_entry_slot, slot_list_, max_threads, exclusive, &error); + + if(error) + { + delete slot_list_; + slot_list_ = 0; + Glib::Error::throw_exception(error); + } +} + +ThreadPool::~ThreadPool() +{ + if(gobject_) + g_thread_pool_free(gobject_, 1, 1); + + if(slot_list_) + { + slot_list_->lock_and_unlock(); + delete slot_list_; + } +} + +void ThreadPool::push(const sigc::slot& slot) +{ + sigc::slot *const slot_ptr = slot_list_->push(slot); + + GError* error = 0; + g_thread_pool_push(gobject_, slot_ptr, &error); + + if(error) + { + slot_list_->pop(slot_ptr); + Glib::Error::throw_exception(error); + } +} + +void ThreadPool::set_max_threads(int max_threads) +{ + GError* error = 0; + g_thread_pool_set_max_threads(gobject_, max_threads, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +int ThreadPool::get_max_threads() const +{ + return g_thread_pool_get_max_threads(gobject_); +} + +unsigned int ThreadPool::get_num_threads() const +{ + return g_thread_pool_get_num_threads(gobject_); +} + +unsigned int ThreadPool::unprocessed() const +{ + return g_thread_pool_unprocessed(gobject_); +} + +bool ThreadPool::get_exclusive() const +{ + g_return_val_if_fail(gobject_ != 0, false); + + return gobject_->exclusive; +} + +void ThreadPool::shutdown(bool immediately) +{ + if(gobject_) + { + g_thread_pool_free(gobject_, immediately, 1); + gobject_ = 0; + } + + if(slot_list_) + { + slot_list_->lock_and_unlock(); + delete slot_list_; + slot_list_ = 0; + } +} + +// static +void ThreadPool::set_max_unused_threads(int max_threads) +{ + g_thread_pool_set_max_unused_threads(max_threads); +} + +// static +int ThreadPool::get_max_unused_threads() +{ + return g_thread_pool_get_max_unused_threads(); +} + +// static +unsigned int ThreadPool::get_num_unused_threads() +{ + return g_thread_pool_get_num_unused_threads(); +} + +// static +void ThreadPool::stop_unused_threads() +{ + g_thread_pool_stop_unused_threads(); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/threadpool.h b/libs/glibmm2/glibmm/threadpool.h new file mode 100644 index 0000000000..5cff035b8a --- /dev/null +++ b/libs/glibmm2/glibmm/threadpool.h @@ -0,0 +1,183 @@ +// -*- c++ -*- +#ifndef _GLIBMM_THREADPOOL_H +#define _GLIBMM_THREADPOOL_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +extern "C" { typedef struct _GThreadPool GThreadPool; } + + +namespace Glib +{ + +/** @defgroup ThreadPools Thread Pools + * Pools of threads to execute work concurrently. + * @{ + */ + +/** A pool of threads to execute work concurrently. + */ +class ThreadPool +{ +public: + /** Constructs a new thread pool. + * Whenever you call ThreadPool::push(), either a new thread is created or an + * unused one is reused. At most @a max_threads threads are running + * concurrently for this thread pool. @a max_threads = -1 allows + * unlimited threads to be created for this thread pool. + * + * The parameter @a exclusive determines, whether the thread pool owns all + * threads exclusive or whether the threads are shared globally. If @a + * exclusive is true, @a max_threads threads are started immediately + * and they will run exclusively for this thread pool until it is destroyed + * by ~ThreadPool(). If @a exclusive is false, threads are created + * when needed and shared between all non-exclusive thread pools. This + * implies that @a max_threads may not be -1 for exclusive thread pools. + * + * @param max_threads The maximal number of threads to execute concurrently + * in the new thread pool, -1 means no limit. + * @param exclusive Should this thread pool be exclusive? + * @throw Glib::ThreadError An error can only occur when @a exclusive is + * set to true and not all @a max_threads threads could be created. + */ + explicit ThreadPool(int max_threads = -1, bool exclusive = false); + virtual ~ThreadPool(); + + /** Inserts @a slot into the list of tasks to be executed by the pool. + * When the number of currently running threads is lower than the maximal + * allowed number of threads, a new thread is started (or reused). Otherwise + * @a slot stays in the queue until a thread in this pool finishes its + * previous task and processes @a slot. + * @param slot A new task for the thread pool. + * @throw Glib::ThreadError An error can only occur when a new thread + * couldn't be created. In that case @a slot is simply appended to the + * queue of work to do. + */ + void push(const sigc::slot& slot); + + /** Sets the maximal allowed number of threads for the pool. + * A value of -1 means that the maximal number of threads is unlimited. + * Setting @a max_threads to 0 means stopping all work for pool. It is + * effectively frozen until @a max_threads is set to a non-zero value again. + * + * A thread is never terminated while it is still running. Instead the + * maximal number of threads only has effect for the allocation of new + * threads in ThreadPool::push(). A new thread is allocated whenever the + * number of currently running threads in the pool is smaller than the + * maximal number. + * + * @param max_threads A new maximal number of threads for the pool. + * @throw Glib::ThreadError An error can only occur when a new thread + * couldn't be created. + */ + void set_max_threads(int max_threads); + + /** Returns the maximal number of threads for the pool. + * @return The maximal number of threads. + */ + int get_max_threads() const; + + /** Returns the number of threads currently running in the pool. + * @return The number of threads currently running. + */ + unsigned int get_num_threads() const; + + /** Returns the number of tasks still unprocessed in the pool. + * @return The number of unprocessed tasks. + */ + unsigned int unprocessed() const; + + /** Returns whether all threads are exclusive to this pool. + * @return Whether all threads are exclusive to this pool. + */ + bool get_exclusive() const; + + /** Frees all resources allocated for the pool. + * If @a immediately is true, no new task is processed. Otherwise the + * pool is not freed before the last task is processed. Note however, that no + * thread of this pool is interrupted while processing a task. Instead at least + * all still running threads can finish their tasks before the pool is freed. + * + * This method does not return before all tasks to be processed (dependent on + * @a immediately, whether all or only the currently running) are ready. + * After calling shutdown() the pool must not be used anymore. + * + * @param immediately Should the pool shut down immediately? + */ + void shutdown(bool immediately = false); + + /** Sets the maximal number of unused threads to @a max_threads. + * If @a max_threads is -1, no limit is imposed on the number of unused threads. + * @param max_threads Maximal number of unused threads. + */ + static void set_max_unused_threads(int max_threads); + + /** Returns the maximal allowed number of unused threads. + * @return The maximal number of unused threads. + */ + static int get_max_unused_threads(); + + /** Returns the number of currently unused threads. + * @return The number of currently unused threads. + */ + static unsigned int get_num_unused_threads(); + + /** Stops all currently unused threads. + * This does not change the maximal number of unused threads. This function can + * be used to regularly stop all unused threads e.g. from Glib::signal_timeout(). + */ + static void stop_unused_threads(); + + GThreadPool* gobj() { return gobject_; } + const GThreadPool* gobj() const { return gobject_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + class SlotList; +#endif + +private: + GThreadPool* gobject_; + SlotList* slot_list_; + + ThreadPool(const ThreadPool&); + ThreadPool& operator=(const ThreadPool&); +}; + +/** @} group ThreadPools */ + + +/***************************************************************************/ +/* inline implementation */ +/***************************************************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/**** Glib::Private ********************************************************/ + + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + + +#endif /* _GLIBMM_THREADPOOL_H */ + diff --git a/libs/glibmm2/glibmm/timer.cc b/libs/glibmm2/glibmm/timer.cc new file mode 100644 index 0000000000..40a7fd35ab --- /dev/null +++ b/libs/glibmm2/glibmm/timer.cc @@ -0,0 +1,72 @@ +// -*- c++ -*- +/* $Id$ */ + +/* timer.cc + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +Timer::Timer() +: + gobject_ (g_timer_new()) +{} + +Timer::~Timer() +{ + g_timer_destroy(gobject_); +} + +void Timer::start() +{ + g_timer_start(gobject_); +} + +void Timer::stop() +{ + g_timer_stop(gobject_); +} + +void Timer::reset() +{ + g_timer_reset(gobject_); +} + +double Timer::elapsed() const +{ + return g_timer_elapsed(gobject_, 0); +} + +double Timer::elapsed(unsigned long& microseconds) const +{ + return g_timer_elapsed(gobject_, µseconds); +} + + +void usleep(unsigned long microseconds) +{ + g_usleep(microseconds); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/timer.h b/libs/glibmm2/glibmm/timer.h new file mode 100644 index 0000000000..a9ac479fbf --- /dev/null +++ b/libs/glibmm2/glibmm/timer.h @@ -0,0 +1,79 @@ +// -*- c++ -*- +#ifndef _GLIBMM_TIMER_H +#define _GLIBMM_TIMER_H + +/* $Id$ */ + +/* timer.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +extern "C" { typedef struct _GTimer GTimer; } + + +namespace Glib +{ + +/** Portable stop watch interface. + * This resembles a convient and portable timer with microseconds resolution. + */ +class Timer +{ +public: + /** Create a new timer. + * Also starts timing by calling start() implicitly. + */ + Timer(); + ~Timer(); + + void start(); + void stop(); + void reset(); + + /** Get the elapsed time. + * @return The value in seconds. + */ + double elapsed() const; + + /** Get the elapsed time. + * @return The value in seconds. Also fills @p microseconds + * with the corresponding @htmlonlyµs@endhtmlonly value. + */ + double elapsed(unsigned long& microseconds) const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GTimer* gobj() { return gobject_; } + const GTimer* gobj() const { return gobject_; } +#endif + +private: + GTimer* gobject_; + + // not copyable + Timer(const Timer&); + Timer& operator=(const Timer&); +}; + + +void usleep(unsigned long microseconds); + +} // namespace Glib + + +#endif /* _GLIBMM_TIMER_H */ + diff --git a/libs/glibmm2/glibmm/timeval.cc b/libs/glibmm2/glibmm/timeval.cc new file mode 100644 index 0000000000..6494d0f41d --- /dev/null +++ b/libs/glibmm2/glibmm/timeval.cc @@ -0,0 +1,120 @@ +// -*- c++ -*- +/* $Id$ */ + +/* timeval.cc + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +#include + + +namespace Glib +{ + +void TimeVal::assign_current_time() +{ + g_get_current_time(this); +} + +void TimeVal::add(const TimeVal& rhs) +{ + g_return_if_fail(tv_usec >= 0 && tv_usec < G_USEC_PER_SEC); + g_return_if_fail(rhs.tv_usec >= 0 && rhs.tv_usec < G_USEC_PER_SEC); + + tv_usec += rhs.tv_usec; + + if(tv_usec >= G_USEC_PER_SEC) + { + tv_usec -= G_USEC_PER_SEC; + ++tv_sec; + } + + tv_sec += rhs.tv_sec; +} + +void TimeVal::subtract(const TimeVal& rhs) +{ + g_return_if_fail(tv_usec >= 0 && tv_usec < G_USEC_PER_SEC); + g_return_if_fail(rhs.tv_usec >= 0 && rhs.tv_usec < G_USEC_PER_SEC); + + tv_usec -= rhs.tv_usec; + + if(tv_usec < 0) + { + tv_usec += G_USEC_PER_SEC; + --tv_sec; + } + + tv_sec -= rhs.tv_sec; +} + +void TimeVal::add_seconds(long seconds) +{ + g_return_if_fail(tv_usec >= 0 && tv_usec < G_USEC_PER_SEC); + + tv_sec += seconds; +} + +void TimeVal::subtract_seconds(long seconds) +{ + g_return_if_fail(tv_usec >= 0 && tv_usec < G_USEC_PER_SEC); + + tv_sec -= seconds; +} + +void TimeVal::add_milliseconds(long milliseconds) +{ + g_return_if_fail(tv_usec >= 0 && tv_usec < G_USEC_PER_SEC); + + tv_usec += (milliseconds % 1000) * 1000; + + if(tv_usec < 0) + { + tv_usec += G_USEC_PER_SEC; + --tv_sec; + } + else if(tv_usec >= G_USEC_PER_SEC) + { + tv_usec -= G_USEC_PER_SEC; + ++tv_sec; + } + + tv_sec += milliseconds / 1000; +} + +void TimeVal::subtract_milliseconds(long milliseconds) +{ + add_milliseconds(-1 * milliseconds); +} + +void TimeVal::add_microseconds(long microseconds) +{ + g_time_val_add(this, microseconds); +} + +void TimeVal::subtract_microseconds(long microseconds) +{ + g_time_val_add(this, -1 * microseconds); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/timeval.h b/libs/glibmm2/glibmm/timeval.h new file mode 100644 index 0000000000..f27952c238 --- /dev/null +++ b/libs/glibmm2/glibmm/timeval.h @@ -0,0 +1,233 @@ +// -*- c++ -*- +#ifndef _GLIBMM_TIMEVAL_H +#define _GLIBMM_TIMEVAL_H + +/* $Id$ */ + +/* timeval.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Glib +{ + +/** Glib::TimeVal is a wrapper around the glib structure GTimeVal. + * The glib structure GTimeVal itself is equivalent to struct timeval, + * which is returned by the gettimeofday() UNIX call. Additionally + * this wrapper provides an assortment of time manipulation functions. + */ +struct TimeVal : public GTimeVal +{ + inline TimeVal(); + inline TimeVal(long seconds, long microseconds); + + inline TimeVal(const GTimeVal& gtimeval); + inline TimeVal& operator=(const GTimeVal& gtimeval); + + /** Assigns the current time to the TimeVal instance. + * Equivalent to the UNIX gettimeofday() function, but is portable and + * works also on Win32. + */ + void assign_current_time(); + + void add(const TimeVal& rhs); + void subtract(const TimeVal& rhs); + void add_seconds(long seconds); + void subtract_seconds(long seconds); + void add_milliseconds(long milliseconds); + void subtract_milliseconds(long milliseconds); + void add_microseconds(long microseconds); + void subtract_microseconds(long microseconds); + + inline TimeVal& operator+=(const TimeVal& gtimeval); + inline TimeVal& operator-=(const TimeVal& gtimeval); + inline TimeVal& operator+=(long seconds); + inline TimeVal& operator-=(long seconds); + + /** Returns a double representation of the time interval. + * This member function converts the time interval, that is + * internally stored as two long values for seconds and microseconds, + * to a double representation, whose unit is seconds. + */ + inline double as_double() const; + + inline bool negative() const; + + /** Checks whether the stored time interval is positive. + * Returns true if the stored time / time interval is positive. + */ + inline bool valid() const; +}; + +inline +TimeVal::TimeVal() +{ + tv_sec = 0; + tv_usec = 0; +} + +inline +TimeVal::TimeVal(long seconds, long microseconds) +{ + tv_sec = seconds; + tv_usec = microseconds; +} + +inline +TimeVal::TimeVal(const GTimeVal& gtimeval) +{ + tv_sec = gtimeval.tv_sec; + tv_usec = gtimeval.tv_usec; +} + +inline +TimeVal& TimeVal::operator=(const GTimeVal& gtimeval) +{ + tv_sec = gtimeval.tv_sec; + tv_usec = gtimeval.tv_usec; + return *this; +} + +inline +TimeVal& TimeVal::operator+=(const TimeVal& gtimeval) +{ + add(gtimeval); + + return *this; +} + +inline +TimeVal& TimeVal::operator-=(const TimeVal& gtimeval) +{ + subtract(gtimeval); + + return *this; +} + +inline +TimeVal& TimeVal::operator+=(long seconds) +{ + add_seconds(seconds); + + return *this; +} + +inline +TimeVal& TimeVal::operator-=(long seconds) +{ + subtract_seconds(seconds); + + return *this; +} + +inline +double TimeVal::as_double() const +{ + return tv_sec + ((double) tv_usec / (double) G_USEC_PER_SEC); +} + +inline +bool TimeVal::negative() const +{ + return (tv_sec < 0); +} + +inline +bool TimeVal::valid() const +{ + return (tv_usec >= 0 && tv_usec < G_USEC_PER_SEC); +} + +/** @relates Glib::TimeVal */ +inline +TimeVal operator+(const TimeVal& lhs, const TimeVal& rhs) +{ return TimeVal(lhs) += rhs; } + +/** @relates Glib::TimeVal */ +inline +TimeVal operator+(const TimeVal& lhs, long seconds) +{ return TimeVal(lhs) += seconds; } + +/** @relates Glib::TimeVal */ +inline +TimeVal operator-(const TimeVal& lhs, const TimeVal& rhs) +{ return TimeVal(lhs) -= rhs; } + +/** @relates Glib::TimeVal */ +inline +TimeVal operator-(const TimeVal& lhs, long seconds) +{ return TimeVal(lhs) -= seconds; } + + +/** @relates Glib::TimeVal */ +inline +bool operator==(const TimeVal& lhs, const TimeVal& rhs) +{ + return (lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec); +} + +/** @relates Glib::TimeVal */ +inline +bool operator!=(const TimeVal& lhs, const TimeVal& rhs) +{ + return (lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec); +} + +/** @relates Glib::TimeVal */ +inline +bool operator<(const TimeVal& lhs, const TimeVal& rhs) +{ + return ((lhs.tv_sec < rhs.tv_sec) || + (lhs.tv_sec == rhs.tv_sec && lhs.tv_usec < rhs.tv_usec)); +} + +/** @relates Glib::TimeVal */ +inline +bool operator>(const TimeVal& lhs, const TimeVal& rhs) +{ + return ((lhs.tv_sec > rhs.tv_sec) || + (lhs.tv_sec == rhs.tv_sec && lhs.tv_usec > rhs.tv_usec)); +} + +/** @relates Glib::TimeVal */ +inline +bool operator<=(const TimeVal& lhs, const TimeVal& rhs) +{ + return ((lhs.tv_sec < rhs.tv_sec) || + (lhs.tv_sec == rhs.tv_sec && lhs.tv_usec <= rhs.tv_usec)); +} + +/** @relates Glib::TimeVal */ +inline +bool operator>=(const TimeVal& lhs, const TimeVal& rhs) +{ + return ((lhs.tv_sec > rhs.tv_sec) || + (lhs.tv_sec == rhs.tv_sec && lhs.tv_usec >= rhs.tv_usec)); +} + +} // namespace Glib + + +#endif /* _GLIBMM_TIMEVAL_H */ + + + + diff --git a/libs/glibmm2/glibmm/unicode.cc b/libs/glibmm2/glibmm/unicode.cc new file mode 100644 index 0000000000..cb58371dff --- /dev/null +++ b/libs/glibmm2/glibmm/unicode.cc @@ -0,0 +1,33 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + diff --git a/libs/glibmm2/glibmm/unicode.h b/libs/glibmm2/glibmm/unicode.h new file mode 100644 index 0000000000..fd2f68a798 --- /dev/null +++ b/libs/glibmm2/glibmm/unicode.h @@ -0,0 +1,311 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GLIBMM_UNICODE_H +#define _GLIBMM_UNICODE_H + + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include + +// Not used, but we want to get rid of possible macros. +#include + +#undef isalnum +#undef isalpha +#undef iscntrl +#undef isdigit +#undef isgraph +#undef islower +#undef isprint +#undef ispunct +#undef isspace +#undef isupper +#undef isxdigit +#undef istitle +#undef isdefined +#undef iswide +#undef toupper +#undef tolower +#undef totitle + + +namespace Glib +{ + +/** @addtogroup glibmmEnums Enums and Flags */ + +/** + * @ingroup glibmmEnums + */ +enum UnicodeType +{ + UNICODE_CONTROL, + UNICODE_FORMAT, + UNICODE_UNASSIGNED, + UNICODE_PRIVATE_USE, + UNICODE_SURROGATE, + UNICODE_LOWERCASE_LETTER, + UNICODE_MODIFIER_LETTER, + UNICODE_OTHER_LETTER, + UNICODE_TITLECASE_LETTER, + UNICODE_UPPERCASE_LETTER, + UNICODE_COMBINING_MARK, + UNICODE_ENCLOSING_MARK, + UNICODE_NON_SPACING_MARK, + UNICODE_DECIMAL_NUMBER, + UNICODE_LETTER_NUMBER, + UNICODE_OTHER_NUMBER, + UNICODE_CONNECT_PUNCTUATION, + UNICODE_DASH_PUNCTUATION, + UNICODE_CLOSE_PUNCTUATION, + UNICODE_FINAL_PUNCTUATION, + UNICODE_INITIAL_PUNCTUATION, + UNICODE_OTHER_PUNCTUATION, + UNICODE_OPEN_PUNCTUATION, + UNICODE_CURRENCY_SYMBOL, + UNICODE_MODIFIER_SYMBOL, + UNICODE_MATH_SYMBOL, + UNICODE_OTHER_SYMBOL, + UNICODE_LINE_SEPARATOR, + UNICODE_PARAGRAPH_SEPARATOR, + UNICODE_SPACE_SEPARATOR +}; + + +/** + * @ingroup glibmmEnums + */ +enum UnicodeBreakType +{ + UNICODE_BREAK_MANDATORY, + UNICODE_BREAK_CARRIAGE_RETURN, + UNICODE_BREAK_LINE_FEED, + UNICODE_BREAK_COMBINING_MARK, + UNICODE_BREAK_SURROGATE, + UNICODE_BREAK_ZERO_WIDTH_SPACE, + UNICODE_BREAK_INSEPARABLE, + UNICODE_BREAK_NON_BREAKING_GLUE, + UNICODE_BREAK_CONTINGENT, + UNICODE_BREAK_SPACE, + UNICODE_BREAK_AFTER, + UNICODE_BREAK_BEFORE, + UNICODE_BREAK_BEFORE_AND_AFTER, + UNICODE_BREAK_HYPHEN, + UNICODE_BREAK_NON_STARTER, + UNICODE_BREAK_OPEN_PUNCTUATION, + UNICODE_BREAK_CLOSE_PUNCTUATION, + UNICODE_BREAK_QUOTATION, + UNICODE_BREAK_EXCLAMATION, + UNICODE_BREAK_IDEOGRAPHIC, + UNICODE_BREAK_NUMERIC, + UNICODE_BREAK_INFIX_SEPARATOR, + UNICODE_BREAK_SYMBOL, + UNICODE_BREAK_ALPHABETIC, + UNICODE_BREAK_PREFIX, + UNICODE_BREAK_POSTFIX, + UNICODE_BREAK_COMPLEX_CONTEXT, + UNICODE_BREAK_AMBIGUOUS, + UNICODE_BREAK_UNKNOWN, + UNICODE_BREAK_NEXT_LINE, + UNICODE_BREAK_WORD_JOINER +}; + + +/** + * @ingroup glibmmEnums + * @par Bitwise operators: + * %AsciiType operator|(AsciiType, AsciiType)
+ * %AsciiType operator&(AsciiType, AsciiType)
+ * %AsciiType operator^(AsciiType, AsciiType)
+ * %AsciiType operator~(AsciiType)
+ * %AsciiType& operator|=(AsciiType&, AsciiType)
+ * %AsciiType& operator&=(AsciiType&, AsciiType)
+ * %AsciiType& operator^=(AsciiType&, AsciiType)
+ */ +enum AsciiType +{ + ASCII_ALNUM = 1 << 0, + ASCII_ALPHA = 1 << 1, + ASCII_CNTRL = 1 << 2, + ASCII_DIGIT = 1 << 3, + ASCII_GRAPH = 1 << 4, + ASCII_LOWER = 1 << 5, + ASCII_PRINT = 1 << 6, + ASCII_PUNCT = 1 << 7, + ASCII_SPACE = 1 << 8, + ASCII_UPPER = 1 << 9, + ASCII_XDIGIT = 1 << 10 +}; + +/** @ingroup glibmmEnums */ +inline AsciiType operator|(AsciiType lhs, AsciiType rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline AsciiType operator&(AsciiType lhs, AsciiType rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline AsciiType operator^(AsciiType lhs, AsciiType rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup glibmmEnums */ +inline AsciiType operator~(AsciiType flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup glibmmEnums */ +inline AsciiType& operator|=(AsciiType& lhs, AsciiType rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline AsciiType& operator&=(AsciiType& lhs, AsciiType rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup glibmmEnums */ +inline AsciiType& operator^=(AsciiType& lhs, AsciiType rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + + +/** + * @ingroup glibmmEnums + */ +enum NormalizeMode +{ + NORMALIZE_DEFAULT, + NORMALIZE_NFD, + NORMALIZE_DEFAULT_COMPOSE, + NORMALIZE_NFC = NORMALIZE_DEFAULT_COMPOSE, + NORMALIZE_ALL, + NORMALIZE_NFKD = NORMALIZE_ALL, + NORMALIZE_ALL_COMPOSE, + NORMALIZE_NFKC = NORMALIZE_ALL_COMPOSE +}; + + +/** @defgroup Unicode Unicode Manipulation + * Functions operating on Unicode characters and UTF-8 strings. + * @{ + */ + +namespace Unicode +{ + +inline bool validate(gunichar uc) + { return (g_unichar_validate(uc) != 0); } +inline bool isalnum(gunichar uc) + { return (g_unichar_isalnum(uc) != 0); } +inline bool isalpha(gunichar uc) + { return (g_unichar_isalpha(uc) != 0); } +inline bool iscntrl(gunichar uc) + { return (g_unichar_iscntrl(uc) != 0); } +inline bool isdigit(gunichar uc) + { return (g_unichar_isdigit(uc) != 0); } +inline bool isgraph(gunichar uc) + { return (g_unichar_isgraph(uc) != 0); } +inline bool islower(gunichar uc) + { return (g_unichar_islower(uc) != 0); } +inline bool isprint(gunichar uc) + { return (g_unichar_isprint(uc) != 0); } +inline bool ispunct(gunichar uc) + { return (g_unichar_ispunct(uc) != 0); } +inline bool isspace(gunichar uc) + { return (g_unichar_isspace(uc) != 0); } +inline bool isupper(gunichar uc) + { return (g_unichar_isupper(uc) != 0); } +inline bool isxdigit(gunichar uc) + { return (g_unichar_isxdigit(uc) != 0); } +inline bool istitle(gunichar uc) + { return (g_unichar_istitle(uc) != 0); } +inline bool isdefined(gunichar uc) + { return (g_unichar_isdefined(uc) != 0); } +inline bool iswide(gunichar uc) + { return (g_unichar_iswide(uc) != 0); } + +inline gunichar toupper(gunichar uc) + { return g_unichar_toupper(uc); } +inline gunichar tolower(gunichar uc) + { return g_unichar_tolower(uc); } +inline gunichar totitle(gunichar uc) + { return g_unichar_totitle(uc); } + +inline int digit_value(gunichar uc) + { return g_unichar_digit_value(uc); } +inline int xdigit_value(gunichar uc) + { return g_unichar_xdigit_value(uc); } + +inline Glib::UnicodeType type(gunichar uc) + { return static_cast(static_cast(g_unichar_type(uc))); } + +inline Glib::UnicodeBreakType break_type(gunichar uc) + { return static_cast(static_cast(g_unichar_break_type(uc))); } + +} // namespace Unicode + + +namespace Ascii +{ + +inline bool isalnum(char c) + { return g_ascii_isalnum(c); } +inline bool isalpha(char c) + { return g_ascii_isalpha(c); } +inline bool iscntrl(char c) + { return g_ascii_iscntrl(c); } +inline bool isdigit(char c) + { return g_ascii_isdigit(c); } +inline bool isgraph(char c) + { return g_ascii_isgraph(c); } +inline bool islower(char c) + { return g_ascii_islower(c); } +inline bool isprint(char c) + { return g_ascii_isprint(c); } +inline bool ispunct(char c) + { return g_ascii_ispunct(c); } +inline bool isspace(char c) + { return g_ascii_isspace(c); } +inline bool isupper(char c) + { return g_ascii_isupper(c); } +inline bool isxdigit(char c) + { return g_ascii_isxdigit(c); } + +inline char tolower(char c) + { return g_ascii_tolower(c); } +inline char toupper(char c) + { return g_ascii_toupper(c); } + +inline int digit_value(char c) + { return g_ascii_digit_value(c); } +inline int xdigit_value(char c) + { return g_ascii_xdigit_value(c); } + +} // namespace Ascii + + +/** @} group Unicode */ + +} // namespace Glib + + +#endif /* _GLIBMM_UNICODE_H */ + diff --git a/libs/glibmm2/glibmm/ustring.cc b/libs/glibmm2/glibmm/ustring.cc new file mode 100644 index 0000000000..76e8d01438 --- /dev/null +++ b/libs/glibmm2/glibmm/ustring.cc @@ -0,0 +1,1207 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +#include +#include + +#include +GLIBMM_USING_STD(find) + + +namespace +{ + +using Glib::ustring; + +// Little helper to make the conversion from gunichar to UTF-8 a one-liner. +// +struct UnicharToUtf8 +{ + char buf[6]; + ustring::size_type len; + + explicit UnicharToUtf8(gunichar uc) + : len (g_unichar_to_utf8(uc, buf)) {} +}; + + +// All utf8_*_offset() functions return npos if offset is out of range. +// The caller should decide if npos is a valid argument and just marks +// the whole string, or if it is not allowed (e.g. for start positions). +// In the latter case std::out_of_range should be thrown, but usually +// std::string will do that for us. + +// First overload: stop on '\0' character. +// +static ustring::size_type utf8_byte_offset(const char* str, ustring::size_type offset) +{ + if(offset == ustring::npos) + return ustring::npos; + + const char *const utf8_skip = g_utf8_skip; + const char* p = str; + + for(; offset != 0; --offset) + { + const unsigned int c = static_cast(*p); + + if(c == 0) + return ustring::npos; + + p += utf8_skip[c]; + } + + return (p - str); +} + +// Second overload: stop when reaching maxlen. +// +static ustring::size_type utf8_byte_offset(const char* str, ustring::size_type offset, + ustring::size_type maxlen) +{ + if(offset == ustring::npos) + return ustring::npos; + + const char *const utf8_skip = g_utf8_skip; + const char *const pend = str + maxlen; + const char* p = str; + + for(; offset != 0; --offset) + { + if(p >= pend) + return ustring::npos; + + p += utf8_skip[static_cast(*p)]; + } + + return (p - str); +} + +// Third overload: stop when reaching str.size(). +// +inline +ustring::size_type utf8_byte_offset(const std::string& str, ustring::size_type offset) +{ + return utf8_byte_offset(str.data(), offset, str.size()); +} + +// Takes UTF-8 character offset and count in ci and cn. +// Returns the byte offset and count in i and n. +// +struct Utf8SubstrBounds +{ + ustring::size_type i; + ustring::size_type n; + + Utf8SubstrBounds(const std::string& str, ustring::size_type ci, ustring::size_type cn) + : + i (utf8_byte_offset(str, ci)), + n (ustring::npos) + { + if(i != ustring::npos) + n = utf8_byte_offset(str.data() + i, cn, str.size() - i); + } +}; + +// Converts byte offset to UTF-8 character offset. +inline +ustring::size_type utf8_char_offset(const std::string& str, ustring::size_type offset) +{ + if(offset == ustring::npos) + return ustring::npos; + + const char *const pdata = str.data(); + return g_utf8_pointer_to_offset(pdata, pdata + offset); +} + + +// Helper to implement ustring::find_first_of() and find_first_not_of(). +// Returns the UTF-8 character offset, or ustring::npos if not found. +// +ustring::size_type utf8_find_first_of(const std::string& str, ustring::size_type offset, + const char* utf8_match, long utf8_match_size, + bool find_not_of) +{ + const ustring::size_type byte_offset = utf8_byte_offset(str, offset); + if(byte_offset == ustring::npos) + return ustring::npos; + + long ucs4_match_size = 0; + const Glib::ScopedPtr ucs4_match + (g_utf8_to_ucs4_fast(utf8_match, utf8_match_size, &ucs4_match_size)); + + const gunichar *const match_begin = ucs4_match.get(); + const gunichar *const match_end = match_begin + ucs4_match_size; + + const char *const str_begin = str.data(); + const char *const str_end = str_begin + str.size(); + + for(const char* pstr = str_begin + byte_offset; + pstr < str_end; + pstr = g_utf8_next_char(pstr)) + { + const gunichar *const pfound = std::find(match_begin, match_end, g_utf8_get_char(pstr)); + + if((pfound != match_end) != find_not_of) + return offset; + + ++offset; + } + + return ustring::npos; +} + +// Helper to implement ustring::find_last_of() and find_last_not_of(). +// Returns the UTF-8 character offset, or ustring::npos if not found. +// +ustring::size_type utf8_find_last_of(const std::string& str, ustring::size_type offset, + const char* utf8_match, long utf8_match_size, + bool find_not_of) +{ + long ucs4_match_size = 0; + const Glib::ScopedPtr ucs4_match + (g_utf8_to_ucs4_fast(utf8_match, utf8_match_size, &ucs4_match_size)); + + const gunichar *const match_begin = ucs4_match.get(); + const gunichar *const match_end = match_begin + ucs4_match_size; + + const char *const str_begin = str.data(); + const char* pstr = str_begin; + + // Set pstr one byte beyond the actual start position. + const ustring::size_type byte_offset = utf8_byte_offset(str, offset); + pstr += (byte_offset < str.size()) ? byte_offset + 1 : str.size(); + + while(pstr > str_begin) + { + // Move to previous character. + do --pstr; while((*pstr & '\xC0') == '\x80'); + + const gunichar *const pfound = std::find(match_begin, match_end, g_utf8_get_char(pstr)); + + if((pfound != match_end) != find_not_of) + return g_utf8_pointer_to_offset(str_begin, pstr); + } + + return ustring::npos; +} + +} // anonymous namespace + + +namespace Glib +{ + +#ifndef GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS +// Initialize static member here, +// because the compiler did not allow us do it inline. +const ustring::size_type ustring::npos = std::string::npos; +#endif + +// We need our own version of g_utf8_get_char(), because the std::string +// iterator is not necessarily a plain pointer (it's in fact not in GCC's +// libstdc++-v3). Copying the UTF-8 data into a temporary buffer isn't an +// option since this operation is quite time critical. The implementation +// is quite different from g_utf8_get_char() -- both more generic and faster. +// +// By looking at the first byte of a UTF-8 character one can determine the +// number of bytes used. GLib offers the g_utf8_skip[] array for this purpose, +// but accessing this global variable would introduce a function call to fetch +// the Global Offset Table, plus two levels of indirection in order to read the +// value. Even worse, fetching the GOT is always done right at the start of +// the function instead of the branch that actually uses the variable. +// +// Fortunately, there's a better way to get the byte count. As this table +// shows, there's a nice regular pattern in the UTF-8 encoding scheme: +// +// 0x00000000 - 0x0000007F: 0xxxxxxx +// 0x00000080 - 0x000007FF: 110xxxxx 10xxxxxx +// 0x00000800 - 0x0000FFFF: 1110xxxx 10xxxxxx 10xxxxxx +// 0x00010000 - 0x001FFFFF: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx +// 0x00200000 - 0x03FFFFFF: 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx +// 0x04000000 - 0x7FFFFFFF: 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx +// +// Except for the single byte case, the number of leading 1-bits equals the +// byte count. All that is needed is to shift the first byte to the left +// until bit 7 becomes 0. Naturally, doing so requires a loop -- but since +// we already have one, no additional cost is introduced. This shifting can +// further be combined with the computation of the bitmask needed to eliminate +// the leading length bits, thus saving yet another register. +// +gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) +{ + unsigned int result = static_cast(*pos); + + if((result & 0x80) != 0) + { + unsigned int mask = 0x40; + + // This loop may look somewhat strange, but this happens to be the + // one variant g++ 3.3 generates optimum code for. (In particular, + // the unconditional break avoids counterproductive loop alignment.) + for(++pos;; ++pos) + { + mask <<= 5; + const unsigned int c = static_cast(*pos); + result = (result << 6) + c - 0x80; + + if((result & mask) != 0) + continue; + break; + } + + result &= --mask; + } + + return result; +} + + +/**** Glib::ustring ********************************************************/ + +ustring::ustring() +: + string_ () +{} + +ustring::ustring(const ustring& other) +: + string_ (other.string_) +{} + +ustring::ustring(const ustring& src, ustring::size_type i, ustring::size_type n) +: + string_ () +{ + const Utf8SubstrBounds bounds (src.string_, i, n); + string_.assign(src.string_, bounds.i, bounds.n); +} + +ustring::ustring(const char* src, ustring::size_type n) +: + string_ (src, utf8_byte_offset(src, n)) +{} + +ustring::ustring(const char* src) +: + string_ (src) +{} + +ustring::ustring(ustring::size_type n, gunichar uc) +: + string_ () +{ + if(uc < 0x80) + { + // Optimize the probably most common case. + string_.assign(n, static_cast(uc)); + } + else + { + const UnicharToUtf8 conv (uc); + string_.reserve(n * conv.len); + + for(; n > 0; --n) + string_.append(conv.buf, conv.len); + } +} + +ustring::ustring(ustring::size_type n, char c) +: + string_ (n, c) +{} + +ustring::ustring(const std::string& src) +: + string_ (src) +{} + +ustring::~ustring() +{} + +void ustring::swap(ustring& other) +{ + string_.swap(other.string_); +} + + +/**** Glib::ustring::operator=() *******************************************/ + +ustring& ustring::operator=(const ustring& other) +{ + string_ = other.string_; + return *this; +} + +ustring& ustring::operator=(const std::string& src) +{ + string_ = src; + return *this; +} + +ustring& ustring::operator=(const char* src) +{ + string_ = src; + return *this; +} + +ustring& ustring::operator=(gunichar uc) +{ + const UnicharToUtf8 conv (uc); + string_.assign(conv.buf, conv.len); + return *this; +} + +ustring& ustring::operator=(char c) +{ + string_ = c; + return *this; +} + + +/**** Glib::ustring::assign() **********************************************/ + +ustring& ustring::assign(const ustring& src) +{ + string_ = src.string_; + return *this; +} + +ustring& ustring::assign(const ustring& src, ustring::size_type i, ustring::size_type n) +{ + const Utf8SubstrBounds bounds (src.string_, i, n); + string_.assign(src.string_, bounds.i, bounds.n); + return *this; +} + +ustring& ustring::assign(const char* src, ustring::size_type n) +{ + string_.assign(src, utf8_byte_offset(src, n)); + return *this; +} + +ustring& ustring::assign(const char* src) +{ + string_ = src; + return *this; +} + +ustring& ustring::assign(ustring::size_type n, gunichar uc) +{ + ustring temp (n, uc); + string_.swap(temp.string_); + return *this; +} + +ustring& ustring::assign(ustring::size_type n, char c) +{ + string_.assign(n, c); + return *this; +} + + +/**** Glib::ustring::operator+=() ******************************************/ + +ustring& ustring::operator+=(const ustring& src) +{ + string_ += src.string_; + return *this; +} + +ustring& ustring::operator+=(const char* src) +{ + string_ += src; + return *this; +} + +ustring& ustring::operator+=(gunichar uc) +{ + const UnicharToUtf8 conv (uc); + string_.append(conv.buf, conv.len); + return *this; +} + +ustring& ustring::operator+=(char c) +{ + string_ += c; + return *this; +} + + +/**** Glib::ustring::push_back() *******************************************/ + +void ustring::push_back(gunichar uc) +{ + const UnicharToUtf8 conv (uc); + string_.append(conv.buf, conv.len); +} + +void ustring::push_back(char c) +{ + string_ += c; +} + + +/**** Glib::ustring::append() **********************************************/ + +ustring& ustring::append(const ustring& src) +{ + string_ += src.string_; + return *this; +} + +ustring& ustring::append(const ustring& src, ustring::size_type i, ustring::size_type n) +{ + const Utf8SubstrBounds bounds (src.string_, i, n); + string_.append(src.string_, bounds.i, bounds.n); + return *this; +} + +ustring& ustring::append(const char* src, ustring::size_type n) +{ + string_.append(src, utf8_byte_offset(src, n)); + return *this; +} + +ustring& ustring::append(const char* src) +{ + string_ += src; + return *this; +} + +ustring& ustring::append(ustring::size_type n, gunichar uc) +{ + string_.append(ustring(n, uc).string_); + return *this; +} + +ustring& ustring::append(ustring::size_type n, char c) +{ + string_.append(n, c); + return *this; +} + + +/**** Glib::ustring::insert() **********************************************/ + +ustring& ustring::insert(ustring::size_type i, const ustring& src) +{ + string_.insert(utf8_byte_offset(string_, i), src.string_); + return *this; +} + +ustring& ustring::insert(ustring::size_type i, const ustring& src, + ustring::size_type i2, ustring::size_type n) +{ + const Utf8SubstrBounds bounds2 (src.string_, i2, n); + string_.insert(utf8_byte_offset(string_, i), src.string_, bounds2.i, bounds2.n); + return *this; +} + +ustring& ustring::insert(ustring::size_type i, const char* src, ustring::size_type n) +{ + string_.insert(utf8_byte_offset(string_, i), src, utf8_byte_offset(src, n)); + return *this; +} + +ustring& ustring::insert(ustring::size_type i, const char* src) +{ + string_.insert(utf8_byte_offset(string_, i), src); + return *this; +} + +ustring& ustring::insert(ustring::size_type i, ustring::size_type n, gunichar uc) +{ + string_.insert(utf8_byte_offset(string_, i), ustring(n, uc).string_); + return *this; +} + +ustring& ustring::insert(ustring::size_type i, ustring::size_type n, char c) +{ + string_.insert(utf8_byte_offset(string_, i), n, c); + return *this; +} + +ustring::iterator ustring::insert(ustring::iterator p, gunichar uc) +{ + const size_type offset = p.base() - string_.begin(); + const UnicharToUtf8 conv (uc); + string_.insert(offset, conv.buf, conv.len); + return iterator(string_.begin() + offset); +} + +ustring::iterator ustring::insert(ustring::iterator p, char c) +{ + return iterator(string_.insert(p.base(), c)); +} + +void ustring::insert(ustring::iterator p, ustring::size_type n, gunichar uc) +{ + string_.insert(p.base() - string_.begin(), ustring(n, uc).string_); +} + +void ustring::insert(ustring::iterator p, ustring::size_type n, char c) +{ + string_.insert(p.base(), n, c); +} + + +/**** Glib::ustring::replace() *********************************************/ + +ustring& ustring::replace(ustring::size_type i, ustring::size_type n, const ustring& src) +{ + const Utf8SubstrBounds bounds (string_, i, n); + string_.replace(bounds.i, bounds.n, src.string_); + return *this; +} + +ustring& ustring::replace(ustring::size_type i, ustring::size_type n, + const ustring& src, ustring::size_type i2, ustring::size_type n2) +{ + const Utf8SubstrBounds bounds (string_, i, n); + const Utf8SubstrBounds bounds2 (src.string_, i2, n2); + string_.replace(bounds.i, bounds.n, src.string_, bounds2.i, bounds2.n); + return *this; +} + +ustring& ustring::replace(ustring::size_type i, ustring::size_type n, + const char* src, ustring::size_type n2) +{ + const Utf8SubstrBounds bounds (string_, i, n); + string_.replace(bounds.i, bounds.n, src, utf8_byte_offset(src, n2)); + return *this; +} + +ustring& ustring::replace(ustring::size_type i, ustring::size_type n, const char* src) +{ + const Utf8SubstrBounds bounds (string_, i, n); + string_.replace(bounds.i, bounds.n, src); + return *this; +} + +ustring& ustring::replace(ustring::size_type i, ustring::size_type n, + ustring::size_type n2, gunichar uc) +{ + const Utf8SubstrBounds bounds (string_, i, n); + string_.replace(bounds.i, bounds.n, ustring(n2, uc).string_); + return *this; +} + +ustring& ustring::replace(ustring::size_type i, ustring::size_type n, + ustring::size_type n2, char c) +{ + const Utf8SubstrBounds bounds (string_, i, n); + string_.replace(bounds.i, bounds.n, n2, c); + return *this; +} + +ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, const ustring& src) +{ + string_.replace(pbegin.base(), pend.base(), src.string_); + return *this; +} + +ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, + const char* src, ustring::size_type n) +{ + string_.replace(pbegin.base(), pend.base(), src, utf8_byte_offset(src, n)); + return *this; +} + +ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, const char* src) +{ + string_.replace(pbegin.base(), pend.base(), src); + return *this; +} + +ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, + ustring::size_type n, gunichar uc) +{ + string_.replace(pbegin.base(), pend.base(), ustring(n, uc).string_); + return *this; +} + +ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, + ustring::size_type n, char c) +{ + string_.replace(pbegin.base(), pend.base(), n, c); + return *this; +} + + +/**** Glib::ustring::erase() ***********************************************/ + +void ustring::clear() +{ + string_.erase(); +} + +ustring& ustring::erase(ustring::size_type i, ustring::size_type n) +{ + const Utf8SubstrBounds bounds (string_, i, n); + string_.erase(bounds.i, bounds.n); + return *this; +} + +ustring& ustring::erase() +{ + string_.erase(); + return *this; +} + +ustring::iterator ustring::erase(ustring::iterator p) +{ + return iterator(string_.erase(p.base())); +} + +ustring::iterator ustring::erase(ustring::iterator pbegin, ustring::iterator pend) +{ + return iterator(string_.erase(pbegin.base(), pend.base())); +} + + +/**** Glib::ustring::compare() *********************************************/ + +int ustring::compare(const ustring& rhs) const +{ + return g_utf8_collate(string_.c_str(), rhs.string_.c_str()); +} + +int ustring::compare(const char* rhs) const +{ + return g_utf8_collate(string_.c_str(), rhs); +} + +int ustring::compare(ustring::size_type i, ustring::size_type n, const ustring& rhs) const +{ + return ustring(*this, i, n).compare(rhs); +} + +int ustring::compare(ustring::size_type i, ustring::size_type n, + const ustring& rhs, ustring::size_type i2, ustring::size_type n2) const +{ + return ustring(*this, i, n).compare(ustring(rhs, i2, n2)); +} + +int ustring::compare(ustring::size_type i, ustring::size_type n, + const char* rhs, ustring::size_type n2) const +{ + return ustring(*this, i, n).compare(ustring(rhs, n2)); +} + +int ustring::compare(ustring::size_type i, ustring::size_type n, const char* rhs) const +{ + return ustring(*this, i, n).compare(rhs); +} + + +/**** Glib::ustring -- index access ****************************************/ + +ustring::value_type ustring::operator[](ustring::size_type i) const +{ + return g_utf8_get_char(g_utf8_offset_to_pointer(string_.data(), i)); +} + +ustring::value_type ustring::at(ustring::size_type i) const +{ + const size_type byte_offset = utf8_byte_offset(string_, i); + + // Throws std::out_of_range if the index is invalid. + return g_utf8_get_char(&string_.at(byte_offset)); +} + + +/**** Glib::ustring -- iterator access *************************************/ + +ustring::iterator ustring::begin() +{ + return iterator(string_.begin()); +} + +ustring::iterator ustring::end() +{ + return iterator(string_.end()); +} + +ustring::const_iterator ustring::begin() const +{ + return const_iterator(string_.begin()); +} + +ustring::const_iterator ustring::end() const +{ + return const_iterator(string_.end()); +} + +ustring::reverse_iterator ustring::rbegin() +{ + return reverse_iterator(iterator(string_.end())); +} + +ustring::reverse_iterator ustring::rend() +{ + return reverse_iterator(iterator(string_.begin())); +} + +ustring::const_reverse_iterator ustring::rbegin() const +{ + return const_reverse_iterator(const_iterator(string_.end())); +} + +ustring::const_reverse_iterator ustring::rend() const +{ + return const_reverse_iterator(const_iterator(string_.begin())); +} + + +/**** Glib::ustring::find() ************************************************/ + +ustring::size_type ustring::find(const ustring& str, ustring::size_type i) const +{ + return utf8_char_offset(string_, string_.find(str.string_, utf8_byte_offset(string_, i))); +} + +ustring::size_type ustring::find(const char* str, ustring::size_type i, ustring::size_type n) const +{ + return utf8_char_offset(string_, string_.find(str, utf8_byte_offset(string_, i), + utf8_byte_offset(str, n))); +} + +ustring::size_type ustring::find(const char* str, ustring::size_type i) const +{ + return utf8_char_offset(string_, string_.find(str, utf8_byte_offset(string_, i))); +} + +ustring::size_type ustring::find(gunichar uc, ustring::size_type i) const +{ + const UnicharToUtf8 conv (uc); + return utf8_char_offset(string_, string_.find(conv.buf, utf8_byte_offset(string_, i), conv.len)); +} + +ustring::size_type ustring::find(char c, ustring::size_type i) const +{ + return utf8_char_offset(string_, string_.find(c, utf8_byte_offset(string_, i))); +} + + +/**** Glib::ustring::rfind() ***********************************************/ + +ustring::size_type ustring::rfind(const ustring& str, ustring::size_type i) const +{ + return utf8_char_offset(string_, string_.rfind(str.string_, utf8_byte_offset(string_, i))); +} + +ustring::size_type ustring::rfind(const char* str, ustring::size_type i, + ustring::size_type n) const +{ + return utf8_char_offset(string_, string_.rfind(str, utf8_byte_offset(string_, i), + utf8_byte_offset(str, n))); +} + +ustring::size_type ustring::rfind(const char* str, ustring::size_type i) const +{ + return utf8_char_offset(string_, string_.rfind(str, utf8_byte_offset(string_, i))); +} + +ustring::size_type ustring::rfind(gunichar uc, ustring::size_type i) const +{ + const UnicharToUtf8 conv (uc); + return utf8_char_offset(string_, string_.rfind(conv.buf, utf8_byte_offset(string_, i), conv.len)); +} + +ustring::size_type ustring::rfind(char c, ustring::size_type i) const +{ + return utf8_char_offset(string_, string_.rfind(c, utf8_byte_offset(string_, i))); +} + + +/**** Glib::ustring::find_first_of() ***************************************/ + +ustring::size_type ustring::find_first_of(const ustring& match, ustring::size_type i) const +{ + return utf8_find_first_of(string_, i, match.string_.data(), match.string_.size(), false); +} + +ustring::size_type ustring::find_first_of(const char* match, + ustring::size_type i, ustring::size_type n) const +{ + return utf8_find_first_of(string_, i, match, n, false); +} + +ustring::size_type ustring::find_first_of(const char* match, ustring::size_type i) const +{ + return utf8_find_first_of(string_, i, match, -1, false); +} + +ustring::size_type ustring::find_first_of(gunichar uc, ustring::size_type i) const +{ + return find(uc, i); +} + +ustring::size_type ustring::find_first_of(char c, ustring::size_type i) const +{ + return find(c, i); +} + + +/**** Glib::ustring::find_last_of() ****************************************/ + +ustring::size_type ustring::find_last_of(const ustring& match, ustring::size_type i) const +{ + return utf8_find_last_of(string_, i, match.string_.data(), match.string_.size(), false); +} + +ustring::size_type ustring::find_last_of(const char* match, + ustring::size_type i, ustring::size_type n) const +{ + return utf8_find_last_of(string_, i, match, n, false); +} + +ustring::size_type ustring::find_last_of(const char* match, ustring::size_type i) const +{ + return utf8_find_last_of(string_, i, match, -1, false); +} + +ustring::size_type ustring::find_last_of(gunichar uc, ustring::size_type i) const +{ + return rfind(uc, i); +} + +ustring::size_type ustring::find_last_of(char c, ustring::size_type i) const +{ + return rfind(c, i); +} + + +/**** Glib::ustring::find_first_not_of() ***********************************/ + +ustring::size_type ustring::find_first_not_of(const ustring& match, ustring::size_type i) const +{ + return utf8_find_first_of(string_, i, match.string_.data(), match.string_.size(), true); +} + +ustring::size_type ustring::find_first_not_of(const char* match, + ustring::size_type i, ustring::size_type n) const +{ + return utf8_find_first_of(string_, i, match, n, true); +} + +ustring::size_type ustring::find_first_not_of(const char* match, ustring::size_type i) const +{ + return utf8_find_first_of(string_, i, match, -1, true); +} + +// Unfortunately, all of the find_*_not_of() methods for single +// characters need their own special implementation. +// +ustring::size_type ustring::find_first_not_of(gunichar uc, ustring::size_type i) const +{ + const size_type bi = utf8_byte_offset(string_, i); + if(bi != npos) + { + const char *const pbegin = string_.data(); + const char *const pend = pbegin + string_.size(); + + for(const char* p = pbegin + bi; + p < pend; + p = g_utf8_next_char(p), ++i) + { + if(g_utf8_get_char(p) != uc) + return i; + } + } + return npos; +} + +ustring::size_type ustring::find_first_not_of(char c, ustring::size_type i) const +{ + const size_type bi = utf8_byte_offset(string_, i); + if(bi != npos) + { + const char *const pbegin = string_.data(); + const char *const pend = pbegin + string_.size(); + + for(const char* p = pbegin + bi; + p < pend; + p = g_utf8_next_char(p), ++i) + { + if(*p != c) + return i; + } + } + return npos; +} + + +/**** Glib::ustring::find_last_not_of() ************************************/ + +ustring::size_type ustring::find_last_not_of(const ustring& match, ustring::size_type i) const +{ + return utf8_find_last_of(string_, i, match.string_.data(), match.string_.size(), true); +} + +ustring::size_type ustring::find_last_not_of(const char* match, + ustring::size_type i, ustring::size_type n) const +{ + return utf8_find_last_of(string_, i, match, n, true); +} + +ustring::size_type ustring::find_last_not_of(const char* match, ustring::size_type i) const +{ + return utf8_find_last_of(string_, i, match, -1, true); +} + +// Unfortunately, all of the find_*_not_of() methods for single +// characters need their own special implementation. +// +ustring::size_type ustring::find_last_not_of(gunichar uc, ustring::size_type i) const +{ + const char *const pbegin = string_.data(); + const char *const pend = pbegin + string_.size(); + size_type i_cur = 0; + size_type i_found = npos; + + for(const char* p = pbegin; + p < pend && i_cur <= i; + p = g_utf8_next_char(p), ++i_cur) + { + if(g_utf8_get_char(p) != uc) + i_found = i_cur; + } + return i_found; +} + +ustring::size_type ustring::find_last_not_of(char c, ustring::size_type i) const +{ + const char *const pbegin = string_.data(); + const char *const pend = pbegin + string_.size(); + size_type i_cur = 0; + size_type i_found = npos; + + for(const char* p = pbegin; + p < pend && i_cur <= i; + p = g_utf8_next_char(p), ++i_cur) + { + if(*p != c) + i_found = i_cur; + } + return i_found; +} + + +/**** Glib::ustring -- get size and resize *********************************/ + +bool ustring::empty() const +{ + return string_.empty(); +} + +ustring::size_type ustring::size() const +{ + const char *const pdata = string_.data(); + return g_utf8_pointer_to_offset(pdata, pdata + string_.size()); +} + +ustring::size_type ustring::length() const +{ + const char *const pdata = string_.data(); + return g_utf8_pointer_to_offset(pdata, pdata + string_.size()); +} + +ustring::size_type ustring::bytes() const +{ + return string_.size(); +} + +ustring::size_type ustring::capacity() const +{ + return string_.capacity(); +} + +ustring::size_type ustring::max_size() const +{ + return string_.max_size(); +} + +void ustring::resize(ustring::size_type n, gunichar uc) +{ + const size_type size_now = size(); + if(n < size_now) + erase(n, npos); + else if(n > size_now) + append(n - size_now, uc); +} + +void ustring::resize(ustring::size_type n, char c) +{ + const size_type size_now = size(); + if(n < size_now) + erase(n, npos); + else if(n > size_now) + string_.append(n - size_now, c); +} + +void ustring::reserve(ustring::size_type n) +{ + string_.reserve(n); +} + + +/**** Glib::ustring -- C string access *************************************/ + +const char* ustring::data() const +{ + return string_.data(); +} + +const char* ustring::c_str() const +{ + return string_.c_str(); +} + +// Note that copy() requests UTF-8 character offsets as +// parameters, but returns the number of copied bytes. +// +ustring::size_type ustring::copy(char* dest, ustring::size_type n, ustring::size_type i) const +{ + const Utf8SubstrBounds bounds (string_, i, n); + return string_.copy(dest, bounds.n, bounds.i); +} + + +/**** Glib::ustring -- UTF-8 utilities *************************************/ + +bool ustring::validate() const +{ + return (g_utf8_validate(string_.data(), string_.size(), 0) != 0); +} + +bool ustring::validate(ustring::iterator& first_invalid) +{ + const char *const pdata = string_.data(); + const char* valid_end = pdata; + const int is_valid = g_utf8_validate(pdata, string_.size(), &valid_end); + + first_invalid = iterator(string_.begin() + (valid_end - pdata)); + return (is_valid != 0); +} + +bool ustring::validate(ustring::const_iterator& first_invalid) const +{ + const char *const pdata = string_.data(); + const char* valid_end = pdata; + const int is_valid = g_utf8_validate(pdata, string_.size(), &valid_end); + + first_invalid = const_iterator(string_.begin() + (valid_end - pdata)); + return (is_valid != 0); +} + +bool ustring::is_ascii() const +{ + const char* p = string_.data(); + const char *const pend = p + string_.size(); + + for(; p != pend; ++p) + { + if((*p & '\x80') != 0) + return false; + } + + return true; +} + +ustring ustring::normalize(NormalizeMode mode) const +{ + const ScopedPtr buf (g_utf8_normalize(string_.data(), string_.size(), + static_cast(int(mode)))); + return ustring(buf.get()); +} + +ustring ustring::uppercase() const +{ + const ScopedPtr buf (g_utf8_strup(string_.data(), string_.size())); + return ustring(buf.get()); +} + +ustring ustring::lowercase() const +{ + const ScopedPtr buf (g_utf8_strdown(string_.data(), string_.size())); + return ustring(buf.get()); +} + +ustring ustring::casefold() const +{ + const ScopedPtr buf (g_utf8_casefold(string_.data(), string_.size())); + return ustring(buf.get()); +} + +std::string ustring::collate_key() const +{ + const ScopedPtr buf (g_utf8_collate_key(string_.data(), string_.size())); + return std::string(buf.get()); +} + +std::string ustring::casefold_collate_key() const +{ + char *const casefold_buf = g_utf8_casefold(string_.data(), string_.size()); + char *const key_buf = g_utf8_collate_key(casefold_buf, -1); + g_free(casefold_buf); + return std::string(ScopedPtr(key_buf).get()); +} + + +/**** Glib::ustring::SequenceToString **************************************/ + +ustring::SequenceToString + ::SequenceToString(Glib::ustring::iterator pbegin, Glib::ustring::iterator pend) +: + std::string(pbegin.base(), pend.base()) +{} + +ustring::SequenceToString + ::SequenceToString(Glib::ustring::const_iterator pbegin, Glib::ustring::const_iterator pend) +: + std::string(pbegin.base(), pend.base()) +{} + + +/**** Glib::ustring -- stream I/O operators ********************************/ + +std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string) +{ + std::string locale_string; + is >> locale_string; + utf8_string = Glib::locale_to_utf8(locale_string); + return is; +} + +std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string) +{ + os << Glib::locale_from_utf8(utf8_string); + return os; +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/ustring.h b/libs/glibmm2/glibmm/ustring.h new file mode 100644 index 0000000000..86578b43bb --- /dev/null +++ b/libs/glibmm2/glibmm/ustring.h @@ -0,0 +1,997 @@ +// -*- c++ -*- +#ifndef _GLIBMM_USTRING_H +#define _GLIBMM_USTRING_H + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +#include +#include +#include + +#include +GLIBMM_USING_STD(bidirectional_iterator_tag) +GLIBMM_USING_STD(reverse_iterator) +GLIBMM_USING_STD(string) +GLIBMM_USING_STD(istream) +GLIBMM_USING_STD(ostream) + +#ifdef GLIBMM_HAVE_STD_ITERATOR_TRAITS +GLIBMM_USING_STD(iterator_traits) +#else +#include /* for ptrdiff_t */ +GLIBMM_USING_STD(random_access_iterator_tag) +#endif + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#ifndef GLIBMM_HAVE_STD_ITERATOR_TRAITS + +template +struct IteratorTraits +{ + typedef typename T::iterator_category iterator_category; + typedef typename T::value_type value_type; + typedef typename T::difference_type difference_type; + typedef typename T::pointer pointer; + typedef typename T::reference reference; +}; + +template +struct IteratorTraits +{ + typedef std::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; +}; + +template +struct IteratorTraits +{ + typedef std::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef const T* pointer; + typedef const T& reference; +}; + +#endif /* GLIBMM_HAVE_STD_ITERATOR_TRAITS */ +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** The iterator type of Glib::ustring. + * Note this is not a random access iterator but a bidirectional one, + * since all index operations need to iterate over the UTF-8 data. Use + * std::advance() to move to a certain position. However, all of the + * relational operators are available: + * == != < > <= >= + * + * A writeable iterator isn't provided because: The number of bytes of + * the old UTF-8 character and the new one to write could be different. + * Therefore, any write operation would invalidate all other iterators + * pointing into the same string. + */ +template +class ustring_Iterator +{ +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef gunichar value_type; + typedef std::string::difference_type difference_type; + typedef value_type reference; + typedef void pointer; + + inline ustring_Iterator(); + inline ustring_Iterator(const ustring_Iterator& other); + + inline value_type operator*() const; + + inline ustring_Iterator & operator++(); + inline const ustring_Iterator operator++(int); + inline ustring_Iterator & operator--(); + inline const ustring_Iterator operator--(int); + + explicit inline ustring_Iterator(T pos); + inline T base() const; + +private: + T pos_; +}; + + +/** Extract a UCS-4 character from UTF-8 data. + * Convert a single UTF-8 (multibyte) character starting at @p pos to + * a UCS-4 wide character. This may read up to 6 bytes after the start + * position, depending on the UTF-8 character width. You have to make + * sure the source contains at least one valid UTF-8 character. + * + * This is mainly used by the implementation of Glib::ustring::iterator, + * but it might be useful as utility function if you prefer using + * std::string even for UTF-8 encoding. + */ +gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_PURE; + + +/** Glib::ustring has much the same interface as std::string, but contains + * %Unicode characters encoded as UTF-8. + * + * @par About UTF-8 and ASCII + * @par + * The standard character set ANSI_X3.4-1968 -- more commonly known as + * ASCII -- is a subset of UTF-8. So, if you want to, you can use + * Glib::ustring without even thinking about UTF-8. + * @par + * Whenever ASCII is mentioned in this manual, we mean the @em real ASCII + * (i.e. as defined in ANSI_X3.4-1968), which contains only 7-bit characters. + * Glib::ustring can @em not be used with ASCII-compatible extended 8-bit + * charsets like ISO-8859-1. It's a good idea to avoid string literals + * containing non-ASCII characters (e.g. German umlauts) in source code, + * or at least you should use UTF-8 literals. + * @par + * You can find a detailed UTF-8 and %Unicode FAQ here: + * http://www.cl.cam.ac.uk/~mgk25/unicode.html + * + * @par Glib::ustring vs. std::string + * @par + * Glib::ustring has implicit type conversions to and from std::string. + * These conversions do @em not convert to/from the current locale (see + * Glib::locale_from_utf8() and Glib::locale_to_utf8() if you need that). You + * can always use std::string instead of Glib::ustring -- however, using + * std::string with multi-byte characters is quite hard. For instance, + * std::string::operator[] might return a byte in the middle of a + * character, and std::string::length() returns the number of bytes + * rather than characters. So don't do that without a good reason. + * @par + * In a perfect world the C++ Standard Library would contain a UTF-8 string + * class. Unfortunately, the C++ standard doesn't mention UTF-8 at all. Note + * that std::wstring is not a UTF-8 string class because it contains only + * fixed-width characters (where width could be 32, 16, or even 8 bits). + * + * @par Glib::ustring and stream input/output + * @par + * The stream I/O operators, that is operator<<() and operator>>(), perform + * implicit charset conversion to/from the current locale. If that's not + * what you intented (e.g. when writing to a configuration file that should + * always be UTF-8 encoded) use ustring::raw() to override this behaviour. + * @par + * If you're using std::ostringstream to build strings for display in the + * user interface, you must convert the result back to UTF-8 as shown below: + * @code + * std::ostringstream output; + * output.imbue(std::locale("")); // use the user's locale for this stream + * output << percentage << " % done"; + * label->set_text(Glib::locale_to_utf8(output.str())); + * @endcode + * + * @par Implementation notes + * @par + * Glib::ustring does not inherit from std::string, because std::string was + * intended to be a final class. For instance, it does not have a virtual + * destructor. Also, a HAS-A relationship is more appropriate because + * ustring can't just enhance the std::string interface. Rather, it has to + * reimplement the interface so that all operations are based on characters + * instead of bytes. + */ +class ustring +{ +public: + typedef std::string::size_type size_type; + typedef std::string::difference_type difference_type; + + typedef gunichar value_type; + typedef gunichar & reference; + typedef const gunichar & const_reference; + + typedef ustring_Iterator iterator; + typedef ustring_Iterator const_iterator; + +#ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR + + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + +#else + + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + +#endif /* GLIBMM_HAVE_SUN_REVERSE_ITERATOR */ + +#ifdef GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS + static const size_type npos = std::string::npos; +#else + //The IRIX MipsPro compiler says "The indicated constant value is not known", + //so we need to initalize the static member data elsewhere. + static const size_type npos; +#endif + + /*! Default constructor, which creates an empty string. + */ + ustring(); + + ~ustring(); + + /*! Construct a ustring as a copy of another ustring. + * @param other A source string. + */ + ustring(const ustring& other); + + /*! Assign the value of another string to this string. + * @param other A source string. + */ + ustring& operator=(const ustring& other); + + /*! Swap contents with another string. + * @param other String to swap with. + */ + void swap(ustring& other); + + /*! Construct a ustring as a copy of another std::string. + * @param src A source std::string containing text encoded as UTF-8. + */ + ustring(const std::string& src); + + /*! Construct a ustring as a copy of a substring. + * @param src %Source ustring. + * @param i Index of first character to copy from. + * @param n Number of characters to copy (defaults to copying the remainder). + */ + ustring(const ustring& src, size_type i, size_type n=npos); + + /*! Construct a ustring as a partial copy of a C string. + * @param src %Source C string encoded as UTF-8. + * @param n Number of characters to copy. + */ + ustring(const char* src, size_type n); + + /*! Construct a ustring as a copy of a C string. + * @param src %Source C string encoded as UTF-8. + */ + ustring(const char* src); + + /*! Construct a ustring as multiple characters. + * @param n Number of characters. + * @param uc UCS-4 code point to use. + */ + ustring(size_type n, gunichar uc); + + /*! Construct a ustring as multiple characters. + * @param n Number of characters. + * @param c ASCII character to use. + */ + ustring(size_type n, char c); + + /*! Construct a ustring as a copy of a range. + * @param pbegin Start of range. + * @param pend End of range. + */ + template ustring(In pbegin, In pend); + + +//! @name Assign new contents. +//! @{ + + ustring& operator=(const std::string& src); + ustring& operator=(const char* src); + ustring& operator=(gunichar uc); + ustring& operator=(char c); + + ustring& assign(const ustring& src); + ustring& assign(const ustring& src, size_type i, size_type n); + ustring& assign(const char* src, size_type n); + ustring& assign(const char* src); + ustring& assign(size_type n, gunichar uc); + ustring& assign(size_type n, char c); + template ustring& assign(In pbegin, In pend); + +//! @} +//! @name Append to the string. +//! @{ + + ustring& operator+=(const ustring& src); + ustring& operator+=(const char* src); + ustring& operator+=(gunichar uc); + ustring& operator+=(char c); + void push_back(gunichar uc); + void push_back(char c); + + ustring& append(const ustring& src); + ustring& append(const ustring& src, size_type i, size_type n); + ustring& append(const char* src, size_type n); + ustring& append(const char* src); + ustring& append(size_type n, gunichar uc); + ustring& append(size_type n, char c); + template ustring& append(In pbegin, In pend); + +//! @} +//! @name Insert into the string. +//! @{ + + ustring& insert(size_type i, const ustring& src); + ustring& insert(size_type i, const ustring& src, size_type i2, size_type n); + ustring& insert(size_type i, const char* src, size_type n); + ustring& insert(size_type i, const char* src); + ustring& insert(size_type i, size_type n, gunichar uc); + ustring& insert(size_type i, size_type n, char c); + + iterator insert(iterator p, gunichar uc); + iterator insert(iterator p, char c); + void insert(iterator p, size_type n, gunichar uc); + void insert(iterator p, size_type n, char c); + template void insert(iterator p, In pbegin, In pend); + +//! @} +//! @name Replace sub-strings. +//! @{ + + ustring& replace(size_type i, size_type n, const ustring& src); + ustring& replace(size_type i, size_type n, const ustring& src, size_type i2, size_type n2); + ustring& replace(size_type i, size_type n, const char* src, size_type n2); + ustring& replace(size_type i, size_type n, const char* src); + ustring& replace(size_type i, size_type n, size_type n2, gunichar uc); + ustring& replace(size_type i, size_type n, size_type n2, char c); + + ustring& replace(iterator pbegin, iterator pend, const ustring& src); + ustring& replace(iterator pbegin, iterator pend, const char* src, size_type n); + ustring& replace(iterator pbegin, iterator pend, const char* src); + ustring& replace(iterator pbegin, iterator pend, size_type n, gunichar uc); + ustring& replace(iterator pbegin, iterator pend, size_type n, char c); + template ustring& replace(iterator pbegin, iterator pend, In pbegin2, In pend2); + +//! @} +//! @name Erase sub-strings. +//! @{ + + void clear(); + ustring& erase(size_type i, size_type n=npos); + ustring& erase(); + iterator erase(iterator p); + iterator erase(iterator pbegin, iterator pend); + +//! @} +//! @name Compare and collate. +//! @{ + + int compare(const ustring& rhs) const; + int compare(const char* rhs) const; + int compare(size_type i, size_type n, const ustring& rhs) const; + int compare(size_type i, size_type n, const ustring& rhs, size_type i2, size_type n2) const; + int compare(size_type i, size_type n, const char* rhs, size_type n2) const; + int compare(size_type i, size_type n, const char* rhs) const; + + /*! Create a unique sorting key for the UTF-8 string. If you need to + * compare UTF-8 strings regularly, e.g. for sorted containers such as + * std::set<>, you should consider creating a collate key first + * and compare this key instead of the actual string. + * + * The ustring::compare() methods as well as the relational operators + * == != < > <= >= are quite costly + * because they have to deal with %Unicode and the collation rules defined by + * the current locale. Converting both operands to UCS-4 is just the first + * of several costly steps involved when comparing ustrings. So be careful. + */ + std::string collate_key() const; + + /*! Create a unique key for the UTF-8 string that can be used for caseless + * sorting. ustr.casefold_collate_key() results in the same string + * as ustr.casefold().collate_key(), but the former is likely more + * efficient. + */ + std::string casefold_collate_key() const; + +//! @} +//! @name Extract characters and sub-strings. +//! @{ + + /*! No reference return; use replace() to write characters. */ + value_type operator[](size_type i) const; + + /*! No reference return; use replace() to write characters. @throw std::out_of_range */ + value_type at(size_type i) const; + + inline ustring substr(size_type i=0, size_type n=npos) const; + +//! @} +//! @name Access a sequence of characters. +//! @{ + + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; + reverse_iterator rbegin(); + reverse_iterator rend(); + const_reverse_iterator rbegin() const; + const_reverse_iterator rend() const; + +//! @} +//! @name Find sub-strings. +//! @{ + + size_type find(const ustring& str, size_type i=0) const; + size_type find(const char* str, size_type i, size_type n) const; + size_type find(const char* str, size_type i=0) const; + size_type find(gunichar uc, size_type i=0) const; + size_type find(char c, size_type i=0) const; + + size_type rfind(const ustring& str, size_type i=npos) const; + size_type rfind(const char* str, size_type i, size_type n) const; + size_type rfind(const char* str, size_type i=npos) const; + size_type rfind(gunichar uc, size_type i=npos) const; + size_type rfind(char c, size_type i=npos) const; + +//! @} +//! @name Match against a set of characters. +//! @{ + + size_type find_first_of(const ustring& match, size_type i=0) const; + size_type find_first_of(const char* match, size_type i, size_type n) const; + size_type find_first_of(const char* match, size_type i=0) const; + size_type find_first_of(gunichar uc, size_type i=0) const; + size_type find_first_of(char c, size_type i=0) const; + + size_type find_last_of(const ustring& match, size_type i=npos) const; + size_type find_last_of(const char* match, size_type i, size_type n) const; + size_type find_last_of(const char* match, size_type i=npos) const; + size_type find_last_of(gunichar uc, size_type i=npos) const; + size_type find_last_of(char c, size_type i=npos) const; + + size_type find_first_not_of(const ustring& match, size_type i=0) const; + size_type find_first_not_of(const char* match, size_type i, size_type n) const; + size_type find_first_not_of(const char* match, size_type i=0) const; + size_type find_first_not_of(gunichar uc, size_type i=0) const; + size_type find_first_not_of(char c, size_type i=0) const; + + size_type find_last_not_of(const ustring& match, size_type i=npos) const; + size_type find_last_not_of(const char* match, size_type i, size_type n) const; + size_type find_last_not_of(const char* match, size_type i=npos) const; + size_type find_last_not_of(gunichar uc, size_type i=npos) const; + size_type find_last_not_of(char c, size_type i=npos) const; + +//! @} +//! @name Retrieve the string's size. +//! @{ + + /** Returns true if the string is empty. Equivalent to *this == "". + * @result Whether the string is empty. + */ + bool empty() const; + + /** Returns the number of characters in the string, not including any null-termination. + * @result The number of UTF-8 characters. + * + * @see bytes(), empty() + */ + size_type size() const; + + //We have length() as well as size(), because std::string has both. + + /** This is the same as size(). + */ + size_type length() const; + + /** Returns the number of bytes in the string, not including any null-termination. + * @result The number of bytes. + * + * @see size(), empty() + */ + size_type bytes() const; + +//! @} +//! @name Change the string's size. +//! @{ + + void resize(size_type n, gunichar uc); + void resize(size_type n, char c='\0'); + +//! @} +//! @name Control the allocated memory. +//! @{ + + size_type capacity() const; + size_type max_size() const; + void reserve(size_type n=0); + +//! @} +//! @name Get a per-byte representation of the string. +//! @{ + + inline operator std::string() const; // e.g. std::string str = ustring(); + inline const std::string& raw() const; + + // Not necessarily an ASCII char*. Use g_utf8_*() where necessary. + const char* data() const; + const char* c_str() const; + + /*! @return Number of copied @em bytes, not characters. */ + size_type copy(char* dest, size_type n, size_type i=0) const; + +//! @} +//! @name UTF-8 utilities. +//! @{ + + /*! Check whether the string is valid UTF-8. */ + bool validate() const; + + /*! Check whether the string is valid UTF-8. */ + bool validate(iterator& first_invalid); + + /*! Check whether the string is valid UTF-8. */ + bool validate(const_iterator& first_invalid) const; + + /*! Check whether the string is plain 7-bit ASCII. @par + * Unlike any other ustring method, is_ascii() is safe to use on invalid + * UTF-8 strings. If the string isn't valid UTF-8, it cannot be valid + * ASCII either, therefore is_ascii() will just return @c false then. + * @return Whether the string contains only ASCII characters. + */ + bool is_ascii() const; + + /*! "Normalize" the %Unicode character representation of the string. */ + ustring normalize(NormalizeMode mode = NORMALIZE_DEFAULT_COMPOSE) const; + +//! @} +//! @name Character case conversion. +//! @{ + + /*! Returns a new UTF-8 string with all characters characters converted to + * their lowercase equivalent, while honoring the current locale. The + * resulting string may change in the number of bytes as well as in the + * number of characters. For instance, the German sharp s + * "ß" will be replaced by two characters + * "SS" because there is no capital "ß". + */ + ustring uppercase() const; + + /*! Returns a new UTF-8 string with all characters characters converted to + * their lowercase equivalent, while honoring the current locale. The + * resulting string may change in the number of bytes as well as in the + * number of characters. + */ + ustring lowercase() const; + + /*! Returns a caseless representation of the UTF-8 string. The resulting + * string doesn't correspond to any particular case, therefore the result + * is only useful to compare strings and should never be displayed to the + * user. + */ + ustring casefold() const; + +//! @} + +private: + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +#ifdef GLIBMM_HAVE_STD_ITERATOR_TRAITS + template ::value_type> +#else + template ::value_type> +#endif + struct SequenceToString; + + //The Tru64 compiler needs these partial specializations to be declared here, + //as well as defined later. That's probably correct. murrayc. + template + struct SequenceToString; + + template + struct SequenceToString; + + /* + template <> + struct ustring::SequenceToString; + + template <> + struct ustring::SequenceToString; + */ + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + std::string string_; +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +template +struct ustring::SequenceToString +{}; + +template +struct ustring::SequenceToString : public std::string +{ + SequenceToString(In pbegin, In pend); +}; + +template +struct ustring::SequenceToString : public std::string +{ + SequenceToString(In pbegin, In pend); +}; + +template <> +struct ustring::SequenceToString : public std::string +{ + SequenceToString(Glib::ustring::iterator pbegin, Glib::ustring::iterator pend); +}; + +template <> +struct ustring::SequenceToString : public std::string +{ + SequenceToString(Glib::ustring::const_iterator pbegin, Glib::ustring::const_iterator pend); +}; + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** Stream input operator. + * @relates Glib::ustring + * @throw Glib::ConvertError + */ +std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string); + +/** Stream output operator. + * @relates Glib::ustring + * @throw Glib::ConvertError + */ +std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string); + + +/***************************************************************************/ +/* Inline implementation */ +/***************************************************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/**** Glib::ustring_Iterator<> *********************************************/ + +template inline +ustring_Iterator::ustring_Iterator(T pos) +: + pos_ (pos) +{} + +template inline +T ustring_Iterator::base() const +{ + return pos_; +} + +template inline +ustring_Iterator::ustring_Iterator() +: + pos_ () +{} + +template inline +ustring_Iterator::ustring_Iterator(const ustring_Iterator& other) +: + pos_ (other.base()) +{} + +template inline +typename ustring_Iterator::value_type ustring_Iterator::operator*() const +{ + return Glib::get_unichar_from_std_iterator(pos_); +} + +template inline +ustring_Iterator& ustring_Iterator::operator++() +{ + pos_ += g_utf8_skip[static_cast(*pos_)]; + return *this; +} + +template inline +const ustring_Iterator ustring_Iterator::operator++(int) +{ + const ustring_Iterator temp (*this); + this->operator++(); + return temp; +} + +template inline +ustring_Iterator& ustring_Iterator::operator--() +{ + do --pos_; while((*pos_ & '\xC0') == '\x80'); + return *this; +} + +template inline +const ustring_Iterator ustring_Iterator::operator--(int) +{ + const ustring_Iterator temp (*this); + this->operator--(); + return temp; +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** @relates Glib::ustring_Iterator */ +template inline +bool operator==(const ustring_Iterator& lhs, const ustring_Iterator& rhs) +{ + return (lhs.base() == rhs.base()); +} + +/** @relates Glib::ustring_Iterator */ +template inline +bool operator!=(const ustring_Iterator& lhs, const ustring_Iterator& rhs) +{ + return (lhs.base() != rhs.base()); +} + +/** @relates Glib::ustring_Iterator */ +template inline +bool operator<(const ustring_Iterator& lhs, const ustring_Iterator& rhs) +{ + return (lhs.base() < rhs.base()); +} + +/** @relates Glib::ustring_Iterator */ +template inline +bool operator>(const ustring_Iterator& lhs, const ustring_Iterator& rhs) +{ + return (lhs.base() > rhs.base()); +} + +/** @relates Glib::ustring_Iterator */ +template inline +bool operator<=(const ustring_Iterator& lhs, const ustring_Iterator& rhs) +{ + return (lhs.base() <= rhs.base()); +} + +/** @relates Glib::ustring_Iterator */ +template inline +bool operator>=(const ustring_Iterator& lhs, const ustring_Iterator& rhs) +{ + return (lhs.base() >= rhs.base()); +} + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/**** Glib::ustring::SequenceToString **************************************/ + +template +ustring::SequenceToString::SequenceToString(In pbegin, In pend) +: + std::string(pbegin, pend) +{} + +template +ustring::SequenceToString::SequenceToString(In pbegin, In pend) +{ + char utf8_buf[6]; // stores a single UTF-8 character + + for(; pbegin != pend; ++pbegin) + { + const std::string::size_type utf8_len = g_unichar_to_utf8(*pbegin, utf8_buf); + this->append(utf8_buf, utf8_len); + } +} + + +/**** Glib::ustring ********************************************************/ + +template +ustring::ustring(In pbegin, In pend) +: + string_ (Glib::ustring::SequenceToString(pbegin, pend)) +{} + +template +ustring& ustring::assign(In pbegin, In pend) +{ + Glib::ustring::SequenceToString temp_string (pbegin, pend); + string_.swap(temp_string); // constant-time operation + return *this; +} + +template +ustring& ustring::append(In pbegin, In pend) +{ + string_.append(Glib::ustring::SequenceToString(pbegin, pend)); + return *this; +} + +template +void ustring::insert(ustring::iterator p, In pbegin, In pend) +{ + string_.insert(p.base(), Glib::ustring::SequenceToString(pbegin, pend)); +} + +template +ustring& ustring::replace(ustring::iterator pbegin, ustring::iterator pend, In pbegin2, In pend2) +{ + string_.replace( + pbegin.base(), pend.base(), + Glib::ustring::SequenceToString(pbegin2, pend2)); + return *this; +} + +// The ustring methods substr() and operator std::string() are inline, +// so that the compiler has a fair chance to optimize the copy ctor away. + +inline +ustring ustring::substr(ustring::size_type i, ustring::size_type n) const +{ + return ustring(*this, i, n); +} + +inline +ustring::operator std::string() const +{ + return string_; +} + +inline +const std::string& ustring::raw() const +{ + return string_; +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** @relates Glib::ustring */ +inline +void swap(ustring& lhs, ustring& rhs) +{ + lhs.swap(rhs); +} + + +/**** Glib::ustring -- comparison operators ********************************/ + +/** @relates Glib::ustring */ +inline bool operator==(const ustring& lhs, const ustring& rhs) + { return (lhs.compare(rhs) == 0); } + +/** @relates Glib::ustring */ +inline bool operator==(const ustring& lhs, const char* rhs) + { return (lhs.compare(rhs) == 0); } + +/** @relates Glib::ustring */ +inline bool operator==(const char* lhs, const ustring& rhs) + { return (rhs.compare(lhs) == 0); } + + +/** @relates Glib::ustring */ +inline bool operator!=(const ustring& lhs, const ustring& rhs) + { return (lhs.compare(rhs) != 0); } + +/** @relates Glib::ustring */ +inline bool operator!=(const ustring& lhs, const char* rhs) + { return (lhs.compare(rhs) != 0); } + +/** @relates Glib::ustring */ +inline bool operator!=(const char* lhs, const ustring& rhs) + { return (rhs.compare(lhs) != 0); } + + +/** @relates Glib::ustring */ +inline bool operator<(const ustring& lhs, const ustring& rhs) + { return (lhs.compare(rhs) < 0); } + +/** @relates Glib::ustring */ +inline bool operator<(const ustring& lhs, const char* rhs) + { return (lhs.compare(rhs) < 0); } + +/** @relates Glib::ustring */ +inline bool operator<(const char* lhs, const ustring& rhs) + { return (rhs.compare(lhs) > 0); } + + +/** @relates Glib::ustring */ +inline bool operator>(const ustring& lhs, const ustring& rhs) + { return (lhs.compare(rhs) > 0); } + +/** @relates Glib::ustring */ +inline bool operator>(const ustring& lhs, const char* rhs) + { return (lhs.compare(rhs) > 0); } + +/** @relates Glib::ustring */ +inline bool operator>(const char* lhs, const ustring& rhs) + { return (rhs.compare(lhs) < 0); } + + +/** @relates Glib::ustring */ +inline bool operator<=(const ustring& lhs, const ustring& rhs) + { return (lhs.compare(rhs) <= 0); } + +/** @relates Glib::ustring */ +inline bool operator<=(const ustring& lhs, const char* rhs) + { return (lhs.compare(rhs) <= 0); } + +/** @relates Glib::ustring */ +inline bool operator<=(const char* lhs, const ustring& rhs) + { return (rhs.compare(lhs) >= 0); } + + +/** @relates Glib::ustring */ +inline bool operator>=(const ustring& lhs, const ustring& rhs) + { return (lhs.compare(rhs) >= 0); } + +/** @relates Glib::ustring */ +inline bool operator>=(const ustring& lhs, const char* rhs) + { return (lhs.compare(rhs) >= 0); } + +/** @relates Glib::ustring */ +inline bool operator>=(const char* lhs, const ustring& rhs) + { return (rhs.compare(lhs) <= 0); } + + +/**** Glib::ustring -- concatenation operators *****************************/ + +/** @relates Glib::ustring */ +inline ustring operator+(const ustring& lhs, const ustring& rhs) + { ustring temp (lhs); temp += rhs; return temp; } + +/** @relates Glib::ustring */ +inline ustring operator+(const ustring& lhs, const char* rhs) + { ustring temp (lhs); temp += rhs; return temp; } + +/** @relates Glib::ustring */ +inline ustring operator+(const char* lhs, const ustring& rhs) + { ustring temp (lhs); temp += rhs; return temp; } + +/** @relates Glib::ustring */ +inline ustring operator+(const ustring& lhs, gunichar rhs) + { ustring temp (lhs); temp += rhs; return temp; } + +/** @relates Glib::ustring */ +inline ustring operator+(gunichar lhs, const ustring& rhs) + { ustring temp (1, lhs); temp += rhs; return temp; } + +/** @relates Glib::ustring */ +inline ustring operator+(const ustring& lhs, char rhs) + { ustring temp (lhs); temp += rhs; return temp; } + +/** @relates Glib::ustring */ +inline ustring operator+(char lhs, const ustring& rhs) + { ustring temp (1, lhs); temp += rhs; return temp; } + +} // namespace Glib + + +#endif /* _GLIBMM_USTRING_H */ + diff --git a/libs/glibmm2/glibmm/utility.cc b/libs/glibmm2/glibmm/utility.cc new file mode 100644 index 0000000000..f415bcb816 --- /dev/null +++ b/libs/glibmm2/glibmm/utility.cc @@ -0,0 +1,40 @@ +// -*- c++ -*- + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +void Glib::append_canonical_typename(std::string& dest, const char* type_name) +{ + const std::string::size_type offset = dest.size(); + dest += type_name; + + std::string::iterator p = dest.begin() + offset; + const std::string::iterator pend = dest.end(); + + for(; p != pend; ++p) + { + if(!(g_ascii_isalnum(*p) || *p == '_' || *p == '-')) + *p = '+'; + } +} + diff --git a/libs/glibmm2/glibmm/utility.h b/libs/glibmm2/glibmm/utility.h new file mode 100644 index 0000000000..8890f9af91 --- /dev/null +++ b/libs/glibmm2/glibmm/utility.h @@ -0,0 +1,119 @@ +// -*- c++ -*- +#ifndef _GLIBMM_UTILITY_H +#define _GLIBMM_UTILITY_H +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +extern "C" void g_free(void*); + + +/* Occasionally, a struct variable has to be initialized after its definition, + * i.e. when using structs as class member data. For convenience, the macro + * GLIBMM_INITIALIZE_STRUCT(Var, Type) is provided. It even avoids creating + * a temporary if the compiler is GCC. + */ +#if ((__GNUC__ >= 3) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) && !defined(__STRICT_ANSI__) + +#define GLIBMM_INITIALIZE_STRUCT(Var, Type) __builtin_memset(&(Var), 0, sizeof(Type)) + +#else + +#define GLIBMM_INITIALIZE_STRUCT(Var, Type) \ + G_STMT_START{ \ + Type const temp_initializer__ = { 0, }; \ + (Var) = temp_initializer__; \ + }G_STMT_END + +#endif /* ((__GNUC__ >= 3) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) && !defined(__STRICT_ANSI__) */ + + +namespace Glib +{ + +// These are used by gtkmmproc-generated type conversions: + +// Helper to deal with memory allocated +// by GLib functions in an exception-safe manner. +template +class ScopedPtr +{ +private: + T* ptr_; + ScopedPtr(const ScopedPtr&); + ScopedPtr& operator=(const ScopedPtr&); + +public: + ScopedPtr() : ptr_ (0) {} + explicit ScopedPtr(T* ptr) : ptr_ (ptr) {} + ~ScopedPtr() { g_free(ptr_); } + T* get() const { return ptr_; } + T** addr() { return &ptr_; } +}; + +// Removes the const nature of a ptr +template +inline T* unconst(const T* t) + { return const_cast(t); } + +// Convert const gchar* to ustring, while treating NULL as empty string. +inline +Glib::ustring convert_const_gchar_ptr_to_ustring(const char* str) +{ + return (str) ? Glib::ustring(str) : Glib::ustring(); +} + +// Convert const gchar* to std::string, while treating NULL as empty string. +inline +std::string convert_const_gchar_ptr_to_stdstring(const char* str) +{ + return (str) ? std::string(str) : std::string(); +} + +// Convert a non-const gchar* return value to ustring, freeing it too. +inline +Glib::ustring convert_return_gchar_ptr_to_ustring(char* str) +{ + return (str) ? Glib::ustring(Glib::ScopedPtr(str).get()) + : Glib::ustring(); +} + +// Convert a non-const gchar* return value to std::string, freeing it too. +inline +std::string convert_return_gchar_ptr_to_stdstring(char* str) +{ + return (str) ? std::string(Glib::ScopedPtr(str).get()) + : std::string(); +} + +// Append type_name to dest, while replacing special characters with '+'. +void append_canonical_typename(std::string& dest, const char* type_name); + +} // namespace Glib + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#endif /* _GLIBMM_UTILITY_H */ + diff --git a/libs/glibmm2/glibmm/value.cc b/libs/glibmm2/glibmm/value.cc new file mode 100644 index 0000000000..adb3e90252 --- /dev/null +++ b/libs/glibmm2/glibmm/value.cc @@ -0,0 +1,242 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Glib +{ + +/**** Glib::ValueBase ******************************************************/ + +ValueBase::ValueBase() +{ + GLIBMM_INITIALIZE_STRUCT(gobject_, GValue); +} + +void ValueBase::init(GType type) +{ + g_value_init(&gobject_, type); +} + +ValueBase::ValueBase(const ValueBase& other) +{ + GLIBMM_INITIALIZE_STRUCT(gobject_, GValue); + + g_value_init(&gobject_, G_VALUE_TYPE(&other.gobject_)); + g_value_copy(&other.gobject_, &gobject_); +} + +ValueBase& ValueBase::operator=(const ValueBase& other) +{ + // g_value_copy() prevents self-assignment and deletes the destination. + g_value_copy(&other.gobject_, &gobject_); + return *this; +} + +ValueBase::~ValueBase() +{ + g_value_unset(&gobject_); +} + +void ValueBase::reset() +{ + g_value_reset(&gobject_); +} + + +/**** Glib::ValueBase_Boxed ************************************************/ + +// static +GType ValueBase_Boxed::value_type() +{ + return G_TYPE_BOXED; +} + +void ValueBase_Boxed::set_boxed(const void* data) +{ + g_value_set_boxed(&gobject_, data); +} + +void* ValueBase_Boxed::get_boxed() const +{ + return g_value_get_boxed(&gobject_); +} + +GParamSpec* ValueBase_Boxed::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_boxed( + name.c_str(), 0, 0, G_VALUE_TYPE(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::ValueBase_Object ***********************************************/ + +// static +GType ValueBase_Object::value_type() +{ + return G_TYPE_OBJECT; +} + +void ValueBase_Object::set_object(Glib::ObjectBase* data) +{ + g_value_set_object(&gobject_, (data) ? data->gobj() : 0); +} + +Glib::ObjectBase* ValueBase_Object::get_object() const +{ + GObject *const data = static_cast(g_value_get_object(&gobject_)); + return Glib::wrap_auto(data, false); +} + +Glib::RefPtr ValueBase_Object::get_object_copy() const +{ + GObject *const data = static_cast(g_value_get_object(&gobject_)); + return Glib::RefPtr(Glib::wrap_auto(data, true)); +} + +GParamSpec* ValueBase_Object::create_param_spec(const Glib::ustring& name) const +{ + // Glib::Value_Pointer<> derives from Glib::ValueBase_Object, because + // we don't know beforehand whether a certain type is derived from + // Glib::Object or not. To keep create_param_spec() out of the template + // struggle, we dispatch here at runtime. + + if(G_VALUE_HOLDS_OBJECT(&gobject_)) + { + return g_param_spec_object( + name.c_str(), 0, 0, G_VALUE_TYPE(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); + } + else + { + g_return_val_if_fail(G_VALUE_HOLDS_POINTER(&gobject_), 0); + + return g_param_spec_pointer( + name.c_str(), 0, 0, + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); + } +} + + +/**** Glib::ValueBase_Enum *************************************************/ + +// static +GType ValueBase_Enum::value_type() +{ + return G_TYPE_ENUM; +} + +void ValueBase_Enum::set_enum(int data) +{ + g_value_set_enum(&gobject_, data); +} + +int ValueBase_Enum::get_enum() const +{ + return g_value_get_enum(&gobject_); +} + +GParamSpec* ValueBase_Enum::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_enum( + name.c_str(), 0, 0, + G_VALUE_TYPE(&gobject_), g_value_get_enum(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::ValueBase_Flags ************************************************/ + +// static +GType ValueBase_Flags::value_type() +{ + return G_TYPE_FLAGS; +} + +void ValueBase_Flags::set_flags(unsigned int data) +{ + g_value_set_flags(&gobject_, data); +} + +unsigned int ValueBase_Flags::get_flags() const +{ + return g_value_get_flags(&gobject_); +} + +GParamSpec* ValueBase_Flags::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_flags( + name.c_str(), 0, 0, + G_VALUE_TYPE(&gobject_), g_value_get_flags(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::ValueBase_String ***********************************************/ + +// static +GType ValueBase_String::value_type() +{ + return G_TYPE_STRING; +} + +void ValueBase_String::set_cstring(const char* data) +{ + g_value_set_string(&gobject_, data); +} + +const char* ValueBase_String::get_cstring() const +{ + if(const char *const data = g_value_get_string(&gobject_)) + return data; + else + return ""; +} + +GParamSpec* ValueBase_String::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_string( + name.c_str(), 0, 0, get_cstring(), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value *********************************************/ + +void Value::set(const std::string& data) +{ + g_value_set_string(&gobject_, data.c_str()); +} + + +/**** Glib::Value *******************************************/ + +void Value::set(const Glib::ustring& data) +{ + g_value_set_string(&gobject_, data.c_str()); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/value.h b/libs/glibmm2/glibmm/value.h new file mode 100644 index 0000000000..94203a324c --- /dev/null +++ b/libs/glibmm2/glibmm/value.h @@ -0,0 +1,319 @@ +// -*- c++ -*- +#ifndef _GLIBMM_VALUE_H +#define _GLIBMM_VALUE_H +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace Glib +{ + +class ObjectBase; +class Object; + +/** @defgroup glibmmValue Generic Values + * + * Glib::Value<> is specialized for almost any type used within + * the glibmm and gtkmm libraries. + * + * - Basic types like int, char, bool, etc., also void*. + * - Glib::ustring and std::string. + * - Pointers to classes derived from Glib::Object. + * - Glib::RefPtr<> pointer types, which are assumed to be Glib::Object pointers. + * - All flags and enum types used within the gtkmm libraries. + * + * If a type doesn't fit into any of these categories, then a generic + * implementation for custom types will be used. The requirements imposed + * on custom types are described in the Glib::Value class documentation. + */ + +/** + * @ingroup glibmmValue + */ +class ValueBase +{ +public: + /** Initializes the GValue, but without a type. You have to + * call init() before using the set(), get(), or reset() methods. + */ + ValueBase(); + + ValueBase(const ValueBase& other); + ValueBase& operator=(const ValueBase& other); + + ~ValueBase(); + + /** Setup the GValue for storing the specified @a type. + * The contents will be initialized to the default value for this type. + * Note that init() should never be called twice. + * + * init() is not implemented as constructor, to avoid the necessity + * to implement a forward constructor in each derived class. + */ + void init(GType type); + + /** Reset contents to the default value of its type. + */ + void reset(); + + GValue* gobj() { return &gobject_; } + const GValue* gobj() const { return &gobject_; } + +protected: + GValue gobject_; +}; + +/** + * @ingroup glibmmValue + */ +class ValueBase_Boxed : public ValueBase +{ +public: + static GType value_type() G_GNUC_CONST; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif + +protected: + void set_boxed(const void* data); + void* get_boxed() const; // doesn't copy +}; + + +/** + * @ingroup glibmmValue + */ +class ValueBase_Object : public ValueBase +{ +public: + static GType value_type() G_GNUC_CONST; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif + +protected: + void set_object(Glib::ObjectBase* data); + Glib::ObjectBase* get_object() const; + Glib::RefPtr get_object_copy() const; +}; + + +/** + * @ingroup glibmmValue + */ +class ValueBase_Enum : public ValueBase +{ +public: + typedef gint CType; + static GType value_type() G_GNUC_CONST; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif + +protected: + void set_enum(int data); + int get_enum() const; +}; + + +/** + * @ingroup glibmmValue + */ +class ValueBase_Flags : public ValueBase +{ +public: + typedef guint CType; + static GType value_type() G_GNUC_CONST; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif + +protected: + void set_flags(unsigned int data); + unsigned int get_flags() const; +}; + + +/** + * @ingroup glibmmValue + */ +class ValueBase_String : public ValueBase +{ +public: + typedef const gchar* CType; + static GType value_type() G_GNUC_CONST; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif + +protected: + void set_cstring(const char* data); + const char* get_cstring() const; // never returns 0 +}; + +} // namespace Glib + + +/* Include generic Glib::Value<> template, before any specializations: + */ +#define _GLIBMM_VALUE_H_INCLUDE_VALUE_CUSTOM_H +#include +#undef _GLIBMM_VALUE_H_INCLUDE_VALUE_CUSTOM_H + + +namespace Glib +{ + +/** + * @ingroup glibmmValue + */ +template +class Value_Boxed : public ValueBase_Boxed +{ +public: + typedef T CppType; + typedef typename T::BaseObjectType* CType; + + static GType value_type() { return T::get_type(); } + + void set(const CppType& data) { set_boxed(data.gobj()); } + CppType get() const { return CppType(static_cast(get_boxed())); } +}; + +//More spec-compliant compilers (such as Tru64) need this to be near Glib::Object instead. +#ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + +/** Partial specialization for RefPtr<> to Glib::Object. + * @ingroup glibmmValue + */ +template +class Value< Glib::RefPtr > : public ValueBase_Object +{ +public: + typedef Glib::RefPtr CppType; + typedef typename T::BaseObjectType* CType; + + static GType value_type() { return T::get_base_type(); } + + void set(const CppType& data) { set_object(data.operator->()); } + CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } +}; + +//The SUN Forte Compiler has a problem with this: +#ifdef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +/** Partial specialization for RefPtr<> to const Glib::Object. + * @ingroup glibmmValue + */ +template +class Value< Glib::RefPtr > : public ValueBase_Object +{ +public: + typedef Glib::RefPtr CppType; + typedef typename T::BaseObjectType* CType; + + static GType value_type() { return T::get_base_type(); } + + void set(const CppType& data) { set_object(const_cast(data.operator->())); } + CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } +}; +#endif //GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS + +#endif //GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + +} // namespace Glib + + +/* Include generated specializations of Glib::Value<> for fundamental types: + */ +#define _GLIBMM_VALUE_H_INCLUDE_VALUE_BASICTYPES_H +#include +#undef _GLIBMM_VALUE_H_INCLUDE_VALUE_BASICTYPES_H + + +namespace Glib +{ + +/** Specialization for strings. + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase_String +{ +public: + typedef std::string CppType; + + void set(const std::string& data); + std::string get() const { return get_cstring(); } +}; + +/** Specialization for UTF-8 strings. + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase_String +{ +public: + typedef Glib::ustring CppType; + + void set(const Glib::ustring& data); + Glib::ustring get() const { return get_cstring(); } +}; + + +/** Base class of Glib::Value specializations for enum types. + * @ingroup glibmmValue + */ +template +class Value_Enum : public ValueBase_Enum +{ +public: + typedef T CppType; + + void set(CppType data) { set_enum(data); } + CppType get() const { return CppType(get_enum()); } +}; + +/** Base class of Glib::Value specializations for flags types. + * @ingroup glibmmValue + */ +template +class Value_Flags : public ValueBase_Flags +{ +public: + typedef T CppType; + + void set(CppType data) { set_flags(data); } + CppType get() const { return CppType(get_flags()); } +}; + +} // namespace Glib + + +#endif /* _GLIBMM_VALUE_H */ + diff --git a/libs/glibmm2/glibmm/value_basictypes.cc b/libs/glibmm2/glibmm/value_basictypes.cc new file mode 100644 index 0000000000..4d76b89f3e --- /dev/null +++ b/libs/glibmm2/glibmm/value_basictypes.cc @@ -0,0 +1,336 @@ +// -*- c++ -*- +// This is a generated file, do not edit. Generated from value_basictypes.cc.m4 + +#include + +namespace Glib +{ + +G_GNUC_EXTENSION typedef long long long_long; +G_GNUC_EXTENSION typedef unsigned long long unsigned_long_long; + + +/**** Glib::Value ****************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_BOOLEAN; +} + +void Value::set(bool data) +{ + g_value_set_boolean(&gobject_, data); +} + +bool Value::get() const +{ + return g_value_get_boolean(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_boolean( + name.c_str(), 0, 0, + g_value_get_boolean(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value ****************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_CHAR; +} + +void Value::set(char data) +{ + g_value_set_char(&gobject_, data); +} + +char Value::get() const +{ + return g_value_get_char(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_char( + name.c_str(), 0, 0, + -128, 127, g_value_get_char(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value *******************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_UCHAR; +} + +void Value::set(unsigned char data) +{ + g_value_set_uchar(&gobject_, data); +} + +unsigned char Value::get() const +{ + return g_value_get_uchar(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_uchar( + name.c_str(), 0, 0, + 0, 255, g_value_get_uchar(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value *****************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_INT; +} + +void Value::set(int data) +{ + g_value_set_int(&gobject_, data); +} + +int Value::get() const +{ + return g_value_get_int(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_int( + name.c_str(), 0, 0, + G_MININT, G_MAXINT, g_value_get_int(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value ********************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_UINT; +} + +void Value::set(unsigned int data) +{ + g_value_set_uint(&gobject_, data); +} + +unsigned int Value::get() const +{ + return g_value_get_uint(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_uint( + name.c_str(), 0, 0, + 0, G_MAXUINT, g_value_get_uint(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value ****************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_LONG; +} + +void Value::set(long data) +{ + g_value_set_long(&gobject_, data); +} + +long Value::get() const +{ + return g_value_get_long(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_long( + name.c_str(), 0, 0, + G_MINLONG, G_MAXLONG, g_value_get_long(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value *******************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_ULONG; +} + +void Value::set(unsigned long data) +{ + g_value_set_ulong(&gobject_, data); +} + +unsigned long Value::get() const +{ + return g_value_get_ulong(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_ulong( + name.c_str(), 0, 0, + 0, G_MAXULONG, g_value_get_ulong(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value ***********************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_INT64; +} + +void Value::set(long_long data) +{ + g_value_set_int64(&gobject_, data); +} + +long_long Value::get() const +{ + return g_value_get_int64(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_int64( + name.c_str(), 0, 0, + G_GINT64_CONSTANT(0x8000000000000000), G_GINT64_CONSTANT(0x7fffffffffffffff), g_value_get_int64(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value **************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_UINT64; +} + +void Value::set(unsigned_long_long data) +{ + g_value_set_uint64(&gobject_, data); +} + +unsigned_long_long Value::get() const +{ + return g_value_get_uint64(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_uint64( + name.c_str(), 0, 0, + G_GINT64_CONSTANT(0U), G_GINT64_CONSTANT(0xffffffffffffffffU), g_value_get_uint64(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value ***************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_FLOAT; +} + +void Value::set(float data) +{ + g_value_set_float(&gobject_, data); +} + +float Value::get() const +{ + return g_value_get_float(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_float( + name.c_str(), 0, 0, + G_MINFLOAT, G_MAXFLOAT, g_value_get_float(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value **************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_DOUBLE; +} + +void Value::set(double data) +{ + g_value_set_double(&gobject_, data); +} + +double Value::get() const +{ + return g_value_get_double(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_double( + name.c_str(), 0, 0, + G_MINDOUBLE, G_MAXDOUBLE, g_value_get_double(&gobject_), + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +/**** Glib::Value ***************************************************/ + +// static +GType Value::value_type() +{ + return G_TYPE_POINTER; +} + +void Value::set(void* data) +{ + g_value_set_pointer(&gobject_, data); +} + +void* Value::get() const +{ + return g_value_get_pointer(&gobject_); +} + +GParamSpec* Value::create_param_spec(const Glib::ustring& name) const +{ + return g_param_spec_pointer( + name.c_str(), 0, 0, + GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/value_basictypes.h b/libs/glibmm2/glibmm/value_basictypes.h new file mode 100644 index 0000000000..3d81e3ece8 --- /dev/null +++ b/libs/glibmm2/glibmm/value_basictypes.h @@ -0,0 +1,271 @@ +// -*- c++ -*- +// This is a generated file, do not edit. Generated from value_basictypes.h.m4 + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#ifndef _GLIBMM_VALUE_H_INCLUDE_VALUE_BASICTYPES_H +#error "glibmm/value_basictypes.h cannot be included directly" +#endif +#endif + +/* Suppress warnings about `long long' when GCC is in -pedantic mode. + */ +#if (__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) +#pragma GCC system_header +#endif + +namespace Glib +{ + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef bool CppType; + typedef gboolean CType; + + static GType value_type() G_GNUC_CONST; + + void set(bool data); + bool get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef char CppType; + typedef gchar CType; + + static GType value_type() G_GNUC_CONST; + + void set(char data); + char get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef unsigned char CppType; + typedef guchar CType; + + static GType value_type() G_GNUC_CONST; + + void set(unsigned char data); + unsigned char get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef int CppType; + typedef gint CType; + + static GType value_type() G_GNUC_CONST; + + void set(int data); + int get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef unsigned int CppType; + typedef guint CType; + + static GType value_type() G_GNUC_CONST; + + void set(unsigned int data); + unsigned int get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef long CppType; + typedef glong CType; + + static GType value_type() G_GNUC_CONST; + + void set(long data); + long get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef unsigned long CppType; + typedef gulong CType; + + static GType value_type() G_GNUC_CONST; + + void set(unsigned long data); + unsigned long get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef long long CppType; + typedef gint64 CType; + + static GType value_type() G_GNUC_CONST; + + void set(long long data); + long long get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef unsigned long long CppType; + typedef guint64 CType; + + static GType value_type() G_GNUC_CONST; + + void set(unsigned long long data); + unsigned long long get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef float CppType; + typedef gfloat CType; + + static GType value_type() G_GNUC_CONST; + + void set(float data); + float get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef double CppType; + typedef gdouble CType; + + static GType value_type() G_GNUC_CONST; + + void set(double data); + double get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + + +/** + * @ingroup glibmmValue + */ +template <> +class Value : public ValueBase +{ +public: + typedef void* CppType; + typedef gpointer CType; + + static GType value_type() G_GNUC_CONST; + + void set(void* data); + void* get() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + GParamSpec* create_param_spec(const Glib::ustring& name) const; +#endif +}; + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/value_custom.cc b/libs/glibmm2/glibmm/value_custom.cc new file mode 100644 index 0000000000..f277477712 --- /dev/null +++ b/libs/glibmm2/glibmm/value_custom.cc @@ -0,0 +1,145 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace +{ + +void warn_already_registered(const char* location, const std::string& full_name) +{ + g_warning("file %s: (%s): The type name `%s' has been registered already.\n" + "This is not supposed to happen -- please send a mail with detailed " + "information about your platform to gtkmm-list@gnome.org. Thanks.\n", + __FILE__, location, full_name.c_str()); +} + +} // anonymous namespace + + +namespace Glib +{ + +GType custom_boxed_type_register(const char* type_name, + ValueInitFunc init_func, + ValueFreeFunc free_func, + ValueCopyFunc copy_func) +{ + std::string full_name ("glibmm__CustomBoxed_"); + Glib::append_canonical_typename(full_name, type_name); + + // Templates of the same type _might_ be duplicated when instantiated in + // multiple translation units -- I'm not sure whether this is true. If the + // static custom_type_ variable in Value<> is duplicated, then the type + // would be registered more than once. + // + // Lookup the type name to see whether this scenario actually happens. + // If this turns out to be common behaviour on some platform the warning + // should be removed. + + if(const GType existing_type = g_type_from_name(full_name.c_str())) + { + warn_already_registered("Glib::custom_boxed_type_register", full_name); + return existing_type; + } + + // Via GTypeValueTable, we can teach GValue how to instantiate, + // destroy, and copy arbitrary objects of the C++ type. + + const GTypeValueTable value_table = + { + init_func, + free_func, + copy_func, + 0, // value_peek_pointer + 0, // collect_format + 0, // collect_value + 0, // lcopy_format + 0, // lcopy_value + }; + + const GTypeInfo type_info = + { + 0, // class_size + 0, // base_init + 0, // base_finalize + 0, // class_init_func + 0, // class_finalize + 0, // class_data + 0, // instance_size + 0, // n_preallocs + 0, // instance_init + &value_table, + }; + + // Don't use g_boxed_type_register_static(), because that wouldn't allow + // for a non-NULL default value. The implementation of g_boxed_copy() will + // use our custom GTypeValueTable automatically. + + return g_type_register_static(G_TYPE_BOXED, full_name.c_str(), &type_info, GTypeFlags(0)); +} + +GType custom_pointer_type_register(const char* type_name) +{ + std::string full_name ("glibmm__CustomPointer_"); + Glib::append_canonical_typename(full_name, type_name); + + // Templates of the same type _might_ be duplicated when instantiated in + // multiple translation units -- I'm not sure whether this is true. If the + // static custom_type variable in Value<>::value_type_() is duplicated, then + // the type would be registered more than once. + // + // Lookup the type name to see whether this scenario actually happens. + // If this turns out to be common behaviour on some platform the warning + // should be removed. + + if(const GType existing_type = g_type_from_name(full_name.c_str())) + { + warn_already_registered("Glib::custom_pointer_type_register", full_name); + return existing_type; + } + + const GTypeInfo type_info = + { + 0, // class_size + 0, // base_init + 0, // base_finalize + 0, // class_init_func + 0, // class_finalize + 0, // class_data + 0, // instance_size + 0, // n_preallocs + 0, // instance_init + 0, // value_table + }; + + // We could probably use g_pointer_type_register_static(), but I want + // to keep this function symmetric to custom_boxed_type_register(). Also, + // g_pointer_type_register_static() would lookup the type name once again. + + return g_type_register_static(G_TYPE_POINTER, full_name.c_str(), &type_info, GTypeFlags(0)); +} + + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/value_custom.h b/libs/glibmm2/glibmm/value_custom.h new file mode 100644 index 0000000000..ab4ad7d594 --- /dev/null +++ b/libs/glibmm2/glibmm/value_custom.h @@ -0,0 +1,289 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#ifndef _GLIBMM_VALUE_H_INCLUDE_VALUE_CUSTOM_H +#error "glibmm/value_custom.h cannot be included directly" +#endif +#endif + +#include +#include +#include + +GLIBMM_USING_STD(nothrow) + + +namespace Glib +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +extern "C" +{ + typedef void (* ValueInitFunc) (GValue*); + typedef void (* ValueFreeFunc) (GValue*); + typedef void (* ValueCopyFunc) (const GValue*, GValue*); +} + +/* When using Glib::Value with custom types, each T will be registered + * as subtype of G_TYPE_BOXED, via this function. The type_name argument + * should be the C++ RTTI name. + */ +GType custom_boxed_type_register(const char* type_name, + ValueInitFunc init_func, + ValueFreeFunc free_func, + ValueCopyFunc copy_func); + +/* When using Glib::Value or Glib::Value with custom types, + * each T* or const T* will be registered as a subtype of G_TYPE_POINTER, + * via this function. The type_name argument should be the C++ RTTI name. + */ +GType custom_pointer_type_register(const char* type_name); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +/** + * @ingroup glibmmValue + */ +template +class Value_Pointer : public ValueBase_Object +{ +public: + typedef PtrT CppType; + typedef void* CType; + + static inline GType value_type() G_GNUC_CONST; + + inline void set(CppType data); + inline CppType get() const; + +private: + inline + static GType value_type_(Glib::Object*); + static GType value_type_(void*); + + inline void set_(CppType data, Glib::Object*); + inline void set_(CppType data, void*); + + inline CppType get_(Glib::Object*) const; + inline CppType get_(void*) const; +}; + + +/** Generic value implementation for custom types. + * @ingroup glibmmValue + * Any type to be used with this template must implement: + * - default constructor + * - copy constructor + * - assignment operator + * - destructor + * + * Compiler-generated implementations are OK, provided they do the + * right thing for the type. In other words, any type that works with + * std::vector will work with Glib::Value<>. + * + * @note None of the operations listed above are allowed to throw. If you + * cannot ensure that no exceptions will be thrown, consider using either + * a normal pointer or a smart pointer to hold your objects indirectly. + */ +template +class Value : public ValueBase_Boxed +{ +public: + typedef T CppType; + typedef T* CType; + + static GType value_type() G_GNUC_CONST; + + inline void set(const CppType& data); + inline CppType get() const; + +private: + static GType custom_type_; + + static void value_init_func(GValue* value); + static void value_free_func(GValue* value); + static void value_copy_func(const GValue* src_value, GValue* dest_value); +}; + + +/** Specialization for pointers to instances of any type. + * @ingroup glibmmValue + * No attempt is made to manage the memory associated with the + * pointer, you must take care of that yourself. + */ +template +class Value : public Value_Pointer +{}; + +/** Specialization for pointers to const instances of any type. + * @ingroup glibmmValue + * No attempt is made to manage the memory associated with the + * pointer, you must take care of that yourself. + */ +template +class Value : public Value_Pointer +{}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/**** Glib::Value_Pointer *****************************************/ + +/** Implementation for Glib::Object pointers **/ + +// static +template inline +GType Value_Pointer::value_type_(Glib::Object*) +{ + return T::get_base_type(); +} + +template inline +void Value_Pointer::set_(PtrT data, Glib::Object*) +{ + set_object(const_cast(data)); +} + +//More spec-compliant compilers (such as Tru64) need this to be near Glib::Object instead. +#ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION +template inline +PtrT Value_Pointer::get_(Glib::Object*) const +{ + return dynamic_cast(get_object()); +} +#endif //GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION + +/** Implementation for custom pointers **/ + +// static +template +GType Value_Pointer::value_type_(void*) +{ + static GType custom_type = 0; + + if(!custom_type) + custom_type = Glib::custom_pointer_type_register(typeid(PtrT).name()); + + return custom_type; +} + +template inline +void Value_Pointer::set_(PtrT data, void*) +{ + gobject_.data[0].v_pointer = const_cast(data); +} + +template inline +PtrT Value_Pointer::get_(void*) const +{ + return static_cast(gobject_.data[0].v_pointer); +} + +/** Public forwarding interface **/ + +// static +template inline +GType Value_Pointer::value_type() +{ + // Dispatch to the specific value_type_() overload. + return Value_Pointer::value_type_(static_cast(0)); +} + +template inline +void Value_Pointer::set(PtrT data) +{ + // Dispatch to the specific set_() overload. + this->set_(data, static_cast(0)); +} + +template inline +PtrT Value_Pointer::get() const +{ + // Dispatch to the specific get_() overload. + return this->get_(static_cast(0)); +} + + +/**** Glib::Value *******************************************************/ + +// Static data, specific to each template instantiation. +template +GType Value::custom_type_ = 0; + +template inline +void Value::set(const typename Value::CppType& data) +{ + // Assume the value is already default-initialized. See value_init_func(). + *static_cast(gobject_.data[0].v_pointer) = data; +} + +template inline +typename Value::CppType Value::get() const +{ + // Assume the pointer is not NULL. See value_init_func(). + return *static_cast(gobject_.data[0].v_pointer); +} + +// static +template +GType Value::value_type() +{ + if(!custom_type_) + { + custom_type_ = Glib::custom_boxed_type_register( + typeid(CppType).name(), + &Value::value_init_func, + &Value::value_free_func, + &Value::value_copy_func); + } + return custom_type_; +} + +// static +template +void Value::value_init_func(GValue* value) +{ + // Never store a NULL pointer (unless we're out of memory). + value->data[0].v_pointer = new(std::nothrow) T(); +} + +// static +template +void Value::value_free_func(GValue* value) +{ + delete static_cast(value->data[0].v_pointer); +} + +// static +template +void Value::value_copy_func(const GValue* src_value, GValue* dest_value) +{ + // Assume the source is not NULL. See value_init_func(). + const T& source = *static_cast(src_value->data[0].v_pointer); + dest_value->data[0].v_pointer = new(std::nothrow) T(source); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + diff --git a/libs/glibmm2/glibmm/wrap.cc b/libs/glibmm2/glibmm/wrap.cc new file mode 100644 index 0000000000..5a7d84048b --- /dev/null +++ b/libs/glibmm2/glibmm/wrap.cc @@ -0,0 +1,161 @@ +// -*- c++ -*- +/* $Id$ */ + +/* wrap.cc + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include +GLIBMM_USING_STD(vector) + + +namespace +{ + +// Although the new g_type_set_qdata() interface is used now, we still need +// a table because we cannot assume that a function pointer fits into void* +// on any platform. Nevertheless, indexing a vector costs almost nothing +// compared to a map lookup. + +typedef std::vector WrapFuncTable; + +static WrapFuncTable* wrap_func_table = 0; + + +static Glib::ObjectBase* create_new_wrapper(GObject* object) +{ + g_return_val_if_fail(wrap_func_table != 0, 0); + + bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_); + if(gtkmm_wrapper_already_deleted) + { + g_warning("Glib::create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted."); + return 0; + } + + // Traverse upwards through the inheritance hierarchy + // to find the most-specialized wrap_new() for this GType. + // + for(GType type = G_OBJECT_TYPE(object); type != 0; type = g_type_parent(type)) + { + // Look up the wrap table index stored in the type's static data. + // If a wrap_new() has been registered for the type then call it. + // + if(const gpointer idx = g_type_get_qdata(type, Glib::quark_)) + { + const Glib::WrapNewFunction func = (*wrap_func_table)[GPOINTER_TO_UINT(idx)]; + return (*func)(object); + } + } + + return 0; +} + +} // anonymous namespace + + +namespace Glib +{ + +void wrap_register_init() +{ + g_type_init(); + + if(!Glib::quark_) + { + Glib::quark_ = g_quark_from_static_string("glibmm__Glib::quark_"); + Glib::quark_cpp_wrapper_deleted_ = g_quark_from_static_string("glibmm__Glib::quark_cpp_wrapper_deleted_"); + } + + if(!wrap_func_table) + { + // Make the first element a dummy so we can detect unregistered types. + // g_type_get_qdata() returns NULL if no data has been set up. + wrap_func_table = new WrapFuncTable(1); + } +} + +void wrap_register_cleanup() +{ + if(wrap_func_table) + { + delete wrap_func_table; + wrap_func_table = 0; + } +} + +// Register the unique wrap_new() function of a new C++ wrapper type. +// The GType argument specifies the parent C type to wrap from. +// +void wrap_register(GType type, WrapNewFunction func) +{ + const guint idx = wrap_func_table->size(); + wrap_func_table->push_back(func); + + // Store the table index in the type's static data. + g_type_set_qdata(type, Glib::quark_, GUINT_TO_POINTER(idx)); +} + +// This is a factory function that converts any type to +// its C++ wrapper instance by looking up a wrap_new() function in a map. +// +ObjectBase* wrap_auto(GObject* object, bool take_copy) +{ + if(!object) + return 0; + + // Look up current C++ wrapper instance: + ObjectBase* pCppObject = + static_cast(g_object_get_qdata(object, Glib::quark_)); + + if(!pCppObject) + { + // There's not already a wrapper: generate a new C++ instance. + pCppObject = create_new_wrapper(object); + + if(!pCppObject) + { + g_warning("failed to wrap type of '%s'", G_OBJECT_TYPE_NAME(object)); + return 0; + } + } + + // take_copy=true is used where the GTK+ function doesn't do + // an extra ref for us, and always for plain struct members. + if(take_copy) + pCppObject->reference(); + + return pCppObject; +} + +Glib::RefPtr wrap(GObject* object, bool take_copy /* = false */) +{ + return Glib::RefPtr(dynamic_cast(wrap_auto(object, take_copy))); +} + +} /* namespace Glib */ + diff --git a/libs/glibmm2/glibmm/wrap.h b/libs/glibmm2/glibmm/wrap.h new file mode 100644 index 0000000000..58288ecd98 --- /dev/null +++ b/libs/glibmm2/glibmm/wrap.h @@ -0,0 +1,118 @@ +// -*- c++ -*- +#ifndef _GLIBMM_WRAP_H +#define _GLIBMM_WRAP_H + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Glib +{ + +class ObjectBase; +class Object; + +// Type of the per-class wrap_new() functions. +typedef Glib::ObjectBase* (*WrapNewFunction) (GObject*); + +// Setup and free the structures used by wrap_register(). +// Both functions might be called more than once. +void wrap_register_init(); +void wrap_register_cleanup(); + +// Register a new type for auto allocation. +void wrap_register(GType type, WrapNewFunction func); + +// Return the current C++ wrapper instance of the GObject, +// or automatically generate a new wrapper if there's none. +Glib::ObjectBase* wrap_auto(GObject* object, bool take_copy = false); + +// Get a C++ instance that wraps the C instance. +// This always returns the same C++ instance for the same C instance. +// Each wrapper has it's own override of Glib::wrap(). +// use take_copy = true when wrapping a struct member. +// TODO: move to object.h ? +/** @relates Glib::Object */ +Glib::RefPtr wrap(GObject* object, bool take_copy = false); + + +/** Get the underlying C instance from the C++ instance. This is just + * like calling gobj(), but it does its own check for a NULL pointer. + */ +template inline +typename T::BaseObjectType* unwrap(T* ptr) +{ + return (ptr) ? ptr->gobj() : 0; +} + +/** Get the underlying C instance from the C++ instance. This is just + * like calling gobj(), but it does its own check for a NULL pointer. + */ +template inline +const typename T::BaseObjectType* unwrap(const T* ptr) +{ + return (ptr) ? ptr->gobj() : 0; +} + +/** Get the underlying C instance from the C++ instance. This is just + * like calling gobj(), but it does its own check for a NULL pointer. + */ +template inline +typename T::BaseObjectType* unwrap(const Glib::RefPtr& ptr) +{ + return (ptr) ? ptr->gobj() : 0; +} + +/** Get the underlying C instance from the C++ instance. This is just + * like calling gobj(), but it does its own check for a NULL pointer. + */ +template inline +const typename T::BaseObjectType* unwrap(const Glib::RefPtr& ptr) +{ + return (ptr) ? ptr->gobj() : 0; +} + +/** Get the underlying C instance from the C++ instance and acquire a + * reference. This is just like calling gobj_copy(), but it does its own + * check for a NULL pointer. + */ +template inline +typename T::BaseObjectType* unwrap_copy(const Glib::RefPtr& ptr) +{ + return (ptr) ? ptr->gobj_copy() : 0; +} + +/** Get the underlying C instance from the C++ instance and acquire a + * reference. This is just like calling gobj_copy(), but it does its own + * check for a NULL pointer. + */ +template inline +const typename T::BaseObjectType* unwrap_copy(const Glib::RefPtr& ptr) +{ + return (ptr) ? ptr->gobj_copy() : 0; +} + +} // namespace Glib + + +#endif /* _GLIBMM_WRAP_H */ + diff --git a/libs/glibmm2/glibmm/wrap_init.cc b/libs/glibmm2/glibmm/wrap_init.cc new file mode 100644 index 0000000000..54188b4045 --- /dev/null +++ b/libs/glibmm2/glibmm/wrap_init.cc @@ -0,0 +1,73 @@ + +#include + +// Disable the 'const' function attribute of the get_type() functions. +// GCC would optimize them out because we don't use the return value. +#undef G_GNUC_CONST +#define G_GNUC_CONST /* empty */ + +#include +#include +#include + +// #include the widget headers so that we can call the get_type() static methods: + +#include "convert.h" +#include "date.h" +#include "fileutils.h" +#include "iochannel.h" +#include "markup.h" +#include "module.h" +#include "optioncontext.h" +#include "optionentry.h" +#include "optiongroup.h" +#include "shell.h" +#include "spawn.h" +#include "thread.h" +#include "unicode.h" + +extern "C" +{ + +//Declarations of the *_get_type() functions: + + +//Declarations of the *_error_quark() functions: + +GQuark g_convert_error_quark(void); +GQuark g_file_error_quark(void); +GQuark g_io_channel_error_quark(void); +GQuark g_markup_error_quark(void); +GQuark g_option_error_quark(void); +GQuark g_shell_error_quark(void); +GQuark g_spawn_error_quark(void); +GQuark g_thread_error_quark(void); +} // extern "C" + + +//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers: + + +namespace Glib { + +void wrap_init() +{ + // Register Error domains: + Glib::Error::register_domain(g_convert_error_quark(), &Glib::ConvertError::throw_func); + Glib::Error::register_domain(g_file_error_quark(), &Glib::FileError::throw_func); + Glib::Error::register_domain(g_io_channel_error_quark(), &Glib::IOChannelError::throw_func); + Glib::Error::register_domain(g_markup_error_quark(), &Glib::MarkupError::throw_func); + Glib::Error::register_domain(g_option_error_quark(), &Glib::OptionError::throw_func); + Glib::Error::register_domain(g_shell_error_quark(), &Glib::ShellError::throw_func); + Glib::Error::register_domain(g_spawn_error_quark(), &Glib::SpawnError::throw_func); + Glib::Error::register_domain(g_thread_error_quark(), &Glib::ThreadError::throw_func); + +// Map gtypes to gtkmm wrapper-creation functions: + + // Register the gtkmm gtypes: + +} // wrap_init() + +} //Glib + + diff --git a/libs/glibmm2/glibmm/wrap_init.h b/libs/glibmm2/glibmm/wrap_init.h new file mode 100644 index 0000000000..63c8a1c8c0 --- /dev/null +++ b/libs/glibmm2/glibmm/wrap_init.h @@ -0,0 +1,38 @@ +// -*- c++ -*- +#ifndef _GLIBMM_WRAP_INIT_H +#define _GLIBMM_WRAP_INIT_H + +/* $Id$ */ + +/* wrap_init.h + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Glib +{ + +void wrap_init(); + +} // namespace Glib + + +#endif /* _GLIBMM_WRAP_INIT_H */ + diff --git a/libs/glibmm2/glibmmconfig.h.in b/libs/glibmm2/glibmmconfig.h.in new file mode 100644 index 0000000000..dddcc07da5 --- /dev/null +++ b/libs/glibmm2/glibmmconfig.h.in @@ -0,0 +1,85 @@ +#ifndef _GLIBMM_CONFIG_H +#define _GLIBMM_CONFIG_H 1 + +/* version numbers */ +#undef GLIBMM_MAJOR_VERSION +#undef GLIBMM_MINOR_VERSION +#undef GLIBMM_MICRO_VERSION + +// detect common platforms +#if defined(_WIN32) +// Win32 compilers have a lot of varation +#if defined(_MSC_VER) +#define GLIBMM_MSC +#define GLIBMM_WIN32 +#define GLIBMM_DLL +#elif defined(__CYGWIN__) +#define GLIBMM_CONFIGURE +#elif defined(__MINGW32__) +#define GLIBMM_WIN32 +#define GLIBMM_CONFIGURE +#else +//AIX clR compiler complains about this even though it doesn't get this far: +//#warning "Unknown architecture (send me gcc --dumpspecs or equiv)" +#endif +#else +#define GLIBMM_CONFIGURE +#endif /* _WIN32 */ + +#ifdef GLIBMM_CONFIGURE +/* compiler feature tests that are used during compile time and run-time + by gtk-- only. tests used by gdk-- and gtk-- should go into + gdk--config.h.in */ +#undef GLIBMM_CXX_HAVE_MUTABLE +#undef GLIBMM_CXX_HAVE_NAMESPACES +//#undef GLIBMM_CXX_GAUB +//#undef GLIBMM_CXX_AMBIGUOUS_TEMPLATES +#undef GLIBMM_HAVE_NAMESPACE_STD +#undef GLIBMM_HAVE_STD_ITERATOR_TRAITS +#undef GLIBMM_HAVE_SUN_REVERSE_ITERATOR +#undef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS +#undef GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS +#undef GLIBMM_COMPILER_SUN_FORTE +#undef GLIBMM_DEBUG_REFCOUNTING +#undef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION +#undef GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS +#undef GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC +#undef GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS +#endif + +#ifdef GLIBMM_MSC + #define GLIBMM_CXX_HAVE_MUTABLE 1 + #define GLIBMM_CXX_HAVE_NAMESPACES 1 + #define GLIBMM_HAVE_NAMESPACE_STD 1 + #define GLIBMM_HAVE_STD_ITERATOR_TRAITS 1 + #define GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS 2 + #define GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS 1 + #define GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION 1 + #define GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS 1 + #define GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC 1 + #define GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS 1 + #pragma warning (disable: 4786 4355 4800 4181) +#endif + +#ifndef GLIBMM_HAVE_NAMESPACE_STD +# define GLIBMM_USING_STD(Symbol) namespace std { using ::Symbol; } +#else +# define GLIBMM_USING_STD(Symbol) /* empty */ +#endif + +#ifdef GLIBMM_DLL + #if defined(GLIBMM_BUILD) && defined(_WINDLL) + /* Do not dllexport as it is handled by gendef on MSVC */ + #define GLIBMM_API + #elif !defined(GLIBMM_BUILD) + #define GLIBMM_API __declspec(dllimport) + #else + /* Build a static library */ + #define GLIBMM_API + #endif /* GLIBMM_BUILD - _WINDLL */ +#else + #define GLIBMM_API +#endif /* GLIBMM_DLL */ + +#endif /* _GLIBMM_CONFIG_H */ + diff --git a/libs/glibmm2/scripts/.cvsignore b/libs/glibmm2/scripts/.cvsignore new file mode 100644 index 0000000000..f480274b19 --- /dev/null +++ b/libs/glibmm2/scripts/.cvsignore @@ -0,0 +1,5 @@ +config.guess +config.sub +install-sh +ltmain.sh +missing diff --git a/libs/glibmm2/scripts/cxx.m4 b/libs/glibmm2/scripts/cxx.m4 new file mode 100644 index 0000000000..8dce019940 --- /dev/null +++ b/libs/glibmm2/scripts/cxx.m4 @@ -0,0 +1,364 @@ + +dnl +dnl AC_CXX_NAMESPACES(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_NAMESPACES],[ +AC_MSG_CHECKING(if C++ compiler supports namespaces) +AC_TRY_COMPILE( +[ +namespace Foo { struct A {}; } +using namespace Foo; +],[ +A a; +(void)a; +],[ + ac_cxx_namespaces=yes + AC_MSG_RESULT([$ac_cxx_namespaces]) + $1 +],[ + ac_cxx_namespaces=no + AC_MSG_RESULT([$ac_cxx_namespaces]) + $2 +]) +]) + +dnl +dnl AC_CXX_NAMESPACES(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_BOOL],[ +AC_MSG_CHECKING(if C++ compiler supports bool) +AC_TRY_COMPILE( +[ +],[ + bool b=true; + bool b1=false; + (void)b; + (void)b1; +],[ + ac_cxx_bool=yes + AC_MSG_RESULT([$ac_cxx_bool]) + $1 +],[ + ac_cxx_bool=no + AC_MSG_RESULT([$ac_cxx_bool]) + $2 +]) +]) + +dnl +dnl AC_CXX_MUTABLE(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_MUTABLE],[ +AC_MSG_CHECKING(if C++ compiler supports mutable) +AC_TRY_COMPILE( +[ +class k { + mutable char *c; +public: + void foo() const { c=0; } +}; +],[ +],[ + ac_cxx_mutable=yes + AC_MSG_RESULT([$ac_cxx_mutable]) + $1 +],[ + ac_cxx_mutable=no + AC_MSG_RESULT([$ac_cxx_mutable]) + $2 +]) +]) + + +dnl +dnl AC_CXX_CONST_CAST(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_CONST_CAST],[ +AC_MSG_CHECKING([if C++ compiler supports const_cast<>]) +AC_TRY_COMPILE( +[ + class foo; +],[ + const foo *c=0; + foo *c1=const_cast(c); + (void)c1; +],[ + ac_cxx_const_cast=yes + AC_MSG_RESULT([$ac_cxx_const_cast]) +],[ + ac_cxx_const_cast=no + AC_MSG_RESULT([$ac_cxx_const_cast]) +]) +]) + + +dnl +dnl GLIBMM_CXX_MEMBER_FUNCTIONS_MEMBER_TEMPLATES(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +dnl Test whether the compiler allows member functions to refer to spezialized member function templates. +dnl Some compilers have problems with this. gcc 2.95.3 aborts with an internal compiler error. +dnl +AC_DEFUN([GLIBMM_CXX_MEMBER_FUNCTIONS_MEMBER_TEMPLATES],[ +AC_MSG_CHECKING([if C++ compiler allows member functions to refer to member templates]) +AC_TRY_COMPILE( +[ + struct foo { + template inline + void doit(); + void thebug(); + }; + + template inline + void foo::doit() { + } + + struct bar { + void neitherabug(); + }; + + void notabug() { + void (foo::*func)(); + func = &foo::doit; + (void)func; + } + + void bar::neitherabug() { + void (foo::*func)(); + func = &foo::doit; + (void)func; + } + + void foo::thebug() { + void (foo::*func)(); + func = &foo::doit; //Compiler bugs usually show here. + (void)func; + } +],[],[ + glibmm_cxx_member_functions_member_templates=yes + AC_DEFINE([GLIBMM_MEMBER_FUNCTIONS_MEMBER_TEMPLATES],[1],[does the C++ compiler allow member functions to refer to member templates]) + AC_MSG_RESULT([$glibmm_cxx_member_functions_member_templates]) +],[ + glibmm_cxx_member_functions_member_templates=no + AC_DEFINE([GLIBMM_MEMBER_FUNCTIONS_MEMBER_TEMPLATES],[0]) + AC_MSG_RESULT([$glibmm_cxx_member_functions_member_templates]) +]) +]) + +## GLIBMM_CXX_CAN_DISAMBIGUATE_CONST_TEMPLATE_SPECIALIZATIONS() +## +## Check whether the compiler finds it ambiguous to have both +## const and non-const template specializations, +## The SUN Forte compiler has this problem, though we are +## not 100% sure that it's a C++ standards violation. +## +AC_DEFUN([GLIBMM_CXX_CAN_DISAMBIGUATE_CONST_TEMPLATE_SPECIALIZATIONS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether the compiler finds it ambiguous to have both const and non-const template specializations], + [glibmm_cv_cxx_can_disambiguate_const_template_specializations], + [ + AC_TRY_COMPILE( + [ + #include + + template class Foo {}; + + template class Traits { + public: + const char* whoami() { + return "generic template"; + } + }; + + template class Traits > { + public: + const char* whoami() { + return "partial specialization for Foo"; + } + }; + + template class Traits > { + public: + const char* whoami() { + return "partial specialization for Foo"; + } + }; + + ],[ + Traits it; + Traits > fit; + Traits > cfit; + + std::cout << "Traits --> " + << it.whoami() << std::endl; + std::cout << "Traits> --> " + << fit.whoami() << std::endl; + std::cout << "Traits> --> " + << cfit.whoami() << std::endl; + ], + [glibmm_cv_cxx_can_disambiguate_const_template_specializations="yes"], + [glibmm_cv_cxx_can_disambiguate_const_template_specializations="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_disambiguate_const_template_specializations}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS],[1], [Defined if the compiler does not find it ambiguous to have both const and non-const template specializations]) + } + fi +]) + + + +## GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION() +## +## Check whether the compiler allows us to define a template that uses +## dynamic_cast<> with an object whose type is not defined, +## even if we do not use that template before we have defined the type. +## This should probably not be allowed anyway. +## +AC_DEFUN([GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION], +[ + AC_CACHE_CHECK( + [whether the compiler allows us to define a template that uses dynamic_cast<> with an object whose type is not yet defined], + [glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition], + [ + AC_TRY_COMPILE( + [ + class SomeClass; + + SomeClass* some_function(); + + template + class SomeTemplate + { + static bool do_something() + { + //This does not compile, with the MipsPro (IRIX) compiler + //even if we don't use this template at all. + //(We would use it later, after we have defined the type). + return dynamic_cast(some_function()); + } + }; + + ],[ + + ], + [glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition="yes"], + [glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition}" = "xyes"; then + { + AC_DEFINE([GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION],[1], [Defined if the compiler allows us to define a template that uses dynamic_cast<> with an object whose type is not yet defined.]) + } + fi +]) + + +## GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS() +## +## Check whether the compiler allows us to use a non-extern "C" function, +## such as a static member function, to an extern "C" function pointer, +## such as a GTK+ callback. +## This should not be allowed anyway. +## +AC_DEFUN([GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS], +[ + AC_CACHE_CHECK( + [whether the the compilerallows us to use a non-extern "C" function for an extern "C" function pointer.], + [glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks], + [ + AC_TRY_COMPILE( + [ + extern "C" + { + struct somestruct + { + void (*callback) (int); + }; + + } // extern "C" + + void somefunction(int) + { + } + + ],[ + somestruct something; + something.callback = &somefunction; + ], + [glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks="yes"], + [glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks}" = "xyes"; then + { + AC_DEFINE([GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS],[1], [Defined if the compiler allows us to use a non-extern "C" function for an extern "C" function pointer.]) + } + fi +]) + +## GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC() +## +## Check whether the compiler puts extern "C" functions in the global namespace, +## even inside a namespace declaration. The AIX xlC compiler does this, and also +## gets confused if we declare the namespace again inside the extern "C" block. +## This seems like a compiler bug, but not a serious one. +## +AC_DEFUN([GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC], +[ + AC_CACHE_CHECK( + [whether the compiler uses namespace declarations inside extern "C" blocks.], + [glibmm_cv_cxx_can_use_namespaces_inside_externc], + [ + AC_TRY_COMPILE( + [ + namespace test + { + + extern "C" + { + + void do_something(); + + } //extern C + + + class Something + { + protected: + int i; + + friend void do_something(); + }; + + void do_something() + { + Something something; + something.i = 1; + } + + } //namespace + + + ],[ + + ], + [glibmm_cv_cxx_can_use_namespaces_inside_externc="yes"], + [glibmm_cv_cxx_can_use_namespaces_inside_externc="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_use_namespaces_inside_externc}" = "xyes"; then + { + AC_DEFINE([GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC],[1], [Defined if the compiler whether the compiler uses namespace declarations inside extern "C" blocks.]) + } + fi +]) + + diff --git a/libs/glibmm2/scripts/cxx_std.m4 b/libs/glibmm2/scripts/cxx_std.m4 new file mode 100644 index 0000000000..cb64fd4afe --- /dev/null +++ b/libs/glibmm2/scripts/cxx_std.m4 @@ -0,0 +1,195 @@ +cv_cxx_has_namespace_std +## GLIBMM_CXX_HAS_NAMESPACE_STD() +## +## Test whether libstdc++ declares namespace std. For safety, +## also check whether several randomly selected STL symbols +## are available in namespace std. +## +## On success, #define GLIBMM_HAVE_NAMESPACE_STD to 1. +## +AC_DEFUN([GLIBMM_CXX_HAS_NAMESPACE_STD], +[ + AC_CACHE_CHECK( + [whether C++ library symbols are declared in namespace std], + [gtkmm_cv_cxx_has_namespace_std], + [ + AC_TRY_COMPILE( + [ + #include + #include + #include + #include + ],[ + using std::min; + using std::find; + using std::copy; + using std::bidirectional_iterator_tag; + using std::string; + using std::istream; + using std::cout; + ], + [gtkmm_cv_cxx_has_namespace_std="yes"], + [gtkmm_cv_cxx_has_namespace_std="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_namespace_std}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_NAMESPACE_STD],[1], [Defined when the libstdc++ declares the std-namespace]) + } + fi +]) + + +## GLIBMM_CXX_HAS_STD_ITERATOR_TRAITS() +## +## Check for standard-conform std::iterator_traits<>, and +## #define GLIBMM_HAVE_STD_ITERATOR_TRAITS on success. +## +AC_DEFUN([GLIBMM_CXX_HAS_STD_ITERATOR_TRAITS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether the C++ library supports std::iterator_traits], + [gtkmm_cv_cxx_has_std_iterator_traits], + [ + AC_TRY_COMPILE( + [ + #include + #ifdef GLIBMM_HAVE_NAMESPACE_STD + using namespace std; + #endif + ],[ + typedef iterator_traits::value_type ValueType; + ], + [gtkmm_cv_cxx_has_std_iterator_traits="yes"], + [gtkmm_cv_cxx_has_std_iterator_traits="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_std_iterator_traits}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_STD_ITERATOR_TRAITS],[1], [Defined if std::iterator_traits<> is standard-conforming]) + } + fi +]) + + +## GLIBMM_CXX_HAS_SUN_REVERSE_ITERATOR() +## +## Check for Sun libCstd style std::reverse_iterator, +## and #define GLIBMM_HAVE_SUN_REVERSE_ITERATOR if found. +## +AC_DEFUN([GLIBMM_CXX_HAS_SUN_REVERSE_ITERATOR], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [for non-standard Sun libCstd reverse_iterator], + [gtkmm_cv_cxx_has_sun_reverse_iterator], + [ + AC_TRY_COMPILE( + [ + #include + #ifdef GLIBMM_HAVE_NAMESPACE_STD + using namespace std; + #endif + ],[ + typedef reverse_iterator ReverseIter; + ], + [gtkmm_cv_cxx_has_sun_reverse_iterator="yes"], + [gtkmm_cv_cxx_has_sun_reverse_iterator="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_sun_reverse_iterator}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_SUN_REVERSE_ITERATOR],[1], [Defined if std::reverse_iterator is in Sun libCstd style]) + } + fi +]) + + +## GLIBMM_CXX_HAS_TEMPLATE_SEQUENCE_CTORS() +## +## Check whether the STL containers have templated sequence ctors, +## and #define GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS on success. +## +AC_DEFUN([GLIBMM_CXX_HAS_TEMPLATE_SEQUENCE_CTORS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether STL containers have templated sequence constructors], + [gtkmm_cv_cxx_has_template_sequence_ctors], + [ + AC_TRY_COMPILE( + [ + #include + #include + #include + #ifdef GLIBMM_HAVE_NAMESPACE_STD + using namespace std; + #endif + ],[ + const int array[8] = { 0, }; + vector test_vector (&array[0], &array[8]); + deque test_deque (test_vector.begin(), test_vector.end()); + list test_list (test_deque.begin(), test_deque.end()); + test_vector.assign(test_list.begin(), test_list.end()); + ], + [gtkmm_cv_cxx_has_template_sequence_ctors="yes"], + [gtkmm_cv_cxx_has_template_sequence_ctors="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_template_sequence_ctors}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS],[1], [Defined if the STL containers have templated sequence ctors]) + } + fi +]) + +## GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS() +## +## Check whether the a static member variable may be initialized inline to std::string::npos. +## The MipsPro (IRIX) compiler does not like this. +## and #define GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS on success. +## +AC_DEFUN([GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether the compiler allows a static member variable to be initialized inline to std::string::npos], + [gtkmm_cv_cxx_has_allows_static_inline_npos], + [ + AC_TRY_COMPILE( + [ + #include + #include + + class ustringtest + { + public: + //The MipsPro compiler (IRIX) says "The indicated constant value is not known", + //so we need to initalize the static member data elsewhere. + static const std::string::size_type ustringnpos = std::string::npos; + }; + ],[ + std::cout << "npos=" << ustringtest::ustringnpos << std::endl; + ], + [gtkmm_cv_cxx_has_allows_static_inline_npos="yes"], + [gtkmm_cv_cxx_has_allows_static_inline_npos="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_allows_static_inline_npos}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS],[1], [Defined if a static member variable may be initialized inline to std::string::npos]) + } + fi +]) + + diff --git a/libs/glibmm2/scripts/macros.m4 b/libs/glibmm2/scripts/macros.m4 new file mode 100644 index 0000000000..dc125a3c9c --- /dev/null +++ b/libs/glibmm2/scripts/macros.m4 @@ -0,0 +1,134 @@ +dnl +dnl Some macros needed for autoconf +dnl + +dnl AL_PROG_GNU_M4(ACTION_NOT_FOUND) +dnl Check for GNU m4. (sun won't do.) +dnl +AC_DEFUN([AL_PROG_GNU_M4],[ +AC_CHECK_PROGS(M4, gm4 m4, m4) + +if test "$M4" = "m4"; then + AC_MSG_CHECKING(whether m4 is GNU m4) + if $M4 --version /dev/null | grep '^GNU m4 ' >/dev/null ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + if test "$host_vendor" = "sun"; then + $1 + fi + fi +fi +]) + + +dnl AL_PROG_GNU_MAKE(ACTION_NOT_FOUND) +dnl Check for GNU make (no sun make) +dnl +AC_DEFUN([AL_PROG_GNU_MAKE],[ +dnl +dnl Check for GNU make (stolen from gtk+/configure.in) +AC_MSG_CHECKING(whether make is GNU Make) +if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + if test "$host_vendor" = "sun" ; then + $1 + fi +fi +]) + +dnl AL_ACLOCAL_INCLUDE(macrodir) +dnl Add a directory to macro search (from gnome) +AC_DEFUN([AL_ACLOCAL_INCLUDE], +[ + test "x$ACLOCAL_FLAGS" = "x" || ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + for dir in $1 + do + ACLOCAL="$ACLOCAL -I $srcdir/$dir" + done +]) + + +## GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING() +## +## Provide the --enable-debug-refcounting configure argument, disabled +## by default. If enabled, #define GTKMM_DEBUG_REFCOUNTING. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING], +[ + AC_ARG_ENABLE([debug-refcounting], + [ --enable-debug-refcounting Print a debug message on every ref/unref. + [[default=disabled]]], + [glibmm_debug_refcounting="$enableval"], + [glibmm_debug_refcounting='no']) + + if test "x$glibmm_debug_refcounting" = "xyes"; then + { + AC_DEFINE([GLIBMM_DEBUG_REFCOUNTING],[1], [Defined when the --enable-debug-refcounting configure argument was given]) + } + fi +]) + + +## GTKMM_ARG_ENABLE_WARNINGS() +## +## Provide the --enable-warnings configure argument, set to 'minimum' +## by default. +## +AC_DEFUN([GTKMM_ARG_ENABLE_WARNINGS], +[ + AC_ARG_ENABLE([warnings], + [ --enable-warnings=[[none|minimum|maximum|hardcore]] + Control compiler pickyness. [[default=minimum]]], + [gtkmm_enable_warnings="$enableval"], + [gtkmm_enable_warnings='minimum']) + + AC_MSG_CHECKING([for compiler warning flags to use]) + + gtkmm_warning_flags='' + + case "$gtkmm_enable_warnings" in + minimum|yes) gtkmm_warning_flags='-Wall -Wno-long-long';; + maximum) gtkmm_warning_flags='-pedantic -W -Wall -Wno-long-long';; + hardcore) gtkmm_warning_flags='-pedantic -W -Wall -Wno-long-long -Werror';; + esac + + gtkmm_use_flags='' + + if test "x$gtkmm_warning_flags" != "x" + then + echo 'int foo() { return 0; }' > conftest.cc + + for flag in $gtkmm_warning_flags + do + # Test whether the compiler accepts the flag. GCC doesn't bail + # out when given an unsupported flag but prints a warning, so + # check the compiler output instead. + gtkmm_cxx_out="`$CXX $flag -c conftest.cc 2>&1`" + rm -f conftest.$OBJEXT + test "x${gtkmm_cxx_out}" = "x" && \ + gtkmm_use_flags="${gtkmm_use_flags:+$gtkmm_use_flags }$flag" + done + + rm -f conftest.cc + gtkmm_cxx_out='' + fi + + if test "x$gtkmm_use_flags" != "x" + then + for flag in $gtkmm_use_flags + do + case " $CXXFLAGS " in + *" $flag "*) ;; # don't add flags twice + *) CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }$flag";; + esac + done + else + gtkmm_use_flags='none' + fi + + AC_MSG_RESULT([$gtkmm_use_flags]) +]) + diff --git a/libs/gtkmm2/AUTHORS b/libs/gtkmm2/AUTHORS new file mode 100644 index 0000000000..35ef03fe26 --- /dev/null +++ b/libs/gtkmm2/AUTHORS @@ -0,0 +1,20 @@ +Please use the mailing list (gtkmm-list@gnome.org) instead of emailing developers directly. +See the ChangeLog for up-to-date information. + +Murray Cumming +Daniel Elstner + +Some former contributors: + +Karl Nelson +Tero Pulkkinen +Elliot Lee +Phil Dawes +Erik Andersen +Bibek Sahu +Mirko Streckenbach +Havoc Pennington +Guillaume Laurent +Todd Dukes +Peter Lerner +Herbert Valerio Riedel diff --git a/libs/gtkmm2/CHANGES b/libs/gtkmm2/CHANGES new file mode 100644 index 0000000000..20c0771eb2 --- /dev/null +++ b/libs/gtkmm2/CHANGES @@ -0,0 +1,88 @@ +*** Changes from gtkmm 2.4 to 2.6: + +* Added IconView, FileChooserButton, and CellView widgets. + +* New API for existing classes: + TODO + +*** Changes from gtkmm 2.0/2.2 to gtkmm 2.4: + +* Useless signals not wrapped. + +* Use of libsigc++ 2 instead of libsigc++ 1.2. See the glibmm CHANGES for details of the syntax. + +* It is now easier to see which signal you should handle, because there are less of them. + Previously we wrapped key-binding signals, but they were quite useless for gtkmm coders. + +* Use of Gdk::Device and Gtk::SelectionData instead of C equivalents + (Murray Cumming) + +* New classes: + + UIManager: Action-based menu and toolbar items. + - Add Actions to an ActionGroup. + - Add the ActionGroup to the UIManager. + - Layout the Menus and Toolbars, with an XML string. Toolbar items and menu items can share the same Action. + - Add the Layout string to the UIManager. + - Get a top-level menu or toolbar from the UIManager and put it in a container. + + ComboBox, ComboBoxText, ComboBoxEntry, CellLayout + + EntryCompletion + + ColorButton, FontButton: Buttons that open selection dialogs when clicked, and show the result inside the button. + + Expander: A disclosure triangle, to hide distracting widgets. + + FileChooser: A new File Selection widget. + + RadioToolButton, SeparatorToolItem, ToggleToolButton, ToolItem, ToolButton + + IconTheme, IconInfo + +* New API for existing classes: + Gtk::AccelMap: lock_path(), unlock_path() + Gtk::Alignment: get/set_padding(). Useful for indenting Gtk::Frame contents. + Gtk::Button: get/set_focus_on_click() get/set_alignment() + Gtk::ButtonBox: get_child_secondary(). + Gtk::Calendar: + - display_options() is now set_display_options(). + - New properties. + Gtk::Clipboard: wait_for_targets(), and a simpler request_targets(). + Gtk::CheckMenuItem: get/set_draw_as_radio() + Gtk::Entry: get/set_completion() + Gtk::EventBox: get/set_visible_window(), get/set_above_child() + Gtk::IconSource: get/set_icon_name() + Gtk::Menu: attach(), set_monitor() + Gtk::MenuItem: unset_accel_path() + Gtk::MenuShell: cancel() + Gtk::MessageDialog: + - set_markup() + - Constructors: Added bool use_markup paramater after message parameter. + This is an API change, and I'd leak to hear suggestions for alternatives. + Gtk::TextBuffer: select_range() + Gtk::TextIter (also known as Gtk::TextBuffer::iterator): + Added *_visible_* versions of forwards/backwards methods. + Gtk::TextView: + - get/set_overwrite(), get/set_accepts_tab() + - Added WRAP_WORD_CHAR wrap mode. + Gtk::TreeViewColumn (also known as Gtk::TreeView::Column): + Added get/set_expand(), get_cell_position() + Gtk::Widget: + - queue_resize_no_redraw(), get/set__no_show_all() + - Added unset_fg(), unset_bg(), unset_font(), unset_text(), unset_base(). + - Added add_modal_grab(), remove_modal_grab(), get_current_modal_grab(). + (Ole Laursen) + - Added set_window() and set_allocation() for implementing new native widgets. + (Detlef Reichl) + Gtk::Window: set_default_icon(), set_keep_above(), set_keep_below() + + Gdk::Cursor: new constructor: Cursor(const Glib::RefPtr& display, const Glib::RefPtr& pixbuf, int x, int y) + Gdk::Display: flush(), supports_cursor_alpha(), supports_cursor_color(), get_default_cursor_size(), + get_maximal_cursor_size(), set_double_click_distance(), get_default_group(). + Gdk::Pixbuf: get_formats(). + Gdk::PixbufLoader: create() now has extra bool mime_type parameter. + Gdk::Window: set_keep_above(), set_keep_below(). + + Pango:LayoutLine: get_length(), get_start_index(), and get_layout(). + diff --git a/libs/gtkmm2/COPYING b/libs/gtkmm2/COPYING new file mode 100644 index 0000000000..c4792dd27a --- /dev/null +++ b/libs/gtkmm2/COPYING @@ -0,0 +1,515 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +^L + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +^L + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +^L + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +^L + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +^L + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. +^L + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. +^L + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS +^L + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper +mail. + +You should also get your employer (if you work as a programmer) or +your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James +Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/libs/gtkmm2/ChangeLog b/libs/gtkmm2/ChangeLog new file mode 100644 index 0000000000..9966e67673 --- /dev/null +++ b/libs/gtkmm2/ChangeLog @@ -0,0 +1,2390 @@ +2.6.1: + +2005-03-12 Claudio Saavedra + + * docs/tutorial/gtkmm-tut.xml: Fixing inconsistences in documentation. + Bug #170131. + +2005-03-13 Murray Cumming + + * gtk/src/cellrenderercombo.hg: + * gtk/src/combo.hg: + * gtk/src/fileselection.hg: + * gtk/src/optionmenu.hg: + * gtk/src/treemodel.hg: + Doxygen comments: Remove deprecated widgets from + the Widgets and Dialogs groups, so they don't + show up in the lists. + +2005-03-11 Murray Cumming + + * gtk/src/cellrenderer.ccg: property_renderable_(): Call the base + class method, not the method itself, to avoid an infinite loop. + +2005-03-10 Cedric Gustin + + * MSVC_Net2003/Makefile.am: Add blank.cpp to EXTRA_DIST. + * MSVC_Net2003/atkmm/atkmm.rc.in, + MSVC_Net2003/pangomm/pangomm.rc.in: Use gtkmm @VERSION@ as version + string. + +2.6.0: + +2005-03-04 Murray Cumming + + * examples/book/menus_and_toolbars/main_menu/examplewindow.[h|cc]: + Demonstrate radio action items. + +2005-03-04 Murray Cumming + + * docs/tutorial/gtkmm-tut.xml: Fixed a duplication section id. + * docs/tutorial/Makefile: Make the phpwebnotes version build in a + separate directory, to make things simpler. + +2005-03-03 Murray Cumming + + * gtk/src/scale.hg: format_value signal: Modify the custom conversion + so that this never sends an empty string to GTK+, so we do not stop + C callbacks from using the special meaning that format_value gives to + a null string. This needs an extra signal parameter in C++ in future - + see the comment. Bug #154004 from Lars Luthman, who did the + detective work. + +2005-03-03 + + * gtk/src/treeview.ccg: insert_column(): Used (void*)0 instead of 0 + for the terminating vararg, to avoid g++ 4.0 warning about missing + sentinel in function call. + +2005-03-03 Albert Chin + + * configure.in: Check whether funlockfile(), flockfile(), and + getc_unlocked() are really available to the compiler, rather than + just present in a library. + * demos/gtk-demo/demo-window.c: Use the new tests. + +2005-02-28 Roel Vanhout + + * docs/tutorial/gtkmm-tut.xml: Add more section ids so that + phpwebnotes would have permanent ids to use. + +2.5.7: + +2005-02-23 Roel Vanhout + + * docs/tutorial/: Experimental generation of the html with + phpWebNotes code, to allow online comments. Not used yet. + +2005-02-18 Murray Cumming + + * gtk/src/gtk_signals.defs: Removed some more quotes from inside + the properties docs strings, because gmmproc can not handle those yet. + +2005-02-18 Murray Cumming + + * gtk/src/cellrenderer.hg: start_editing(): Add a default value of 0 + for the last flags parameter, because this is a valid value. + * examples/book/treeview/editable_cells: Added a number_validated + column, which shows how to handle edited cells without the + convenience functions, and how to validate date. + +2005-02-15 Murray Cumming + + * gtk/src/messagedialog.hg: Deprecate set_markup in favour of + set_message(string, false), which now uses the new + gtk_message_dialog_set_markup() function. We should not have added + this, but we are past API freeze now. Added documentation for + set_message() and set_secondary_text(). + * examples/book/dialogs/messagedialog/examplewindow.cc: Used + set_secondary_text(). + +2005-02-13 Murray Cumming + + * gtk/src/cellview.hg, comboboxentry.hg, image.hg, main.hg, + gkd/src/pixbuf.hg: Corrected some minor doxygen documenation errors. + +2005-02-13 Murray Cumming + + * atk/src/atk_signals.defs, gdk/src/gdk_signals.defs, + gtk/gtk_signals.defs: Regenerate with latest extra_defs_gen, to get + the property documentation. + * docs/reference: Added widget_hierarchy html image map and .dia + original from Marco Scholten in bug 88610. + * docs/index.html: Added link to hierarchy. + * docs/reference/Makefile.am: Add extra commands to install and + upload the widget_hierarchy files. + +2005-02-13 Murray Cumming + + * gtk/src/cellrenderertext.hg: Added documentation for the edited() + method. Bug found by Antonio Coralles. + +2005-02-13 Murray Cumming + + * gdk/src/dragtarget.ccg: get_targets(): Fixed typo to fix the build. + +2005-02-07 Ronald Lembcke + + * gdk/src/dragcontext.ccg: get_targets(): Actually step through the + list, instead of looping infinitely. Bug #166412. + +2005-02-03 Murray Cumming + + * gtk/src/targetlist.ccg: Add TargetList:: prefix to the create + method, so that it is actually defined. Bug found by Ronald Lembcke. + +2005-02-02 Murray Cumming + + * examples/cellrenderercustom/cellrenderertoggle.cc: AppWindow: + Move the inner ModelColumns class outside of the AppWindow class, + because the IRIX MipsPro compiler (wrongly) says that its + destructor it was referenced but not defined. + * examples/gdk/radar.cc: Added #include of math.h, needed by + IRIX MipsPro compiler. + +2005-02-02 Murray Cumming + + * gtk/src/treeview.hg: append_column_numeric(), + _connect_auto_store_editable_signal(): Use an intermediate + function pointer, because the IRIX MipsPro compiler needs that. + +2005-02-01 Murray Cumming + + * examples/book/clipboard/ideal/examplewindow.cc: + on_clipboard_received_targets(). Use targets = targets_array instead + of targets(targets_array). The IRIX MipsPro compiler needs this, + maybe because of the ustring-std::string conversion. We should + maybe use ustring anyway. + +2005-02-01 Murray Cumming + + * gtk/gtkmm/comboboxtext.h: Class documentation: Warn about using this + with Glade. Bug #165411, + +2005-02-01 Murray Cumming + + * configure.in: Check for atk version 1.9 at configure time, + because that is what we use, because it follows the same schedule as + gtkmm. + +2005-02-01 Murray Cumming + + * gtk/src/treeview.hg, colorselection.ccg: Remove the #ifdefs for AIX, + because sigc::bind now works on AIX. + +2.5.6: + +2005-01-26 Cedric Gustin + + * Makefile.am: Added MSVC_Net2003 directory. + * configure.in: Added MSVC_Net2003 entries. AC_SUBST + GTKMM_*_VERSION macros (for the MSVC resource files) + * gtk/gtkmmconfig.h.in: Added dllimport/dllexport rules. Moved + HAVE_FLOCKFILE and HAVE_FUNLOCKFILE #undef's to GLIBMM_CONFIGURE + section, as it is not relevant to platforms that do not run + configure (MSVC for example). + * examples/stock/stock.cc, examples/tictactoe/tictactoe.cc: Added + Gtk namespace to "manage" calls (Gtk::manage) as required by MSVC. + * demos/gtk-demo/demo-common.cc: Fixed typo in #ifdef/#endif + structure. Uncommented get_democodedir function. + * demos/gtk-demo/textwidget.cc: Use default system font on win32. + * MSVC_Net2003/*: Initial commit, imported from gtkmm-2-4 branch. + * MSVC_Net2003/gtkmm/Makefile.am, MSVC_Net2003/gdkmm/Makefile.am: + Rewrote rule for local copy of g[d|t]kmmconfig.h (required for + 'make distcheck'). + +2005-01-25 Bryan Forbes + + * gtk/src/plug.[hg|ccg]: Add a default constructor. + +2005-01-25 Murray Cumming + + * gtk/src/colorselection.hg: set_change_pallete_hook(): On AIX, #ifdef + out the part that uses sigc::bind, which does not work with the AIX + xlC compiler. This method will be broken of that platform, but it is + rarely used anyway. + * demos/gtk-demo/demowindow.cc: SUN Forte, AIX, and Tru64 have the + problem with flockfile and funlockfile - configure finds it but the + compiler can not find it while compiling demowindow.cc. #undef + HAVE_FLOCKFILE and HAVE_FUNLOCKFILE for now, so that it builds on + those platforms. + +2005-01-25 Murray Cumming + + * configure.in, Makefile.am: Add --disable-demos configure option, + by plors in bug #160756. This is needed because AIX does not support + sigc::bind at all and the demos would be quite unreadable if we + worked around that. This way, at least gtkmm can be installed on AIX. + +2005-01-25 Murray Cumming + + * examples/book/input/main.cc: Do not use O_NONBLOCK, because the + example is meant to be blocking. As advised by Chris Vine. + +2005-01-25 Murray Cumming + + * gtk/src/treeview.hg: Use nested sigc::bind<-1>s instead of + sigc::bind(), because the Tru64 compiler needs the extra hint. + Added #ifdef GTKMM_HAVE_SIGC_BIND() around some templated convenience + methods, so we can disable these on AIX. + * gtk/src/treemodel.[hg|ccg]: Use Gtk::TreeModel::iterator instead of just + iterator, because the Tru64 compiler finds it ambiguous. + * demos/example_treeview_editable_cells.cc: Replace use of + TreeView::append_column_editable() with the long-winded workaround, + so that the IRIX MipsPro and Tru64 compilers can build this + +2005-01-18 Marco Scholten + + * examples/book/custom/custom_widget/examplewindow.cc: + Removed #include because it is not used. + * examples/book/custom/custom_widget/mywidget.cc: + Removed #include because it is not used. + In on_realize() removed: + -set_flags(Gtk::REALIZED); + -set_window( get_parent_window() ); + -GtkWidget* cWidget = (GtkWidget*)gobj(); + -cWidget->style = gtk_style_attach(cWidget->style, get_window()->gobj()); + Added attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK; + to make the widget receive expose events. + Create GdkWindow and set this as the widgets window + Set colors in on_realize() instead of on_expose_event() because this + needs to be done only once. + Removed colormap in on_expose_event() because of problem with + get_default_colormap() (see Bug 163992). I decided not to wait for a fix + on that bug because how we set the color is not essential to this example. + Made it draw something nice. + +2005-01-18 Murray Cumming + + * demos/gtk-demo/demos.h: Use sigc::ptr_fun() instead of the bare + function pointer, because that does not work with the SUN Forte + compiler. on_treeview_row_activated(): Use a const reference of the + slot with operator[] to avoid ambiguity with the SUN Forte compiler - + see the comment in the code. + +2005-01-18 Murray Cumming + + * examples/book/input/main.cc: Add extra #includes, needed by + the SUN Forte compiler. + +2005-01-18 Murray Cumming + + * demos/demowindow.cc: #ifdef on __SUNPRO_CC instead of + GLIBMM_COMPILER_SUN_FORTE, though we should really find out why + GLIBMM_COMPILER_SUN_FORTE is not defined with the SUN compiler. + * demos/example_stockbrowser.cc: Remove some consts that the + SUN compiler does not allow. + * gtk/src/radiobutton.hg: Remove duplicate Group typedef, which + SUN Forte complains about. + * This should fix the remaining issues in bug #154973. + Joel Fredrikson helped with these fixes. + +2005-01-11 Murray Cumming + + * examples/book/custom/custom_widget/mywidget.cc: Fix from Marco + (mshcoltn) to make this widget actually draw something: on_realize(): + Use get_window() instead of creating our own Gdk::Window. I am not + sure why this works, but it is simpler. + +2.5.5: + +2005-01-10 Murray Cumming + + * gtk/src/main.[hg|ccg]: Added Main constructor that takes a + Glib::OptionContext(), and added + Main::add_gtk_option_group(option_context) to wrap functionality in + gtk_init_with_args() and gtk_get_option_group(), hopefully. + * tests/: Added main_with_option_group to show that it works. + +2005-01-10 Murray Cumming + + * gtk/src/combobox.hg, comboboxentry.hg, clipboard.hg, cellview.hg, + celllayout.hg, celleditable.hg, cellrenderer*.hg: Added class + documentation, based on the C documentation. + * gtk/src/clipboard.hg: Added set_can_store() overload that takes no + arguments. + * gtk/src/combobox.hg: Added unset_row_separator_func(). + +2005-01-09 Murray Cumming + + * gtk/src/filechooserbutton.[hg|ccg]: Inherit from the FileChooser + interface. Add constructor which takes no title. Add documentation, + based on the C documentation. + +2005-01-09 Murray Cumming + + * gtk/examples/book/buttons/: Added filechooserbutton example, + though I see g_warnings. + +2005-01-09 Murray Cumming + + * gtk/examples/book/treeview/list/examplewindow.[h|cc]: Add an extra + model column, rendered with a CellRendererProgress, to show that it + works. + +2005-01-08 Murray Cumming + + * gtk/src/aboutdialog.hg: Add logo_icon_name proeprty. + * gtk/src/iconview.hg: Wrap the properties. + +2005-01-07 Murray Cumming + + * Makefile.am: Offline documentation tarball: Do not try to tar up non + existant docs/internals directory. Put 2-4 in the tarball name to + avoid confusion. + * docs/index.html: Correct the offline documentation link, so that + people do not download the tarball for the 2.0 documentation instead. + Bug #163122. + +2005-01-07 Murray Cumming + + * gtk/src/modelfilter.hg: Added documentation for set_modify_func(). + * pango/src/renderer.hg: Added get_color(), + * pango/src/color.hg: Added operator bool() so that people can check + for a null Color returned by Renderer::get_color(). + +2005-01-07 Murray Cumming + + * gtk/src/entrycompletion.hg, toolitem.hg: Added //TODO comments + to tell us to add default signal handlers when we can break ABI. Also + remove an extra ; to avoid a warning and fix the build. + +2005-01-06 Bryan Forbes + + * updated .cvsignore files. + * gtk/gtkmm/stock.[h|cc]: Added new stock items. + * gtk/src/entrycompletion.hg: Changed to use no_default_handler on + insert_prefix signal. + * gtk/src/filechooserdialog.[hg|ccg]: + * gtk/src/filechooserwidget.[hg|ccg]: Added constructors to choose the + backend used. + * gtk/src/main.[hg|ccg]: Added commented constructors for gtk_init_with_args + so we can take a look at it. + * gtk/src/toolitem.hg: Changed to use no_default_handler on set_tooltip + signal. + +2005-01-06 Murray Cumming + + * gdk/src/pixbufloader.hg, gtk/src/cellrenderer.hg, gtk/src/range.hg: + For the signals that are new in gtkmm 2.5, use the extra + no_default_handler argument with _WRAP_SIGNAL(), to avoid adding new + virtual functions which would break the ABI by increasing the size + of base class objects. + +2005-01-06 Murray Cumming + + * gtk/src/treeiter.[hg|ccg]: Add forward_search() and + backward_search() overloads without the limit argument. + * gtk/src/gtk_docs_override.xml: Correct the documentation for + the full forward_search() and backward_search() methods, so that it + does not suggest 0 for references. Bug found by Rob Page. + +2005-01-06 Murray Cumming + + * examples/book/dialog/: Added aboutdialog example. + +2.5.4: + +2005-01-05 Murray Cumming + + * atk/src/atk_enums.defs: Regenerated. + * atk/src/relation.hg: Added add_target(). + * atk/src/relationset.hg: Added add_relation_by_type(). + * atk/src/text.hg: Added get_range_extents(), get_bounded_ranges(). + +2005-01-05 Murray Cumming + + * gdk/src/gdk_pixbuf.defs: Updated with h2defs.py + * gdk/src/display.[hg|ccg]: Added supports_selection_notification(), + request_selection_notification(), supports_clipboard_persistance(), + store_clipboard(). + * gdk/src/pixbuf.[hg|ccg]: Added rotate_simple(), flip(), + save_to_buffer(). + * gdk/src/pixbuf_format.hg: Added is_scalable(), is_disabled(), + set_disabled(), get_license(). + * gdk/src/window.hg: Added enable_synchronized_configure(), + configure_finished(), set_focus_on_map(). + +2005-01-05 Murray Cumming + + * gdk/src/gdk_methods.defs: Updated with h2defs.py. + +2005-01-04 Murray Cumming + + * gdk/src/gdk_enums.defs, gtk/src/gtk_enums.defs, + gtk/src/gtk_signals.defs: Regenerated. + * gtk/src/gtk_others.defs: Added get_authors, get_documentors and + get_artists because h2defs.py does not add them to gtk_methods.defs, + for some reason. + * gtk/src/action.hg: Added get_accel_path(). + +2005-01-04 Murray Cumming + + * gtk/src/treeview.hg: Added hover_expand and hover_selection + properties. + +2005-01-03 Bryan Forbes + + * gtk/src/cellrenderertext.hg: added properties "language", + "ellipsize", and "ellipsize-set". + +2.5.3: + +2004-12-19 Murray Cumming + + * gdk/pixbuf.hg: Added create_from_file() overload that takes + height and width, wrapping gdk_pixbuf_create_from_file_at_scale(). + Bug #157894. + +2004-12-19 Claudio Saavedra + + * example/book/input/main.cc: Improved example to use a + Glib::IOChannel. References bug #138259. + +2004-12-19 Murray Cumming + + * gtk/src/cellrenderer.hg: Added stop_editing() which replaces the + now-deprecated editing_cancelled(). + * gtk/src/iconview.hg: Added get/set_columns(), get/set_item_width(), + get/set_spacing(), get/set_row_spacing(), get/set_column_spacing(), + get/set_margin(). + * gtk/src/label.hg: Added get/set_max_chars_width(), and property. + * gtk/src/textview.hg: Added get_iter_at_position(). + * gdk/src/gdk_docs.xml, pango/src/pango_docs.xml, + gtk/src/gtk_docs.xml: Regenerated with docextract_to_xm.py, to get + new GTK+ documentation. + +2004-12-19 Murray Cumming + + * gtk/src/filechooserbutton.hg: Constructors: Added action parameters, + because they have been added to the GTK+ API. + * gtk/src/gtk_methods.defs: Regenerated with h2defs.py + +2004-12-16 Murray Cumming + + * examples/book/dialogs/messagedialog/examplewindow.cc: The + ButtonsType enum is not an ORable flag. + * docs/tutorial/gtkmm-tut.xml: Fix the text where it says that it is. + +2004-12-16 Murray Cumming + + * gtk/src/cellview.hg: Remove set_value(), because it has been + removed from GTK+. This fixes the build. Now inherits from the + CellLayout interface. Added text and pixbuf constructors, to match + the C _new conveience functions. + +2.5.2: + +2004-12-04 Roger Leigh + + * configure.in: Bug #160244: Ask automake to use the utar format, to + fix the problems with the long filenames of our documentation in the + tarballs. + +2004-12-03 Murray Cumming + + * gtk/src/treeview.hg: Added append_column_numeric() which allows you + to specify a printf-style format string for the View column, and + append_column_numeric_editable() which does the same, and auto-stores + decimal input. Updated the append_column() documentation to improve + the explanation of supported types, and to suggest use of + append_column_numeric(). + * examples/book/treeview/list/, editable_cells/: Demonstrate these + new convenience methods. + +2004-12-01 Murray Cumming + + * gtk/src/label.hg: Added get/set_angle(). + +2004-12-01 Murray Cumming + + * gtk/src/filechooserbutton.hg: GtkFileChooser inherits from HBox, not + Button. + +2004-12-01 Murray Cumming + + * gtk/src/filechooserbutton.hg: Removed get/set_active(), because they + have been removed from GTK+. + +2004-12-01 Murray Cumming + + * gtk/src/cellview.hg: Removed set_cell_data() because it has been + removed from GTK+. + +2004-12-01 Murray Cumming + + * pango/pangomm/: Added types.h, for typedefs of simple structs. + * pango/src/: Added renderer.[hg|ccg]. + * pango/src/context.hg: Add get/set_matrix(). + * pango/src/fontmetrics.hg: Added get_underline_position(), + get_underline_thickness(), get_strikethrough_position(), + get_strikethrough_thickness(). + * pango/src/pango_enums.defs: Regenerated. + * tools/m4/convert_pango.m4: Added Matrix and Layout conversions. + +2004-11-30 Murray Cumming + + * tools/m4/convert_gtk.m4: Use _CONVERT_CONST_REFPTR_TO_P_SUN() instead + of _CONVERT_CONST_REFPTR_TO_P(), to hopefully fix the SUN Forte build + problems in bug #154973. + +2004-11-30 Murray Cumming + + * examples/book/menus_and_toolbars: Applied Fredrik Arnerup's patch + to add a non-stock icon, with some changes. + +2004-11-30 Murray Cumming + + * atk/src/hyperlink.hg: get_object(), + * atk/src/object.hg: get_relation_set(), + * gdk/src/cursor.hg: get_display(), + * gdk/src/display.hg: get_default_group(), + * gdk/src/displaymanager.hg: get_default_display(), + * gdk/src/drawable.hg: get_screen(), get_display(), + * gdk/src/event.hg: get_screen(), + * gdk/src/visual.hg: get_system(), get_best(), get_screen(), + * gtk/src/widget.hg: get_default_style() + +2004-11-25 Chris Vine + + * example/book/input/: This now works. + +2004-11-25 Murray Cumming + + * docs/tut/gtkmm-tut.xml: TreeView selection: Use + selected_foreach_iter() instead of selected_foreach(). Error + found by Teus Benschop. + +2004-11-24 Murray Cumming + + * demos/gtk-demo/: Added missing demo-common.[h|cc] files. + * gtk/src/treeview.hg, gdk/src/pixbuf.hg, : Removed extra ; and + unused parameter to fix build for g++ 3.4. + +2004-11-21 Murray Cumming + + * gtk/src/dialog.[hg|ccg]: Added set_alternative_button_order(). + * gtk/src/button.[hg|ccg]: Added set/get_image() and property. + +2004-11-17 Murray Cumming + + * gtk/src/iconinfo.[hg|ccg]: Added operator bool(), needed to check + the result of IconTheme::lookup_icon(). Bug #143018. + +2004-11-16 Murray Cumming + + * docs/tutorial/gtkmm-tut.xml: Mention Gtk::manage() in the Basics/ + Widgets section, with a link to the Memory Management chapter, so that + people have an explanation of manage() before it is used in examples. + Bug #138248. + +2004-11-16 Claudio Saavedra + + * docs/tutorial/gtkmm-tut.xml: Fixed two typos in Chapter 19 and + Appendix A. + * examples/book/helloworld/helloworld.cc: Fixed wrong reference + to a inexistent method in a comment. + +2.5.1: + +2004-11-11 Murray Cumming + + * gtk/src/filechooser.hg: Wrap GTK_FILE_CHOOSER_ERROR as exception. + Still need to investigate whether GTK_FILE_SYSTEM_ERROR is public API. + * gtk/src/icontheme.hg: Wrap GTK_ICON_THEME_ERROR as exception + instead of enum. Luckily, the enum was not used in the API anywhere + so nobody can be using it. + * examples/book/: Added input example, based on code that was in the + tutorial inline. This needs to be updated properly - see TODO in the + code. + * docs/tutorial/gtkmm-tut.xml: Some minor corrections to the + Idle/Timeout chapter, but it needs to be reviewed properly after we + have finished the example. Get the example from the source, instead of + pasting it inline. + * gdk/src/pixbufloader.hg: Wrap size_prepared signal. I am not sure + why this was not wrapped in 2.4. + * gtk/src/filefilter.hg: Add add_pixbuf_formats(). + +2004-11-11 Murray Cumming + + * gtk/src/textbuffer.hg: Added ; to fix build. + +2004-11-10 Murray Cumming + + * gtk/src/gtk_methods.defs: Regenerated with h2defs.py. + * gtk/src/selectiondata.hg: Added targets_include_image(). + * gtk/src/progressbar.hg: Added set/get_ellipsize() and property. + * gtk/src/label.hg: Added set/get_single_line_mode() and property. + * gtk/src/clipboard.hg: Added set_image(), wait_is_image_available(), + wait_for_image(), request_image(). + * gtk/src/toolitem: Added rebuild_menu(). + +2004-11-08 Murray Cumming + + * examples/book/treeview/combo_renderer/examplewindow.[h|cc]: Use a + combo model from the treeview model, now that it works in GTK+. + +2004-11-07 Murray Cumming + + * gtk/src/combocellrenderer.hg: The model is a TreeModel, not a + Pixbuf. + * gtk/gtkmm/cellrenderer_generation.[h|cc]: Remove the TreeModel/Combo + specialization, because the Combo is not for representing or editing + a TreeModel - it's just to use a TreeModel to present choices for + a text column. + * examples/book/treeview/combo_renderer/examplewindow.[h|cc]: This + now works. + +2004-11-04 Murray Cumming + + * gtk/src/messagedialog.hg: Reverted set_message() implementation + change and added set_secondary_text(). + * gtk/src/dialog.hg: Added alternative_button_order(). + * gtk/src/: Added cellrenderercombo.[hg|ccg] and cellrendererprogress.[hg|ccg]. + * gtk/gtkmm/cellrenderer_generation.[h|cc]: Add template + specializations to create a CellRendererCombo when the model is of + type TreeModel. + * pango/src/context.hg: Added get_font_map(). + * examples/book/treeview/: Added combo_renderer example - does not + actually work yet. + +2004-11-03 Murray Cumming + + * examples/book/menus/popup/examplewindow.[h|cc]: Use the popup + UIManager node type, so that this example works. + * docs/tutorial/gtkmm-tut.xml: Update the popup menu section. + +2004-11-03 Murray Cumming + + * Removed gtkmm.spec.in and mention of it in configure.in and + Makefile.am, yet again. There is no point in having a broken spec + file that nobody is maintaining. spec files are distro-specific and + belong with distros. + +2004-10-31 Murray Cumming + + * gtk/src/treemodelfilter.ccg: SignalProxy_Modify::gtk_callback(): + Do not return before actually copying the value. + * examples/book/treeview/: Added filter_modify example, to show the + use of set_modify_func(). + +2004-10-30 Murray Cumming + + * gtk/src/gtk_methods.hg: Regenerated with h2defs.py. + * gtk/src/window.hg: Added drag_dest_add_text_targets(), + drag_dest_add_uri_targets(), drag_dest_add_image_targets(), + drag_source_add_text_targets(), drag_source_add_uri_targets(), + drag_source_add_image_targets(). + * gtk/src/aboutdialog: Added get_logo_icon_name(), and + set_logo_icon_name(). + * gtk/src/clipboard.hg: Added wait_is_target_available(), + set_can_store(), store() + * gtk/src/filechooserbutton: Added get/set_width_chars() + * gtk/src/image.hg: Added set_from_icon_name(), get/set_pixel_size(), + get_icon_name() + * gtk/src/label.hg: Added get/set_width_chars(). + * gtk/src/messagedialog.[hg|ccg]: Made set_message() public and + reimplemented it with gtk_message_dialog_format_secondary_text() and + gtk_message_dialog_format_secondary_markup() instead of the private + label field. + * gtk/src/selectiondata.hg: Added get/set_pixbuf(), get/set_uris(). + +2004-10-30 Murray Cumming + + * gtk/src/treemodelfilter.[hg|ccg]: Added implementations of + set_value_impl() to ouput a warning when it is used instead of + the child model. Added const versions of patch convert methods. + * gtk/src/treeview.[hg|ccg]: Added _get_base_model() non-public API + member method to get the child model, if necessary. Used it in the + cell renderer signal handlers instead of get_model(). + * Added examples/book/treeview/filter, from the gtkmm-2-4 branch. + +2004-10-16 Gene Ruebsamen + + * docs/tutorial/gtkmm-tut.xml: Added a chapter for the new gtk-2.4 + FileChooserDialog. + * docs/tutorial/figures/dialogs_filechooser.png: Added a PNG image + of the new FileChooserDialog. + +2004-10-25 Roger Leigh + + * build_shared/Makefile_build.am_fragment: Use PLATFORM_WIN32 + rather than OS_WIN32 so that -no-undefined is used on Cygwin + as well as MinGW toolchains. + +2004-10-25 Murray Cumming + + * gtk/gtkmm.h: #include filechooserwidget.h, as suggested in bug + #156170 from Arjan Timmerman. + +2004-10-24 Murray Cumming + + * docs/tutorial/gtkmm-tut.xml: Updated the menus and toolbars section + about UIManager, though the popup example does not work yet, and I + should mention ui merging and toggle items. + +2004-10-22 Murray Cumming + + * gtk/src/treemodelfilter.hg: _WRAP_CTOR: Rename root parameter to + virual_root so that it sets the correct property. + +2004-10-22 Murray Cumming + + * gtk/src/treeiter.hg: In ifdef, use SUN-Forte-style reverse_iterator. + Patch from TODO in bug #154973. + +2004-10-22 Murray Cumming + + * gtk/src/aboutdialog.hg: Wrap the get and set methods that deal with + char** arrays, using Glib::SArrayHandle. Wrap the callback set + methods with a SignalProxy. + * gtk/src/gtk_signals.defs: Add signals and properties for + AboutDialog and MenuToolButton. + * tools/extra_defs_gen/generate_defs_gtk.cc: Get defs for + GtkAboutDialog and GtkMenuToolButton. + * gtk/src/action_group.hg: Add translate_string(). We probably need to + use iit in the .ccg file. + * gtk/src/icontheme.hg: Added get_icon_sizes(). + * gtk/src/iconview.hg: Added get_selected_items(). + * tools/m4/convert_gtk.m4: Added conversion for SArrayHandle to char**, + and GList* to SListHandle + +2004-10-17 Gene Ruebsamen + + * docs/tutorial/gtkmm-tut.xml: Updated the Windows installation + appendix by providing a link to the latest Gtk+ Win32 installer, + and updating the installation instructions. + +2004-10-12 Murray Cumming + + * examples/book/custom/custom_container.cc: Use only C++ methods + instead of the C functions, now that they are public. + * docs/tutorial/figures/: Added custom_container.png. + +2004-10-10 Murray Cumming + + * docs/tutorial/gtkmm-tut.xml: Added Custom Widgets chapter, so far + with a Custom Container section and example. + +2004-10-10 Murray Cumming + + * gtk/src/widget.hg: Made set_parent(), and unparent() public instead + of protected, because they are need by custom Containers. Added + size_request() which is const and actually returns a value, also + needed by custom Containers. + * gtk/src/accelgroup,hg: Wrap the new gtk_accelerator_get_label() + function. + * gtk/src/comboboxentry.[hg|ccg]: Hand-code get_entry() to fix the + build. + * gtk/src/: Added menutoolbutton.[hg|ccg]. + * gtk/gtkmm/comboboxtext.[h|cc], comboboxentrytext.[h||cc]: Added + set_active_text(), clear(). Reimplemented append() and prepend() + without using the C functions, because they might not work with our + model. + +2004-10-09 Murray Cumming + + * docs/index.html: Changed cvs links to viewcvs, because lxr and + bonsai are still broken. + +2004-10-09 Murray Cumming + + * gtk/src/style.hg: Add create() method, as per bug #148012. + +2004-10-09 Murray Cumming + + * gtk/src/comboboxentry.hg: Added get_entry(), as per bug #142758. + +2004-09-04 Jonathan Brandmeyer + + * gdk/src/screen.hg: get_default(): Take an extra reference so that + the Screen is not deleted too early. + +2004-09-17 Murray Cumming + + * iconview.hg: Added overrides of set_text_column(), and + set_pixbuf_column() that take ModelColumns instead of ints. + Wrapped signals. Added foreach() + * cellview.hg: Make get_size_of_row() const. + * tools/extra_defs_gen/gtk_extra_defs_gen: Added new types. + * gtk/src/gtk_signals.defs: Regenerated (making the usual corrections + for Event* and gpointer parameters. + * combobox.[hg|ccg], treeview.[hg|ccg]: Add set_row_separator_func(), + with common implementation in treeview-private.[h|cc]. + * range.hg: Wrapped change_value signal. + * demos/gtk-demo/: Added example_iconview.cc, which demonstrates the + IconView and is a C++ version of the C original.. + +2.5.0: + +2004-09-12 Murray Cumming + + * gtk/src/: Added cellview.[hg|ccg]. + +2004-09-10 Murray Cumming + + * pango/src/layout: Added set_ellipsize(), get_ellipsize(), and + EllipsizeMode enum. + * pango/src/pango_enums.defs: Regenerated. + * pango/src/pango_methods.defs: Regenerated. + * gtk/src/: Added iconview.[hg|ccg|, filechooserbutton.[hg|ccg]. + * gtk/src/entry.hg: Added layout_index_to_text_index() and + text_index_to_layout_index() + * gtk/src/entrycompletion.hg: Added insert_prefix(), + set_inline_completion(), get_inline_completion(), + set_popup_completion(), get_popup_completion(), get_text_column() + * gtk/src/combobox.hg: Added get_wrap_width(), get_row_span_column(), + get_column_span_column(), get_add_tearoffs(), set_add_tearoffs(), + get_focus_on_click(), set_focus_on_click(), get_popup_accessible(). + Wrapped new properties. + * gtk/src/action.hg: Wrap new gtk_action_set_sensitive() + instead of writing our own method. Add set_visible() too. + * gtk/src/label.hg: Added set_ellipsize(), get_ellipsize(). + * gtk/src/cellrenderer.hg: Added editing_started signal. + * gtk/src/filechooser.hg: Added set_show_hidden(), get_show_hidden(). + * gtk/src/gtk_methods.defs: Regenerated. + * gtk/src/treesortable.hg: Added DEFAULT_UNSORTED_COLUMN_ID constant. + * gtk/src/treeview.hg: Added set_fixed_height_mode(), + get_fixed_height_mode(), set_hover_selection(), get_hover_selection(), + set_hover_expand(), get_hover_expand() + +2004-09-02 Murray Cumming + + * This is the HEAD branch, which should wrap new API in GTK+ 2.5/2.6. + +2004-08-30 Murray Cumming + + * examples/book/dialogs/fileselection/examplewindow.cc: Removed a + misleading include. + +2.4.5: + +2004-08-07 Murray Cumming + + * gtk/src/toolbar.hg: Class documentation: remove mention of + tools() which no longer exists. + * examples/book/treeview/drag_and_drop: Correct the implementation + of the vfuncs so that they actually work. In particular they are const + in gtkmm 2.4. + +2004-07-16 Murray Cumming + + * gtk/src/settings.ccg: get_default(): Use reference() instead of an + extra parameter, to fix the build. + +2004-07-15 Murray Cumming + + * gtk/src/settings.ccg: get_default(): Take an extra reference so that + the Settings is not deleted too early. Bug #147592. + +2004-07-15 Murray Cumming + + * examples/book/treeview/: Added popup example, which was already in + gtkmm 2.0/2.2. + +2004-07-08 Murray Cumming + + * docs/tutorial/gtk_tut.xml: libglademm chapter: Mention memory + management. + +2004-07-08 Murray Cumming + + * Patch from Christopher Palm in bug #145594, to change ActionGroup and + EntryCompletion constructors from private to protected. Lets hope + there are no more of these, because this is technically API change in + the stable branch. However, the methods already exist and are tested + by the create() methods, and are simple and generated, and therefore + unlikely to have errors. Also, this change will only be useful to a + very small number of people, so it does not confuse the API versions. + +2004-07-04 Murray Cumming + + * docs/tutorial/gtkmm_tut.xml: Tell people to pkg-config for 2.4 + instead of 2.0. + +2004-07-02 Murray Cumming + + * gtk/src/uimanager.hg: Made constructor protected, like in the + previous change. + * gtk/src/treesortable.hg: Added docs explaining the return values + for the sort func. + +2.4.4: + +2004-07-01 Murray Cumming + + * gtk/src/action.hg, toggleaction.hg, radioaction.hg, icontheme.hg: + Added protected keyword at start of class so that + the constructors can be used by derived classes. This is addition of + API in the stable branch, but it should not affect many people and it + is a little too embarassing to leave as it is. + +2004-06-30 Murray Cumming + + * gtk/src/container.hg: Add code to the GClass init() function to null + the remove callback if the type is actually GtkContainer rather than + a derived class. The default implementation in GtkContainer complains + about it not being implemented, but that is useless and annoying to us + when deriving directly from Gtk::Container. + +2004-06-20 Daniel Elstner + + * gtk/src/stockitem.ccg (StockItem::StockItem): Pass a 0 pointer + to GTK+ if translation_domain is the empty string, so that the + application's global translation domain will be used by default. + +2004-06-20 Daniel Elstner + + * gtk/src/widget.ccg (Widget::unset_fg): First cast Gtk::StateType + to int and then to GtkStateType, because direct static_cast<> from + one enum type to another is invalid C++. Why g++ 3.3 accepts this + is a mystery to me though... + (Widget::unset_bg): ditto + (Widget::unset_text): ditto + (Widget::unset_base): ditto. + +2.4.3: + +2004-06-16 Daniel Elstner + + * gtk/src/treeiter.ccg (TreeIter::operator--): Correctly decrement + the end iterator. Also assert that the iterator is not already at + the begin of the sequence. + + * gtk/src/treeiter.hg (TreeIter::operator--): s/slow/very slow/ + +2004-06-15 Murray Cumming + + * gtk/gtkmm/comboboxentrytext.h: Correct the header guard so that it + can be used at the same time as comboboxentry.h. + * gtk/gtkmm/comboboxentrytext.cc, comboboxtext.cc: Implement the + GObject* castitem constructors. + +2004-06-08 Cedric Gustin + + * gdk/gdkmm/Makefile.am: link against libpangomm-1.4 instead of + 1.6 on win32 (sublib_win32_dlls_libs variable). + +2.4.2: + +2004-06-04 Daniel Elstner + + * gtk/src/filechooser.hg (FileChooser): Copy the class docs from + GTK+. Also explain the fact that the API is broken and how to use + it correctly despite this problem (bug #142138). + +2004-06-03 Murray Cumming + + * gtk/src/treeview.ccg: get_path_at_pos(): Correct memory management + of the path. Bug #142970 from david@thepriorities.com. + +2004-05-28 Murray Cumming + + * docs/FAQ/gtkmm_faq.xml: Mentioned gtkmm 2.4. + +2004-05-28 Murray Cumming + + * gtk/src/combobox.ccg: get_active(): Instantiate a + Gtk::TreeModel::iterator instead of the GtkTreeIter, so that the + underlying GtkTreeIter is properly initialized. + +2004-05-25 Daniel Elstner + + * demos/pixbuf-demo.cc: More micro tweaking. + +2004-05-25 Daniel Elstner + + * demos/pixbuf-demo.cc: Minor cleanups: use const double rather + than a macro for pi, no need to explicitly maintain the timeout + signal connection, and some other stuff. + +2004-05-23 Murray Cumming + + * gtk/gtkmm/comboboxentrytext.cc: Patch from Teemu Tervo to prevent + the text column from being added twice, in bug #142956. + +2004-05-22 Daniel Elstner + + * configure.in: Check for gthread-2.0 and if it exists, substitute + the required compiler flags into GTHREAD_CFLAGS. This is necessary + to make the library code work correctly in a threaded application. + For instance, on glibc systems errno is replaced by a macro which + expands into a function call. Actually this stuff was already in + place, but apparently got lost when glibmm was split off. + + * build_shared/Makefile_build.am_fragment (all_includes): Append + $(GTHREAD_CFLAGS). + +2004-05-19 Daniel Elstner + + * gtk/gtkmm.h: Remove duplicated combobox.h include. Add missing + includes of comboboxentry.h and comboboxentrytext.h. + +2004-05-18 Daniel Elstner + + * gtk/src/treeiter.ccg (TreeIter::operator bool): Put the original + test for gobject_.stamp != 0 back in place. The iter_is_valid() + method provided by model implementations is intended for debugging + purposes only, and thus should not be used here (bug #142599). + + * gtk/src/treemodel.hg (TreeModel::iter_is_valid): Document that + the usage of this method as abstract interface is deprecated, and + that the implementation's iter_is_valid() should be used directly. + +2004-05-14 Murray Cumming + + * gtk/gtkmm/comboboxtext.cc, comboboxentrytext.cc: get_active_text(): + The iterator was being used in ways that probably should not compile. + This leads to strange results in other situations, so it is best to fix + it. + +2.4.1: + +2004-04-25 Murray Cumming + + * gdk/Makefile.am: install gdkmmconfig.h in a gdkmm-2.6 directory, + instead of a gtkmm-2.6 directory. Bug #141045. + +2004-04-23 Murray Cumming + + * gtk/src/uimanager.[hg|ccg]: add_ui_from_string now returns a + ui_merge_id instead of a guint, to make the API clearer. This is + technically an API change, but it's not a breaking one, and it's not + an ABI change. + +2004-04-22 Alexander Nedotsukov + + * atk/atkmm: Fixed private/ includes installation directory. + +2004-04-17 Murray Cumming + + * gtk/src/optionmenu.hg, fileselection.hg, combo.hg: Mark them as + deprecated in the docs, by using the Doxygen @deprecated command. + +2004-04-17 Murray Cumming + + * Removed some extra semi-colons detected by gcc 3.4 from cvs. + +2.4.0: + +2004-04-11 Murray Cumming + + * atk/src/: Added implementor.[hg|ccg] to wrap the AtkImplementorIface. + * gtk/src/widget.hg: Widget inherits from the Implementor interface + as well as Gtk::Object. + +2004-04-10 Murray Cumming + + * gtk/gtkmm.h: #include treemodelsort.h and treemodelfilter.h + * gtk/src/menu.hg: popup(): Wrap the C callback as a Slot, so we do + not need to include gtkmenu.h. + * gtk/src/iconinfo.hg: Do not include gtkiconinfo.h. + * gtk/src/notebook.hg: Do not include gtknotebook.h + * gtk/src/stockitem.hg: Do not include gtkstockitem.h + * gtk/src/texttag.hg: Do not include gtktexttag.h + +2004-04-09 Murray Cumming + + * toolbar.hg: Added get_tooltips_object() accessor, which should let + us set tooltips on toolbar objects. + +2004-04-09 Murray Cumming + + * filefilter.hg: Create a FileFilter::Info class to use in place of + GtkFileFilterInfo, in the add_custom() callbak . Removed filter(), + because it is not needed and because it is difficult to wrap. + +2004-04-08 Bryan Forbes + + * gtk/gtkmm.h: include gtkmm/settings.h. + +2.3.8 + +2004-04-09 Murray Cumming + + * gtk/src/action.hg: Added set_tooltip(). + +2004-04-07 Bryan Forbes + + * gtk/src/icontheme.hg: added refreturns for get_default and get_for_screen. + * gtk/src/settings.hg: added unwrapped properties. + * gtk/src/targetlist.[hg|ccg]: added a create method that wraps + gtk_target_list_new. + +2004-04-07 Murray Cumming + + * Removed some TODO comments that are no longer relevant. + +2004-04-03 Murray Cumming + + * gtk/src/treemodel.[hg|ccg]: Rename 2 of the 3 foreach() overloads + to foreach_iter() and foreach_path(), because they are ambiguous with + libsigc++ 2. + +2004-04-03 Murray Cumming + + * gtk/src/liststore.[hg|ccg], treestore.[hg|ccg]: Added insert_after(), + because it is apparently faster with many rows. Bug #131019. + +2004-04-01 Murray Cumming + + * gtk/src/action.[hg|ccg]: Added set_sensitive(), even though + it does not exist in GTK+ itself yet. Spotted by Matthew Walton. + +2.3.7: + +2004-03-28 Bryan Forbes + + * gtk/src/action.[hg|ccg]: + * tools/m4/convert_gtk.m4: changed Action::create_menu_item(), + create_tool_item(), and create_icon() to return Gtk::MenuItem*, + Gtk::ToolItem*, and Gtk::Image respectively, rather than Gtk::Widget*. + +2004-03-28 Murray Cumming + + * gtk/src/uimanager.ccg: Fix typo to fix the build. + * */src/*_methods.defs: Regenerated with h2defs.py. + +2004-03-28 Murray Cumming + + * *_docs_override.xml: Added several overrides to remove references to + 0 parameters and freeing of strings. + * atk/src/table.hg: Added const versions of some get_*() methods. + +2004-03-25 Andrew E. Makeev + + * gtk/src/treeview.hg, gtk/src/treeview.ccg: Added + move_column_to_start(), which uses gtk_tree_view_move_column_after() + with a 0 parameter. + +2004-03-26 Elijah Newren + + * docs/tutorial/gtkmm-tut.xml: Several simple fixes. + +2004-03-27 Murray Cumming + + * example/book/: Added menus_and_toolbars example that uses UIManager. + The book should probably stop using the other menu and toolbar examples + and they should be moved away. + +2004-03-27 Murray Cumming + + * gtk/src/action.ccg, toggleaction.ccg, radioaction.ccg: + Constructor: Give GTK+ 0 instead of "" for default labels and tooltips, + so that the stock ones are used. + +2004-03-25 Murray Cumming + + * gtk/src/filefilter.[hg|ccg]: Wrapped filefilter as a GtkObject + instead of a GObject, because it is a GtkObject. + * examples/book/dialogs/filechooserdialog/: Used filefilter. + +2004-03-25 Bryan Forbes + + * gtk/src/messagedialog.[hg|ccg]: removed use_separator parameter from + constructor as GtkMessageDialog gets its separator setting from the style + now. + +2004-03-24 Bryan Forbes + + * gtk/src/uimanager.hg: fixed typo in disconnect_proxy signal. + +2004-03-21 Elijah Newren + + * doc/FAQ/gtkmm-faq.xml: Updated to mention gtkmm2 more than gtkmm 1.2. + +2004-03-20 Murray Cumming + + * demos/gtk-demo/demowindow.cc: Use sigc::ptr_fun() instead of giving + the set_select_function function pointer directly to connect. + +2004-03-20 Murray Cumming + + * ActionGroup::get_action(), Clipboard::get_owner(), + ComboBox::get_model(), Entry::get_layout(), get_completion(), + EntryCompletion::get_model(), FileChooser::get_filter(), + IconInfo::get_builtin_pixbuf(), IconSource::get_pixbuf(), + Image::get_pixbuf(), get_animation(), Menu::get_accel_group(), + Scale::get_layout(), TreeModelFilter::get_model(), + UIManager::get_accel_group(), get_action(), + Widget::drag_begin(): Use refreturn. + * Entry::get_layout(), IconInfo::get_builtin_pixbuf(): + IconSource::get_pixbuf(), Image::get_pixbuf(), + Menu::get_accel_group(): Added const versions. + (Thanks to Bryan Forbes for finding the missing refreturns.) + +2004-03-18 Murray Cumming + + * gtk/src/icontheme.hg: Wrapped changed signal. + +2004-03-14 Murray Cumming + + * gtk/src/bin.ccg remove(), + gtk/src/container.[hg|ccg]: If the child widget is managed, do + a reference on the child widget before removing it, so that it + is not destroyed, and is ready for a new container, just like + when it was first instantiated. + +2.3.6: + +2004-03-14 Murray Cumming + + * demos/demowindow.cc: Do not use flockfile if we are using the SUN + compiler, even though it passes the configure test, because it does + not seem to work here. + +2004-03-13 Murray Cumming + + * gtk/src/toolbar, treestore: Removed extra semicolon to remove + g++ 3.4 warning. + +2004-03-13 Murray Cumming + + * atk/src/hypertext.hg, + Removed extra semicolon to remove g++ 3.4 warning. + +2004-03-12 Cedric Gustin + + * README.win32: Updated file for upcoming gtkmm-2.4. + * atk/src/action.hg, atk/src/component.hg, atk/src/object.hg, + gtk/gtkmm/accelmap.cc, gtk/gtkmm/accelmap.h, + gtk/gtkmm/comboboxtext.cc, gtk/gtkmm/comboboxtext.h, + gtk/src/main.ccg : Removed many #ifndef WIN32 as all methods are + now available/dllexported on win32, with the exceptions og Plug + and Socket. + * atk/atkmm/Makefile.am, atk/atkmm/private/Makefile.am, + atk/src/Makefile_list_of_hg.am_fragment, + build_shared/Makefile_build.am_fragment, + build_shared/Makefile_build_gensrc.am_fragment, + build_shared/Makefile_conditional.am_fragment, + build_shared/Makefile_gensrc.am_fragment, gdk/gdkmm/Makefile.am, + gdk/gdkmm/private/Makefile.am, + gdk/src/Makefile_list_of_hg.am_fragment, gtk/gtkmm/Makefile.am, + gtk/gtkmm/private/Makefile.am, + gtk/src/Makefile_list_of_hg.am_fragment, + pango/pangomm/Makefile.am, pango/pangomm/private/Makefile.am, + pango/src/Makefile_list_of_hg.am_fragment: Revamped the + Makefile.am helpers to accomodate multiple platforms (general, + posix, win32) and files sections (regular and deprecated files). + +2004-03-12 Murray Cumming + + * docs/reference/Makefile.am: remove the make dependency of + html/index.html on the generated installed beautify_docs.pl script, so + that docs are not rebuilt when building from a tarball. + Bug #136597 from dalgoda. + +2004-03-12 Murray Cumming + + * examples/cellrenderercustom/cellrendererpopup.cc: Removed some + accidentally pasted text that breaks the build. + +2004-03-11 Murray Cumming + + * demos/gtk-demo/demowindow.cc: Added #ifdef GLIBMM_COMPILER_SUN_FORTE + around the strange flockfile and funlockfile function prototypes, to + avoid problems on platforms which declare them differently. + +2004-03-09 Murray Cumming + + * Some, but not all, SUN Forte build fixes: + * demos/gtk-demo/demowindow.cc: Added prototypes for flockfile() + and funlockfile() because it does not seem to get them from + stdio.h - very strange. Commented-out the g_assert() lines that it + says as badly formed. + * demos/gtk-demo/textwidget.cc: Made the next_token char* const. + * examples/book/clipboard/ideal/examplewindow.cc: + on_clipboard_received_targets: Remove the useless const from the + std::list variable because it confused the compiler. + * examples/cellrenderercustom/cellrendererpopup.cc: + on_show_popup(): Use namespaced class name when specifying a + particular version of gobj(). + * gdk/src/display.hg: Removed lots of extra ;s that caused + warnings. + * gdk/src/pixmap.ccg: Use unwrap instead of + unwrap - this is the same as the sun-specific + stuff in tools/m4/convert_*.m4. + * gdk/src/pixmap.hg: Removed extra ;s that cause warnings. + * gtk/src/textbuffer.ccg: insert_(): Some const changes - see the + comments. + * tools/m4/convert_gdk.m4, convert_glib.m4: Use existing + sun-specific conversion when converting from any + RefPtr to *Something. + +2004-03-09 Murray Cumming + + * Regenerated gtk/src/gtk_docs.xml, and gdk/src/gdk_docs.xml with + docextract_to_xml.py. + * docs/reference/Makefile.am: Upload doxygen-warnings.txt and + doxygen-output.txt every time, so everybody sees them. + +2004-03-09 Hagen Moebius + + * Recent efforts cumulated in a massive documentation patch, which + eliminates almost all doxygen warnings/errors. + Files: atk/atkmm/init.h, gdk/src/display.hg, drawable.hg, + gdk_docs_override.xml, pixbuf.hg, window.ccg, window.hg, + gtk/gtkmm/accelkey.h, gtk/src/accellabel.hg, alignment.hg, box.hg + button.hg, cellrenderer.hg, filechooser.hg, gtk_docs_override.xml, + image.hg, layout.hg, main.hg, notebook.hg, rc.hg, textbuffer.hg, + treedragdest.hg, treemodelfilter.hg, treemodel.hg, treepath.hg, + treeview.hg, widget.hg, window.hg, pango/src/attributes.hg, + pango_docs_override.xml + +2004-03-07 Murray Cumming + + * Regenerated *_docs.xml files for atk, gdk, pango, and gtkmm, + because Hagen Moebius improved the docextract_to_xml.py script. + +2004-04-07 Hagen Moebius + + * added documentation to gtk/src/viewport.hg, gtk/src/toolbutton.hg, + gtk/src/toggletoolbutton.hg, gtk/src/separatortoolitem.hg and + gtk/src/range.hg. Fixed a spelling error in gtk/src/radiotoolbutton.hg. + All documentation copy/pasted from Gtk+, so still room for imrovement. + +2004-04-06 Hagen Moebius + + * modified docs/reference/Makefile.am to support a more general output + of doxygen warnings/errors. + +2004-03-06 Murray Cumming + + * gtk/src/gtk_signals.defs: Added the new RadioMenuItem::group_changed + signal. + +2004-03-06 Murray Cumming + + * gtk/src/filechooser.hg: set_current_folder(), + set_current_folder_uri(), select_filename(), select_uri(), + set_filename(), and set_uri() now return bools, because GTK+ now + does this. + +2004-03-06 Murray Cumming + + * gtk/src/gtk_methods.defs: regenerated. + * gtk/src/gtk_docs.xml: regenerated. + +2004-03-05 Hagen Moebius + + * added missing documentation to gtk/src/expander.hg, + gtk/src/filechooserwidget.hg, gtk/src/fontbutton.hg, + gtk/src/imagemenuitem.hg, gtk/src/radiotoolbutton.hg. Mainly + class documentation, some non-Gtk+ function and some constructors. + +2004-03-05 Hagen Moebius + + * gtk/src/colorbutton.hg: added missing documentation to some functions. + +2004-03-05 Murray Cumming + + * gtk/src/radiobutton.hg, radiomenuitem.hg: Wrap the group_changed + signals now that they are corrected in GTK+. + * gtk/src/filechooser.hg: Correct the set_local_only() parameter name + to match the one in GTK+, as spotted by Matthew Walton. + +2.3.5: + +2004-03-03 Bryan Forbes + + * gtk/src/toolbar.[hg|ccg]: added methods to append, prepend, and + insert with a sigc::slot. + * examples/stock/stock.cc: use new append method to append with a slot; + added a toggle button to prove that there are no ambiguity problems + with the new methods. + +2004-03-02 Bryan Forbes + + * gtk/src/toolbar.[hg|ccg]: removed old STL-stlye API (deprecated and + can't co-exist with new API). + * gtk/gtkmm/toolbar_elements.[h|cc]: removed these files to get rid of + all old API for Gtk::Toolbar. + * gtk/gtkmm/Makefile.am: removed toolbar_elements.[h|cc] from list of + files to build, because it is only needed by the old STL-style Toolbar + API. + +2004-03-03 Murray Cumming + + * gtk/src/radiobutton.hg, radiomenuitem.hg: Commented-out + the new group_changed signals until their declarations + are fixed in GTK+ - patch submitted. + +2004-03-03 Murray Cumming + + * pango/src/pango_methods.defs: Updated with h2defs.py. + * pango/fontface.[hg|ccg]: Added list_sizes(). + * pango/attriter.[hg|ccg]: Added get_attrs(). + * pango/fontfamily.hg: Added is_monospace(). + * pango/fontset.[hg|ccg]: Added foreach(). + * pango/language.hg: Added includes_script(). + * pango/layout: Added set/get_auto_dir(). + +2004-03-02 Murray Cumming + + * Updated gtk/src/gtk_signals.defs with tools/extra_defs_gen. + * gtk/src/cellrendererpixbuf.hg: Wrapped several new properties. + +2004-03-02 Murray Cumming + + * New GTK+ API wrapped: + * FileChooser: Added set/get_use_preview_label() and use_preview_label + property. + * Entry: Added set/get_alignment(). + * ComboBox: Added popup() and popdown(). + * Scale: Added get_layout() and get_layout_offsets(). + * Widget: Added add_mnemonic_labels(), remove_mnemonic_label(), and + list_mnemonic_labels(). + * ComboBoxEntry: Added a set_text_column() overload that takes a + ModelColumnBase instead of an int. + * Added ComboBoxEntryText, like ComboBoxText, as an equivalent for + gtk_combo_box_entry_new_text(). + * RadioButton, RadioMenuItem: Added group_changed signals. + * Widget: Added draw_insertion_cursor() as wrapper for + gtk_draw_insertion_cursor, which has a GtkWidget as the first + parameter. + * Updated gtk/src/gtk_methods.defs with h2defs.py + +2004-03-01 Murray Cumming + + * gtk/src/treeview.ccg: Corrected the implementation of + unset_expander_column() to reset_expander_column(), to fix the build. + +2004-02-29 Billy O'Connor + + * gtk/src/treeview.hg: Added documentation for Gtk::TreeView. + +2004-02-29 Murray Cumming + + * gtk/src/treeiter.[hg|ccg]: begins_tag(), ends_tag(), toggles_tag(), + has_tag(): Use a const parameter, and added method overloads with no + parameter, because the C functions can take a NULL. + * gtk/src/treemodel.[hg|ccg]: rows_reordered() now takes a + Glib::ArrayHandle instead of a int* array of unknown size. + * gtk/src/entrycompletion.hg: Added prepend_*() methods instead of + using a default arg for insert(). + * examples/book/entry: Moved the existing example into a simple + sub-directory, and added a completion sub-directory, demonstrating + Gtk::EntryCompletion. + +2004-02-29 Murray Cumming + + * gtk/src/treeselection.[hg|ccg]: Made selected_foreach() methods + const, because the slots are not allowed to change the model. But we + really need a TreeModel::const_iterator for this, and other things. + +2004-02-27 Bryan Forbes + + * gtk/src/filechooser.hg: removed the inclusion of gtk/gtkfilechooser.h + since it's included in the ccg. + +2004-02-27 Bryan Forbes + + * gtk/src/gtk_methods.defs: removed the set_folder_mode and get_folder_mode + methods as they are no longer in gtk+. + +2004-02-27 Murray Cumming + + * gtk/src/gtk_enums.defs: Added new FileChooser enum values, so that + set_action() is now a real replacement for set_folder_mode(). + * examples/book/dialogs/filechooser/: Updated to use set_action() + instead of set_folder_mode(), really fixin build. + +2004-02-27 Murray Cumming + + * gtk/src/filechooser.hg: Removed set_folder_mode() and + get_folder_mode() because they have been removed from GTK+. This fixes + the cvs build. + +2004-02-27 Murray Cumming + + * gtk/src/treepath.hg: append<>(): Corrected a typo that is detected by + gtk++ 3.4 prereleases and would have been detected before if this + template method had been used. Bug #131928 by Matthew Tuck. + +2004-02-26 Martin Schulze + + * More libsigc++ 2 changes: Some documentation fixes, updates in the + tutorial and tries to solve some issues in GtkMainConnectionNode. With + fixes from Bryan Forbes. + +2004-02-26 Bryan Forbes + + * configure.in: + * Makefile.am: added --enable-examples to configure to enable/disable the + building of the examples. + +2004-02-26 Murray Cumming + + * examples/book/treeview/tree/examplewindow.[h|cc]: Handle the TreeView + row_activated signal. + * gdk/src/display.hg: Add const overloads get_screen(), + get_default_screen(), list_devices(), get_event(), and peek_event(). + * gdk/src/iconinfo.ccg: Actually implement get_attach_points(), though + the implementation is incomplete - see the TODO in the code. + * gdk/src/iconinfo.hg: Add default parameter values for + set_raw_coordinates(). Make get_embedded_rect() and get_attach_points() + const. + * gdk/src/icontheme.hg: Add parameter names in get_for_screen() and + set_screen(). Made load_icon() and list_icons() const. + * gtk/src/widget.[hg|ccg]: Made drag_dest_find_target() const. + * gdk/src/treeiter: Added reverse_iterator and const_reverse_iterator, + though const_iterator and const_reverse_iterator are not really const + yet. Added suitable overloads of begin() and end(), and added rbegin() + and rend(). + * tools/m4/convert_gtk.m4: Added conversion needed by the above. + +2004-02-26 Bryan Forbes + + * examples/stock/stock.cc: fixed to use the new Toolbar API. + +2.5.4: + +2004-02-14 Murray Cumming + + * gtk/src/gtk_methods.defs: Updated with h2defs.py + * gtk/src/gtk_signals.defs: Updated with generate_extra_defs, keeping + hand-coded changes for the Widget _event signals. + * gtk/src/gtk_enums.defs: Updated with glibmm/tools/enums.pl. + * gdk/src/pixbufloader.hg: Added set_size() as wrapper for + gdk_pixbuf_loader_set_size(). + * gtk/src/cellrenderer.hg: Wrapped editing_cancelled() and the + editing_cancelled signal, for use by CellRenderer implementations. + * gtk/src/action.hg: Added get_visible(), get_sensitive(), + is_visible(), is_sensitive(). + * gtk/src/actiongroup.hg: Added set_sensitive(), set_visible(), + get_visible(), get_sensitive(). + * gtk/src/uimanager.hg: Wrapped the proxy_connected, + proxy_disconnected, pre_activate, and post_activate signals. + * gtk/src/widget.hg: Wrapped event_after signal. + +2004-02-11 Bryan Forbes + + * examples/cellrenderercustom/popupentry.cc: change to use Gtk::Requisition. + * examples/dnd/dndwindow.cc: change to use Gtk::AtomString::to_cpp_type. + * gdk/src/drawable.hg: changed the PangoGlyphString* arg to + Pango::GlyphString& since that argument is not an array. closes bug #97036 + * gdk/src/window.[ccg|hg]: changed methods that use GList* to a + Glib::ListHandle<>; wrote get_internal_paint_info by hand because we need a + temporary variable. + * gtk/gtkmm/stock.[cc|h]: added the new Authentication dialog stock icon. + * gtk/src/Makefile_list_of_hg.am_fragment: added new iconinfo.hg. + * gtk/src/filechooser.hg: changed the GSList* returned by get_uris() to a + Glib::SListHandle. + * gtk/src/iconinfo.[ccg|hg]: added new class to deal with GtkIconInfo. + * gtk/src/icontheme.[ccg|hg]: changed to use new IconInfo class; hand coded + get|set_search_path. + * gtk/src/window.hg: added property "role". + * tools/m4/convert_gtk.m4: added conversion for GtkIconInfo*->IconInfo. + +2.3.4: + +2004-02-13 Murray Cumming + + * examples/cellrendercustom/popup.cc: Get and use a string for the + target, to fix the build. + * gdk/src/dragcontext.hg: get_selection() is now const. + +2004-02-11 Matthew Walton + + * examples/book/dialogs/filechooserdialog/examplewindow.cc: + Add buttons, as you would need in a real example. + +2004-02-10 Bryan Forbes + + * tools/m4/convert_gtk.m4: added TargetFlags<->GtkTargetFlags, + IconLookupFlags<->GtkIconLookupFlags, and + IconThemeError<->GtkIconThemeError; added conversions for + IconTheme<->GtkIconTheme and TargetList<->GtkTargetList. + * gtk/gtkmm/targetentry.[cc|h]: use the TargetFlags enum. + * gtk/src/Makefile_list_of_hg.am_fragment: added icontheme.hg and + targetlist.hg. + * gtk/src/enums.hg: added TargetFlags enum. + * gtk/src/frame.hg: use Allocation instead of GtkAllocation. + * gtk/src/icontheme.[ccg|hg]: added IconTheme class. + * gtk/src/socket.hg: use Gdk::NativeWindow instead of GdkNativeWindow. + * gtk/src/targetlist.[ccg|hg]: added TargetList class. + * gtk/src/widget.[ccg|hg]: use the new TargetList class; typedef Requisition + and Allocation and convert methods to use them; use Glib::ustring instead of + GdkAtom where necessary; + * demos/gtk-demo/example_drawingarea.cc: + * examples/cellrenderercustom/cellrendererpopup.cc: changed to use new + Allocation API. + * examples/dnd/dndwindow.c: changed to use the new TargetFlag enum. + * fixed up as per murrayc's requests; closes bug #133936. + +2004-02-10 Bryan Forbes + + * tools/m4/convert_gdk.m4: added InputSource<->GdkInputSource, + Glib::ustring<->GdkAtom, and NativeWindow<->GdkNativeWindow. + * gdk/src/colormap.hg: Used Gdk::Color instead of GdkColor. + * gdk/src/device.hg: Wrapped GdkInputSource and used the new enum in + corresponding methods. + * gdk/src/display.[hg|ccg]: Used Glib::ustring instead of GdkAtom and + NativeWindow instead of GdkNativeWindow. + * gdk/src/dragcontext.[ccg|hg]: Used DragProtocol instead of + GdkDragProtocol; GdkAtom->Glib::ustring. + * gdk/src/event.[ccg|hg]: + * gdk/src/pixmap.[ccg|hg]: GdkNativeWindow->NativeWindow. + * gdk/src/types.[ccg|hg]: Added Gdk::AtomStringTraits struct back and + typedef'd it as AtomString; typedef'd GdkNativeWindow as Gdk::NativeWindow. + * gdk/src/window.hg: GdkGeometry->Geometry. + * fixed up as per murrayc's requests; closes bug #133933. + +2004-02-10 Murray Cumming + + * gtkmm now uses libsigc++ 2 as like glibmm, with slightly different + API. See bug #125061. We need to update CHANGES later. + +2.3.3: + +2004-01-31 Murray Cumming + + * gdk/src/window.hg, gtk/src/widget.hg: Used C++ Region type instead of + GdkRegion. Make Region& args const where appropriate. + * gtk/src/treedragsource.[hg|ccg]: Hand-coded the drag_get_data vfunc + so that it can use a C++ SelectionData& output parameter. + * gtk/src/selectiondata.[hg|ccg]: Added set() method with fewer + parameters, that calls get_target() to get the type(), like the + examples do. Hopefully that is sensible. + * gtk/src/celllayout.hg: Use C++ CellRenderer* instead of C + GtkCellRenderer for vfunc paramters. + * gtk/src/treeiter.[hg|ccg]: Added TreeIter::operator--(), which is + slow and which has no direct equivalent in GTK+ itself yet. + * Added lots of const ListHandle and SListHandle get methods, with + const elements. Fixes bug 126721. + + +2004-01-29 Murray Cumming + + * gtk/src/widget: The drag_data_get and selection_get signals now have + Gtk::SelectionData& return parameters instead of GtkSelectionData*. + This requires the latest glibmm, which has added the optional + custom_c_callback parameter for _WRAP_SIGNAL(). This required some + copy/paste/changed code in the .ccg files. + +2.3.2: + +2004-01-21 Murray Cumming + + * examples/book/treemodelcustom/exampletreemodel.[h|cc]: Wrote and + used some GlueItem and GlueList classes to better manage the + GtkTreeIter data. But at the moment, the old iters are never + invalidatated so this concept is not fully tested. + * gtk/src/treemodelfilter: Wrapped set_modify_func() after talking + to Kris about what it does. + +2004-01-19 Murray Cumming + + * gtk/src/liststore.[hg|ccg], gtk/src/treestore.[hg|ccg]: Added + set_model_columns() methods, as wrappers for + gtk_list_store_set_model_columns() and + gtk_tree_store_set_model_columns(). + * examples/book/treeview/drag_and_drop/dnd_treemodel.[h|cc]: Used + these methods with a non-static member ModelColumnRecord, so that + the ModelColumnRecord can be instantiated after the gtkmm type system. + Thanks to Bryan Forbes for pointing this out. + +2004-01-19 Takashi Takekawa + + * atk/src/text.hg, gtk/src/enums.hg: deleted unnecessary namespace + qualification, for the Intel compiler. Bug #131172. + +2004-01-19 Murray Cumming + + * gdk/src/drawable.[hg|ccg]: Added copy_to_image() as wrapper for + gdk_drawable_copy_to_image(). + * gtk/src/cellrenderertext.hg: Add a custom m4 conversion for the + Gdk::Drawable paramter of the render() vfunc, so that it takes + an extra reference. + +2004-01-16 Murray Cumming + + * */*.hg: All _WRAP_VFUNCS are now in protected sections, because + gmmproc no longer puts them in a separated protected section + automatically. Note also, that gmmproc now generates correct const + _vfuncs, so some of your overrides might no longer be overrides. Also, + you can add doxygen documentation before the _WRAP_VFUNC() macro now, + and it will be read by doxygen. + +2004-01-14 Murray Cumming + + * gtk/src/treeiter.[hg}ccg]: Added TreeIter::set_stamp() and + get_stamp(), with documentation, for use when implementing a + custom TreeModel. + * gtk/src/treemodel.[hg|ccg]: + - Hand-coded several vfuncs and their C callbacks, so that we can have + C++ iterators instead of GtkTreeIter*s in the API, and to reorder some + parameters. + - Added 2 extra vfuncs for information about root nodes. The C + versions of these vfuncs provide root node information when the iter + is NULL, but it is nicer in C++ to just have an extra vfunc without + that parameter. This requires an extra if() in the _vfunc_callback() + implementation. + - Added documentation for the vfuncs but gmmproc does not yet put the + documentation in the right place for the generated vfuncs. + * gtk/src/cellrenderer.hg: Added docuemntation for the vfuncs, but + gmmproc does not put this documentation in the right place yet. + * examples/: Added treemodelcustom to show a derived TreeModel, which + overrides those vfuncs, based on the example by Christof Pettig. + +2004-01-12 Murray Cumming + + * demos/gtk-demo/example_uimanager.cc: Removed extra comma to fix + build - patch by Billy O'Connor. + +2004-01-09 Murray Cumming + + * gtk/src/main.[hg|ccg]: Added docs, based on the C docs. Added bool + return value to iteration(). + * gtk/src/uimanager.hg: Added wrapper for get_toplevels(), as wrapper + for gtk_ui_manager_get_toplevels(). + * gtk/src/action.hg: add(): Use the new + gtk_action_group_add_action_with_accels() instead of + gtk_action_group_add_action() so that it tries to use the stock + accelerator if the action has a stock_id. + +2004-01-05 Murray Cumming + + * gdk/src/image.hg: Added accessors for public struct fields. + +2003-01-05 Eric Bourque + + * gtkmm.spec.in: added an unpackaged file (.devhelp) to the %files + section. + +2004-01-03 Murray Cumming + + * gdk/src/*.[hg|ccg]: Added class documentation, by copying it from the + C documentation. + * gdk/gdkmm/: Added rgb.[h|cc] with some global functions, wrapping + gdk_rgb_get_colormap(), gdk_rgb_get_visual() and gdk_rgb_ditherable(). + * gdk/src/color.hg: Documented all methods, apart from the hsv and hsl + stuff that is a mystery to me. + * gdk/src/colormap.hg: Added get_system() as a wrapper for + gdk_colormap_get_system(). + * gdk/src/device.hg: Added get_name(), get_source(), get_mode() and + get_has_cursor() as accessors for read-only struct fields. + * gdk/src/dragcontext.[hg|ccg]: Added get_targets() and documented it + and other accessors. + * gtk/src/liststore.hg, treestore.hg: Documented all methods. + * gtk/src/tree*.hg: Added lots of class and method documentation. + +2003-12-31 Murray Cumming + + * docs/reference/Makefile.am: Corrected generated .devhelp filename + so that it matches the pattern that devhelp looks for. + * docs/reference/doxygen_to_devhelp.xsl: Correct link prefix, so that + it links to the installed html documentation. + * gtk/gtkmm/accelmap.[h|cc]: Added lock_path() and unlock_path() as + wrappers for new GTK+ functions. Added documentation for all AccelMap + methods, based on the GTK+ docs. + * gtk/src/clipboard.[hg|ccg]: Added documentation, based on the C docs. + Added wait_for_targets(), as a wrapper for + gtk_clipboard_wait_for_targets(). Added a version of request_targets() + with a callback that takes a list of strings, as a wrapper for + gtk_clipboard_request_targets(), and deprecated the hacky one + with a callback that takes a SelectionData. + * atk/src/: Added Hyperlink, Hypertext, Document, and StreamableContent + * atk/src/atkobject.hg: Now inherits from the Hypertext interfaces as + well as the others. + * gtk/src/gtk_methods.defs: Updated from gtk+ with h2defs.py + +2003-12-30 Murray Cumming + + * docs/reference/Makefile.am: Use installed beautify_docs, instead + of a copy. + * configure.in: Use installed glibmm_check_perl() instead of a copy. + +2003-12-21 Murray Cumming + + * gtk/src/menushell.hg: Added cancel() as wrapper for + gtk_menu_shell_cancel(). + +2003-12-20 Murray Cumming + + * gtk/src/celllayout.hg: Wrapped reorder() method and vfunc. + * gtk/src/gtk_methods.defs and gdk/src/gdk_methods.defs: regenerated + with h2defs.pyt. + +2003-12-18 Murray Cumming + + * gdk/src/display.hg: Added set_double_click_distance() as wrapper + for gdk_display_set_double_click_distance(), though the .defs for + it are not there yet. + * gtk/src/settings.hg: Added double-click-distance property. + * gtk/src/button.hg: Added get/set_alignment() as wrapper for + gtk_button_get/set_alignment(), though the .defs are not there yet. + * pango/src/pangoline.hg: Added get_length(), get_start_index(), and + get_layout() as accessors for the public struct fields. + * gtk/src/cellrenderertext.hg: Wrapped the new single-paragraph-mode + property. + +2003-12-13 Murray Cumming + + * docs/reference/Makefile.am: Make sure that gtkmm2.devhelp is + generated before trying to install it. Added a doxygen-warnings + target that outputs the doxygen log to doyxgen_warnings.txt. + * gdk/src/window.hg: Added get_group(), as a wrapper for + gdk_window_get_group(), and set_accept_focus() as wrapper for + gdk_window_set_accept_focus(). + * gdk/src/display.hg: Added get_default_group(), as wrapper for + gdk_display_get_default_group(). + +2.3.1: + +2003-12-08 Murray Cumming + + * gtk/src/gtk_methods.defs: Regenerated with h2defs.py. + * gtk/src/combobox.hg: Corrected C function name in _WRAP_CONSTRUCT, + so that the constructor is actually generated. + * gtk/src/comboboxentry.hg: Added set_text_column() as wrapper + for gtk_combo_box_entry_set_text_column(). + * gtk/src/entrycompletion.[hg|ccg]: Wrapped match_selected signal, + unpleasantly, by hand-coding everything. + * gtk/src/filefilter.[hg|ccg]: Added add_custom() as wrapper for + gtk_file_filter_add_custom(), using a SignalProxy. + * gtk/src/menu: Added set_monitor() as wrapper for + gtk_menu_set_monitor(). + * gtk/src/treeviewcolumn.hg: Added get_cell_position() as a + wrapper for gtk_tree_view_column_cell_get_position(). + +2003-12-08 Murray Cumming + + * atk/atkmm/, pango/pangomm: Added init.[h|cc] so you can use + these libraries without using all of gtkmm. + +2003-12-06 Murray Cumming + + * gtk/src/radiotoolbutton.[hg|ccg]: Removed the constructor that + takes a RadioToolButton& group, because it looks like a copy + constructor. Added a constructor that takes a Widget& icon_group, + for consistency with the other ToolButton classes. + Bug 128484 (Billy O'Connor). + +2003-12-03 Murray Cumming + + * gtk/src/widget.hg: Wrapped get_accessible, screen_changed, and + can_activate_accel signals, though the .defs are not there for them + yet. + +2003-11-27 Murray Cumming + + * gtk/src/treemodel.hg: Added iter_is_valid(). Use the old TreeIter:: + operator bool() as a default implementation, but this is already + reimplemented in ListStore and TreeStore, using GTK+ functions. + * gtk/src/treeiter.hg: operator bool(): Use iter_is_valid() instead + of our hack. + +2003-11-23 Murray Cumming + + * gtk/src/radiotoolbutton.[hg|ccg]: Manually-implement constructors, + because the group is not a property. + * examples/book/toolbar: Use the new Toolbar API, to test it, though + this example should probably use the UIManager in future. + * gtk/gtkmm.h: Added the toolitem headers. + +2003-11-22 Murray Cumming + + * gtk/src/toolbar.[hg|ccg]: Deprecated ToolList. + * examples/Makefile.am_fragment: Added GTKMM_DISABLE_DEPRECATED to + examples build. + * gdk/src/pixbuf.[hg|ccg]: Wrapped get_formats(). + +2003-11-19 Murray Cumming + + * docs/reference/Makefile.am: Fix the distcheck for the .devhelp file. + * gtk/src/expander.hg: Add the get/set_markup methods, though there + are no .defs for them yet. + +2003-11-17 Murray Cumming + + * gtk/src/combobox.hg: Changed constructors, and added set_model(), + because the model is now a non-construct-only property in GTK+. + * gtk/gtkmm/comboboxtext.[h|cc]: Used changed API to implement this. + examples/book/combobox/text now works. + +2003-11-16 Murray Cumming + + * gtk/src/toolbar.[hg|cc]: Wrapped new functions, including the + ToolItem-based insert, append, and prepend, and deprecated our + equivalents of the deprecated C functions. + Moved deprecated Elements API into toolbar_elements.[h|cc]. + * gtk/src/gtk_docs.xml: Replaced with freshly generated output + from docextract_to_xml.py from pygtk. + * Added gdk/src/pixbufformat.[hg|ccg] as wrapper for GdkPixbufFormat. + +2003-11-14 Murray Cumming + + * gdk/src/gdk_docs_override.xml, gtk/src/gtk_docs_override.xm, + pango/src/pango_docs_override.xml. Added overrides for 4 or 5 methods + that mention Glib::Free, though I feel sure that I did this once + before. Bug #126870. + +2003-11-05 Murray Cumming + + * gtk/src/widget.hg, gdk/src/window.hg: Fixed typos to fix build. + +2003-11-03 Murray Cumming + + * gtk/src/action.[hg|ccg]: Renamed add_action() to add(), to reduce + the amount of client code slightly. + * gtk/src/celllayout.[hg|ccg]: Added set_cell_data_func(), using + SignalProxy. + * gtk/src/treemodelfilter.[hg|ccg]: + Added set_visible_func(), using SignalProxy. + Added convert methods. + + +2003-11-02 Murray Cumming + + * gtk/src/*action.[hg|ccg]: renamed create_from_stock() to + create() because I think we can overload the methods, because the + parameters are distinguishable. + * examples/book/dialogs/: Added filechooserdialog, by copying and + modifying the fileselectiondialog example. + * gtk/src/entrycompletion.[hg|ccg]: wrap set_match_func() using + SignalProxy. + +2003-11-01 Murray Cumming + + * gtk/src/: Added wrappers for FileChooser, FileChooserWidget, + FileChooserDialog and FileFilter. FileChooser is an interface + but I see no way to override it. + * Wrapped some more signals and vfuncs. + +2003-10-31 Murray Cumming + + * docs/index.html: Corrected links to glibmm docs, using relative + links. + +2003-10-30 Murray Cumming + + * gtk/src/toolitem.hg: Removed get/set_pack_end() now that they are + removed from GTK+, to fix the CVS build. + * docs/Makefile.am_fragment: Install docs to gtkmm-2.4 directory + instead of gtkmm-2.3. + * docs/reference/Makefile.am: Add installdox rule to make the + reference html link to the glibmm docs when they are installed. + +2003-10-26 Murray Cumming + + * Dealt with several //TODO comments, adding several unset_*() methods + * *Action: Changed create() to create_from_stock() and create. + * ToggleAction: create() methods: Added bool is_active parameter. + * RadioAction: create() methods: Added group parameter. + * Added gtk/gtkmm/radiobuttongroup.[h|cc] containing + Gtk::RadioButtonGroup. This was previously in the Gtk::Menu_Helpers + namespace. It now works with RadioActions as well as the 3 other + Radio item classes. + * Added examples/combobox/complex, showing a custom tree model, + +2.3.0: + +2003-10-24 Murray Cumming + + * gtk/src/gtk_signals.defs: regenerated, keeping hand-coded changes, + after adding some extra GTypes to tools/extra_defs_gen. + * gkt/gtkmm: Added cellrenderer_generation.[h|cc], with some of the + templates and template specialisations previously in + treeviewcolumn.[hg|ccg]. This allowed them to be reused in + gtk/src/celllayout.hg for a pack_start(model column) template. + * demos/gtk-demo/: Added example_ui_manager.cc - a C++ version of + the C one. + +2003-10-22 Murray Cumming + + * Added wrappers for GtkToolItem, ToolButton, ToggleButton, + RadioToolButton. + +2003-10-17 Murray Cumming + + * gtk/src/combobox.hg: Updated for latest API. + * Added gtk/gtkmm/comboboxtext.[h|cc], putting text-based stuff + in a sub class. + * gtk/src/treemodel.[hg|ccg]: Added const overload of children(), + but it's a bad hack that needs more attention. + * Added examples/book/combobox, which uses ComboBoxText and should use + ComboBox also in future. It segfaults at the moment. + * Added gtk/src/toggleaction.[hg|ccg] and gtk/src/radioaction.hg. + * Wrapped GList* and GSList*-using methods. + * UIManager: Wrapped Error-using methods, with optional errthrow + parameter of _WRAP_METHOD(). + * gtk/src/gtk_signals.defs: Updated with newly-generated defs from + extra_defs_gen, redoing the by-hand corrections. + * examples/book/dialogs/colorselection, fontselection: Used + the buttons instead. This will be moved into the buttons folder + later. + * examples/book/dialogs/messagedialog: Updated for new constructor + API. + +2003-10-12 Murray Cumming + + * gtk/src/treemodel.hg: Comment-out wrapper for row-inserted + signal, until gtk+ bug 123923 has been dealt with, to prevent + treeview crash with GTK+ 2.3 + +2003-10-12 Murray Cumming + + * Added wrappers for new GTK+ classes: Action, ActionGroup, + CellLayout, ComboBox, ComboBoxEntry, ColorButton, EntryCompletion, + Expander, FontButton, UIManager, and a few extra methods and + properties. More API details in NEWS. + +2003-10-01 Murray Cumming + + * tools/m4/convert_gdk.m4: Correct the GdkDrawable conversion to + fix the build. + +2003-09-30 Murray Cumming + + * gtk/src/cellrenderer.hg, gtk/src/gtk_vfuncs.defs, + tools/m4/convert_gdk.m4: The CellRenderer render vfunc now takes a + Gdk::Drawable instead of a Gdk::Window, as per my recent change + in GTK+ in CVS. See bug #102405. + +2003-09-30 Murray Cumming + + * gtk/src/gtk_methods.defs: Updated with h2defs.py from GTK+ in cvs. + +2003-09-30 Murray Cumming + + * gtk/src/cellrenderer.hg, gtk/src/gtk_signals.defs: + Wrapped the CellRenderer::background-cell-* properties that seem + to have been added in GTK+ 2.2, but that we had not wrapped yet. + Bug #116803. + +2003-09-30 Murray Cumming + + * gtk/src/textbuffer.hg: get_selection_bounds() returns a bool + to say whether anything is selected. Bug #118459 + * gtk/src/widget.hg: get_style_property(): Parameter renamed to + avoid rare warning. Part of bug #117740. + +2003-09-28 Bradley Bell + + * gtk/src/notebook.hg, gtk/src/treeiter.ccg, gtk/src/treeiter.hg: + workarounds for inaccessible base bugs with latest gcc. + +2003-09-11 Cedric Gustin + + * atk/src/text.hg, gdk/src/display.hg, gdk/src/displaymanager.hg, + gdk/src/screen.hg, glib/glibmm/threadpool.cc, + gtk/src/clipboard.hg, gtk/src/treerowreference.hg, + gtk/src/widget.hg, gtk/src/window.hg : Removed a bunch of + _GTKMMPROC_SIGNAL_H_AND_CC(#ifndef G_OS_WIN32) restrictions. These + functions are now implemented in the latest (2.2.4) GTK+ on win32. + * gdk/src/Makefile_list_of_hg.am_fragment, + gtk/src/Makefile_list_of_hg.am_fragment : Adapted Makefile.am's + accordingly. In particular, Gtk::Clipboard is now supported on + win32. + * README.win32 : Updated list of unsupported functions. + +2003-09-04 Bradley Bell + + * docs/reference/Makefile.am: Distribute doxygen tags + +2003-08-20 Murray Cumming + + * gdk/src/display.hg: Add refreturn WRAP_METHOD() parameter to + open() and open_default_libgtk_only(), because these seem to return + an existing instance rather than a new one. Should fix bug #119049. + +2003-08-20 Frank Naumann + + * demos/gtk-demo/example_treeview_editable_cells.cc, + examples/book/treeview/editable_cells/examplewindow.cc, + gtk/src/treeview.hg: Added workaround for MSVC++. + The MSVC++ now compile Gtk::TreeView::append_column_editable + and the result work as expected. An exact description + can be found in the treeview.h as comment. Removed + the no longer required MSVC++ workarounds from the + examples too. + +2003-08-11 Martin Schulze + + * gtk/src/treeview.hg, docs/tutorial/gtkmm-tut.xml: + Add information about what to do when the column type is not + supported and TreeView::append_column() sets up the CellRenderer + incompletely (bug #118922). + +2003-07-21 Murray Cumming + + * src/gtk/buttonbox.hg: Documentation: Corrected the switched + vertical/horizonal descriptions of VButtonBox and HButtonBox. + Bug #117883. + +2003-07-05 Murray Cumming + + * gtk/src/object.ccg Object::_init_unmanage(): + Don't g_object_ref() objects that are already not managed, such as + stuff used with Glib::Wrap() which is already in a container + (Containers sink (unfloat) child widgets after they are added). Also, + don't mark it as not manage()d, (!referenced_) of course. This was + doing one-too-many refs, so sometimes the objects would not be + finalized even if they were destroyed. Daniel Elstner found this + potential problem months ago and I should have listened to him. + This seems to fix the lifetime bug shown in tests/wrap_existing. I think this + fixes the get_toplevel_windows() leak shown in tests/refcount_dialog also. + Thanks to Harold Hopfes for doing _lots_ of investigation work on this bug. + * gtk/src/window.ccg: Window::_destroy_c_instance(): + Remove the g_object_unref() that was a window-specific fix for the + extra g_object_ref() in gtk/src/object.ccg above. + +2003-07-12 Murray Cumming + + * pango/src/pango_docs_override.xml, + gdk/src/gdk_docs_override.xml, + gtk/src/gtk_docs_override.xml: Added overrides for documentation + that talks about null pointer values where we use references. Added + TODOs in the .hg files to add unset() methods in 2.4 to support this + functionality. + +2003-07-03 Murray Cumming + + * Used %p and (void*) cast to various g_warning()s used when + --enable-debug-refcounting is used, avoiding compiler warnings. + * Added tests/wrap_existing, which shows a memory leak that we are + currently working on. + +2003-06-17 Murray Cumming + + * docs/FAQ/gtkmm_faq.xml: Applied patch from Andreas Rottman + mentioning libsigcx extension library. + +2003-06-13 Cedric Gustin + + * gtk/src/treeviewcolumn.hg: Added declaration of + generate_cellrenderer full class specialization for types bool and + Gdk::Pixbuf. This solves a long-standing bug with treeviews on + win32. Hopefully, it will also solve bug #113688 on Debian. + * demos/gtk-demo/example_stockbrowser.cc: Removed GTKMM_WIN32 + compiler directive. On win32, stock icons are not displayed as + expected in the first column of the treeview. + +2003-05-31 Murray Cumming + + * configure.in: Depends on GTK+ 2.3.0 now that GTK+ has branched, with + GTK+ 2.4 in HEAD. + * configure.in: gmmproc is now installed in a glibmm-2.3 folder + rather than a glibmm-2.4 folder. + * gtk/src/alignment.hg: Wrapped new padding functions and properties. + Wrote New in GTK+ 2.4 next to them. They need regenerated .defs files, + but we can do that later. + +2003-05-18 Murray Cumming + + * docs/tutorial/gtkmm-tut.xml: TreeView chapter: Replaced some TODOs + with short paragraphs. Added copies of the example screenshots to + show the list and tree models. + +2003-05-14 Murray Cumming + + * Applied some of MSVC++ .NET 2003 changes from jburris. For instance, + use of Gtk:: prefix with manage, because MSVC++ can not guess it. Also + corrected the out-of-sync protected/private modifiers in the private + gtype classes and their prototypes. + +2003-05-09 Murray Cumming + + * gtk/src/menushell.[hg|ccg] replace GP_LIST_CONTAINER_REMOVE() with + custom-written remove() and erase() MenuList methods, to ensure that + we unset the accel widget that we might have set in the MenuItem() + constructor. This avoids a memory leak due to the extra reference. + * gtk/src/accel_label.[hg|ccg]: Added unset_accel_widget(). + +2003-05-06 Enrico Costanza + + * gtk/src/image.hg: Added "refreturn" to _METHOD_WRAP for get_pixbuf + This fixes a bug that caused "(g_object_unref): assertion `G_IS_OBJECT + (object)' failed" + +2003-05-06 Murray Cumming + + * gtk/src/optionmenu.[hg|ccg]: Implemented a custom destructor which + calls remove_menu(), to prevent the menu (set with set_menu()), from + remembering a dead OptionMenu. See the comment in the destructor for + more details. + +2003-05-02 Murray Cumming + + * *.hg: Added namespace prefix to all StateType parameter types, + because there is one in Atk and in Gtk and that confuses Doxygen. + * demos/gtk-demo/example_change_display.cc: Commented-out some unused + method parameters, to avoid warnings. + +2003-04-26 Gene Ruebsamen + + * docs/tutorial/gtkmm-tut.xml: Added a new appendix for win32 + with the cygwin/command-line portion contributed by Cedric Gustin. + Created a new link from the Installation section to point to the new appendix. + Also fixed the filename of the tutorial in the "Contributing" section. + * docs/tutorial/figures/devcpp_project_options.png: Added new image for the new win32 appendix described above. + +2003-04-22 Murray Cumming + + * Install headers in x.3 directories instead of .4 because I noticed + that some are already there so it needed to be fixed, and, given the + current build files, it was easier to choose .3 than .4 (it is based + on the library names), and because it does not seem like such a bad + idea. + +2003-04-21 Murray Cumming + + * gtk/src/menushell.ccg: Added + GP_LIST_ITER(Glib::List_Cpp_Iterator + because the standard GP_LIST iterator seems to be useless. See bug + #110206. + +2003-04-21 Murray Cumming + + * examples/book/Makefile.am: Added idle directory. + * configure.in: Added examples/book/idle/Makefile. + +2003-03-30 Gene Ruebsamen + + * examples/book/timeout/timerexample.[cc,h]: update examples to + work with Gtkmm2. + * examples/book/idle/idleexample.[cc,h]: create new idle directory and + examples for Gtkmm2. + * docs/tutorial/gtkmm-tut.xml: update the idle/timeout chapter for + Gtkmm2 and modify to use the program listings in the examples/book/ + directories. + +2003-04-21 Oli Kessler + + * gtk/gtk_docs_override.xml, fixed docu bug in the function + gtk_window_set_default + +2003-04-15 Ole Laursen + + * gtk/src/widget.{cc,h}g: Added unset_fg/bg/font/text/base to + support unwrapped null pointer parameter to modify_fg/bg/.... + +2003-04-13 Ole Laursen + + * examples/cellrenderercustom/cellrendererpopup.cc: Switched to + using wrappers of grab_add and friends instead of using the C + functions. + + * gtk/src/main.ccg, gtk/src/main.hg: Removed commented wrapper of + grab_add and friends. + + * gtk/src/widget.ccg, gtk/src/widget.hg: Wrapped + gtk_grab_add()/remove()/get_current(). + +2003-03-30 Murray Cumming + + * gtk/gtk_docs_override.xml, likewise atk, pango: Added overrides for + docs that mention *_free() functions. + +2003-03-26 Martin Schulze + + * pango/src/attrlist.{ccg,hg}: AttrList::insert, + AttrList::insert_before, AttrList::change must pass a copy of + the attribute parameter into the c functions (should fix #109334). + +2003-03-22 Enrico Scholz + + * examples/Makefile.am_fragment: Added DESTDIR-support. + +2003-03-20 Ole Laursen + + * gtk/src/widget.hg: Applied patch from Detlef Reichl to add + protected set_window and set_allocation (#108484). + +2003-03-18 Cedric Gustin + + * Makefile.am : removed examples from DIST_SUBDIRS. + +2003-03-13 Sebastian Rittau + + * gdk/src/gc.hg: Added refreturn flag to both GC::get_screen() flavors. + Closes bug #108233. (With help by Sven Grottke.) + +2003-02-14 Bryan Forbes + + * gtk/src/accelgroup.hg: + * gtk/src/accellabel.hg: + * gtk/src/adjustment.hg: + * gtk/src/alignment.hg: + * gtk/src/arrow.hg: + * gtk/src/aspectframe.hg: + * gtk/src/bin.hg: Added documentation for constructors and + _MEMBER_GET() wrappers. + * gtk/src/box.hg: Added the PackOptions enum into the gtkmmEnums + group so it is now on the correct documentation page. + * gtk/src/enums.hg: Allow Doxygen to grab Gtk::AlignmentEnum (used in + alignment.hg and others) and added it to the gtkmmEnums group. + * gtk/src/gtk_docs_override.xml: Added documentation for methods + in accelgroup.hg, accellabel.hg, adjusment.hg, and arrow.hg. + +2003-01-27 Murray Cumming + + * gdk/src/display.hg: Used refreturn on get_default() and + get_core_pointer(), preventing segfaults. + +2003-01-27 Murray Cumming + + * Replaced use of RefPtr::is_null() with use of operator bool(). + +2003-01-24 Murray Cumming + + * gtk/gtkmm/menu_elems.cc: Element::Element(MenuItem): Use the + Glib::RefPtr<> constructor explicitly, for clarity, and do the + necessary extra ref - fixes lifetime bug 104194 + +2003-01-23 Murray Cumming + + * More TODOs: + - Gtk::Container: Removed const set_focus_chain(), added const + get_focus_chain(). + - Gtk::TreeDragSource::drag_data_get() and + Gtk::TreeDragDest::row_drag_possible() now use SelectionData + instead of GtkSelectionData. + +2003-01-23 Murray Cumming + + * Updated dnd examples for new signal signatures. + +2003-01-23 Murray Cumming + + * More use of Gdk::Device and Gtk::SelectionData. + +2003-01-22 Murray Cumming + + * Used _IGNORE_SIGNAL() on keybinding signals, though gmmproc still + complains about them. I founds these signals by grepping for + binding_entry_add_signal in the gtk+ source code. + * Dealt with various minor TODOs, adding const and using C++ types. + +2003-01-22 Murray Cumming + + * Rename GTKMM_ macros to GLIBMM_. + +2003-01-22 Murray Cumming + + * build_shared: Used the general/win32/posix variables used in + the gtkmm Makefile.ams, so that the libraries actually build. + * gtk/src/treepath.[hg|ccg]: Removed the TreePath(bool) override, as + suggested, because it broke the build, because we don't seem to set + gtkmm_COMPILATION. + * gtk/gtkmm/menu_elem.[h|cc]: It used the RefPtr::operator=() that we + removed because that operator=() shouldn't be used. Faked the behaviour + with an explict use of the constructor and a reference() for now, with + a TODO. + +2003-01-21 Murray Cumming + + * Changed library names: 1.4 -> 1.3 and 2.4 -> 2.3 so that they + can be unstable. + +2003-01-21 Murray Cumming + + * Copied and modified slightly the build_shared files from libgdamm, + to use the gmmproc from glibmm-2.4. + +2003-01-21 Murray Cumming + + * Changed library names: 1.0 -> 1.4 and 2.0 -> 2.4 + +See gtkmm 2.2 for previous ChangeLog entries. diff --git a/libs/gtkmm2/atk/SConscript b/libs/gtkmm2/atk/SConscript new file mode 100644 index 0000000000..f0f18d4d12 --- /dev/null +++ b/libs/gtkmm2/atk/SConscript @@ -0,0 +1,10 @@ +import glob + +atkmm_files = glob.glob('atkmm/*.cc') + +Import('env libraries') +atkmm = env.Copy() +atkmm.Merge([libraries['glibmm2'], libraries['gtk2'], libraries['sigc2'] ]) + +libatkmm = atkmm.StaticLibrary('atkmm', atkmm_files) +Default(libatkmm) diff --git a/libs/gtkmm2/atk/atkmm.h b/libs/gtkmm2/atk/atkmm.h new file mode 100644 index 0000000000..712664344f --- /dev/null +++ b/libs/gtkmm2/atk/atkmm.h @@ -0,0 +1,42 @@ +/* $Id$ */ + +/* atkmm - a C++ wrapper for the GLib toolkit + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _ATKMM_H +#define _ATKMM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* _ATKMM_H */ + diff --git a/libs/gtkmm2/atk/atkmm/action.cc b/libs/gtkmm2/atk/atkmm/action.cc new file mode 100644 index 0000000000..69a260463c --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/action.cc @@ -0,0 +1,481 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkAction* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Action_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Action_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_action_get_type(); + } + + return *this; +} + +void Action_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->do_action = &do_action_vfunc_callback; + klass->get_n_actions = &get_n_actions_vfunc_callback; + klass->get_description = &get_description_vfunc_callback; + klass->get_name = &get_name_vfunc_callback; + klass->get_keybinding = &get_keybinding_vfunc_callback; + klass->set_description = &set_description_vfunc_callback; +} + +gboolean Action_Class::do_action_vfunc_callback(AtkAction* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->do_action_vfunc(i +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->do_action) + return (*base->do_action)(self, i); + } + + typedef gboolean RType; + return RType(); +} + +gint Action_Class::get_n_actions_vfunc_callback(AtkAction* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_actions_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_n_actions) + return (*base->get_n_actions)(self); + } + + typedef gint RType; + return RType(); +} + +const gchar* Action_Class::get_description_vfunc_callback(AtkAction* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_description_vfunc(i +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_description) + return (*base->get_description)(self, i); + } + + typedef const gchar* RType; + return RType(); +} + +const gchar* Action_Class::get_name_vfunc_callback(AtkAction* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_name_vfunc(i +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_name) + return (*base->get_name)(self, i); + } + + typedef const gchar* RType; + return RType(); +} + +const gchar* Action_Class::get_keybinding_vfunc_callback(AtkAction* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_keybinding_vfunc(i +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_keybinding) + return (*base->get_keybinding)(self, i); + } + + typedef const gchar* RType; + return RType(); +} + +gboolean Action_Class::set_description_vfunc_callback(AtkAction* self, gint i, const gchar* desc) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_description_vfunc(i +, Glib::convert_const_gchar_ptr_to_ustring(desc) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_description) + return (*base->set_description)(self, i, desc); + } + + typedef gboolean RType; + return RType(); +} + + +Glib::ObjectBase* Action_Class::wrap_new(GObject* object) +{ + return new Action((AtkAction*)(object)); +} + + +/* The implementation: */ + +Action::Action() +: + Glib::Interface(action_class_.init()) +{} + +Action::Action(AtkAction* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Action::~Action() +{} + +// static +void Action::add_interface(GType gtype_implementer) +{ + action_class_.init().add_interface(gtype_implementer); +} + +Action::CppClassType Action::action_class_; // initialize static member + +GType Action::get_type() +{ + return action_class_.init().get_type(); +} + +GType Action::get_base_type() +{ + return atk_action_get_type(); +} + + +bool Action::do_action(int i) +{ + return atk_action_do_action(gobj(), i); +} + +int Action::get_n_actions() const +{ + return atk_action_get_n_actions(const_cast(gobj())); +} + +Glib::ustring Action::get_description(int i) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_description(const_cast(gobj()), i)); +} + +Glib::ustring Action::get_name(int i) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_name(const_cast(gobj()), i)); +} + +Glib::ustring Action::get_keybinding(int i) +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_keybinding(gobj(), i)); +} + +bool Action::set_description(int i, const Glib::ustring& desc) +{ + return atk_action_set_description(gobj(), i, desc.c_str()); +} + +Glib::ustring Action::get_localized_name(int i) +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_localized_name(gobj(), i)); +} + + +bool Atk::Action::do_action_vfunc(int i) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->do_action) + return (*base->do_action)(gobj(),i); + + typedef bool RType; + return RType(); +} + +int Atk::Action::get_n_actions_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_n_actions) + return (*base->get_n_actions)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +const char* Atk::Action::get_description_vfunc(int i) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_description) + return (*base->get_description)(const_cast(gobj()),i); + + typedef const char* RType; + return RType(); +} + +const char* Atk::Action::get_name_vfunc(int i) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_name) + return (*base->get_name)(const_cast(gobj()),i); + + typedef const char* RType; + return RType(); +} + +const char* Atk::Action::get_keybinding_vfunc(int i) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_keybinding) + return (*base->get_keybinding)(const_cast(gobj()),i); + + typedef const char* RType; + return RType(); +} + +bool Atk::Action::set_description_vfunc(int i, const Glib::ustring& desc) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_description) + return (*base->set_description)(gobj(),i,desc.c_str()); + + typedef bool RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/action.h b/libs/gtkmm2/atk/atkmm/action.h new file mode 100644 index 0000000000..af8a131378 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/action.h @@ -0,0 +1,193 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_ACTION_H +#define _ATKMM_ACTION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _AtkActionIface AtkActionIface; } +#endif + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkAction AtkAction; +typedef struct _AtkActionClass AtkActionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Action_Class; } // namespace Atk +namespace Atk +{ + +/** The ATK interface provided by UI components which the user can activate/interact with, + * This should be implemented by instances of Atk::Object classes with which the user can interact directly, i.e. buttons, + * checkboxes, scrollbars, e.g. components which are not "passive" providers of UI information. + * + * Exceptions: when the user interaction is already covered by another appropriate interface such as Atk::EditableText + * (insert/delete test, etc.) or Atk::Value (set value) then these actions should not be exposed by Atk::Action as well. + * + * Also note that the Atk::Action API is limited in that parameters may not be passed to the object being activated; + * thus the action must be self-contained and specifiable via only a single "verb". Concrete examples include "press", + * "release", "click" for buttons, "drag" (meaning initiate drag) and "drop" for drag sources and drop targets, etc. + * + * Though most UI interactions on components should be invocable via keyboard as well as mouse, there will generally be + * a close mapping between "mouse actions" that are possible on a component and the Atk::Actions. Where mouse and keyboard + * actions are redundant in effect, Atk::Action should expose only one action rather than exposing redundant actions if + * possible. By convention we have been using "mouse centric" terminology for Atk::Action names. + */ + +class Action : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Action CppObjectType; + typedef Action_Class CppClassType; + typedef AtkAction BaseObjectType; + typedef AtkActionIface BaseClassType; + +private: + friend class Action_Class; + static CppClassType action_class_; + + // noncopyable + Action(const Action&); + Action& operator=(const Action&); + +protected: + Action(); // you must derive from this class + explicit Action(AtkAction* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Action(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkAction* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkAction* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + + /** Perform the specified action on the object. + * @param i The action index corresponding to the action to be performed. + * @return true if success, false otherwise. + */ + bool do_action(int i); + + /** Gets the number of accessible actions available on the object. + * If there are more than one, the first one is considered the + * "default" action of the object. + * @return A the number of actions, or 0 if @a action does not + * implement this interface. + */ + int get_n_actions() const; + + /** Returns a description of the specified action of the object. + * @param i The action index corresponding to the action to be performed. + * @return A description string, or 0 + * if @a action does not implement this interface. + */ + Glib::ustring get_description(int i) const; + + /** Returns the name of the specified action of the object. + * @param i The action index corresponding to the action to be performed. + * @return A name string, or an empty string if @a action does not implement this interface. + */ + Glib::ustring get_name(int i) const; + + /** Returns a keybinding associated with this action, if one exists. + * @param i The action index corresponding to the action to be performed. + * @return A string representing the keybinding, or an empty string + * if there is no keybinding for this action. + */ + Glib::ustring get_keybinding(int i); + + /** Sets a description of the specified action of the object. + * @param i The action index corresponding to the action to be performed. + * @param desc The description to be assigned to this action. + * @return A bool representing if the description was successfully set;. + */ + bool set_description(int i, const Glib::ustring& desc); + + /** Returns the localized name of the specified action of the object. + * @param i The action index corresponding to the action to be performed. + * @return A name string, or an empty string + * if @a action does not implement this interface. + */ + Glib::ustring get_localized_name(int i); + +protected: + virtual bool do_action_vfunc(int i); + virtual int get_n_actions_vfunc() const; + virtual const char* get_description_vfunc(int i) const; + virtual const char* get_name_vfunc(int i) const; + virtual const char* get_keybinding_vfunc(int i) const; + virtual bool set_description_vfunc(int i, const Glib::ustring& desc); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Action + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkAction* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_ACTION_H */ + diff --git a/libs/gtkmm2/atk/atkmm/component.cc b/libs/gtkmm2/atk/atkmm/component.cc new file mode 100644 index 0000000000..c4256e7699 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/component.cc @@ -0,0 +1,892 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return atk_coord_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return atk_layer_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkComponent* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Component_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Component_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_component_get_type(); + } + + return *this; +} + +void Component_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->add_focus_handler = &add_focus_handler_vfunc_callback; + klass->contains = &contains_vfunc_callback; + klass->ref_accessible_at_point = &ref_accessible_at_point_vfunc_callback; + klass->get_extents = &get_extents_vfunc_callback; + klass->get_position = &get_position_vfunc_callback; + klass->get_size = &get_size_vfunc_callback; + klass->get_layer = &get_layer_vfunc_callback; + klass->get_mdi_zorder = &get_mdi_zorder_vfunc_callback; + klass->grab_focus = &grab_focus_vfunc_callback; + klass->remove_focus_handler = &remove_focus_handler_vfunc_callback; + klass->set_extents = &set_extents_vfunc_callback; + klass->set_position = &set_position_vfunc_callback; + klass->set_size = &set_size_vfunc_callback; +} + +guint Component_Class::add_focus_handler_vfunc_callback(AtkComponent* self, AtkFocusHandler handler) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->add_focus_handler_vfunc(handler); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->add_focus_handler) + return (*base->add_focus_handler)(self, handler); + } + + typedef guint RType; + return RType(); +} + +gboolean Component_Class::contains_vfunc_callback(AtkComponent* self, gint x, gint y, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->contains_vfunc(x +, y +, ((CoordType)(coord_type)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->contains) + return (*base->contains)(self, x, y, coord_type); + } + + typedef gboolean RType; + return RType(); +} + +AtkObject* Component_Class::ref_accessible_at_point_vfunc_callback(AtkComponent* self, gint x, gint y, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap_copy(obj->get_accessible_at_point_vfunc(x +, y +, ((CoordType)(coord_type)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->ref_accessible_at_point) + return (*base->ref_accessible_at_point)(self, x, y, coord_type); + } + + typedef AtkObject* RType; + return RType(); +} + +void Component_Class::get_extents_vfunc_callback(AtkComponent* self, gint* x, gint* y, gint* width, gint* height, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_extents_vfunc(*(x) +, *(y) +, *(width) +, *(height) +, ((CoordType)(coord_type)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_extents) + (*base->get_extents)(self, x, y, width, height, coord_type); + } +} + +void Component_Class::get_position_vfunc_callback(AtkComponent* self, gint* x, gint* y, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_position_vfunc(*(x) +, *(y) +, ((CoordType)(coord_type)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_position) + (*base->get_position)(self, x, y, coord_type); + } +} + +void Component_Class::get_size_vfunc_callback(AtkComponent* self, gint* width, gint* height) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_size_vfunc(*(width) +, *(height) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_size) + (*base->get_size)(self, width, height); + } +} + +AtkLayer Component_Class::get_layer_vfunc_callback(AtkComponent* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return ((AtkLayer)(obj->get_layer_vfunc())); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_layer) + return (*base->get_layer)(self); + } + + typedef AtkLayer RType; + return RType(); +} + +gint Component_Class::get_mdi_zorder_vfunc_callback(AtkComponent* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_mdi_zorder_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_mdi_zorder) + return (*base->get_mdi_zorder)(self); + } + + typedef gint RType; + return RType(); +} + +gboolean Component_Class::grab_focus_vfunc_callback(AtkComponent* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->grab_focus_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->grab_focus) + return (*base->grab_focus)(self); + } + + typedef gboolean RType; + return RType(); +} + +void Component_Class::remove_focus_handler_vfunc_callback(AtkComponent* self, guint handler_id) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->remove_focus_handler_vfunc(handler_id); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_focus_handler) + (*base->remove_focus_handler)(self, handler_id); + } +} + +gboolean Component_Class::set_extents_vfunc_callback(AtkComponent* self, gint x, gint y, gint width, gint height, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_extents_vfunc(x +, y +, width +, height +, ((CoordType)(coord_type)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_extents) + return (*base->set_extents)(self, x, y, width, height, coord_type); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Component_Class::set_position_vfunc_callback(AtkComponent* self, gint x, gint y, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_position_vfunc(x +, y +, ((CoordType)(coord_type)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_position) + return (*base->set_position)(self, x, y, coord_type); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Component_Class::set_size_vfunc_callback(AtkComponent* self, gint width, gint height) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_size_vfunc(width +, height +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_size) + return (*base->set_size)(self, width, height); + } + + typedef gboolean RType; + return RType(); +} + + +Glib::ObjectBase* Component_Class::wrap_new(GObject* object) +{ + return new Component((AtkComponent*)(object)); +} + + +/* The implementation: */ + +Component::Component() +: + Glib::Interface(component_class_.init()) +{} + +Component::Component(AtkComponent* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Component::~Component() +{} + +// static +void Component::add_interface(GType gtype_implementer) +{ + component_class_.init().add_interface(gtype_implementer); +} + +Component::CppClassType Component::component_class_; // initialize static member + +GType Component::get_type() +{ + return component_class_.init().get_type(); +} + +GType Component::get_base_type() +{ + return atk_component_get_type(); +} + + +guint Component::add_focus_handler(AtkFocusHandler handler) +{ + return atk_component_add_focus_handler(gobj(), handler); +} + +bool Component::contains(int x, int y, CoordType coord_type) const +{ + return atk_component_contains(const_cast(gobj()), x, y, ((AtkCoordType)(coord_type))); +} + +Glib::RefPtr Component::get_accessible_at_point(int x, int y, CoordType coord_type) +{ + return Glib::wrap(atk_component_ref_accessible_at_point(gobj(), x, y, ((AtkCoordType)(coord_type)))); +} + +void Component::get_extents(int& x, int& y, int& width, int& height, CoordType coord_type) const +{ + atk_component_get_extents(const_cast(gobj()), &x, &y, &width, &height, ((AtkCoordType)(coord_type))); +} + +void Component::get_position(int& x, int& y, CoordType coord_type) const +{ + atk_component_get_position(const_cast(gobj()), &x, &y, ((AtkCoordType)(coord_type))); +} + +void Component::get_size(int& width, int& height) const +{ + atk_component_get_size(const_cast(gobj()), &width, &height); +} + +Layer Component::get_layer() const +{ + return ((Layer)(atk_component_get_layer(const_cast(gobj())))); +} + +int Component::get_mdi_zorder() const +{ + return atk_component_get_mdi_zorder(const_cast(gobj())); +} + +bool Component::grab_focus() +{ + return atk_component_grab_focus(gobj()); +} + +void Component::remove_focus_handler(guint handler_id) +{ + atk_component_remove_focus_handler(gobj(), handler_id); +} + +bool Component::set_extents(int x, int y, int width, int height, CoordType coord_type) +{ + return atk_component_set_extents(gobj(), x, y, width, height, ((AtkCoordType)(coord_type))); +} + +bool Component::set_position(int x, int y, CoordType coord_type) +{ + return atk_component_set_position(gobj(), x, y, ((AtkCoordType)(coord_type))); +} + +bool Component::set_size(int width, int height) +{ + return atk_component_set_size(gobj(), width, height); +} + + +guint Atk::Component::add_focus_handler_vfunc(AtkFocusHandler handler) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->add_focus_handler) + return (*base->add_focus_handler)(gobj(),handler); + + typedef guint RType; + return RType(); +} + +bool Atk::Component::contains_vfunc(int x, int y, CoordType coord_type) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->contains) + return (*base->contains)(const_cast(gobj()),x,y,((AtkCoordType)(coord_type))); + + typedef bool RType; + return RType(); +} + +Glib::RefPtr Atk::Component::get_accessible_at_point_vfunc(int x, int y, CoordType coord_type) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->ref_accessible_at_point) + return Glib::wrap((*base->ref_accessible_at_point)(gobj(),x,y,((AtkCoordType)(coord_type)))); + + typedef Glib::RefPtr RType; + return RType(); +} + +void Atk::Component::get_extents_vfunc(int& x, int& y, int& width, int& height, CoordType coord_type) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_extents) + (*base->get_extents)(const_cast(gobj()),&x,&y,&width,&height,((AtkCoordType)(coord_type))); +} + +void Atk::Component::get_position_vfunc(int& x, int& y, CoordType coord_type) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_position) + (*base->get_position)(const_cast(gobj()),&x,&y,((AtkCoordType)(coord_type))); +} + +void Atk::Component::get_size_vfunc(int& width, int& height) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_size) + (*base->get_size)(const_cast(gobj()),&width,&height); +} + +Layer Atk::Component::get_layer_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_layer) + return ((Layer)((*base->get_layer)(const_cast(gobj())))); + + typedef Layer RType; + return RType(); +} + +int Atk::Component::get_mdi_zorder_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_mdi_zorder) + return (*base->get_mdi_zorder)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +bool Atk::Component::grab_focus_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->grab_focus) + return (*base->grab_focus)(gobj()); + + typedef bool RType; + return RType(); +} + +void Atk::Component::remove_focus_handler_vfunc(guint handler_id) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_focus_handler) + (*base->remove_focus_handler)(gobj(),handler_id); +} + +bool Atk::Component::set_extents_vfunc(int x, int y, int width, int height, CoordType coord_type) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_extents) + return (*base->set_extents)(gobj(),x,y,width,height,((AtkCoordType)(coord_type))); + + typedef bool RType; + return RType(); +} + +bool Atk::Component::set_position_vfunc(int x, int y, CoordType coord_type) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_position) + return (*base->set_position)(gobj(),x,y,((AtkCoordType)(coord_type))); + + typedef bool RType; + return RType(); +} + +bool Atk::Component::set_size_vfunc(int width, int height) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_size) + return (*base->set_size)(gobj(),width,height); + + typedef bool RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/component.h b/libs/gtkmm2/atk/atkmm/component.h new file mode 100644 index 0000000000..889d626dae --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/component.h @@ -0,0 +1,331 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_COMPONENT_H +#define _ATKMM_COMPONENT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkComponentIface AtkComponentIface; + typedef struct _AtkObject AtkObject; + typedef void (* AtkFocusHandler) (AtkObject*, gboolean); +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkComponent AtkComponent; +typedef struct _AtkComponentClass AtkComponentClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Component_Class; } // namespace Atk +namespace Atk +{ + + +/** @addtogroup atkmmEnums Enums and Flags */ + +/** + * @ingroup atkmmEnums + */ +enum CoordType +{ + XY_SCREEN, + XY_WINDOW +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + +/** + * @ingroup atkmmEnums + */ +enum Layer +{ + LAYER_INVALID, + LAYER_BACKGROUND, + LAYER_CANVAS, + LAYER_WIDGET, + LAYER_MDI, + LAYER_POPUP, + LAYER_OVERLAY, + LAYER_WINDOW +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + + +class Object; + + +/** The ATK interface provided by UI components which occupy a physical area on the screen. + * This should be implemented by most if not all UI elements with an actual on-screen presence, i.e. components which + * can be said to have a screen-coordinate bounding box. Virtually all widgets will need to have Atk::Component + * implementations provided for their corresponding Atk::Object class. In short, only UI elements which are *not* GUI + * elements will omit this ATK interface. + * + * A possible exception might be textual information with a transparent background, in which case text glyph bounding + * box information is provided by Atk::Text. + */ + +class Component : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Component CppObjectType; + typedef Component_Class CppClassType; + typedef AtkComponent BaseObjectType; + typedef AtkComponentIface BaseClassType; + +private: + friend class Component_Class; + static CppClassType component_class_; + + // noncopyable + Component(const Component&); + Component& operator=(const Component&); + +protected: + Component(); // you must derive from this class + explicit Component(AtkComponent* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Component(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkComponent* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkComponent* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Add the specified handler to the set of functions to be called + * when this object receives focus events (in or out). If the handler is + * already added it is not added again + * @param handler The Atk::FocusHandler to be attached to @a component . + * @return A handler id which can be used in atk_component_remove_focus_handler + * or zero if the handler was already added. + */ + guint add_focus_handler(AtkFocusHandler handler); + + /** Checks whether the specified point is within the extent of the @a component . + * @param x X coordinate. + * @param y Y coordinate. + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + * @return true or false indicating whether the specified point is within + * the extent of the @a component or not. + */ + bool contains(int x, int y, CoordType coord_type) const; + + /** Gets a reference to the accessible child, if one exists, at the + * coordinate point specified by @a x and @a y . + * @param x X coordinate. + * @param y Y coordinate. + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + * @return A reference to the accessible child, if one exists. + */ + Glib::RefPtr get_accessible_at_point(int x, int y, CoordType coord_type); + + /** Gets the rectangle which gives the extent of the @a component . + * @param x Address of int to put x coordinate. + * @param y Address of int to put y coordinate. + * @param width Address of int to put width. + * @param height Address of int to put height. + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + */ + void get_extents(int& x, int& y, int& width, int& height, CoordType coord_type) const; + + /** Gets the position of @a component in the form of + * a point specifying @a component 's top-left corner. + * @param x Address of int to put x coordinate position. + * @param y Address of int to put y coordinate position. + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + */ + void get_position(int& x, int& y, CoordType coord_type) const; + + /** Gets the size of the @a component in terms of width and height. + * @param width Address of int to put width of @a component . + * @param height Address of int to put height of @a component . + */ + void get_size(int& width, int& height) const; + + /** Gets the layer of the component. + * @return An Atk::Layer which is the layer of the component. + */ + Layer get_layer() const; + + /** Gets the zorder of the component. The value G_MININT will be returned + * if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW. + * @return A int which is the zorder of the component, i.e. the depth at + * which the component is shown in relation to other components in the same + * container. + */ + int get_mdi_zorder() const; + + /** Grabs focus for this @a component . + * @return true if successful, false otherwise. + */ + bool grab_focus(); + + /** Remove the handler specified by @a handler_id from the list of + * functions to be executed when this object receives focus events + * (in or out). + * @param handler_id The handler id of the focus handler to be removed + * from @a component . + */ + void remove_focus_handler(guint handler_id); + + /** Sets the extents of @a component . + * @param x X coordinate. + * @param y Y coordinate. + * @param width Width to set for @a component . + * @param height Height to set for @a component . + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + * @return true or false whether the extents were set or not. + */ + bool set_extents(int x, int y, int width, int height, CoordType coord_type); + + /** Sets the postition of @a component . + * @param x X coordinate. + * @param y Y coordinate. + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + * @return true or false whether or not the position was set or not. + */ + bool set_position(int x, int y, CoordType coord_type); + + /** Set the size of the @a component in terms of width and height. + * @param width Width to set for @a component . + * @param height Height to set for @a component . + * @return true or false whether the size was set or not. + */ + bool set_size(int width, int height); + +protected: + virtual guint add_focus_handler_vfunc(AtkFocusHandler handler); + virtual bool contains_vfunc(int x, int y, CoordType coord_type) const; + + virtual Glib::RefPtr get_accessible_at_point_vfunc(int x, int y, CoordType coord_type); + + virtual void get_extents_vfunc(int& x, int& y, int& width, int& height, CoordType coord_type) const; + virtual void get_position_vfunc(int& x, int& y, CoordType coord_type) const; + virtual void get_size_vfunc(int& width, int& height) const; + virtual Layer get_layer_vfunc() const; + virtual int get_mdi_zorder_vfunc() const; + virtual bool grab_focus_vfunc(); + virtual void remove_focus_handler_vfunc(guint handler_id); + virtual bool set_extents_vfunc(int x, int y, int width, int height, CoordType coord_type); + virtual bool set_position_vfunc(int x, int y, CoordType coord_type); + virtual bool set_size_vfunc(int width, int height); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Component + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkComponent* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_COMPONENT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/document.cc b/libs/gtkmm2/atk/atkmm/document.cc new file mode 100644 index 0000000000..64946c6f84 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/document.cc @@ -0,0 +1,246 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Atk +{ + + +} // namespace Atk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkDocument* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Document_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Document_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_document_get_type(); + } + + return *this; +} + +void Document_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->get_document_type = &get_document_type_vfunc_callback; + klass->get_document = &get_document_vfunc_callback; +} + +const gchar* Document_Class::get_document_type_vfunc_callback(AtkDocument* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_document_type_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_document_type) + return (*base->get_document_type)(self); + } + + typedef const gchar* RType; + return RType(); +} + +gpointer Document_Class::get_document_vfunc_callback(AtkDocument* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_document_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_document) + return (*base->get_document)(self); + } + + typedef gpointer RType; + return RType(); +} + + +Glib::ObjectBase* Document_Class::wrap_new(GObject* object) +{ + return new Document((AtkDocument*)(object)); +} + + +/* The implementation: */ + +Document::Document() +: + Glib::Interface(document_class_.init()) +{} + +Document::Document(AtkDocument* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Document::~Document() +{} + +// static +void Document::add_interface(GType gtype_implementer) +{ + document_class_.init().add_interface(gtype_implementer); +} + +Document::CppClassType Document::document_class_; // initialize static member + +GType Document::get_type() +{ + return document_class_.init().get_type(); +} + +GType Document::get_base_type() +{ + return atk_document_get_type(); +} + + +Glib::ustring Document::get_document_type() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_document_get_document_type(const_cast(gobj()))); +} + +gpointer Document::get_document() +{ + return atk_document_get_document(gobj()); +} + + +const gchar* Atk::Document::get_document_type_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_document_type) + return (*base->get_document_type)(gobj()); + + typedef const gchar* RType; + return RType(); +} + +gpointer Atk::Document::get_document_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_document) + return (*base->get_document)(const_cast(gobj())); + + typedef gpointer RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/document.h b/libs/gtkmm2/atk/atkmm/document.h new file mode 100644 index 0000000000..71808475c3 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/document.h @@ -0,0 +1,145 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_DOCUMENT_H +#define _ATKMM_DOCUMENT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkDocumentIface AtkDocumentIface; + typedef struct _AtkDocument AtkDocument; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkDocument AtkDocument; +typedef struct _AtkDocumentClass AtkDocumentClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Document_Class; } // namespace Atk +namespace Atk +{ + +class Object; + +/** The ATK interface which allows access to a DOM associated with on object. + * This interface should be supported by any object that has an associated document object model (DOM). This interface + * provides the standard mechanism allowing an assistive technology access to the DOM. + */ + +class Document : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Document CppObjectType; + typedef Document_Class CppClassType; + typedef AtkDocument BaseObjectType; + typedef AtkDocumentIface BaseClassType; + +private: + friend class Document_Class; + static CppClassType document_class_; + + // noncopyable + Document(const Document&); + Document& operator=(const Document&); + +protected: + Document(); // you must derive from this class + explicit Document(AtkDocument* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Document(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkDocument* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkDocument* gobj() const { return reinterpret_cast(gobject_); } + +private: + +public: + + + /** Gets a string indicating the document type. + * @return A string indicating the document type. + */ + Glib::ustring get_document_type() const; + + /** Gets a %gpointer that points to an instance of the DOM. It is + * up to the caller to check atk_document_get_type to determine + * how to cast this pointer. + * @return A %gpointer that points to an instance of the DOM. + */ + gpointer get_document(); + +protected: + virtual const gchar* get_document_type_vfunc(); + virtual gpointer get_document_vfunc() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Document + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkDocument* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_DOCUMENT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/editabletext.cc b/libs/gtkmm2/atk/atkmm/editabletext.cc new file mode 100644 index 0000000000..10e58003b7 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/editabletext.cc @@ -0,0 +1,506 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkEditableText* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& EditableText_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &EditableText_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_editable_text_get_type(); + } + + return *this; +} + +void EditableText_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->set_run_attributes = &set_run_attributes_vfunc_callback; + klass->set_text_contents = &set_text_contents_vfunc_callback; + klass->insert_text = &insert_text_vfunc_callback; + klass->copy_text = ©_text_vfunc_callback; + klass->cut_text = &cut_text_vfunc_callback; + klass->delete_text = &delete_text_vfunc_callback; + klass->paste_text = &paste_text_vfunc_callback; +} + +gboolean EditableText_Class::set_run_attributes_vfunc_callback(AtkEditableText* self, AtkAttributeSet* attrib_set, gint start_offset, gint end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_run_attributes_vfunc(attrib_set, start_offset +, end_offset +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_run_attributes) + return (*base->set_run_attributes)(self, attrib_set, start_offset, end_offset); + } + + typedef gboolean RType; + return RType(); +} + +void EditableText_Class::set_text_contents_vfunc_callback(AtkEditableText* self, const gchar* string) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_text_contents_vfunc(Glib::convert_const_gchar_ptr_to_ustring(string) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_text_contents) + (*base->set_text_contents)(self, string); + } +} + +void EditableText_Class::insert_text_vfunc_callback(AtkEditableText* self, const gchar* string, gint length, gint* position) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->insert_text_vfunc(Glib::convert_const_gchar_ptr_to_ustring(string) +, length +, *(position) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->insert_text) + (*base->insert_text)(self, string, length, position); + } +} + +void EditableText_Class::copy_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->copy_text_vfunc(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->copy_text) + (*base->copy_text)(self, start_pos, end_pos); + } +} + +void EditableText_Class::cut_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->cut_text_vfunc(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->cut_text) + (*base->cut_text)(self, start_pos, end_pos); + } +} + +void EditableText_Class::delete_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->delete_text_vfunc(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->delete_text) + (*base->delete_text)(self, start_pos, end_pos); + } +} + +void EditableText_Class::paste_text_vfunc_callback(AtkEditableText* self, gint position) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->paste_text_vfunc(position +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->paste_text) + (*base->paste_text)(self, position); + } +} + + +Glib::ObjectBase* EditableText_Class::wrap_new(GObject* object) +{ + return new EditableText((AtkEditableText*)(object)); +} + + +/* The implementation: */ + +EditableText::EditableText() +: + Glib::Interface(editabletext_class_.init()) +{} + +EditableText::EditableText(AtkEditableText* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +EditableText::~EditableText() +{} + +// static +void EditableText::add_interface(GType gtype_implementer) +{ + editabletext_class_.init().add_interface(gtype_implementer); +} + +EditableText::CppClassType EditableText::editabletext_class_; // initialize static member + +GType EditableText::get_type() +{ + return editabletext_class_.init().get_type(); +} + +GType EditableText::get_base_type() +{ + return atk_editable_text_get_type(); +} + + +bool EditableText::set_run_attributes(const AttributeSet& attrib_set, int start_offset, int end_offset) +{ + return atk_editable_text_set_run_attributes(gobj(), (attrib_set).data(), start_offset, end_offset); +} + +void EditableText::set_text_contents(const Glib::ustring& string) +{ + atk_editable_text_set_text_contents(gobj(), string.c_str()); +} + +void EditableText::insert_text(const Glib::ustring& string, int length, int& position) +{ + atk_editable_text_insert_text(gobj(), string.c_str(), length, &position); +} + +void EditableText::copy_text(int start_pos, int end_pos) +{ + atk_editable_text_copy_text(gobj(), start_pos, end_pos); +} + +void EditableText::cut_text(int start_pos, int end_pos) +{ + atk_editable_text_cut_text(gobj(), start_pos, end_pos); +} + +void EditableText::delete_text(int start_pos, int end_pos) +{ + atk_editable_text_delete_text(gobj(), start_pos, end_pos); +} + +void EditableText::paste_text(int position) +{ + atk_editable_text_paste_text(gobj(), position); +} + + +bool Atk::EditableText::set_run_attributes_vfunc(AtkAttributeSet* attrib_set, int start_offset, int end_offset) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_run_attributes) + return (*base->set_run_attributes)(gobj(),attrib_set,start_offset,end_offset); + + typedef bool RType; + return RType(); +} + +void Atk::EditableText::set_text_contents_vfunc(const Glib::ustring& string) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_text_contents) + (*base->set_text_contents)(gobj(),string.c_str()); +} + +void Atk::EditableText::insert_text_vfunc(const Glib::ustring& string, int length, int& position) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->insert_text) + (*base->insert_text)(gobj(),string.c_str(),length,&position); +} + +void Atk::EditableText::copy_text_vfunc(int start_pos, int end_pos) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->copy_text) + (*base->copy_text)(gobj(),start_pos,end_pos); +} + +void Atk::EditableText::cut_text_vfunc(int start_pos, int end_pos) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->cut_text) + (*base->cut_text)(gobj(),start_pos,end_pos); +} + +void Atk::EditableText::delete_text_vfunc(int start_pos, int end_pos) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->delete_text) + (*base->delete_text)(gobj(),start_pos,end_pos); +} + +void Atk::EditableText::paste_text_vfunc(int position) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->paste_text) + (*base->paste_text)(gobj(),position); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/editabletext.h b/libs/gtkmm2/atk/atkmm/editabletext.h new file mode 100644 index 0000000000..233aa9e892 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/editabletext.h @@ -0,0 +1,193 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_EDITABLETEXT_H +#define _ATKMM_EDITABLETEXT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkEditableTextIface AtkEditableTextIface; + typedef struct _AtkEditableText AtkEditableText; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkEditableText AtkEditableText; +typedef struct _AtkEditableTextClass AtkEditableTextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class EditableText_Class; } // namespace Atk +namespace Atk +{ + +//TODO: I see no evidence that AtkEditableText is actually a subclass of AtkText, as the C docs say. murrayc. +/* The ATK interface implemented by components containing user-editable text content. + * This should be implemented by UI components which contain text which the user can edit, via the Atk::Object + * corresponding to that component (see Atk::Object). + * EditableText is a subclass of AtkText, and as such, an object which implements EditableText is by definition + * an Atk::Text implementor as well. + */ + +class EditableText : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef EditableText CppObjectType; + typedef EditableText_Class CppClassType; + typedef AtkEditableText BaseObjectType; + typedef AtkEditableTextIface BaseClassType; + +private: + friend class EditableText_Class; + static CppClassType editabletext_class_; + + // noncopyable + EditableText(const EditableText&); + EditableText& operator=(const EditableText&); + +protected: + EditableText(); // you must derive from this class + explicit EditableText(AtkEditableText* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~EditableText(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkEditableText* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkEditableText* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Sets the attributes for a specified range. See the ATK_ATTRIBUTE + * macros (such as Atk::ATTRIBUTE_LEFT_MARGIN) for examples of attributes + * that can be set. Note that other attributes that do not have corresponding + * ATK_ATTRIBUTE macros may also be set for certain text widgets. + * @param attrib_set An Atk::AttributeSet. + * @param start_offset Start of range in which to set attributes. + * @param end_offset End of range in which to set attributes. + * @return true if attributes successfully set for the specified + * range, otherwise false. + */ + bool set_run_attributes(const AttributeSet& attrib_set, int start_offset, int end_offset); + + /** Set text contents of @a text . + * @param string String to set for text contents of @a text . + */ + void set_text_contents(const Glib::ustring& string); + + /** Insert text at a given position. + * @param string The text to insert. + * @param length The length of text to insert, in bytes. + * @param position The caller initializes this to + * the position at which to insert the text. After the call it + * points at the position after the newly inserted text. + */ + void insert_text(const Glib::ustring& string, int length, int& position); + + /** Copy text from @a start_pos up to, but not including @a end_pos + * to the clipboard. + * @param start_pos Start position. + * @param end_pos End position. + */ + void copy_text(int start_pos, int end_pos); + + /** Copy text from @a start_pos up to, but not including @a end_pos + * to the clipboard and then delete from the widget. + * @param start_pos Start position. + * @param end_pos End position. + */ + void cut_text(int start_pos, int end_pos); + + /** Delete text @a start_pos up to, but not including @a end_pos . + * @param start_pos Start position. + * @param end_pos End position. + */ + void delete_text(int start_pos, int end_pos); + + /** Paste text from clipboard to specified @a position . + * @param position Position to paste. + */ + void paste_text(int position); + +protected: + virtual bool set_run_attributes_vfunc(AtkAttributeSet* attrib_set, int start_offset, int end_offset); + virtual void set_text_contents_vfunc(const Glib::ustring& string); + virtual void insert_text_vfunc(const Glib::ustring& string, int length, int& position); + virtual void copy_text_vfunc(int start_pos, int end_pos); + virtual void cut_text_vfunc(int start_pos, int end_pos); + virtual void delete_text_vfunc(int start_pos, int end_pos); + virtual void paste_text_vfunc(int position); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::EditableText + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkEditableText* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_EDITABLETEXT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/hyperlink.cc b/libs/gtkmm2/atk/atkmm/hyperlink.cc new file mode 100644 index 0000000000..d9e1050a7b --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/hyperlink.cc @@ -0,0 +1,681 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace Atk +{ + +} // namespace Atk + + +namespace +{ + +const Glib::SignalProxyInfo Hyperlink_signal_link_activated_info = +{ + "link_activated", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkHyperlink* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Hyperlink_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Hyperlink_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_hyperlink_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + Action::add_interface(get_type()); + } + + return *this; +} + +void Hyperlink_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->get_uri = &get_uri_vfunc_callback; + klass->get_object = &get_object_vfunc_callback; + klass->get_end_index = &get_end_index_vfunc_callback; + klass->get_start_index = &get_start_index_vfunc_callback; + klass->is_valid = &is_valid_vfunc_callback; + klass->get_n_anchors = &get_n_anchors_vfunc_callback; + klass->link_state = &link_state_vfunc_callback; + klass->is_selected_link = &is_selected_link_vfunc_callback; + klass->link_activated = &link_activated_callback; +} + +gchar* Hyperlink_Class::get_uri_vfunc_callback(AtkHyperlink* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_uri_vfunc(i +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_uri) + return (*base->get_uri)(self, i); + } + + typedef gchar* RType; + return RType(); +} + +AtkObject* Hyperlink_Class::get_object_vfunc_callback(AtkHyperlink* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->get_object_vfunc(i +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_object) + return (*base->get_object)(self, i); + } + + typedef AtkObject* RType; + return RType(); +} + +gint Hyperlink_Class::get_end_index_vfunc_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_end_index_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_end_index) + return (*base->get_end_index)(self); + } + + typedef gint RType; + return RType(); +} + +gint Hyperlink_Class::get_start_index_vfunc_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_start_index_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_start_index) + return (*base->get_start_index)(self); + } + + typedef gint RType; + return RType(); +} + +gboolean Hyperlink_Class::is_valid_vfunc_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->is_valid_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->is_valid) + return (*base->is_valid)(self); + } + + typedef gboolean RType; + return RType(); +} + +gint Hyperlink_Class::get_n_anchors_vfunc_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_anchors_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_n_anchors) + return (*base->get_n_anchors)(self); + } + + typedef gint RType; + return RType(); +} + +guint Hyperlink_Class::link_state_vfunc_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->link_state_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->link_state) + return (*base->link_state)(self); + } + + typedef guint RType; + return RType(); +} + +gboolean Hyperlink_Class::is_selected_link_vfunc_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->is_selected_link_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->is_selected_link) + return (*base->is_selected_link)(self); + } + + typedef gboolean RType; + return RType(); +} + + +void Hyperlink_Class::link_activated_callback(AtkHyperlink* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_link_activated(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->link_activated) + (*base->link_activated)(self); + } +} + + +Glib::ObjectBase* Hyperlink_Class::wrap_new(GObject* object) +{ + return new Hyperlink((AtkHyperlink*)object); +} + + +/* The implementation: */ + +AtkHyperlink* Hyperlink::gobj_copy() +{ + reference(); + return gobj(); +} + +Hyperlink::Hyperlink(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Hyperlink::Hyperlink(AtkHyperlink* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Hyperlink::~Hyperlink() +{} + + +Hyperlink::CppClassType Hyperlink::hyperlink_class_; // initialize static member + +GType Hyperlink::get_type() +{ + return hyperlink_class_.init().get_type(); +} + +GType Hyperlink::get_base_type() +{ + return atk_hyperlink_get_type(); +} + + +Glib::ustring Hyperlink::get_uri(int i) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(atk_hyperlink_get_uri(const_cast(gobj()), i)); +} + +Glib::RefPtr Hyperlink::get_object(int i) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_hyperlink_get_object(gobj(), i)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Hyperlink::get_object(int i) const +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_hyperlink_get_object(const_cast(gobj()), i)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Hyperlink::get_end_index() const +{ + return atk_hyperlink_get_end_index(const_cast(gobj())); +} + +int Hyperlink::get_start_index() const +{ + return atk_hyperlink_get_start_index(const_cast(gobj())); +} + +bool Hyperlink::is_valid() const +{ + return atk_hyperlink_is_valid(const_cast(gobj())); +} + +bool Hyperlink::is_inline() const +{ + return atk_hyperlink_is_inline(const_cast(gobj())); +} + +int Hyperlink::get_n_anchors() const +{ + return atk_hyperlink_get_n_anchors(const_cast(gobj())); +} + +bool Hyperlink::is_selected_link() const +{ + return atk_hyperlink_is_selected_link(const_cast(gobj())); +} + + +Glib::SignalProxy0< void > Hyperlink::signal_link_activated() +{ + return Glib::SignalProxy0< void >(this, &Hyperlink_signal_link_activated_info); +} + + +Glib::PropertyProxy_ReadOnly Hyperlink::property_selected_link() const +{ + return Glib::PropertyProxy_ReadOnly(this, "selected-link"); +} + +Glib::PropertyProxy_ReadOnly Hyperlink::property_number_of_anchors() const +{ + return Glib::PropertyProxy_ReadOnly(this, "number-of-anchors"); +} + +Glib::PropertyProxy_ReadOnly Hyperlink::property_end_index() const +{ + return Glib::PropertyProxy_ReadOnly(this, "end-index"); +} + +Glib::PropertyProxy_ReadOnly Hyperlink::property_start_index() const +{ + return Glib::PropertyProxy_ReadOnly(this, "start-index"); +} + + +void Atk::Hyperlink::on_link_activated() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->link_activated) + (*base->link_activated)(gobj()); +} + + +gchar* Atk::Hyperlink::get_uri_vfunc(int i) const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_uri) + return (*base->get_uri)(const_cast(gobj()),i); + + typedef gchar* RType; + return RType(); +} + +Glib::RefPtr Atk::Hyperlink::get_object_vfunc(int i) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_object) + return Glib::wrap((*base->get_object)(gobj(),i)); + + typedef Glib::RefPtr RType; + return RType(); +} + +int Atk::Hyperlink::get_end_index_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_end_index) + return (*base->get_end_index)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +int Atk::Hyperlink::get_start_index_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_start_index) + return (*base->get_start_index)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +bool Atk::Hyperlink::is_valid_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->is_valid) + return (*base->is_valid)(const_cast(gobj())); + + typedef bool RType; + return RType(); +} + +int Atk::Hyperlink::get_n_anchors_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_n_anchors) + return (*base->get_n_anchors)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +guint Atk::Hyperlink::link_state_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->link_state) + return (*base->link_state)(const_cast(gobj())); + + typedef guint RType; + return RType(); +} + +bool Atk::Hyperlink::is_selected_link_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->is_selected_link) + return (*base->is_selected_link)(const_cast(gobj())); + + typedef bool RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/hyperlink.h b/libs/gtkmm2/atk/atkmm/hyperlink.h new file mode 100644 index 0000000000..293137afb0 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/hyperlink.h @@ -0,0 +1,252 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_HYPERLINK_H +#define _ATKMM_HYPERLINK_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkHyperlink AtkHyperlink; +typedef struct _AtkHyperlinkClass AtkHyperlinkClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Hyperlink_Class; } // namespace Atk +namespace Atk +{ + +class Object; + +/* An ATK object which encapsulates a link or set of links in a hypertext document. + * It implements the AtkAction interface. + */ + +class Hyperlink + : public Glib::Object, + public Atk::Action +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Hyperlink CppObjectType; + typedef Hyperlink_Class CppClassType; + typedef AtkHyperlink BaseObjectType; + typedef AtkHyperlinkClass BaseClassType; + +private: friend class Hyperlink_Class; + static CppClassType hyperlink_class_; + +private: + // noncopyable + Hyperlink(const Hyperlink&); + Hyperlink& operator=(const Hyperlink&); + +protected: + explicit Hyperlink(const Glib::ConstructParams& construct_params); + explicit Hyperlink(AtkHyperlink* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Hyperlink(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkHyperlink* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkHyperlink* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkHyperlink* gobj_copy(); + +private: + + +protected: + +public: + + + /** Get a the URI associated with the anchor specified + * by @a i of @a link . + * + * Multiple anchors are primarily used by client-side image maps. + * @param i A (zero-index) integer specifying the desired anchor. + * @return A string specifying the URI. + */ + Glib::ustring get_uri(int i) const; + + + /** Returns the item associated with this hyperlinks nth anchor. + * For instance, the returned Atk::Object will implement Atk::Text + * if @a link is a text hyperlink, Atk::Image if @a link is an image + * hyperlink etc. + * + * Multiple anchors are primarily used by client-side image maps. + * @param i A (zero-index) integer specifying the desired anchor. + * @return An Atk::Object associated with this hyperlinks i-th anchor. + */ + Glib::RefPtr get_object(int i); + + /** Returns the item associated with this hyperlinks nth anchor. + * For instance, the returned Atk::Object will implement Atk::Text + * if @a link is a text hyperlink, Atk::Image if @a link is an image + * hyperlink etc. + * + * Multiple anchors are primarily used by client-side image maps. + * @param i A (zero-index) integer specifying the desired anchor. + * @return An Atk::Object associated with this hyperlinks i-th anchor. + */ + Glib::RefPtr get_object(int i) const; + + + /** Gets the index with the hypertext document at which this link ends. + * @return The index with the hypertext document at which this link ends. + */ + int get_end_index() const; + + + /** Gets the index with the hypertext document at which this link begins. + * @return The index with the hypertext document at which this link begins. + */ + int get_start_index() const; + + + /** Since the document that a link is associated with may have changed + * this method returns true if the link is still valid (with + * respect to the document it references) and false otherwise. + * @return Whether or not this link is still valid. + */ + bool is_valid() const; + + + /** Indicates whether the link currently displays some or all of its + * content inline. Ordinary HTML links will usually return + * false, but an inline <src> HTML element will return + * true. + * a * + * @return Whether or not this link displays its content inline. + */ + bool is_inline() const; + + + /** Gets the number of anchors associated with this hyperlink. + * @return The number of anchors associated with this hyperlink. + */ + int get_n_anchors() const; + + /** Determines whether this AtkHyperlink is selected + * @return True is the AtkHyperlink is selected, False otherwise. + */ + bool is_selected_link() const; + + + Glib::SignalProxy0< void > signal_link_activated(); + + + /** Specifies whether the AtkHyperlink object is selected. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_selected_link() const; + + + /** The number of anchors associated with the AtkHyperlink object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_number_of_anchors() const; + + + /** The end index of the AtkHyperlink object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_end_index() const; + + + /** The start index of the AtkHyperlink object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_start_index() const; + + +protected: + virtual gchar* get_uri_vfunc(int i) const; + virtual Glib::RefPtr get_object_vfunc(int i); + virtual int get_end_index_vfunc() const; + virtual int get_start_index_vfunc() const; + virtual bool is_valid_vfunc() const; + virtual int get_n_anchors_vfunc() const; + virtual guint link_state_vfunc() const; + virtual bool is_selected_link_vfunc() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_link_activated(); + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Hyperlink + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkHyperlink* object, bool take_copy = false); +} + + +#endif /* _ATKMM_HYPERLINK_H */ + diff --git a/libs/gtkmm2/atk/atkmm/hypertext.cc b/libs/gtkmm2/atk/atkmm/hypertext.cc new file mode 100644 index 0000000000..f383ba5e74 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/hypertext.cc @@ -0,0 +1,396 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Atk +{ + + +} // namespace Atk + + +namespace +{ + +void Hypertext_signal_link_selected_callback(AtkHypertext* self, gint p0,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Hypertext_signal_link_selected_info = +{ + "link_selected", + (GCallback) &Hypertext_signal_link_selected_callback, + (GCallback) &Hypertext_signal_link_selected_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkHypertext* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Hypertext_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Hypertext_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_hypertext_get_type(); + } + + return *this; +} + +void Hypertext_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->get_link = &get_link_vfunc_callback; + klass->get_n_links = &get_n_links_vfunc_callback; + klass->get_link_index = &get_link_index_vfunc_callback; + klass->link_selected = &link_selected_callback; +} + +AtkHyperlink* Hypertext_Class::get_link_vfunc_callback(AtkHypertext* self, gint link_index) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->get_link_vfunc(link_index +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_link) + return (*base->get_link)(self, link_index); + } + + typedef AtkHyperlink* RType; + return RType(); +} + +gint Hypertext_Class::get_n_links_vfunc_callback(AtkHypertext* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_links_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_n_links) + return (*base->get_n_links)(self); + } + + typedef gint RType; + return RType(); +} + +gint Hypertext_Class::get_link_index_vfunc_callback(AtkHypertext* self, gint char_index) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_link_index_vfunc(char_index +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_link_index) + return (*base->get_link_index)(self, char_index); + } + + typedef gint RType; + return RType(); +} + + +void Hypertext_Class::link_selected_callback(AtkHypertext* self, gint p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_link_selected(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->link_selected) + (*base->link_selected)(self, p0); + } +} + + +Glib::ObjectBase* Hypertext_Class::wrap_new(GObject* object) +{ + return new Hypertext((AtkHypertext*)(object)); +} + + +/* The implementation: */ + +Hypertext::Hypertext() +: + Glib::Interface(hypertext_class_.init()) +{} + +Hypertext::Hypertext(AtkHypertext* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Hypertext::~Hypertext() +{} + +// static +void Hypertext::add_interface(GType gtype_implementer) +{ + hypertext_class_.init().add_interface(gtype_implementer); +} + +Hypertext::CppClassType Hypertext::hypertext_class_; // initialize static member + +GType Hypertext::get_type() +{ + return hypertext_class_.init().get_type(); +} + +GType Hypertext::get_base_type() +{ + return atk_hypertext_get_type(); +} + + +Glib::RefPtr Hypertext::get_link(int link_index) +{ + return Glib::wrap(atk_hypertext_get_link(gobj(), link_index)); +} + +Glib::RefPtr Hypertext::get_link(int link_index) const +{ + return Glib::wrap(atk_hypertext_get_link(const_cast(gobj()), link_index)); +} + +int Hypertext::get_n_links() const +{ + return atk_hypertext_get_n_links(const_cast(gobj())); +} + +int Hypertext::get_link_index(int char_index) const +{ + return atk_hypertext_get_link_index(const_cast(gobj()), char_index); +} + + +Glib::SignalProxy1< void,int > Hypertext::signal_link_selected() +{ + return Glib::SignalProxy1< void,int >(this, &Hypertext_signal_link_selected_info); +} + + +void Atk::Hypertext::on_link_selected(int link_index) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->link_selected) + (*base->link_selected)(gobj(),link_index); +} + + +Glib::RefPtr Atk::Hypertext::get_link_vfunc(int link_index) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_link) + return Glib::wrap((*base->get_link)(gobj(),link_index)); + + typedef Glib::RefPtr RType; + return RType(); +} + +int Atk::Hypertext::get_n_links_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_n_links) + return (*base->get_n_links)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +int Atk::Hypertext::get_link_index_vfunc(int char_index) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_link_index) + return (*base->get_link_index)(const_cast(gobj()),char_index); + + typedef int RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/hypertext.h b/libs/gtkmm2/atk/atkmm/hypertext.h new file mode 100644 index 0000000000..090827662a --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/hypertext.h @@ -0,0 +1,167 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_HYPERTEXT_H +#define _ATKMM_HYPERTEXT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkHypertextIface AtkHypertextIface; + typedef struct _AtkHypertext AtkHypertext; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +/** The ATK interface which provides standard mechanism for manipulating hyperlinks. + */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkHypertext AtkHypertext; +typedef struct _AtkHypertextClass AtkHypertextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Hypertext_Class; } // namespace Atk +namespace Atk +{ + +class Object; + + +class Hypertext : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Hypertext CppObjectType; + typedef Hypertext_Class CppClassType; + typedef AtkHypertext BaseObjectType; + typedef AtkHypertextIface BaseClassType; + +private: + friend class Hypertext_Class; + static CppClassType hypertext_class_; + + // noncopyable + Hypertext(const Hypertext&); + Hypertext& operator=(const Hypertext&); + +protected: + Hypertext(); // you must derive from this class + explicit Hypertext(AtkHypertext* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Hypertext(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkHypertext* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkHypertext* gobj() const { return reinterpret_cast(gobject_); } + +private: + +public: + + + /** Gets the link in this hypertext document at index + * @a link_index + * @param link_index An integer specifying the desired link. + * @return The link in this hypertext document at + * index @a link_index . + */ + Glib::RefPtr get_link(int link_index); + + /** Gets the link in this hypertext document at index + * @a link_index + * @param link_index An integer specifying the desired link. + * @return The link in this hypertext document at + * index @a link_index . + */ + Glib::RefPtr get_link(int link_index) const; + + /** Gets the number of links within this hypertext document. + * @return The number of links within this hypertext document. + */ + int get_n_links() const; + + /** Gets the index into the array of hyperlinks that is associated with + * the character specified by @a char_index , or -1 if there is no hyperlink + * associated with this character. + * @param char_index A character index. + * @return An index into the array of hyperlinks in @a hypertext . + */ + int get_link_index(int char_index) const; + + + Glib::SignalProxy1< void,int > signal_link_selected(); + + + virtual Glib::RefPtr get_link_vfunc(int link_index); + virtual int get_n_links_vfunc() const; + virtual int get_link_index_vfunc(int char_index) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_link_selected(int link_index); + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Hypertext + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkHypertext* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_HYPERTEXT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/image.cc b/libs/gtkmm2/atk/atkmm/image.cc new file mode 100644 index 0000000000..2f1df28c18 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/image.cc @@ -0,0 +1,349 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkImage* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Image_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Image_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_image_get_type(); + } + + return *this; +} + +void Image_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->set_image_description = &set_image_description_vfunc_callback; + klass->get_image_description = &get_image_description_vfunc_callback; + klass->get_image_position = &get_image_position_vfunc_callback; + klass->get_image_size = &get_image_size_vfunc_callback; +} + +gboolean Image_Class::set_image_description_vfunc_callback(AtkImage* self, const gchar* description) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_image_description_vfunc(Glib::convert_const_gchar_ptr_to_ustring(description) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_image_description) + return (*base->set_image_description)(self, description); + } + + typedef gboolean RType; + return RType(); +} + +const gchar* Image_Class::get_image_description_vfunc_callback(AtkImage* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_image_description_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_image_description) + return (*base->get_image_description)(self); + } + + typedef const gchar* RType; + return RType(); +} + +void Image_Class::get_image_position_vfunc_callback(AtkImage* self, gint* x, gint* y, AtkCoordType coord_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_image_position_vfunc(*(x) +, *(y) +, ((CoordType)(coord_type)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_image_position) + (*base->get_image_position)(self, x, y, coord_type); + } +} + +void Image_Class::get_image_size_vfunc_callback(AtkImage* self, gint* width, gint* height) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_image_size_vfunc(*(width) +, *(height) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_image_size) + (*base->get_image_size)(self, width, height); + } +} + + +Glib::ObjectBase* Image_Class::wrap_new(GObject* object) +{ + return new Image((AtkImage*)(object)); +} + + +/* The implementation: */ + +Image::Image() +: + Glib::Interface(image_class_.init()) +{} + +Image::Image(AtkImage* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Image::~Image() +{} + +// static +void Image::add_interface(GType gtype_implementer) +{ + image_class_.init().add_interface(gtype_implementer); +} + +Image::CppClassType Image::image_class_; // initialize static member + +GType Image::get_type() +{ + return image_class_.init().get_type(); +} + +GType Image::get_base_type() +{ + return atk_image_get_type(); +} + + +bool Image::set_image_description(const Glib::ustring& description) +{ + return atk_image_set_image_description(gobj(), description.c_str()); +} + +Glib::ustring Image::get_image_description() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_image_get_image_description(const_cast(gobj()))); +} + +void Image::get_image_size(int& width, int& height) const +{ + atk_image_get_image_size(const_cast(gobj()), &width, &height); +} + +void Image::get_image_position(int& x, int& y, CoordType coord_type) const +{ + atk_image_get_image_position(const_cast(gobj()), &x, &y, ((AtkCoordType)(coord_type))); +} + + +bool Atk::Image::set_image_description_vfunc(const Glib::ustring& description) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_image_description) + return (*base->set_image_description)(gobj(),description.c_str()); + + typedef bool RType; + return RType(); +} + +const char* Atk::Image::get_image_description_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_image_description) + return (*base->get_image_description)(const_cast(gobj())); + + typedef const char* RType; + return RType(); +} + +void Atk::Image::get_image_position_vfunc(int& x, int& y, CoordType coord_type) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_image_position) + (*base->get_image_position)(const_cast(gobj()),&x,&y,((AtkCoordType)(coord_type))); +} + +void Atk::Image::get_image_size_vfunc(int& width, int& height) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_image_size) + (*base->get_image_size)(const_cast(gobj()),&width,&height); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/image.h b/libs/gtkmm2/atk/atkmm/image.h new file mode 100644 index 0000000000..a6af34884a --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/image.h @@ -0,0 +1,173 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_IMAGE_H +#define _ATKMM_IMAGE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include /* for Atk::CoordType */ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkImageIface AtkImageIface; + typedef struct _AtkImage AtkImage; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkImage AtkImage; +typedef struct _AtkImageClass AtkImageClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Image_Class; } // namespace Atk +namespace Atk +{ + +/** The ATK Interface implemented by components which expose image or pixmap content on-screen. + * This should be implemented by Atk::Object subtypes on behalf of components which display image/pixmap information + * onscreen, and which provide information (other than just widget borders, etc.) via that image content. For instance, + * icons, buttons with icons, toolbar elements, and image viewing panes typically should implement AtkImage. + * + * Atk::Image primarily provides two types of information: coordinate information (useful for screen review mode of + * screenreaders, and for use by onscreen magnifiers), and descriptive information. The descriptive information is + * provided for alternative, text-only presentation of the most significant information present in the image. + */ + +class Image : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Image CppObjectType; + typedef Image_Class CppClassType; + typedef AtkImage BaseObjectType; + typedef AtkImageIface BaseClassType; + +private: + friend class Image_Class; + static CppClassType image_class_; + + // noncopyable + Image(const Image&); + Image& operator=(const Image&); + +protected: + Image(); // you must derive from this class + explicit Image(AtkImage* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Image(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkImage* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkImage* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Sets the textual description for this image. + * @param description A string description to set for @a image . + * @return Boolean true, or false if operation could + * not be completed. + */ + bool set_image_description(const Glib::ustring& description); + + /** Get a textual description of this image. + * @return A string representing the image description. + */ + Glib::ustring get_image_description() const; + + + /** Get the width and height in pixels for the specified image. + * The values of @a width and @a height are returned as -1 if the + * values cannot be obtained. + * @param width Filled with the image width. + * @param height Filled with the image height. + */ + void get_image_size(int& width, int& height) const; + + /** Gets the position of the image in the form of a point specifying the + * images top-left corner. The values of @a x and @a y are returned as -1 + * if the values cannot be obtained. + * @param x Address of int to put x coordinate position. + * @param y Address of int to put y coordinate position. + * @param coord_type Specifies whether the coordinates are relative to the screen + * or to the components top level window. + */ + void get_image_position(int& x, int& y, CoordType coord_type) const; + +protected: + virtual bool set_image_description_vfunc(const Glib::ustring& description); + virtual const char* get_image_description_vfunc() const; + + virtual void get_image_position_vfunc(int& x, int& y, CoordType coord_type) const; + virtual void get_image_size_vfunc(int& width, int& height) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Image + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkImage* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_IMAGE_H */ + diff --git a/libs/gtkmm2/atk/atkmm/implementor.cc b/libs/gtkmm2/atk/atkmm/implementor.cc new file mode 100644 index 0000000000..303bf3d0a1 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/implementor.cc @@ -0,0 +1,175 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkImplementor* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Implementor_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Implementor_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_implementor_get_type(); + } + + return *this; +} + +void Implementor_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->ref_accessible = &ref_accessible_vfunc_callback; +} + +AtkObject* Implementor_Class::ref_accessible_vfunc_callback(AtkImplementor* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->ref_accessibile_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->ref_accessible) + return (*base->ref_accessible)(self); + } + + typedef AtkObject* RType; + return RType(); +} + + +Glib::ObjectBase* Implementor_Class::wrap_new(GObject* object) +{ + return new Implementor((AtkImplementor*)(object)); +} + + +/* The implementation: */ + +Implementor::Implementor() +: + Glib::Interface(implementor_class_.init()) +{} + +Implementor::Implementor(AtkImplementor* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Implementor::~Implementor() +{} + +// static +void Implementor::add_interface(GType gtype_implementer) +{ + implementor_class_.init().add_interface(gtype_implementer); +} + +Implementor::CppClassType Implementor::implementor_class_; // initialize static member + +GType Implementor::get_type() +{ + return implementor_class_.init().get_type(); +} + +GType Implementor::get_base_type() +{ + return atk_implementor_get_type(); +} + + +Glib::RefPtr Atk::Implementor::ref_accessibile_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->ref_accessible) + return Glib::wrap((*base->ref_accessible)(gobj())); + + typedef Glib::RefPtr RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/implementor.h b/libs/gtkmm2/atk/atkmm/implementor.h new file mode 100644 index 0000000000..7df786ce27 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/implementor.h @@ -0,0 +1,127 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_IMPLEMENTOR_H +#define _ATKMM_IMPLEMENTOR_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkImplementorIface AtkImplementorIface; + typedef struct _AtkImplementor AtkImplementor; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkImplementor AtkImplementor; +typedef struct _AtkImplementorClass AtkImplementorClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Implementor_Class; } // namespace Atk +namespace Atk +{ + + +class Implementor : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Implementor CppObjectType; + typedef Implementor_Class CppClassType; + typedef AtkImplementor BaseObjectType; + typedef AtkImplementorIface BaseClassType; + +private: + friend class Implementor_Class; + static CppClassType implementor_class_; + + // noncopyable + Implementor(const Implementor&); + Implementor& operator=(const Implementor&); + +protected: + Implementor(); // you must derive from this class + explicit Implementor(AtkImplementor* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Implementor(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkImplementor* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkImplementor* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +protected: + virtual Glib::RefPtr ref_accessibile_vfunc(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Implementor + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkImplementor* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_IMPLEMENTOR_H */ + diff --git a/libs/gtkmm2/atk/atkmm/init.cc b/libs/gtkmm2/atk/atkmm/init.cc new file mode 100644 index 0000000000..0b103a9b05 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/init.cc @@ -0,0 +1,34 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2003 The atkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Atk +{ + +void init() +{ + Glib::init(); + Atk::wrap_init(); +} + +} // namespace Atk + diff --git a/libs/gtkmm2/atk/atkmm/init.h b/libs/gtkmm2/atk/atkmm/init.h new file mode 100644 index 0000000000..05bdd07f34 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/init.h @@ -0,0 +1,40 @@ +// -*- c++ -*- +#ifndef _ATKMM_INIT_H +#define _ATKMM_INIT_H + +/* $Id$ */ + +/* Copyright (C) 2003 The atkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Atk +{ + +/** Initialize atkmm. + * You may call this more than once. + * You do not need to call this if you are using Gtk::Main, + * because it calls this for you. + */ +void init(); + +} // namespace Atk + + + +#endif // _ATKMM_INIT_H + + diff --git a/libs/gtkmm2/atk/atkmm/noopobject.cc b/libs/gtkmm2/atk/atkmm/noopobject.cc new file mode 100644 index 0000000000..c9c78627cd --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/noopobject.cc @@ -0,0 +1,132 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkNoOpObject* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& NoOpObject_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &NoOpObject_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_no_op_object_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + Component::add_interface(get_type()); + Action::add_interface(get_type()); + EditableText::add_interface(get_type()); + Image::add_interface(get_type()); + Selection::add_interface(get_type()); + Table::add_interface(get_type()); + Text::add_interface(get_type()); + Hypertext::add_interface(get_type()); + Value::add_interface(get_type()); + } + + return *this; +} + +void NoOpObject_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* NoOpObject_Class::wrap_new(GObject* object) +{ + return new NoOpObject((AtkNoOpObject*)object); +} + + +/* The implementation: */ + +AtkNoOpObject* NoOpObject::gobj_copy() +{ + reference(); + return gobj(); +} + +NoOpObject::NoOpObject(const Glib::ConstructParams& construct_params) +: + Atk::Object(construct_params) +{} + +NoOpObject::NoOpObject(AtkNoOpObject* castitem) +: + Atk::Object((AtkObject*)(castitem)) +{} + +NoOpObject::~NoOpObject() +{} + + +NoOpObject::CppClassType NoOpObject::noopobject_class_; // initialize static member + +GType NoOpObject::get_type() +{ + return noopobject_class_.init().get_type(); +} + +GType NoOpObject::get_base_type() +{ + return atk_no_op_object_get_type(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/noopobject.h b/libs/gtkmm2/atk/atkmm/noopobject.h new file mode 100644 index 0000000000..b5ee9bed0c --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/noopobject.h @@ -0,0 +1,143 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_NOOPOBJECT_H +#define _ATKMM_NOOPOBJECT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkNoOpObject AtkNoOpObject; +typedef struct _AtkNoOpObjectClass AtkNoOpObjectClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class NoOpObject_Class; } // namespace Atk +namespace Atk +{ + +/** An Atk::NoOpObject is an Atk::Object which purports to implement all ATK interfaces. + * It is the type of Atk::Object which is created if an accessible object is requested for an object type for which no + * factory type is specified. + */ + +class NoOpObject +: + public Atk::Object, + public Atk::Component, + public Atk::Action, + public Atk::EditableText, + public Atk::Image, + public Atk::Selection, + public Atk::Table, + public Atk::Text, + public Atk::Hypertext, + public Atk::Value +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef NoOpObject CppObjectType; + typedef NoOpObject_Class CppClassType; + typedef AtkNoOpObject BaseObjectType; + typedef AtkNoOpObjectClass BaseClassType; + +private: friend class NoOpObject_Class; + static CppClassType noopobject_class_; + +private: + // noncopyable + NoOpObject(const NoOpObject&); + NoOpObject& operator=(const NoOpObject&); + +protected: + explicit NoOpObject(const Glib::ConstructParams& construct_params); + explicit NoOpObject(AtkNoOpObject* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~NoOpObject(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkNoOpObject* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkNoOpObject* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkNoOpObject* gobj_copy(); + +private: + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + friend class Atk::Object_Class; +#endif + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::NoOpObject + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkNoOpObject* object, bool take_copy = false); +} + + +#endif /* _ATKMM_NOOPOBJECT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/object.cc b/libs/gtkmm2/atk/atkmm/object.cc new file mode 100644 index 0000000000..44e7301691 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/object.cc @@ -0,0 +1,834 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + + +namespace Atk +{ + +/* AtkObject is actually an abstract base class. So if this wrap_new() + * function is called, it means that no wrapper exists for the real C object. + * The problem is that gail (the real accessibility implementation) is + * currently not wrapped and will probably never be. Therefore, code like + * in the following example is doomed to fail: + * + * Gtk::Image image ("icon.png"); + * Glib::RefPtr accessible = Glib::RefPtr::cast_dynamic(image.get_accessible()); + * accessible->set_image_description("my icon"); + * + * This would segfault, even though the accessible object _does_ implement + * AtkImage. But Atk::Image is an interface class that can't be instantiated + * as is. It needs an object. + * + * The solution is to instantiate a dummy object that implements all of the + * ATK interfaces. Fortunately, ATK already provides us with such a thing, + * AtkNoOpObject. All widget accessible objects are of this type if the gail + * module is not loaded (which is the default). + * + * So what we do here is abusing Atk::NoOpObject to get around the lack of + * C++ wrappers for gail. Instead of instantiating a useless instance of an + * abstract base class, we just create a Atk::NoOpObject instance which can + * be casted to any of the Atk interface classes. + */ +Glib::ObjectBase* Object_Class::wrap_new(GObject* object) +{ + return new Atk::NoOpObject((AtkNoOpObject*) object); +} + +} // namespace Atk + + +namespace +{ + +void Object_signal_children_changed_callback(AtkObject* self, guint p0,gpointer p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,guint,gpointer > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0, p1); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Object_signal_children_changed_info = +{ + "children_changed", + (GCallback) &Object_signal_children_changed_callback, + (GCallback) &Object_signal_children_changed_callback +}; + + +void Object_signal_focus_event_callback(AtkObject* self, gboolean p0,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,bool > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Object_signal_focus_event_info = +{ + "focus_event", + (GCallback) &Object_signal_focus_event_callback, + (GCallback) &Object_signal_focus_event_callback +}; + + +void Object_signal_property_change_callback(AtkObject* self, AtkPropertyValues* p0,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,AtkPropertyValues* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Object_signal_property_change_info = +{ + "property_change", + (GCallback) &Object_signal_property_change_callback, + (GCallback) &Object_signal_property_change_callback +}; + + +void Object_signal_state_change_callback(AtkObject* self, const gchar* p0,gboolean p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,const Glib::ustring&,bool > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0) +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Object_signal_state_change_info = +{ + "state_change", + (GCallback) &Object_signal_state_change_callback, + (GCallback) &Object_signal_state_change_callback +}; + + +const Glib::SignalProxyInfo Object_signal_visible_data_changed_info = +{ + "visible_data_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void Object_signal_active_descendant_changed_callback(AtkObject* self, gpointer* p0,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,void** > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Object_signal_active_descendant_changed_info = +{ + "active_descendant_changed", + (GCallback) &Object_signal_active_descendant_changed_callback, + (GCallback) &Object_signal_active_descendant_changed_callback +}; + +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return atk_role_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkObject* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Object_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Object_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_object_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Object_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->children_changed = &children_changed_callback; + klass->focus_event = &focus_event_callback; + klass->property_change = &property_change_callback; + klass->state_change = &state_change_callback; + klass->visible_data_changed = &visible_data_changed_callback; + klass->active_descendant_changed = &active_descendant_changed_callback; +} + + +void Object_Class::children_changed_callback(AtkObject* self, guint p0, gpointer p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_children_changed(p0, p1); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->children_changed) + (*base->children_changed)(self, p0, p1); + } +} + +void Object_Class::focus_event_callback(AtkObject* self, gboolean p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_focus_event(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->focus_event) + (*base->focus_event)(self, p0); + } +} + +void Object_Class::property_change_callback(AtkObject* self, AtkPropertyValues* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_property_change(p0); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->property_change) + (*base->property_change)(self, p0); + } +} + +void Object_Class::state_change_callback(AtkObject* self, const gchar* p0, gboolean p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_state_change(Glib::convert_const_gchar_ptr_to_ustring(p0) +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->state_change) + (*base->state_change)(self, p0, p1); + } +} + +void Object_Class::visible_data_changed_callback(AtkObject* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_visible_data_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->visible_data_changed) + (*base->visible_data_changed)(self); + } +} + +void Object_Class::active_descendant_changed_callback(AtkObject* self, gpointer* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_active_descendant_changed(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->active_descendant_changed) + (*base->active_descendant_changed)(self, p0); + } +} + + +/* The implementation: */ + +AtkObject* Object::gobj_copy() +{ + reference(); + return gobj(); +} + +Object::Object(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Object::Object(AtkObject* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Object::~Object() +{} + + +Object::CppClassType Object::object_class_; // initialize static member + +GType Object::get_type() +{ + return object_class_.init().get_type(); +} + +GType Object::get_base_type() +{ + return atk_object_get_type(); +} + + +Glib::ustring Object::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_object_get_name(const_cast(gobj()))); +} + +Glib::ustring Object::get_description() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_object_get_description(const_cast(gobj()))); +} + +Glib::RefPtr Object::get_parent() +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_object_get_parent(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Object::get_n_accessible_children() const +{ + return atk_object_get_n_accessible_children(const_cast(gobj())); +} + +Glib::RefPtr Object::get_accessible_child(int i) +{ + return Glib::wrap(atk_object_ref_accessible_child(gobj(), i)); +} + +Glib::RefPtr Object::get_relation_set() +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_object_ref_relation_set(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Role Object::get_role() const +{ + return ((Role)(atk_object_get_role(const_cast(gobj())))); +} + +Glib::RefPtr Object::get_state_set() +{ + return Glib::wrap(atk_object_ref_state_set(gobj())); +} + +int Object::get_index_in_parent() +{ + return atk_object_get_index_in_parent(gobj()); +} + +void Object::set_name(const Glib::ustring& name) +{ + atk_object_set_name(gobj(), name.c_str()); +} + +void Object::set_description(const Glib::ustring& description) +{ + atk_object_set_description(gobj(), description.c_str()); +} + +void Object::set_parent(const Glib::RefPtr& parent) +{ + atk_object_set_parent(gobj(), Glib::unwrap(parent)); +} + +void Object::set_role(Role role) +{ + atk_object_set_role(gobj(), ((AtkRole)(role))); +} + +void Object::notify_state_change(State state, bool value) +{ + atk_object_notify_state_change(gobj(), state, static_cast(value)); +} + +bool Object::add_relationship(RelationType relationship, const Glib::RefPtr& target) +{ + return atk_object_add_relationship(gobj(), ((AtkRelationType)(relationship)), Glib::unwrap(target)); +} + +bool Object::remove_relationship(RelationType relationship, const Glib::RefPtr& target) +{ + return atk_object_remove_relationship(gobj(), ((AtkRelationType)(relationship)), Glib::unwrap(target)); +} + + +Glib::SignalProxy2< void,guint,gpointer > Object::signal_children_changed() +{ + return Glib::SignalProxy2< void,guint,gpointer >(this, &Object_signal_children_changed_info); +} + +Glib::SignalProxy1< void,bool > Object::signal_focus_event() +{ + return Glib::SignalProxy1< void,bool >(this, &Object_signal_focus_event_info); +} + +Glib::SignalProxy1< void,AtkPropertyValues* > Object::signal_property_change() +{ + return Glib::SignalProxy1< void,AtkPropertyValues* >(this, &Object_signal_property_change_info); +} + +Glib::SignalProxy2< void,const Glib::ustring&,bool > Object::signal_state_change() +{ + return Glib::SignalProxy2< void,const Glib::ustring&,bool >(this, &Object_signal_state_change_info); +} + +Glib::SignalProxy0< void > Object::signal_visible_data_changed() +{ + return Glib::SignalProxy0< void >(this, &Object_signal_visible_data_changed_info); +} + +Glib::SignalProxy1< void,void** > Object::signal_active_descendant_changed() +{ + return Glib::SignalProxy1< void,void** >(this, &Object_signal_active_descendant_changed_info); +} + + +Glib::PropertyProxy Object::property_accessible_name() +{ + return Glib::PropertyProxy(this, "accessible-name"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_name() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-name"); +} + +Glib::PropertyProxy Object::property_accessible_description() +{ + return Glib::PropertyProxy(this, "accessible-description"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_description() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-description"); +} + +Glib::PropertyProxy< Glib::RefPtr > Object::property_accessible_parent() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "accessible-parent"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Object::property_accessible_parent() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "accessible-parent"); +} + +Glib::PropertyProxy Object::property_accessible_value() +{ + return Glib::PropertyProxy(this, "accessible-value"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_value() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-value"); +} + +Glib::PropertyProxy Object::property_accessible_role() +{ + return Glib::PropertyProxy(this, "accessible-role"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_role() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-role"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_component_layer() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-component-layer"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_component_mdi_zorder() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-component-mdi-zorder"); +} + +Glib::PropertyProxy Object::property_accessible_table_caption() +{ + return Glib::PropertyProxy(this, "accessible-table-caption"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_table_caption() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-table-caption"); +} + +Glib::PropertyProxy Object::property_accessible_table_column_description() +{ + return Glib::PropertyProxy(this, "accessible-table-column-description"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_table_column_description() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-table-column-description"); +} + +Glib::PropertyProxy< Glib::RefPtr > Object::property_accessible_table_column_header() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "accessible-table-column-header"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Object::property_accessible_table_column_header() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "accessible-table-column-header"); +} + +Glib::PropertyProxy Object::property_accessible_table_row_description() +{ + return Glib::PropertyProxy(this, "accessible-table-row-description"); +} + +Glib::PropertyProxy_ReadOnly Object::property_accessible_table_row_description() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accessible-table-row-description"); +} + +Glib::PropertyProxy< Glib::RefPtr > Object::property_accessible_table_row_header() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "accessible-table-row-header"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Object::property_accessible_table_row_header() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "accessible-table-row-header"); +} + +Glib::PropertyProxy< Glib::RefPtr > Object::property_accessible_table_summary() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "accessible-table-summary"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Object::property_accessible_table_summary() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "accessible-table-summary"); +} + + +void Atk::Object::on_children_changed(guint change_index, gpointer changed_child) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->children_changed) + (*base->children_changed)(gobj(),change_index,changed_child); +} + +void Atk::Object::on_focus_event(bool focus_in) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->focus_event) + (*base->focus_event)(gobj(),static_cast(focus_in)); +} + +void Atk::Object::on_property_change(AtkPropertyValues* values) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->property_change) + (*base->property_change)(gobj(),values); +} + +void Atk::Object::on_state_change(const Glib::ustring& name, bool state_set) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->state_change) + (*base->state_change)(gobj(),name.c_str(),static_cast(state_set)); +} + +void Atk::Object::on_visible_data_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->visible_data_changed) + (*base->visible_data_changed)(gobj()); +} + +void Atk::Object::on_active_descendant_changed(void** child) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->active_descendant_changed) + (*base->active_descendant_changed)(gobj(),child); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/object.h b/libs/gtkmm2/atk/atkmm/object.h new file mode 100644 index 0000000000..047cb2a254 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/object.h @@ -0,0 +1,570 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_OBJECT_H +#define _ATKMM_OBJECT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _AtkPropertyValues AtkPropertyValues; } +#endif + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkObject AtkObject; +typedef struct _AtkObjectClass AtkObjectClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Object_Class; } // namespace Atk +namespace Atk +{ + + +/** @addtogroup atkmmEnums Enums and Flags */ + +/** + * @ingroup atkmmEnums + */ +enum Role +{ + ROLE_INVALID, + ROLE_ACCEL_LABEL, + ROLE_ALERT, + ROLE_ANIMATION, + ROLE_ARROW, + ROLE_CALENDAR, + ROLE_CANVAS, + ROLE_CHECK_BOX, + ROLE_CHECK_MENU_ITEM, + ROLE_COLOR_CHOOSER, + ROLE_COLUMN_HEADER, + ROLE_COMBO_BOX, + ROLE_DATE_EDITOR, + ROLE_DESKTOP_ICON, + ROLE_DESKTOP_FRAME, + ROLE_DIAL, + ROLE_DIALOG, + ROLE_DIRECTORY_PANE, + ROLE_DRAWING_AREA, + ROLE_FILE_CHOOSER, + ROLE_FILLER, + ROLE_FONT_CHOOSER, + ROLE_FRAME, + ROLE_GLASS_PANE, + ROLE_HTML_CONTAINER, + ROLE_ICON, + ROLE_IMAGE, + ROLE_INTERNAL_FRAME, + ROLE_LABEL, + ROLE_LAYERED_PANE, + ROLE_LIST, + ROLE_LIST_ITEM, + ROLE_MENU, + ROLE_MENU_BAR, + ROLE_MENU_ITEM, + ROLE_OPTION_PANE, + ROLE_PAGE_TAB, + ROLE_PAGE_TAB_LIST, + ROLE_PANEL, + ROLE_PASSWORD_TEXT, + ROLE_POPUP_MENU, + ROLE_PROGRESS_BAR, + ROLE_PUSH_BUTTON, + ROLE_RADIO_BUTTON, + ROLE_RADIO_MENU_ITEM, + ROLE_ROOT_PANE, + ROLE_ROW_HEADER, + ROLE_SCROLL_BAR, + ROLE_SCROLL_PANE, + ROLE_SEPARATOR, + ROLE_SLIDER, + ROLE_SPLIT_PANE, + ROLE_SPIN_BUTTON, + ROLE_STATUSBAR, + ROLE_TABLE, + ROLE_TABLE_CELL, + ROLE_TABLE_COLUMN_HEADER, + ROLE_TABLE_ROW_HEADER, + ROLE_TEAR_OFF_MENU_ITEM, + ROLE_TERMINAL, + ROLE_TEXT, + ROLE_TOGGLE_BUTTON, + ROLE_TOOL_BAR, + ROLE_TOOL_TIP, + ROLE_TREE, + ROLE_TREE_TABLE, + ROLE_UNKNOWN, + ROLE_VIEWPORT, + ROLE_WINDOW, + ROLE_HEADER, + ROLE_FOOTER, + ROLE_PARAGRAPH, + ROLE_RULER, + ROLE_APPLICATION, + ROLE_AUTOCOMPLETE, + ROLE_EDITBAR, + ROLE_EMBEDDED, + ROLE_LAST_DEFINED +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + + +class RelationSet; +class Relation; +class StateSet; + +typedef guint64 State; + +/** The base object class for the Accessibility Toolkit API. + * This class is the primary class for accessibility support via the Accessibility ToolKit (ATK). Objects which are + * instances of Atk::Object (or instances of Atk::Object-derived types) are queried for properties which relate basic + * (and generic) properties of a UI component such as name and description. Instances of Atk::Object may also be queried + * as to whether they implement other ATK interfaces (e.g. Atk::Action, Atk::Component, etc.), as appropriate to the role + * which a given UI component plays in a user interface. + * + * All UI components in an application which provide useful information or services to the user must provide corresponding + * Atk::Object instances on request (in GTK+, for instance, usually on a call to Gtk::Widget::get_accessible()), either via + * ATK support built into the toolkit for the widget class or ancestor class, or in the case of custom widgets, if the + * inherited Atk::Object implementation is insufficient, via instances of a new Atk::Object subclass. + */ + +class Object : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Object CppObjectType; + typedef Object_Class CppClassType; + typedef AtkObject BaseObjectType; + typedef AtkObjectClass BaseClassType; + +private: friend class Object_Class; + static CppClassType object_class_; + +private: + // noncopyable + Object(const Object&); + Object& operator=(const Object&); + +protected: + explicit Object(const Glib::ConstructParams& construct_params); + explicit Object(AtkObject* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Object(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkObject* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkObject* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkObject* gobj_copy(); + +private: + + // see wrap_new() implementation in object.ccg + +public: + + + /** Gets the accessible name of the accessible. + * @return A character string representing the accessible name of the object. + */ + Glib::ustring get_name() const; + + /** Gets the accessible description of the accessible. + * @return A character string representing the accessible description + * of the accessible. + */ + Glib::ustring get_description() const; + + /** Gets the accessible parent of the accessible. + * @return A Atk::Object representing the accessible parent of the accessible. + */ + Glib::RefPtr get_parent(); + + /** Gets the number of accessible children of the accessible. + * @return An integer representing the number of accessible children + * of the accessible. + */ + int get_n_accessible_children() const; + + /** Gets a reference to the specified accessible child of the object. + * The accessible children are 0-based so the first accessible child is + * at index 0, the second at index 1 and so on. + * @param i A int representing the position of the child, starting from 0. + * @return An Atk::Object representing the specified accessible child + * of the accessible. + */ + Glib::RefPtr get_accessible_child(int i); + + /** Gets the Atk::RelationSet associated with the object. + * @return An Atk::RelationSet representing the relation set of the object. + */ + Glib::RefPtr get_relation_set(); + + /** Gets the role of the accessible. + * @return An Atk::Role which is the role of the accessible. + */ + Role get_role() const; + + /** Gets a reference to the state set of the accessible; the caller must + * unreference it when it is no longer needed. + * @return A reference to an Atk::StateSet which is the state + * set of the accessible. + */ + Glib::RefPtr get_state_set(); + + /** Gets the 0-based index of this accessible in its parent; returns -1 if the + * accessible does not have an accessible parent. + * @return An integer which is the index of the accessible in its parent. + */ + int get_index_in_parent(); + + /** Sets the accessible name of the accessible. + * @param name A character string to be set as the accessible name. + */ + void set_name(const Glib::ustring& name); + + /** Sets the accessible description of the accessible. + * @param description A character string to be set as the accessible description. + */ + void set_description(const Glib::ustring& description); + + /** Sets the accessible parent of the accessible. + * @param parent An Atk::Object to be set as the accessible parent. + */ + void set_parent(const Glib::RefPtr& parent); + + /** Sets the role of the accessible. + * @param role An Atk::Role to be set as the role. + */ + void set_role(Role role); + //_WRAP_METHOD(guint connect_property_change_handler(AtkPropertyChangeHandler* handler), atk_object_connect_property_change_handler) + //_WRAP_METHOD(void remove_property_change_handler(guint handler_id), atk_object_remove_property_change_handler) + + /** Emits a state-change signal for the specified state. + * @param state An Atk::State whose state is changed. + * @param value A bool which indicates whether the state is being set on or off. + */ + void notify_state_change(State state, bool value); + + + /** Adds a relationship of the specified type with the specified target. + * @param relationship The Atk::RelationType of the relation. + * @param target The Atk::Object which is to be the target of the relation. + * @return true if the relationship is added. + */ + bool add_relationship(RelationType relationship, const Glib::RefPtr& target); + + /** Removes a relationship of the specified type with the specified target. + * @param relationship The Atk::RelationType of the relation. + * @param target The Atk::Object which is the target of the relation to be removed. + * @return true if the relationship is removed. + */ + bool remove_relationship(RelationType relationship, const Glib::RefPtr& target); + + + Glib::SignalProxy2< void,guint,gpointer > signal_children_changed(); + + + Glib::SignalProxy1< void,bool > signal_focus_event(); + + + Glib::SignalProxy1< void,AtkPropertyValues* > signal_property_change(); + + + Glib::SignalProxy2< void,const Glib::ustring&,bool > signal_state_change(); + + + Glib::SignalProxy0< void > signal_visible_data_changed(); + + + Glib::SignalProxy1< void,void** > signal_active_descendant_changed(); + + + /** Object instance's name formatted for assistive technology access. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_name() ; + +/** Object instance's name formatted for assistive technology access. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_name() const; + + /** Description of an object + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_description() ; + +/** Description of an object + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_description() const; + + /** Is used to notify that the parent has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_accessible_parent() ; + +/** Is used to notify that the parent has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_accessible_parent() const; + + /** Is used to notify that the value has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_value() ; + +/** Is used to notify that the value has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_value() const; + + /** The accessible role of this object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_role() ; + +/** The accessible role of this object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_role() const; + + /** The accessible layer of this object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_component_layer() const; + + + /** The accessible MDI value of this object. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_component_mdi_zorder() const; + + + /** Is used to notify that the table caption has changed; this property should not be used. accessible-table-caption-object should be used instead. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_table_caption() ; + +/** Is used to notify that the table caption has changed; this property should not be used. accessible-table-caption-object should be used instead. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_table_caption() const; + + /** Is used to notify that the table column description has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_table_column_description() ; + +/** Is used to notify that the table column description has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_table_column_description() const; + + /** Is used to notify that the table column header has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_accessible_table_column_header() ; + +/** Is used to notify that the table column header has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_accessible_table_column_header() const; + + /** Is used to notify that the table row description has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accessible_table_row_description() ; + +/** Is used to notify that the table row description has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accessible_table_row_description() const; + + /** Is used to notify that the table row header has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_accessible_table_row_header() ; + +/** Is used to notify that the table row header has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_accessible_table_row_header() const; + + /** Is used to notify that the table summary has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_accessible_table_summary() ; + +/** Is used to notify that the table summary has changed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_accessible_table_summary() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_children_changed(guint change_index, gpointer changed_child); + virtual void on_focus_event(bool focus_in); + virtual void on_property_change(AtkPropertyValues* values); + virtual void on_state_change(const Glib::ustring& name, bool state_set); + virtual void on_visible_data_changed(); + virtual void on_active_descendant_changed(void** child); + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Object + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkObject* object, bool take_copy = false); +} + + +#endif /* _ATKMM_OBJECT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/objectaccessible.cc b/libs/gtkmm2/atk/atkmm/objectaccessible.cc new file mode 100644 index 0000000000..da4136bef7 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/objectaccessible.cc @@ -0,0 +1,165 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkGObjectAccessible* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ObjectAccessible_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ObjectAccessible_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_gobject_accessible_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ObjectAccessible_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* ObjectAccessible_Class::wrap_new(GObject* object) +{ + return new ObjectAccessible((AtkGObjectAccessible*)object); +} + + +/* The implementation: */ + +AtkGObjectAccessible* ObjectAccessible::gobj_copy() +{ + reference(); + return gobj(); +} + +ObjectAccessible::ObjectAccessible(const Glib::ConstructParams& construct_params) +: + Atk::Object(construct_params) +{} + +ObjectAccessible::ObjectAccessible(AtkGObjectAccessible* castitem) +: + Atk::Object((AtkObject*)(castitem)) +{} + +ObjectAccessible::~ObjectAccessible() +{} + + +ObjectAccessible::CppClassType ObjectAccessible::objectaccessible_class_; // initialize static member + +GType ObjectAccessible::get_type() +{ + return objectaccessible_class_.init().get_type(); +} + +GType ObjectAccessible::get_base_type() +{ + return atk_gobject_accessible_get_type(); +} + + +Glib::RefPtr ObjectAccessible::get_object() +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_gobject_accessible_get_object(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr ObjectAccessible::get_object() const +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_gobject_accessible_get_object(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr ObjectAccessible::for_object(const Glib::RefPtr& obj) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_gobject_accessible_for_object(Glib::unwrap(obj))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr ObjectAccessible::for_object(const Glib::RefPtr& obj) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_gobject_accessible_for_object(const_cast(Glib::unwrap(obj)))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/objectaccessible.h b/libs/gtkmm2/atk/atkmm/objectaccessible.h new file mode 100644 index 0000000000..d266f9a97e --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/objectaccessible.h @@ -0,0 +1,145 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_OBJECTACCESSIBLE_H +#define _ATKMM_OBJECTACCESSIBLE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkGObjectAccessible AtkGObjectAccessible; +typedef struct _AtkGObjectAccessibleClass AtkGObjectAccessibleClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class ObjectAccessible_Class; } // namespace Atk +namespace Atk +{ + +/** This object class is derived from AtkObject and can be used as a basis implementing accessible objects. + * This can be used as a basis for implementing accessible objects for Glib::Objects which are not derived from + * Gtk::Widget. One example of its use is in providing an accessible object for GnomeCanvasItem in the GAIL library. + */ + +class ObjectAccessible : public Atk::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef ObjectAccessible CppObjectType; + typedef ObjectAccessible_Class CppClassType; + typedef AtkGObjectAccessible BaseObjectType; + typedef AtkGObjectAccessibleClass BaseClassType; + +private: friend class ObjectAccessible_Class; + static CppClassType objectaccessible_class_; + +private: + // noncopyable + ObjectAccessible(const ObjectAccessible&); + ObjectAccessible& operator=(const ObjectAccessible&); + +protected: + explicit ObjectAccessible(const Glib::ConstructParams& construct_params); + explicit ObjectAccessible(AtkGObjectAccessible* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~ObjectAccessible(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkGObjectAccessible* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkGObjectAccessible* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkGObjectAccessible* gobj_copy(); + +private: + +protected: + + + /** Gets the GObject for which @a obj is the accessible object. + * @return A G::Object which is the object for which @a obj is the accessible objedct. + */ + Glib::RefPtr get_object(); + + /** Gets the GObject for which @a obj is the accessible object. + * @return A G::Object which is the object for which @a obj is the accessible objedct. + */ + Glib::RefPtr get_object() const; + + + /** Gets the accessible object for the specified @a obj . + * @param obj A G::Object. + * @return A Atk::Object which is the accessible object for the @a obj . + */ + static Glib::RefPtr for_object(const Glib::RefPtr& obj); + + /** Gets the accessible object for the specified @a obj . + * @param obj A G::Object. + * @return A Atk::Object which is the accessible object for the @a obj . + */ + static Glib::RefPtr for_object(const Glib::RefPtr& obj); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::ObjectAccessible + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkGObjectAccessible* object, bool take_copy = false); +} + + +#endif /* _ATKMM_OBJECTACCESSIBLE_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/action_p.h b/libs/gtkmm2/atk/atkmm/private/action_p.h new file mode 100644 index 0000000000..bb3c5afa09 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/action_p.h @@ -0,0 +1,47 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_ACTION_P_H +#define _ATKMM_ACTION_P_H +#include + +#include + +namespace Atk +{ + +class Action_Class : public Glib::Interface_Class +{ +public: + typedef Action CppObjectType; + typedef AtkAction BaseObjectType; + typedef AtkActionIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Action; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static gboolean do_action_vfunc_callback(AtkAction* self, gint i); + static gint get_n_actions_vfunc_callback(AtkAction* self); + static const gchar* get_description_vfunc_callback(AtkAction* self, gint i); + static const gchar* get_name_vfunc_callback(AtkAction* self, gint i); + static const gchar* get_keybinding_vfunc_callback(AtkAction* self, gint i); + static gboolean set_description_vfunc_callback(AtkAction* self, gint i, const gchar* desc); +}; + + +} // namespace Atk + +#endif /* _ATKMM_ACTION_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/component_p.h b/libs/gtkmm2/atk/atkmm/private/component_p.h new file mode 100644 index 0000000000..010df9e92f --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/component_p.h @@ -0,0 +1,54 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_COMPONENT_P_H +#define _ATKMM_COMPONENT_P_H +#include + +#include + +namespace Atk +{ + +class Component_Class : public Glib::Interface_Class +{ +public: + typedef Component CppObjectType; + typedef AtkComponent BaseObjectType; + typedef AtkComponentIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Component; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static guint add_focus_handler_vfunc_callback(AtkComponent* self, AtkFocusHandler handler); + static gboolean contains_vfunc_callback(AtkComponent* self, gint x, gint y, AtkCoordType coord_type); + static AtkObject* ref_accessible_at_point_vfunc_callback(AtkComponent* self, gint x, gint y, AtkCoordType coord_type); + static void get_extents_vfunc_callback(AtkComponent* self, gint* x, gint* y, gint* width, gint* height, AtkCoordType coord_type); + static void get_position_vfunc_callback(AtkComponent* self, gint* x, gint* y, AtkCoordType coord_type); + static void get_size_vfunc_callback(AtkComponent* self, gint* width, gint* height); + static AtkLayer get_layer_vfunc_callback(AtkComponent* self); + static gint get_mdi_zorder_vfunc_callback(AtkComponent* self); + static gboolean grab_focus_vfunc_callback(AtkComponent* self); + static void remove_focus_handler_vfunc_callback(AtkComponent* self, guint handler_id); + static gboolean set_extents_vfunc_callback(AtkComponent* self, gint x, gint y, gint width, gint height, AtkCoordType coord_type); + static gboolean set_position_vfunc_callback(AtkComponent* self, gint x, gint y, AtkCoordType coord_type); + static gboolean set_size_vfunc_callback(AtkComponent* self, gint width, gint height); +}; + + +} // namespace Atk + +#endif /* _ATKMM_COMPONENT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/document_p.h b/libs/gtkmm2/atk/atkmm/private/document_p.h new file mode 100644 index 0000000000..01115486b5 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/document_p.h @@ -0,0 +1,43 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_DOCUMENT_P_H +#define _ATKMM_DOCUMENT_P_H +#include + +#include + +namespace Atk +{ + +class Document_Class : public Glib::Interface_Class +{ +public: + typedef Document CppObjectType; + typedef AtkDocument BaseObjectType; + typedef AtkDocumentIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Document; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static const gchar* get_document_type_vfunc_callback(AtkDocument* self); + static gpointer get_document_vfunc_callback(AtkDocument* self); +}; + + +} // namespace Atk + +#endif /* _ATKMM_DOCUMENT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/editabletext_p.h b/libs/gtkmm2/atk/atkmm/private/editabletext_p.h new file mode 100644 index 0000000000..fb5004ed1d --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/editabletext_p.h @@ -0,0 +1,47 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_EDITABLETEXT_P_H +#define _ATKMM_EDITABLETEXT_P_H + +#include + +namespace Atk +{ + +class EditableText_Class : public Glib::Interface_Class +{ +public: + typedef EditableText CppObjectType; + typedef AtkEditableText BaseObjectType; + typedef AtkEditableTextIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class EditableText; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static gboolean set_run_attributes_vfunc_callback(AtkEditableText* self, AtkAttributeSet* attrib_set, gint start_offset, gint end_offset); + static void set_text_contents_vfunc_callback(AtkEditableText* self, const gchar* string); + static void insert_text_vfunc_callback(AtkEditableText* self, const gchar* string, gint length, gint* position); + static void copy_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos); + static void cut_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos); + static void delete_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos); + static void paste_text_vfunc_callback(AtkEditableText* self, gint position); +}; + + +} // namespace Atk + +#endif /* _ATKMM_EDITABLETEXT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/hyperlink_p.h b/libs/gtkmm2/atk/atkmm/private/hyperlink_p.h new file mode 100644 index 0000000000..a5d9e61275 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/hyperlink_p.h @@ -0,0 +1,54 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_HYPERLINK_P_H +#define _ATKMM_HYPERLINK_P_H +#include +#include + +#include + +namespace Atk +{ + +class Hyperlink_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Hyperlink CppObjectType; + typedef AtkHyperlink BaseObjectType; + typedef AtkHyperlinkClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Hyperlink; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void link_activated_callback(AtkHyperlink* self); + + //Callbacks (virtual functions): + static gchar* get_uri_vfunc_callback(AtkHyperlink* self, gint i); + static AtkObject* get_object_vfunc_callback(AtkHyperlink* self, gint i); + static gint get_end_index_vfunc_callback(AtkHyperlink* self); + static gint get_start_index_vfunc_callback(AtkHyperlink* self); + static gboolean is_valid_vfunc_callback(AtkHyperlink* self); + static gint get_n_anchors_vfunc_callback(AtkHyperlink* self); + static guint link_state_vfunc_callback(AtkHyperlink* self); + static gboolean is_selected_link_vfunc_callback(AtkHyperlink* self); +}; + + +} // namespace Atk + +#endif /* _ATKMM_HYPERLINK_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/hypertext_p.h b/libs/gtkmm2/atk/atkmm/private/hypertext_p.h new file mode 100644 index 0000000000..79eaad32c5 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/hypertext_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_HYPERTEXT_P_H +#define _ATKMM_HYPERTEXT_P_H +#include + +#include + +namespace Atk +{ + +class Hypertext_Class : public Glib::Interface_Class +{ +public: + typedef Hypertext CppObjectType; + typedef AtkHypertext BaseObjectType; + typedef AtkHypertextIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Hypertext; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void link_selected_callback(AtkHypertext* self, gint p0); + + //Callbacks (virtual functions): + static AtkHyperlink* get_link_vfunc_callback(AtkHypertext* self, gint link_index); + static gint get_n_links_vfunc_callback(AtkHypertext* self); + static gint get_link_index_vfunc_callback(AtkHypertext* self, gint char_index); +}; + + +} // namespace Atk + +#endif /* _ATKMM_HYPERTEXT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/image_p.h b/libs/gtkmm2/atk/atkmm/private/image_p.h new file mode 100644 index 0000000000..b2e8d327ca --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/image_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_IMAGE_P_H +#define _ATKMM_IMAGE_P_H +#include + +#include + +namespace Atk +{ + +class Image_Class : public Glib::Interface_Class +{ +public: + typedef Image CppObjectType; + typedef AtkImage BaseObjectType; + typedef AtkImageIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Image; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static gboolean set_image_description_vfunc_callback(AtkImage* self, const gchar* description); + static const gchar* get_image_description_vfunc_callback(AtkImage* self); + static void get_image_position_vfunc_callback(AtkImage* self, gint* x, gint* y, AtkCoordType coord_type); + static void get_image_size_vfunc_callback(AtkImage* self, gint* width, gint* height); +}; + + +} // namespace Atk + +#endif /* _ATKMM_IMAGE_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/implementor_p.h b/libs/gtkmm2/atk/atkmm/private/implementor_p.h new file mode 100644 index 0000000000..7c5fc8804f --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/implementor_p.h @@ -0,0 +1,41 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_IMPLEMENTOR_P_H +#define _ATKMM_IMPLEMENTOR_P_H + +#include + +namespace Atk +{ + +class Implementor_Class : public Glib::Interface_Class +{ +public: + typedef Implementor CppObjectType; + typedef AtkImplementor BaseObjectType; + typedef AtkImplementorIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Implementor; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static AtkObject* ref_accessible_vfunc_callback(AtkImplementor* self); +}; + + +} // namespace Atk + +#endif /* _ATKMM_IMPLEMENTOR_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/noopobject_p.h b/libs/gtkmm2/atk/atkmm/private/noopobject_p.h new file mode 100644 index 0000000000..afa515b316 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/noopobject_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_NOOPOBJECT_P_H +#define _ATKMM_NOOPOBJECT_P_H +#include + +#include + +namespace Atk +{ + +class NoOpObject_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef NoOpObject CppObjectType; + typedef AtkNoOpObject BaseObjectType; + typedef AtkNoOpObjectClass BaseClassType; + typedef Atk::Object_Class CppClassParent; + typedef AtkObjectClass BaseClassParent; + + friend class NoOpObject; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Atk + +#endif /* _ATKMM_NOOPOBJECT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/object_p.h b/libs/gtkmm2/atk/atkmm/private/object_p.h new file mode 100644 index 0000000000..f65e8f8c08 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/object_p.h @@ -0,0 +1,50 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_OBJECT_P_H +#define _ATKMM_OBJECT_P_H +#include + +#include + +namespace Atk +{ + +class Object_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Object CppObjectType; + typedef AtkObject BaseObjectType; + typedef AtkObjectClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Object; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void children_changed_callback(AtkObject* self, guint p0, gpointer p1); + static void focus_event_callback(AtkObject* self, gboolean p0); + static void property_change_callback(AtkObject* self, AtkPropertyValues* p0); + static void state_change_callback(AtkObject* self, const gchar* p0, gboolean p1); + static void visible_data_changed_callback(AtkObject* self); + static void active_descendant_changed_callback(AtkObject* self, gpointer* p0); + + //Callbacks (virtual functions): +}; + + +} // namespace Atk + +#endif /* _ATKMM_OBJECT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/objectaccessible_p.h b/libs/gtkmm2/atk/atkmm/private/objectaccessible_p.h new file mode 100644 index 0000000000..b94c1320e5 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/objectaccessible_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_OBJECTACCESSIBLE_P_H +#define _ATKMM_OBJECTACCESSIBLE_P_H +#include + +#include + +namespace Atk +{ + +class ObjectAccessible_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ObjectAccessible CppObjectType; + typedef AtkGObjectAccessible BaseObjectType; + typedef AtkGObjectAccessibleClass BaseClassType; + typedef Atk::Object_Class CppClassParent; + typedef AtkObjectClass BaseClassParent; + + friend class ObjectAccessible; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Atk + +#endif /* _ATKMM_OBJECTACCESSIBLE_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/relation_p.h b/libs/gtkmm2/atk/atkmm/private/relation_p.h new file mode 100644 index 0000000000..63513db828 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/relation_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_RELATION_P_H +#define _ATKMM_RELATION_P_H +#include + +#include + +namespace Atk +{ + +class Relation_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Relation CppObjectType; + typedef AtkRelation BaseObjectType; + typedef AtkRelationClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Relation; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Atk + +#endif /* _ATKMM_RELATION_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/relationset_p.h b/libs/gtkmm2/atk/atkmm/private/relationset_p.h new file mode 100644 index 0000000000..8d3787e6e6 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/relationset_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_RELATIONSET_P_H +#define _ATKMM_RELATIONSET_P_H +#include + +#include + +namespace Atk +{ + +class RelationSet_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef RelationSet CppObjectType; + typedef AtkRelationSet BaseObjectType; + typedef AtkRelationSetClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class RelationSet; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Atk + +#endif /* _ATKMM_RELATIONSET_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/selection_p.h b/libs/gtkmm2/atk/atkmm/private/selection_p.h new file mode 100644 index 0000000000..dd5f27702a --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/selection_p.h @@ -0,0 +1,49 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_SELECTION_P_H +#define _ATKMM_SELECTION_P_H +#include + +#include + +namespace Atk +{ + +class Selection_Class : public Glib::Interface_Class +{ +public: + typedef Selection CppObjectType; + typedef AtkSelection BaseObjectType; + typedef AtkSelectionIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Selection; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void selection_changed_callback(AtkSelection* self); + + //Callbacks (virtual functions): + static gboolean add_selection_vfunc_callback(AtkSelection* self, gint i); + static gboolean clear_selection_vfunc_callback(AtkSelection* self); + static AtkObject* ref_selection_vfunc_callback(AtkSelection* self, gint i); + static gint get_selection_count_vfunc_callback(AtkSelection* self); + static gboolean is_child_selected_vfunc_callback(AtkSelection* self, gint i); + static gboolean remove_selection_vfunc_callback(AtkSelection* self, gint i); + static gboolean select_all_selection_vfunc_callback(AtkSelection* self); +}; + + +} // namespace Atk + +#endif /* _ATKMM_SELECTION_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/stateset_p.h b/libs/gtkmm2/atk/atkmm/private/stateset_p.h new file mode 100644 index 0000000000..51dd352ec0 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/stateset_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_STATESET_P_H +#define _ATKMM_STATESET_P_H +#include + +#include + +namespace Atk +{ + +class StateSet_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef StateSet CppObjectType; + typedef AtkStateSet BaseObjectType; + typedef AtkStateSetClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class StateSet; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Atk + +#endif /* _ATKMM_STATESET_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/streamablecontent_p.h b/libs/gtkmm2/atk/atkmm/private/streamablecontent_p.h new file mode 100644 index 0000000000..7c22e8c8ec --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/streamablecontent_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_STREAMABLECONTENT_P_H +#define _ATKMM_STREAMABLECONTENT_P_H +#include + +#include + +namespace Atk +{ + +class StreamableContent_Class : public Glib::Interface_Class +{ +public: + typedef StreamableContent CppObjectType; + typedef AtkStreamableContent BaseObjectType; + typedef AtkStreamableContentIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class StreamableContent; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static int get_n_mime_types_vfunc_callback(AtkStreamableContent* self); + static const gchar* get_mime_type_vfunc_callback(AtkStreamableContent* self, gint i); + static GIOChannel* get_stream_vfunc_callback(AtkStreamableContent* self, const gchar* mime_type); +}; + + +} // namespace Atk + +#endif /* _ATKMM_STREAMABLECONTENT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/table_p.h b/libs/gtkmm2/atk/atkmm/private/table_p.h new file mode 100644 index 0000000000..5516bb05c9 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/table_p.h @@ -0,0 +1,77 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_TABLE_P_H +#define _ATKMM_TABLE_P_H +#include + +#include + +namespace Atk +{ + +class Table_Class : public Glib::Interface_Class +{ +public: + typedef Table CppObjectType; + typedef AtkTable BaseObjectType; + typedef AtkTableIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Table; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void row_inserted_callback(AtkTable* self, gint p0, gint p1); + static void column_inserted_callback(AtkTable* self, gint p0, gint p1); + static void row_deleted_callback(AtkTable* self, gint p0, gint p1); + static void column_deleted_callback(AtkTable* self, gint p0, gint p1); + static void row_reordered_callback(AtkTable* self); + static void column_reordered_callback(AtkTable* self); + static void model_changed_callback(AtkTable* self); + + //Callbacks (virtual functions): + static AtkObject* ref_at_vfunc_callback(AtkTable* self, gint row, gint column); + static gint get_index_at_vfunc_callback(AtkTable* self, gint row, gint column); + static gint get_column_at_index_vfunc_callback(AtkTable* self, gint index_); + static gint get_row_at_index_vfunc_callback(AtkTable* self, gint index_); + static gint get_n_columns_vfunc_callback(AtkTable* self); + static gint get_n_rows_vfunc_callback(AtkTable* self); + static gint get_column_extent_at_vfunc_callback(AtkTable* self, gint row, gint column); + static gint get_row_extent_at_vfunc_callback(AtkTable* self, gint row, gint column); + static AtkObject* get_caption_vfunc_callback(AtkTable* self); + static const gchar* get_column_description_vfunc_callback(AtkTable* self, gint column); + static AtkObject* get_column_header_vfunc_callback(AtkTable* self, gint column); + static const gchar* get_row_description_vfunc_callback(AtkTable* self, gint row); + static AtkObject* get_row_header_vfunc_callback(AtkTable* self, gint row); + static AtkObject* get_summary_vfunc_callback(AtkTable* self); + static void set_caption_vfunc_callback(AtkTable* self, AtkObject* caption); + static void set_column_description_vfunc_callback(AtkTable* self, gint column, const gchar* description); + static void set_column_header_vfunc_callback(AtkTable* self, gint column, AtkObject* header); + static void set_row_description_vfunc_callback(AtkTable* self, gint row, const gchar* description); + static void set_row_header_vfunc_callback(AtkTable* self, gint row, AtkObject* header); + static void set_summary_vfunc_callback(AtkTable* self, AtkObject* accessible); + static gboolean is_column_selected_vfunc_callback(AtkTable* self, gint column); + static gboolean is_row_selected_vfunc_callback(AtkTable* self, gint row); + static gboolean is_selected_vfunc_callback(AtkTable* self, gint row, gint column); + static gboolean add_row_selection_vfunc_callback(AtkTable* self, gint row); + static gboolean remove_row_selection_vfunc_callback(AtkTable* self, gint row); + static gboolean add_column_selection_vfunc_callback(AtkTable* self, gint column); + static gboolean remove_column_selection_vfunc_callback(AtkTable* self, gint column); + static gint get_selected_columns_vfunc_callback(AtkTable* self, gint** selected); + static gint get_selected_rows_vfunc_callback(AtkTable* self, gint** selected); +}; + + +} // namespace Atk + +#endif /* _ATKMM_TABLE_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/text_p.h b/libs/gtkmm2/atk/atkmm/private/text_p.h new file mode 100644 index 0000000000..3ccc748965 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/text_p.h @@ -0,0 +1,61 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_TEXT_P_H +#define _ATKMM_TEXT_P_H + +#include + +namespace Atk +{ + +class Text_Class : public Glib::Interface_Class +{ +public: + typedef Text CppObjectType; + typedef AtkText BaseObjectType; + typedef AtkTextIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Text; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void text_changed_callback(AtkText* self, gint p0, gint p1); + static void text_caret_moved_callback(AtkText* self, gint p0); + static void text_selection_changed_callback(AtkText* self); + static void text_attributes_changed_callback(AtkText* self); + + //Callbacks (virtual functions): + static gchar* get_text_vfunc_callback(AtkText* self, gint start_offset, gint end_offset); + static gunichar get_character_at_offset_vfunc_callback(AtkText* self, gint offset); + static gchar* get_text_after_offset_vfunc_callback(AtkText* self, gint offset, AtkTextBoundary boundary_type, gint* start_offset, gint* end_offset); + static gchar* get_text_at_offset_vfunc_callback(AtkText* self, gint offset, AtkTextBoundary boundary_type, gint* start_offset, gint* end_offset); + static gchar* get_text_before_offset_vfunc_callback(AtkText* self, gint offset, AtkTextBoundary boundary_type, gint* start_offset, gint* end_offset); + static gint get_caret_offset_vfunc_callback(AtkText* self); + static void get_character_extents_vfunc_callback(AtkText* self, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords); + static AtkAttributeSet* get_run_attributes_vfunc_callback(AtkText* self, gint offset, gint* start_offset, gint* end_offset); + static AtkAttributeSet* get_default_attributes_vfunc_callback(AtkText* self); + static gint get_character_count_vfunc_callback(AtkText* self); + static gint get_offset_at_point_vfunc_callback(AtkText* self, gint x, gint y, AtkCoordType coords); + static gint get_n_selections_vfunc_callback(AtkText* self); + static gchar* get_selection_vfunc_callback(AtkText* self, gint selection_num, gint* start_offset, gint* end_offset); + static gboolean add_selection_vfunc_callback(AtkText* self, gint start_offset, gint end_offset); + static gboolean remove_selection_vfunc_callback(AtkText* self, gint selection_num); + static gboolean set_selection_vfunc_callback(AtkText* self, gint selection_num, gint start_offset, gint end_offset); + static gboolean set_caret_offset_vfunc_callback(AtkText* self, gint offset); +}; + + +} // namespace Atk + +#endif /* _ATKMM_TEXT_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/private/value_p.h b/libs/gtkmm2/atk/atkmm/private/value_p.h new file mode 100644 index 0000000000..f712e3cd70 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/private/value_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_VALUE_P_H +#define _ATKMM_VALUE_P_H + +#include + +namespace Atk +{ + +class Value_Class : public Glib::Interface_Class +{ +public: + typedef Value CppObjectType; + typedef AtkValue BaseObjectType; + typedef AtkValueIface BaseClassType; + typedef Glib::Interface_Class CppClassParent; + + friend class Value; + + const Glib::Interface_Class& init(); + + static void iface_init_function(void* g_iface, void* iface_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): + static void get_current_value_vfunc_callback(AtkValue* self, GValue* value); + static void get_maximum_value_vfunc_callback(AtkValue* self, GValue* value); + static void get_minimum_value_vfunc_callback(AtkValue* self, GValue* value); + static gboolean set_current_value_vfunc_callback(AtkValue* self, const GValue* value); +}; + + +} // namespace Atk + +#endif /* _ATKMM_VALUE_P_H */ + diff --git a/libs/gtkmm2/atk/atkmm/relation.cc b/libs/gtkmm2/atk/atkmm/relation.cc new file mode 100644 index 0000000000..94c3fe2d48 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/relation.cc @@ -0,0 +1,177 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace Atk +{ + +//TODO: Implement this with the new GValue array thingy. See bug #74246. +Relation::Relation(const Glib::ArrayHandle< Glib::RefPtr >& targets, + RelationType relationship) +: + Glib::Object((GObject*) atk_relation_new(const_cast(targets.data()), targets.size(), + (AtkRelationType) relationship)) +{} + +Glib::ArrayHandle< Glib::RefPtr > Relation::get_target() +{ + GPtrArray *const parray = atk_relation_get_target(gobj()); + + return Glib::ArrayHandle< Glib::RefPtr > + (reinterpret_cast(parray->pdata), parray->len, Glib::OWNERSHIP_NONE); +} + +Glib::ArrayHandle< Glib::RefPtr > Relation::get_target() const +{ + GPtrArray *const parray = atk_relation_get_target(const_cast(gobj())); + + return Glib::ArrayHandle< Glib::RefPtr > + (reinterpret_cast(parray->pdata), parray->len, Glib::OWNERSHIP_NONE); +} + +} // namespace Atk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return atk_relation_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkRelation* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Relation_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Relation_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_relation_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Relation_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Relation_Class::wrap_new(GObject* object) +{ + return new Relation((AtkRelation*)object); +} + + +/* The implementation: */ + +AtkRelation* Relation::gobj_copy() +{ + reference(); + return gobj(); +} + +Relation::Relation(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Relation::Relation(AtkRelation* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Relation::~Relation() +{} + + +Relation::CppClassType Relation::relation_class_; // initialize static member + +GType Relation::get_type() +{ + return relation_class_.init().get_type(); +} + +GType Relation::get_base_type() +{ + return atk_relation_get_type(); +} + + +Glib::RefPtr Relation::create(const Glib::ArrayHandle< Glib::RefPtr >& targets, RelationType relationship) +{ + return Glib::RefPtr( new Relation(targets, relationship) ); +} +RelationType Relation::get_relation_type() const +{ + return ((RelationType)(atk_relation_get_relation_type(const_cast(gobj())))); +} + +void Relation::add_target(const Glib::RefPtr& target) +{ + atk_relation_add_target(gobj(), Glib::unwrap(target)); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/relation.h b/libs/gtkmm2/atk/atkmm/relation.h new file mode 100644 index 0000000000..683b938947 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/relation.h @@ -0,0 +1,187 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_RELATION_H +#define _ATKMM_RELATION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkRelation AtkRelation; +typedef struct _AtkRelationClass AtkRelationClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Relation_Class; } // namespace Atk +namespace Atk +{ + + +/** @addtogroup atkmmEnums Enums and Flags */ + +/** + * @ingroup atkmmEnums + */ +enum RelationType +{ + RELATION_NULL, + RELATION_CONTROLLED_BY, + RELATION_CONTROLLER_FOR, + RELATION_LABEL_FOR, + RELATION_LABELLED_BY, + RELATION_MEMBER_OF, + RELATION_NODE_CHILD_OF, + RELATION_FLOWS_TO, + RELATION_FLOWS_FROM, + RELATION_SUBWINDOW_OF, + RELATION_EMBEDS, + RELATION_EMBEDDED_BY, + RELATION_POPUP_FOR, + RELATION_PARENT_WINDOW_OF, + RELATION_LAST_DEFINED +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + + +class Object; + +/** An Atk::Relation describes a relation between an object and one or more other objects. + * The actual relations that an object has with other objects are defined as an Atk::RelationSet, + * which is a set of Atk::Relations. + */ + +class Relation : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Relation CppObjectType; + typedef Relation_Class CppClassType; + typedef AtkRelation BaseObjectType; + typedef AtkRelationClass BaseClassType; + +private: friend class Relation_Class; + static CppClassType relation_class_; + +private: + // noncopyable + Relation(const Relation&); + Relation& operator=(const Relation&); + +protected: + explicit Relation(const Glib::ConstructParams& construct_params); + explicit Relation(AtkRelation* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Relation(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkRelation* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkRelation* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkRelation* gobj_copy(); + +private: + + +protected: + explicit Relation(const Glib::ArrayHandle< Glib::RefPtr >& targets, + RelationType relationship); + +public: + + static Glib::RefPtr create(const Glib::ArrayHandle< Glib::RefPtr >& targets, RelationType relationship = RELATION_NULL); + + + /** Gets the type of @a relation + * @return The type of @a relation . + */ + RelationType get_relation_type() const; + + Glib::ArrayHandle< Glib::RefPtr > get_target(); + Glib::ArrayHandle< Glib::RefPtr > get_target() const; + + + void add_target(const Glib::RefPtr& target); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Relation + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkRelation* object, bool take_copy = false); +} + + +#endif /* _ATKMM_RELATION_H */ + diff --git a/libs/gtkmm2/atk/atkmm/relationset.cc b/libs/gtkmm2/atk/atkmm/relationset.cc new file mode 100644 index 0000000000..2060639bc1 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/relationset.cc @@ -0,0 +1,181 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkRelationSet* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& RelationSet_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &RelationSet_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_relation_set_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void RelationSet_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* RelationSet_Class::wrap_new(GObject* object) +{ + return new RelationSet((AtkRelationSet*)object); +} + + +/* The implementation: */ + +AtkRelationSet* RelationSet::gobj_copy() +{ + reference(); + return gobj(); +} + +RelationSet::RelationSet(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +RelationSet::RelationSet(AtkRelationSet* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +RelationSet::~RelationSet() +{} + + +RelationSet::CppClassType RelationSet::relationset_class_; // initialize static member + +GType RelationSet::get_type() +{ + return relationset_class_.init().get_type(); +} + +GType RelationSet::get_base_type() +{ + return atk_relation_set_get_type(); +} + + +RelationSet::RelationSet() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(relationset_class_.init())) +{ + } + +Glib::RefPtr RelationSet::create() +{ + return Glib::RefPtr( new RelationSet() ); +} +bool RelationSet::set_contains(RelationType relationship) +{ + return atk_relation_set_contains(gobj(), ((AtkRelationType)(relationship))); +} + +void RelationSet::set_remove(const Glib::RefPtr& relation) +{ + atk_relation_set_remove(gobj(), Glib::unwrap(relation)); +} + +void RelationSet::set_add(const Glib::RefPtr& relation) +{ + atk_relation_set_add(gobj(), Glib::unwrap(relation)); +} + +int RelationSet::get_n_relations() const +{ + return atk_relation_set_get_n_relations(const_cast(gobj())); +} + +Glib::RefPtr RelationSet::get_relation(gint i) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_relation_set_get_relation(gobj(), i)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr RelationSet::get_relation(RelationType relationship) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_relation_set_get_relation_by_type(gobj(), ((AtkRelationType)(relationship)))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void RelationSet::add_relation_by_type(RelationType relationship, const Glib::RefPtr& target) +{ + atk_relation_set_add_relation_by_type(gobj(), ((AtkRelationType)(relationship)), Glib::unwrap(target)); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/relationset.h b/libs/gtkmm2/atk/atkmm/relationset.h new file mode 100644 index 0000000000..3702083fa5 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/relationset.h @@ -0,0 +1,171 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_RELATIONSET_H +#define _ATKMM_RELATIONSET_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkRelationSet AtkRelationSet; +typedef struct _AtkRelationSetClass AtkRelationSetClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class RelationSet_Class; } // namespace Atk +namespace Atk +{ + +/** A set of Atk::Relations, normally the set of AtkRelations which an Atk::Object has. + */ + +class RelationSet : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef RelationSet CppObjectType; + typedef RelationSet_Class CppClassType; + typedef AtkRelationSet BaseObjectType; + typedef AtkRelationSetClass BaseClassType; + +private: friend class RelationSet_Class; + static CppClassType relationset_class_; + +private: + // noncopyable + RelationSet(const RelationSet&); + RelationSet& operator=(const RelationSet&); + +protected: + explicit RelationSet(const Glib::ConstructParams& construct_params); + explicit RelationSet(AtkRelationSet* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~RelationSet(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkRelationSet* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkRelationSet* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkRelationSet* gobj_copy(); + +private: + +protected: + RelationSet(); + +public: + + static Glib::RefPtr create(); + + + /** Determines whether the relation set contains a relation that matches the + * specified type. + * @param relationship An Atk::RelationType. + * @return true if @a relationship is the relationship type of a relation + * in @a set , false otherwise. + */ + bool set_contains(RelationType relationship); + + /** Removes a relation from the relation set. + * This function unref's the Atk::Relation so it will be deleted unless there + * is another reference to it. + * @param relation An Atk::Relation. + */ + void set_remove(const Glib::RefPtr& relation); + + /** Add a new relation to the current relation set if it is not already + * present. + * This function ref's the AtkRelation so the caller of this function + * should unref it to ensure that it will be destroyed when the AtkRelationSet + * is destroyed. + * @param relation An Atk::Relation. + */ + void set_add(const Glib::RefPtr& relation); + + /** Determines the number of relations in a relation set. + * @return An integer representing the number of relations in the set. + */ + int get_n_relations() const; + + /** Determines the relation at the specified position in the relation set. + * @param i A int representing a position in the set, starting from 0. + * @return A Atk::Relation, which is the relation at position i in the set. + */ + Glib::RefPtr get_relation(gint i); + + /** Finds a relation that matches the specified type. + * @param relationship An Atk::RelationType. + * @return An Atk::Relation, which is a relation matching the specified type. + */ + Glib::RefPtr get_relation(RelationType relationship); + + + void add_relation_by_type(RelationType relationship, const Glib::RefPtr& target); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::RelationSet + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkRelationSet* object, bool take_copy = false); +} + + +#endif /* _ATKMM_RELATIONSET_H */ + diff --git a/libs/gtkmm2/atk/atkmm/selection.cc b/libs/gtkmm2/atk/atkmm/selection.cc new file mode 100644 index 0000000000..95c6a0a60a --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/selection.cc @@ -0,0 +1,596 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ + +const Glib::SignalProxyInfo Selection_signal_selection_changed_info = +{ + "selection_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkSelection* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Selection_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Selection_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_selection_get_type(); + } + + return *this; +} + +void Selection_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->add_selection = &add_selection_vfunc_callback; + klass->clear_selection = &clear_selection_vfunc_callback; + klass->ref_selection = &ref_selection_vfunc_callback; + klass->get_selection_count = &get_selection_count_vfunc_callback; + klass->is_child_selected = &is_child_selected_vfunc_callback; + klass->remove_selection = &remove_selection_vfunc_callback; + klass->select_all_selection = &select_all_selection_vfunc_callback; + klass->selection_changed = &selection_changed_callback; +} + +gboolean Selection_Class::add_selection_vfunc_callback(AtkSelection* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->add_selection_vfunc(i +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->add_selection) + return (*base->add_selection)(self, i); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Selection_Class::clear_selection_vfunc_callback(AtkSelection* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->clear_selection_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->clear_selection) + return (*base->clear_selection)(self); + } + + typedef gboolean RType; + return RType(); +} + +AtkObject* Selection_Class::ref_selection_vfunc_callback(AtkSelection* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap_copy(obj->get_selection_vfunc(i +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->ref_selection) + return (*base->ref_selection)(self, i); + } + + typedef AtkObject* RType; + return RType(); +} + +gint Selection_Class::get_selection_count_vfunc_callback(AtkSelection* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_selection_count_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_selection_count) + return (*base->get_selection_count)(self); + } + + typedef gint RType; + return RType(); +} + +gboolean Selection_Class::is_child_selected_vfunc_callback(AtkSelection* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->is_child_selected_vfunc(i +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->is_child_selected) + return (*base->is_child_selected)(self, i); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Selection_Class::remove_selection_vfunc_callback(AtkSelection* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->remove_selection_vfunc(i +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_selection) + return (*base->remove_selection)(self, i); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Selection_Class::select_all_selection_vfunc_callback(AtkSelection* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->select_all_selection_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->select_all_selection) + return (*base->select_all_selection)(self); + } + + typedef gboolean RType; + return RType(); +} + + +void Selection_Class::selection_changed_callback(AtkSelection* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_selection_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->selection_changed) + (*base->selection_changed)(self); + } +} + + +Glib::ObjectBase* Selection_Class::wrap_new(GObject* object) +{ + return new Selection((AtkSelection*)(object)); +} + + +/* The implementation: */ + +Selection::Selection() +: + Glib::Interface(selection_class_.init()) +{} + +Selection::Selection(AtkSelection* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Selection::~Selection() +{} + +// static +void Selection::add_interface(GType gtype_implementer) +{ + selection_class_.init().add_interface(gtype_implementer); +} + +Selection::CppClassType Selection::selection_class_; // initialize static member + +GType Selection::get_type() +{ + return selection_class_.init().get_type(); +} + +GType Selection::get_base_type() +{ + return atk_selection_get_type(); +} + + +bool Selection::add_selection(int i) +{ + return atk_selection_add_selection(gobj(), i); +} + +bool Selection::clear_selection() +{ + return atk_selection_clear_selection(gobj()); +} + +Glib::RefPtr Selection::get_selection(int i) +{ + return Glib::wrap(atk_selection_ref_selection(gobj(), i)); +} + +int Selection::get_selection_count() const +{ + return atk_selection_get_selection_count(const_cast(gobj())); +} + +bool Selection::is_child_selected(int i) const +{ + return atk_selection_is_child_selected(const_cast(gobj()), i); +} + +bool Selection::remove_selection(int i) +{ + return atk_selection_remove_selection(gobj(), i); +} + +bool Selection::select_all_selection() +{ + return atk_selection_select_all_selection(gobj()); +} + + +Glib::SignalProxy0< void > Selection::signal_selection_changed() +{ + return Glib::SignalProxy0< void >(this, &Selection_signal_selection_changed_info); +} + + +void Atk::Selection::on_selection_changed() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->selection_changed) + (*base->selection_changed)(gobj()); +} + + +bool Atk::Selection::add_selection_vfunc(int i) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->add_selection) + return (*base->add_selection)(gobj(),i); + + typedef bool RType; + return RType(); +} + +bool Atk::Selection::clear_selection_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->clear_selection) + return (*base->clear_selection)(gobj()); + + typedef bool RType; + return RType(); +} + +Glib::RefPtr Atk::Selection::get_selection_vfunc(int i) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->ref_selection) + return Glib::wrap((*base->ref_selection)(gobj(),i)); + + typedef Glib::RefPtr RType; + return RType(); +} + +int Atk::Selection::get_selection_count_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_selection_count) + return (*base->get_selection_count)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +bool Atk::Selection::is_child_selected_vfunc(int i) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->is_child_selected) + return (*base->is_child_selected)(const_cast(gobj()),i); + + typedef bool RType; + return RType(); +} + +bool Atk::Selection::remove_selection_vfunc(int i) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_selection) + return (*base->remove_selection)(gobj(),i); + + typedef bool RType; + return RType(); +} + +bool Atk::Selection::select_all_selection_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->select_all_selection) + return (*base->select_all_selection)(gobj()); + + typedef bool RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/selection.h b/libs/gtkmm2/atk/atkmm/selection.h new file mode 100644 index 0000000000..62185ed0d9 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/selection.h @@ -0,0 +1,208 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_SELECTION_H +#define _ATKMM_SELECTION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkSelectionIface AtkSelectionIface; + typedef struct _AtkSelection AtkSelection; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkSelection AtkSelection; +typedef struct _AtkSelectionClass AtkSelectionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Selection_Class; } // namespace Atk +namespace Atk +{ + +class Object; + +/** The ATK interface implemented by container objects whose Atk::Object children can be selected. + * This should be implemented by UI components with children which are exposed by Atk::Object::ref_child and + * Atk::Object::get_n_children, if the use of the parent UI component ordinarily involves selection of one or + * more of the objects corresponding to those AtkObject children - for example, selectable lists. + * + * Note that other types of "selection" (for instance text selection) are accomplished a other ATK interfaces - + * Atk::Selection is limited to the selection/deselection of children. + */ + +class Selection : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Selection CppObjectType; + typedef Selection_Class CppClassType; + typedef AtkSelection BaseObjectType; + typedef AtkSelectionIface BaseClassType; + +private: + friend class Selection_Class; + static CppClassType selection_class_; + + // noncopyable + Selection(const Selection&); + Selection& operator=(const Selection&); + +protected: + Selection(); // you must derive from this class + explicit Selection(AtkSelection* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Selection(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkSelection* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkSelection* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Adds the specified accessible child of the object to the + * object's selection. + * @param i A int specifying the child index. + * @return true if success, false otherwise. + */ + bool add_selection(int i); + + /** Clears the selection in the object so that no children in the object + * are selected. + * @return true if success, false otherwise. + */ + bool clear_selection(); + + /** Gets a reference to the accessible object representing the specified + * selected child of the object. + * @note callers should not rely on 0 or on a zero value for + * indication of whether AtkSelectionIface is implemented, they should + * use type checking/interface checking macros or the + * atk_get_accessible_value() convenience method. + * @param i A int specifying the index in the selection set. (e.g. the + * ith selection as opposed to the ith child). + * @return An Atk::Object representing the selected accessible , or 0 + * if @a selection does not implement this interface. + */ + Glib::RefPtr get_selection(int i); + + /** Gets the number of accessible children currently selected. + * @note callers should not rely on 0 or on a zero value for + * indication of whether AtkSelectionIface is implemented, they should + * use type checking/interface checking macros or the + * atk_get_accessible_value() convenience method. + * @return A int representing the number of items selected, or 0 + * if @a selection does not implement this interface. + */ + int get_selection_count() const; + + /** Determines if the current child of this object is selected + * @note callers should not rely on 0 or on a zero value for + * indication of whether AtkSelectionIface is implemented, they should + * use type checking/interface checking macros or the + * atk_get_accessible_value() convenience method. + * @param i A int specifying the child index. + * @return A bool representing the specified child is selected, or 0 + * if @a selection does not implement this interface. + */ + bool is_child_selected(int i) const; + + /** Removes the specified child of the object from the object's selection. + * @param i A int specifying the index in the selection set. (e.g. the + * ith selection as opposed to the ith child). + * @return true if success, false otherwise. + */ + bool remove_selection(int i); + + /** Causes every child of the object to be selected if the object + * supports multiple selections. + * @return true if success, false otherwise. + */ + bool select_all_selection(); + + + Glib::SignalProxy0< void > signal_selection_changed(); + + +protected: + virtual bool add_selection_vfunc(int i); + virtual bool clear_selection_vfunc(); + virtual Glib::RefPtr get_selection_vfunc(int i); + virtual int get_selection_count_vfunc() const; + virtual bool is_child_selected_vfunc(int i) const; + virtual bool remove_selection_vfunc(int i); + virtual bool select_all_selection_vfunc(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_selection_changed(); + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Selection + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkSelection* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_SELECTION_H */ + diff --git a/libs/gtkmm2/atk/atkmm/stateset.cc b/libs/gtkmm2/atk/atkmm/stateset.cc new file mode 100644 index 0000000000..6feb4d6ee3 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/stateset.cc @@ -0,0 +1,200 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Atk +{ + +void StateSet::add_states(const Glib::ArrayHandle& types) +{ + atk_state_set_add_states(gobj(), (AtkStateType*) types.data(), types.size()); +} + +bool StateSet::contains_states(const Glib::ArrayHandle& types) const +{ + return atk_state_set_contains_states( + const_cast(gobj()), (AtkStateType*) types.data(), types.size()); +} + +} // namespace Atk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return atk_state_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkStateSet* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& StateSet_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &StateSet_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(atk_state_set_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void StateSet_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* StateSet_Class::wrap_new(GObject* object) +{ + return new StateSet((AtkStateSet*)object); +} + + +/* The implementation: */ + +AtkStateSet* StateSet::gobj_copy() +{ + reference(); + return gobj(); +} + +StateSet::StateSet(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +StateSet::StateSet(AtkStateSet* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +StateSet::~StateSet() +{} + + +StateSet::CppClassType StateSet::stateset_class_; // initialize static member + +GType StateSet::get_type() +{ + return stateset_class_.init().get_type(); +} + +GType StateSet::get_base_type() +{ + return atk_state_set_get_type(); +} + + +StateSet::StateSet() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(stateset_class_.init())) +{ + } + +Glib::RefPtr StateSet::create() +{ + return Glib::RefPtr( new StateSet() ); +} +bool StateSet::is_empty() const +{ + return atk_state_set_is_empty(const_cast(gobj())); +} + +bool StateSet::add_state(Atk::StateType type) +{ + return atk_state_set_add_state(gobj(), ((AtkStateType)(type))); +} + +void StateSet::clear_states() +{ + atk_state_set_clear_states(gobj()); +} + +bool StateSet::contains_state(Atk::StateType type) +{ + return atk_state_set_contains_state(gobj(), ((AtkStateType)(type))); +} + +bool StateSet::remove_state(Atk::StateType type) +{ + return atk_state_set_remove_state(gobj(), ((AtkStateType)(type))); +} + +Glib::RefPtr StateSet::and_sets(const Glib::RefPtr& compare_set) +{ + return Glib::wrap(atk_state_set_and_sets(gobj(), Glib::unwrap(compare_set))); +} + +Glib::RefPtr StateSet::or_sets(const Glib::RefPtr& compare_set) +{ + return Glib::wrap(atk_state_set_or_sets(gobj(), Glib::unwrap(compare_set))); +} + +Glib::RefPtr StateSet::xor_sets(const Glib::RefPtr& compare_set) +{ + return Glib::wrap(atk_state_set_xor_sets(gobj(), Glib::unwrap(compare_set))); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/stateset.h b/libs/gtkmm2/atk/atkmm/stateset.h new file mode 100644 index 0000000000..f3e8f70504 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/stateset.h @@ -0,0 +1,247 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_STATESET_H +#define _ATKMM_STATESET_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkStateSet AtkStateSet; +typedef struct _AtkStateSetClass AtkStateSetClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class StateSet_Class; } // namespace Atk +namespace Atk +{ + + +/** @addtogroup atkmmEnums Enums and Flags */ + +/** + * @ingroup atkmmEnums + */ +enum StateType +{ + STATE_INVALID, + STATE_ACTIVE, + STATE_ARMED, + STATE_BUSY, + STATE_CHECKED, + STATE_DEFUNCT, + STATE_EDITABLE, + STATE_ENABLED, + STATE_EXPANDABLE, + STATE_EXPANDED, + STATE_FOCUSABLE, + STATE_FOCUSED, + STATE_HORIZONTAL, + STATE_ICONIFIED, + STATE_MODAL, + STATE_MULTI_LINE, + STATE_MULTISELECTABLE, + STATE_OPAQUE, + STATE_PRESSED, + STATE_RESIZABLE, + STATE_SELECTABLE, + STATE_SELECTED, + STATE_SENSITIVE, + STATE_SHOWING, + STATE_SINGLE_LINE, + STATE_STALE, + STATE_TRANSIENT, + STATE_VERTICAL, + STATE_VISIBLE, + STATE_MANAGES_DESCENDANTS, + STATE_INDETERMINATE, + STATE_TRUNCATED, + STATE_LAST_DEFINED +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + + +/** An AtkStateSet determines a component's state set. + * It is composed of a set of Atk::States. + */ + +class StateSet : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef StateSet CppObjectType; + typedef StateSet_Class CppClassType; + typedef AtkStateSet BaseObjectType; + typedef AtkStateSetClass BaseClassType; + +private: friend class StateSet_Class; + static CppClassType stateset_class_; + +private: + // noncopyable + StateSet(const StateSet&); + StateSet& operator=(const StateSet&); + +protected: + explicit StateSet(const Glib::ConstructParams& construct_params); + explicit StateSet(AtkStateSet* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~StateSet(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkStateSet* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkStateSet* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + AtkStateSet* gobj_copy(); + +private: + + +protected: + StateSet(); + +public: + + static Glib::RefPtr create(); + + + /** Checks whether the state set is empty, i.e.\ has no states set. + * @return true if @a set has no states set, otherwise false. + */ + bool is_empty() const; + + //Note that we use Atk::StateType instead of StateType, because there is a Gtk::StateType too, and Doxygen gets confused. + + /** Add a new state for the specified type to the current state set if + * it is not already present. + * @param type An Atk::StateType. + * @return true if the state for @a type is not already in @a set . + */ + bool add_state(Atk::StateType type); + void add_states(const Glib::ArrayHandle& types); + + + /** Removes all states from the state set. + */ + void clear_states(); + + /** Checks whether the state for the specified type is in the specified set. + * @param type An Atk::StateType. + * @return true if @a type is the state type is in @a set . + */ + bool contains_state(Atk::StateType type); + bool contains_states(const Glib::ArrayHandle& types) const; + + + /** Removes the state for the specified type from the state set. + * @param type An Atk::Type. + * @return true if @a type was the state type is in @a set . + */ + bool remove_state(Atk::StateType type); + + /** Constructs the intersection of the two sets, returning 0 if the + * intersection is empty. + * @param compare_set Another Atk::StateSet. + * @return A new Atk::StateSet which is the intersection of the two sets. + */ + Glib::RefPtr and_sets(const Glib::RefPtr& compare_set); + + /** Constructs the union of the two sets. + * @param compare_set Another Atk::StateSet. + * @return A new Atk::StateSet which is the union of the two sets, + * returning 0 is empty. + */ + Glib::RefPtr or_sets(const Glib::RefPtr& compare_set); + + /** Constructs the exclusive-or of the two sets, returning 0 is empty. + * The set returned by this operation contains the states in exactly + * one of the two sets. + * @param compare_set Another Atk::StateSet. + * @return A new Atk::StateSet which contains the states which are + * in exactly one of the two sets. + */ + Glib::RefPtr xor_sets(const Glib::RefPtr& compare_set); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::StateSet + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkStateSet* object, bool take_copy = false); +} + + +#endif /* _ATKMM_STATESET_H */ + diff --git a/libs/gtkmm2/atk/atkmm/streamablecontent.cc b/libs/gtkmm2/atk/atkmm/streamablecontent.cc new file mode 100644 index 0000000000..13916f861d --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/streamablecontent.cc @@ -0,0 +1,306 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Atk +{ + + +} // namespace Atk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkStreamableContent* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& StreamableContent_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &StreamableContent_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_streamable_content_get_type(); + } + + return *this; +} + +void StreamableContent_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->get_n_mime_types = &get_n_mime_types_vfunc_callback; + klass->get_mime_type = &get_mime_type_vfunc_callback; + klass->get_stream = &get_stream_vfunc_callback; +} + +int StreamableContent_Class::get_n_mime_types_vfunc_callback(AtkStreamableContent* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_mime_types_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_n_mime_types) + return (*base->get_n_mime_types)(self); + } + + typedef int RType; + return RType(); +} + +const gchar* StreamableContent_Class::get_mime_type_vfunc_callback(AtkStreamableContent* self, gint i) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_mime_type_vfunc(i +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_mime_type) + return (*base->get_mime_type)(self, i); + } + + typedef const gchar* RType; + return RType(); +} + +GIOChannel* StreamableContent_Class::get_stream_vfunc_callback(AtkStreamableContent* self, const gchar* mime_type) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_stream_vfunc(Glib::convert_const_gchar_ptr_to_ustring(mime_type) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_stream) + return (*base->get_stream)(self, mime_type); + } + + typedef GIOChannel* RType; + return RType(); +} + + +Glib::ObjectBase* StreamableContent_Class::wrap_new(GObject* object) +{ + return new StreamableContent((AtkStreamableContent*)(object)); +} + + +/* The implementation: */ + +StreamableContent::StreamableContent() +: + Glib::Interface(streamablecontent_class_.init()) +{} + +StreamableContent::StreamableContent(AtkStreamableContent* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +StreamableContent::~StreamableContent() +{} + +// static +void StreamableContent::add_interface(GType gtype_implementer) +{ + streamablecontent_class_.init().add_interface(gtype_implementer); +} + +StreamableContent::CppClassType StreamableContent::streamablecontent_class_; // initialize static member + +GType StreamableContent::get_type() +{ + return streamablecontent_class_.init().get_type(); +} + +GType StreamableContent::get_base_type() +{ + return atk_streamable_content_get_type(); +} + + +int StreamableContent::get_n_mime_types() const +{ + return atk_streamable_content_get_n_mime_types(const_cast(gobj())); +} + +Glib::ustring StreamableContent::get_mime_type(int i) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_streamable_content_get_mime_type(const_cast(gobj()), i)); +} + +Glib::RefPtr StreamableContent::get_stream(const Glib::ustring& mime_type) +{ + return Glib::wrap(atk_streamable_content_get_stream(gobj(), mime_type.c_str())); +} + + +int Atk::StreamableContent::get_n_mime_types_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_n_mime_types) + return (*base->get_n_mime_types)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +const gchar* Atk::StreamableContent::get_mime_type_vfunc(int i) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_mime_type) + return (*base->get_mime_type)(const_cast(gobj()),i); + + typedef const gchar* RType; + return RType(); +} + +GIOChannel* Atk::StreamableContent::get_stream_vfunc(const Glib::ustring& mime_type) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_stream) + return (*base->get_stream)(gobj(),mime_type.c_str()); + + typedef GIOChannel* RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/streamablecontent.h b/libs/gtkmm2/atk/atkmm/streamablecontent.h new file mode 100644 index 0000000000..698aaef86b --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/streamablecontent.h @@ -0,0 +1,153 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_STREAMABLECONTENT_H +#define _ATKMM_STREAMABLECONTENT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkStreamableContentIface AtkStreamableContentIface; + typedef struct _AtkStreamableContent AtkStreamableContent; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkStreamableContent AtkStreamableContent; +typedef struct _AtkStreamableContentClass AtkStreamableContentClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class StreamableContent_Class; } // namespace Atk +namespace Atk +{ + +class Object; + +/** The ATK interface which provides access to streamable content. + */ + +class StreamableContent : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef StreamableContent CppObjectType; + typedef StreamableContent_Class CppClassType; + typedef AtkStreamableContent BaseObjectType; + typedef AtkStreamableContentIface BaseClassType; + +private: + friend class StreamableContent_Class; + static CppClassType streamablecontent_class_; + + // noncopyable + StreamableContent(const StreamableContent&); + StreamableContent& operator=(const StreamableContent&); + +protected: + StreamableContent(); // you must derive from this class + explicit StreamableContent(AtkStreamableContent* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~StreamableContent(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkStreamableContent* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkStreamableContent* gobj() const { return reinterpret_cast(gobject_); } + +private: + +public: + + + /** Gets the number of mime types supported by this object. + * @return A int which is the number of mime types supported by the object. + */ + int get_n_mime_types() const; + + /** Gets the character string of the specified mime type. The first mime + * type is at position 0, the second at position 1, and so on. + * @param i A int representing the position of the mime type starting from 0. + * @return : a gchar* representing the specified mime type; the caller + * should not free the character string. + */ + Glib::ustring get_mime_type(int i) const; + + /** Gets the content in the specified mime type. + * @param mime_type A gchar* representing the mime type. + * @return A G::IOChannel which contains the content in the specified mime + * type. + */ + Glib::RefPtr get_stream(const Glib::ustring& mime_type); + +protected: + virtual int get_n_mime_types_vfunc() const; + virtual const gchar* get_mime_type_vfunc(int i) const; + virtual GIOChannel* get_stream_vfunc(const Glib::ustring& mime_type); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::StreamableContent + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkStreamableContent* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_STREAMABLECONTENT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/table.cc b/libs/gtkmm2/atk/atkmm/table.cc new file mode 100644 index 0000000000..335fb55ece --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/table.cc @@ -0,0 +1,2394 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Atk +{ + +Glib::ArrayHandle Table::get_selected_columns() const +{ + int* selected = 0; + const int n_selected = atk_table_get_selected_columns(const_cast(gobj()), &selected); + + return Glib::ArrayHandle(selected, n_selected, Glib::OWNERSHIP_SHALLOW); +} + +Glib::ArrayHandle Table::get_selected_rows() const +{ + int* selected = 0; + const int n_selected = atk_table_get_selected_rows(const_cast(gobj()), &selected); + + return Glib::ArrayHandle(selected, n_selected, Glib::OWNERSHIP_SHALLOW); +} + +} // namespace Atk + + +namespace +{ + +void Table_signal_row_inserted_callback(AtkTable* self, gint p0,gint p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Table_signal_row_inserted_info = +{ + "row_inserted", + (GCallback) &Table_signal_row_inserted_callback, + (GCallback) &Table_signal_row_inserted_callback +}; + + +void Table_signal_column_inserted_callback(AtkTable* self, gint p0,gint p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Table_signal_column_inserted_info = +{ + "column_inserted", + (GCallback) &Table_signal_column_inserted_callback, + (GCallback) &Table_signal_column_inserted_callback +}; + + +void Table_signal_row_deleted_callback(AtkTable* self, gint p0,gint p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Table_signal_row_deleted_info = +{ + "row_deleted", + (GCallback) &Table_signal_row_deleted_callback, + (GCallback) &Table_signal_row_deleted_callback +}; + + +void Table_signal_column_deleted_callback(AtkTable* self, gint p0,gint p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Table_signal_column_deleted_info = +{ + "column_deleted", + (GCallback) &Table_signal_column_deleted_callback, + (GCallback) &Table_signal_column_deleted_callback +}; + + +const Glib::SignalProxyInfo Table_signal_row_reordered_info = +{ + "row_reordered", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Table_signal_column_reordered_info = +{ + "column_reordered", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Table_signal_model_changed_info = +{ + "model_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkTable* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Table_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Table_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_table_get_type(); + } + + return *this; +} + +void Table_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->ref_at = &ref_at_vfunc_callback; + klass->get_index_at = &get_index_at_vfunc_callback; + klass->get_column_at_index = &get_column_at_index_vfunc_callback; + klass->get_row_at_index = &get_row_at_index_vfunc_callback; + klass->get_n_columns = &get_n_columns_vfunc_callback; + klass->get_n_rows = &get_n_rows_vfunc_callback; + klass->get_column_extent_at = &get_column_extent_at_vfunc_callback; + klass->get_row_extent_at = &get_row_extent_at_vfunc_callback; + klass->get_caption = &get_caption_vfunc_callback; + klass->get_column_description = &get_column_description_vfunc_callback; + klass->get_column_header = &get_column_header_vfunc_callback; + klass->get_row_description = &get_row_description_vfunc_callback; + klass->get_row_header = &get_row_header_vfunc_callback; + klass->get_summary = &get_summary_vfunc_callback; + klass->set_caption = &set_caption_vfunc_callback; + klass->set_column_description = &set_column_description_vfunc_callback; + klass->set_column_header = &set_column_header_vfunc_callback; + klass->set_row_description = &set_row_description_vfunc_callback; + klass->set_row_header = &set_row_header_vfunc_callback; + klass->set_summary = &set_summary_vfunc_callback; + klass->is_column_selected = &is_column_selected_vfunc_callback; + klass->is_row_selected = &is_row_selected_vfunc_callback; + klass->is_selected = &is_selected_vfunc_callback; + klass->add_row_selection = &add_row_selection_vfunc_callback; + klass->remove_row_selection = &remove_row_selection_vfunc_callback; + klass->add_column_selection = &add_column_selection_vfunc_callback; + klass->remove_column_selection = &remove_column_selection_vfunc_callback; + klass->get_selected_columns = &get_selected_columns_vfunc_callback; + klass->get_selected_rows = &get_selected_rows_vfunc_callback; + klass->row_inserted = &row_inserted_callback; + klass->column_inserted = &column_inserted_callback; + klass->row_deleted = &row_deleted_callback; + klass->column_deleted = &column_deleted_callback; + klass->row_reordered = &row_reordered_callback; + klass->column_reordered = &column_reordered_callback; + klass->model_changed = &model_changed_callback; +} + +AtkObject* Table_Class::ref_at_vfunc_callback(AtkTable* self, gint row, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap_copy(obj->get_at_vfunc(row +, column +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->ref_at) + return (*base->ref_at)(self, row, column); + } + + typedef AtkObject* RType; + return RType(); +} + +gint Table_Class::get_index_at_vfunc_callback(AtkTable* self, gint row, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_index_at_vfunc(row +, column +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_index_at) + return (*base->get_index_at)(self, row, column); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_column_at_index_vfunc_callback(AtkTable* self, gint index_) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_column_at_index_vfunc(index_ +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_column_at_index) + return (*base->get_column_at_index)(self, index_); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_row_at_index_vfunc_callback(AtkTable* self, gint index_) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_row_at_index_vfunc(index_ +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_row_at_index) + return (*base->get_row_at_index)(self, index_); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_n_columns_vfunc_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_columns_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_n_columns) + return (*base->get_n_columns)(self); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_n_rows_vfunc_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_rows_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_n_rows) + return (*base->get_n_rows)(self); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_column_extent_at_vfunc_callback(AtkTable* self, gint row, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_column_extent_at_vfunc(row +, column +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_column_extent_at) + return (*base->get_column_extent_at)(self, row, column); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_row_extent_at_vfunc_callback(AtkTable* self, gint row, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_row_extent_at_vfunc(row +, column +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_row_extent_at) + return (*base->get_row_extent_at)(self, row, column); + } + + typedef gint RType; + return RType(); +} + +AtkObject* Table_Class::get_caption_vfunc_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->get_caption_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_caption) + return (*base->get_caption)(self); + } + + typedef AtkObject* RType; + return RType(); +} + +const gchar* Table_Class::get_column_description_vfunc_callback(AtkTable* self, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_column_description_vfunc(column +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_column_description) + return (*base->get_column_description)(self, column); + } + + typedef const gchar* RType; + return RType(); +} + +AtkObject* Table_Class::get_column_header_vfunc_callback(AtkTable* self, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->get_column_header_vfunc(column +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_column_header) + return (*base->get_column_header)(self, column); + } + + typedef AtkObject* RType; + return RType(); +} + +const gchar* Table_Class::get_row_description_vfunc_callback(AtkTable* self, gint row) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_row_description_vfunc(row +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_row_description) + return (*base->get_row_description)(self, row); + } + + typedef const gchar* RType; + return RType(); +} + +AtkObject* Table_Class::get_row_header_vfunc_callback(AtkTable* self, gint row) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->get_row_header_vfunc(row +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_row_header) + return (*base->get_row_header)(self, row); + } + + typedef AtkObject* RType; + return RType(); +} + +AtkObject* Table_Class::get_summary_vfunc_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->get_summary_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_summary) + return (*base->get_summary)(self); + } + + typedef AtkObject* RType; + return RType(); +} + +void Table_Class::set_caption_vfunc_callback(AtkTable* self, AtkObject* caption) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_caption_vfunc(Glib::wrap(caption, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_caption) + (*base->set_caption)(self, caption); + } +} + +void Table_Class::set_column_description_vfunc_callback(AtkTable* self, gint column, const gchar* description) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_column_description_vfunc(column +, description +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_column_description) + (*base->set_column_description)(self, column, description); + } +} + +void Table_Class::set_column_header_vfunc_callback(AtkTable* self, gint column, AtkObject* header) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_column_header_vfunc(column +, Glib::wrap(header, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_column_header) + (*base->set_column_header)(self, column, header); + } +} + +void Table_Class::set_row_description_vfunc_callback(AtkTable* self, gint row, const gchar* description) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_row_description_vfunc(row +, description +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_row_description) + (*base->set_row_description)(self, row, description); + } +} + +void Table_Class::set_row_header_vfunc_callback(AtkTable* self, gint row, AtkObject* header) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_row_header_vfunc(row +, Glib::wrap(header, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_row_header) + (*base->set_row_header)(self, row, header); + } +} + +void Table_Class::set_summary_vfunc_callback(AtkTable* self, AtkObject* accessible) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_summary_vfunc(Glib::wrap(accessible, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_summary) + (*base->set_summary)(self, accessible); + } +} + +gboolean Table_Class::is_column_selected_vfunc_callback(AtkTable* self, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->is_column_selected_vfunc(column +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->is_column_selected) + return (*base->is_column_selected)(self, column); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Table_Class::is_row_selected_vfunc_callback(AtkTable* self, gint row) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->is_row_selected_vfunc(row +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->is_row_selected) + return (*base->is_row_selected)(self, row); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Table_Class::is_selected_vfunc_callback(AtkTable* self, gint row, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->is_selected_vfunc(row +, column +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->is_selected) + return (*base->is_selected)(self, row, column); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Table_Class::add_row_selection_vfunc_callback(AtkTable* self, gint row) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->add_row_selection_vfunc(row +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->add_row_selection) + return (*base->add_row_selection)(self, row); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Table_Class::remove_row_selection_vfunc_callback(AtkTable* self, gint row) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->remove_row_selection_vfunc(row +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_row_selection) + return (*base->remove_row_selection)(self, row); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Table_Class::add_column_selection_vfunc_callback(AtkTable* self, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->add_column_selection_vfunc(column +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->add_column_selection) + return (*base->add_column_selection)(self, column); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Table_Class::remove_column_selection_vfunc_callback(AtkTable* self, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->remove_column_selection_vfunc(column +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_column_selection) + return (*base->remove_column_selection)(self, column); + } + + typedef gboolean RType; + return RType(); +} + +gint Table_Class::get_selected_columns_vfunc_callback(AtkTable* self, gint** selected) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_selected_columns_vfunc(selected +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_selected_columns) + return (*base->get_selected_columns)(self, selected); + } + + typedef gint RType; + return RType(); +} + +gint Table_Class::get_selected_rows_vfunc_callback(AtkTable* self, gint** selected) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_selected_rows_vfunc(selected +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_selected_rows) + return (*base->get_selected_rows)(self, selected); + } + + typedef gint RType; + return RType(); +} + + +void Table_Class::row_inserted_callback(AtkTable* self, gint p0, gint p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_row_inserted(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->row_inserted) + (*base->row_inserted)(self, p0, p1); + } +} + +void Table_Class::column_inserted_callback(AtkTable* self, gint p0, gint p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_column_inserted(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->column_inserted) + (*base->column_inserted)(self, p0, p1); + } +} + +void Table_Class::row_deleted_callback(AtkTable* self, gint p0, gint p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_row_deleted(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->row_deleted) + (*base->row_deleted)(self, p0, p1); + } +} + +void Table_Class::column_deleted_callback(AtkTable* self, gint p0, gint p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_column_deleted(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->column_deleted) + (*base->column_deleted)(self, p0, p1); + } +} + +void Table_Class::row_reordered_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_row_reordered(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->row_reordered) + (*base->row_reordered)(self); + } +} + +void Table_Class::column_reordered_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_column_reordered(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->column_reordered) + (*base->column_reordered)(self); + } +} + +void Table_Class::model_changed_callback(AtkTable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_model_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->model_changed) + (*base->model_changed)(self); + } +} + + +Glib::ObjectBase* Table_Class::wrap_new(GObject* object) +{ + return new Table((AtkTable*)(object)); +} + + +/* The implementation: */ + +Table::Table() +: + Glib::Interface(table_class_.init()) +{} + +Table::Table(AtkTable* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Table::~Table() +{} + +// static +void Table::add_interface(GType gtype_implementer) +{ + table_class_.init().add_interface(gtype_implementer); +} + +Table::CppClassType Table::table_class_; // initialize static member + +GType Table::get_type() +{ + return table_class_.init().get_type(); +} + +GType Table::get_base_type() +{ + return atk_table_get_type(); +} + + +Glib::RefPtr Table::get_at(int row, int column) +{ + return Glib::wrap(atk_table_ref_at(gobj(), row, column)); +} + +int Table::get_index_at(int row, int column) const +{ + return atk_table_get_index_at(const_cast(gobj()), row, column); +} + +int Table::get_column_at_index(int index) const +{ + return atk_table_get_column_at_index(const_cast(gobj()), index); +} + +int Table::get_row_at_index(int index) const +{ + return atk_table_get_row_at_index(const_cast(gobj()), index); +} + +int Table::get_n_columns() const +{ + return atk_table_get_n_columns(const_cast(gobj())); +} + +int Table::get_n_rows() const +{ + return atk_table_get_n_rows(const_cast(gobj())); +} + +int Table::get_column_extent_at(int row, int column) const +{ + return atk_table_get_column_extent_at(const_cast(gobj()), row, column); +} + +int Table::get_row_extent_at(int row, int column) const +{ + return atk_table_get_row_extent_at(const_cast(gobj()), row, column); +} + +Glib::RefPtr Table::get_caption() +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_caption(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Table::get_caption() const +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_caption(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ustring Table::get_column_description(int column) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_table_get_column_description(const_cast(gobj()), column)); +} + +Glib::RefPtr Table::get_column_header(int column) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_column_header(gobj(), column)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Table::get_column_header(int column) const +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_column_header(const_cast(gobj()), column)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ustring Table::get_row_description(int row) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(atk_table_get_row_description(const_cast(gobj()), row)); +} + +Glib::RefPtr Table::get_row_header(int row) +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_row_header(gobj(), row)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Table::get_row_header(int row) const +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_row_header(const_cast(gobj()), row)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Table::get_summary() +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_summary(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Table::get_summary() const +{ + + Glib::RefPtr retvalue = Glib::wrap(atk_table_get_summary(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Table::set_caption(const Glib::RefPtr& caption) +{ + atk_table_set_caption(gobj(), Glib::unwrap(caption)); +} + +void Table::set_column_description(int column, const Glib::ustring& description) +{ + atk_table_set_column_description(gobj(), column, description.c_str()); +} + +void Table::set_column_header(int column, const Glib::RefPtr& header) +{ + atk_table_set_column_header(gobj(), column, Glib::unwrap(header)); +} + +void Table::set_row_description(int row, const Glib::ustring& description) +{ + atk_table_set_row_description(gobj(), row, description.c_str()); +} + +void Table::set_row_header(int row, const Glib::RefPtr& header) +{ + atk_table_set_row_header(gobj(), row, Glib::unwrap(header)); +} + +void Table::set_summary(const Glib::RefPtr& accessible) +{ + atk_table_set_summary(gobj(), Glib::unwrap(accessible)); +} + +bool Table::is_column_selected(int column) const +{ + return atk_table_is_column_selected(const_cast(gobj()), column); +} + +bool Table::is_row_selected(int row) const +{ + return atk_table_is_row_selected(const_cast(gobj()), row); +} + +bool Table::is_selected(int row, int column) const +{ + return atk_table_is_selected(const_cast(gobj()), row, column); +} + +bool Table::add_row_selection(int row) +{ + return atk_table_add_row_selection(gobj(), row); +} + +bool Table::remove_row_selection(int row) +{ + return atk_table_remove_row_selection(gobj(), row); +} + +bool Table::add_column_selection(int column) +{ + return atk_table_add_column_selection(gobj(), column); +} + +bool Table::remove_column_selection(int column) +{ + return atk_table_remove_column_selection(gobj(), column); +} + + +Glib::SignalProxy2< void,int,int > Table::signal_row_inserted() +{ + return Glib::SignalProxy2< void,int,int >(this, &Table_signal_row_inserted_info); +} + +Glib::SignalProxy2< void,int,int > Table::signal_column_inserted() +{ + return Glib::SignalProxy2< void,int,int >(this, &Table_signal_column_inserted_info); +} + +Glib::SignalProxy2< void,int,int > Table::signal_row_deleted() +{ + return Glib::SignalProxy2< void,int,int >(this, &Table_signal_row_deleted_info); +} + +Glib::SignalProxy2< void,int,int > Table::signal_column_deleted() +{ + return Glib::SignalProxy2< void,int,int >(this, &Table_signal_column_deleted_info); +} + +Glib::SignalProxy0< void > Table::signal_row_reordered() +{ + return Glib::SignalProxy0< void >(this, &Table_signal_row_reordered_info); +} + +Glib::SignalProxy0< void > Table::signal_column_reordered() +{ + return Glib::SignalProxy0< void >(this, &Table_signal_column_reordered_info); +} + +Glib::SignalProxy0< void > Table::signal_model_changed() +{ + return Glib::SignalProxy0< void >(this, &Table_signal_model_changed_info); +} + + +void Atk::Table::on_row_inserted(int row, int num_inserted) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->row_inserted) + (*base->row_inserted)(gobj(),row,num_inserted); +} + +void Atk::Table::on_column_inserted(int column, int num_inserted) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->column_inserted) + (*base->column_inserted)(gobj(),column,num_inserted); +} + +void Atk::Table::on_row_deleted(int row, int num_deleted) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->row_deleted) + (*base->row_deleted)(gobj(),row,num_deleted); +} + +void Atk::Table::on_column_deleted(int column, int num_deleted) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->column_deleted) + (*base->column_deleted)(gobj(),column,num_deleted); +} + +void Atk::Table::on_row_reordered() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->row_reordered) + (*base->row_reordered)(gobj()); +} + +void Atk::Table::on_column_reordered() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->column_reordered) + (*base->column_reordered)(gobj()); +} + +void Atk::Table::on_model_changed() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->model_changed) + (*base->model_changed)(gobj()); +} + + +Glib::RefPtr Atk::Table::get_at_vfunc(int row, int column) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->ref_at) + return Glib::wrap((*base->ref_at)(gobj(),row,column)); + + typedef Glib::RefPtr RType; + return RType(); +} + +int Atk::Table::get_index_at_vfunc(int row, int column) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_index_at) + return (*base->get_index_at)(const_cast(gobj()),row,column); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_column_at_index_vfunc(int index) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_column_at_index) + return (*base->get_column_at_index)(const_cast(gobj()),index); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_row_at_index_vfunc(int index) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_row_at_index) + return (*base->get_row_at_index)(const_cast(gobj()),index); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_n_columns_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_n_columns) + return (*base->get_n_columns)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_n_rows_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_n_rows) + return (*base->get_n_rows)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_column_extent_at_vfunc(int row, int column) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_column_extent_at) + return (*base->get_column_extent_at)(const_cast(gobj()),row,column); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_row_extent_at_vfunc(int row, int column) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_row_extent_at) + return (*base->get_row_extent_at)(const_cast(gobj()),row,column); + + typedef int RType; + return RType(); +} + +Glib::RefPtr Atk::Table::get_caption_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_caption) + return Glib::wrap((*base->get_caption)(gobj())); + + typedef Glib::RefPtr RType; + return RType(); +} + +const char* Atk::Table::get_column_description_vfunc(int column) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_column_description) + return (*base->get_column_description)(const_cast(gobj()),column); + + typedef const char* RType; + return RType(); +} + +Glib::RefPtr Atk::Table::get_column_header_vfunc(int column) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_column_header) + return Glib::wrap((*base->get_column_header)(gobj(),column)); + + typedef Glib::RefPtr RType; + return RType(); +} + +const char* Atk::Table::get_row_description_vfunc(int row) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_row_description) + return (*base->get_row_description)(const_cast(gobj()),row); + + typedef const char* RType; + return RType(); +} + +Glib::RefPtr Atk::Table::get_row_header_vfunc(int row) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_row_header) + return Glib::wrap((*base->get_row_header)(gobj(),row)); + + typedef Glib::RefPtr RType; + return RType(); +} + +Glib::RefPtr Atk::Table::get_summary_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_summary) + return Glib::wrap((*base->get_summary)(gobj())); + + typedef Glib::RefPtr RType; + return RType(); +} + +void Atk::Table::set_caption_vfunc(const Glib::RefPtr& caption) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_caption) + (*base->set_caption)(gobj(),Glib::unwrap(caption)); +} + +void Atk::Table::set_column_description_vfunc(int column, const char* description) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_column_description) + (*base->set_column_description)(gobj(),column,description); +} + +void Atk::Table::set_column_header_vfunc(int column, const Glib::RefPtr& header) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_column_header) + (*base->set_column_header)(gobj(),column,Glib::unwrap(header)); +} + +void Atk::Table::set_row_description_vfunc(int row, const char* description) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_row_description) + (*base->set_row_description)(gobj(),row,description); +} + +void Atk::Table::set_row_header_vfunc(int row, const Glib::RefPtr& header) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_row_header) + (*base->set_row_header)(gobj(),row,Glib::unwrap(header)); +} + +void Atk::Table::set_summary_vfunc(const Glib::RefPtr& accessible) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_summary) + (*base->set_summary)(gobj(),Glib::unwrap(accessible)); +} + +bool Atk::Table::is_column_selected_vfunc(int column) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->is_column_selected) + return (*base->is_column_selected)(const_cast(gobj()),column); + + typedef bool RType; + return RType(); +} + +bool Atk::Table::is_row_selected_vfunc(int row) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->is_row_selected) + return (*base->is_row_selected)(const_cast(gobj()),row); + + typedef bool RType; + return RType(); +} + +bool Atk::Table::is_selected_vfunc(int row, int column) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->is_selected) + return (*base->is_selected)(const_cast(gobj()),row,column); + + typedef bool RType; + return RType(); +} + +bool Atk::Table::add_row_selection_vfunc(int row) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->add_row_selection) + return (*base->add_row_selection)(gobj(),row); + + typedef bool RType; + return RType(); +} + +bool Atk::Table::remove_row_selection_vfunc(int row) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_row_selection) + return (*base->remove_row_selection)(gobj(),row); + + typedef bool RType; + return RType(); +} + +bool Atk::Table::add_column_selection_vfunc(int column) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->add_column_selection) + return (*base->add_column_selection)(gobj(),column); + + typedef bool RType; + return RType(); +} + +bool Atk::Table::remove_column_selection_vfunc(int column) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_column_selection) + return (*base->remove_column_selection)(gobj(),column); + + typedef bool RType; + return RType(); +} + +int Atk::Table::get_selected_columns_vfunc(int** selected) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_selected_columns) + return (*base->get_selected_columns)(const_cast(gobj()),selected); + + typedef int RType; + return RType(); +} + +int Atk::Table::get_selected_rows_vfunc(int** selected) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_selected_rows) + return (*base->get_selected_rows)(const_cast(gobj()),selected); + + typedef int RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/table.h b/libs/gtkmm2/atk/atkmm/table.h new file mode 100644 index 0000000000..f1936afd49 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/table.h @@ -0,0 +1,427 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_TABLE_H +#define _ATKMM_TABLE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkTableIface AtkTableIface; + typedef struct _AtkTable AtkTable; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkTable AtkTable; +typedef struct _AtkTableClass AtkTableClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Table_Class; } // namespace Atk +namespace Atk +{ + +class Object; + +/** The ATK interface implemented for UI components which contain tabular or row/column information. + * This should be implemented by components which present elements ordered via rows and columns. It may also be used to + * present tree-structured information if the nodes of the trees can be said to contain multiple "columns". Individual + * elements of an Atk::Table are typically referred to as "cells", and these cells are exposed by Atk::Table as child + * Atk::Objects of the Atk::Table. Both row/column and child-index-based access to these children is provided. + * + * Children of Atk::Table are frequently "lightweight" objects, that is, they may not have backing widgets in the host UI + * toolkit. They are therefore often transient. + * + * Since tables are often very complex, Atk::Table includes provision for offering simplified summary information, as + * well as row and column headers and captions. Headers and captions are AtkObjects which may implement other interfaces + * (Atk::Text, Atk::Image, etc.) as appropriate. Atk::Table summaries may themselves be (simplified) Atk::Tables, etc. + */ + +class Table : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Table CppObjectType; + typedef Table_Class CppClassType; + typedef AtkTable BaseObjectType; + typedef AtkTableIface BaseClassType; + +private: + friend class Table_Class; + static CppClassType table_class_; + + // noncopyable + Table(const Table&); + Table& operator=(const Table&); + +protected: + Table(); // you must derive from this class + explicit Table(AtkTable* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Table(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkTable* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkTable* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Get a reference to the table cell at @a row , @a column . + * @param row A int representing a row in @a table . + * @param column A int representing a column in @a table . + * @return A AtkObject* representing the referred to accessible. + */ + Glib::RefPtr get_at(int row, int column); + + /** Gets a int representing the index at the specified @a row and @a column . + * The value -1 is returned if the object at row,column is not a child + * of table or table does not implement this interface. + * @param row A int representing a row in @a table . + * @param column A int representing a column in @a table . + * @return A int representing the index at specified position. + */ + int get_index_at(int row, int column) const; + + /** Gets a int representing the column at the specified @a index , or -1 + * if the table does not implement this interface + * @param index A int representing an index in @a table . + * @return A int representing the column at the specified index. + */ + int get_column_at_index(int index) const; + + /** Gets a int representing the row at the specified @a index , or -1 + * if the table does not implement this interface + * @param index A int representing an index in @a table . + * @return A int representing the row at the specified index. + */ + int get_row_at_index(int index) const; + + /** Gets the number of columns in the table. + * @return A int representing the number of columns, or 0 + * if value does not implement this interface. + */ + int get_n_columns() const; + + /** Gets the number of rows in the table. + * @return A int representing the number of rows, or 0 + * if value does not implement this interface. + */ + int get_n_rows() const; + + /** Gets the number of columns occupied by the accessible object + * at the specified @a row and @a column in the @a table . + * @param row A int representing a row in @a table . + * @param column A int representing a column in @a table . + * @return A int representing the column extent at specified position, or 0 + * if value does not implement this interface. + */ + int get_column_extent_at(int row, int column) const; + + /** Gets the number of rows occupied by the accessible object + * at a specified @a row and @a column in the @a table . + * @param row A int representing a row in @a table . + * @param column A int representing a column in @a table . + * @return A int representing the row extent at specified position, or 0 + * if value does not implement this interface. + */ + int get_row_extent_at(int row, int column) const; + + + /** Gets the caption for the @a table . + * @return A AtkObject* representing the table caption, or 0 + * if value does not implement this interface. + */ + Glib::RefPtr get_caption(); + + /** Gets the caption for the @a table . + * @return A AtkObject* representing the table caption, or 0 + * if value does not implement this interface. + */ + Glib::RefPtr get_caption() const; + + + /** Gets the description text of the specified @a column in the table + * @param column A int representing a column in @a table . + * @return A gchar* representing the column description, or 0 + * if value does not implement this interface. + */ + Glib::ustring get_column_description(int column) const; + + + /** Gets the column header of a specified column in an accessible table. + * @param column A int representing a column in the table. + * @return A AtkObject* representing the specified column header, or + * 0 if value does not implement this interface. + */ + Glib::RefPtr get_column_header(int column); + + /** Gets the column header of a specified column in an accessible table. + * @param column A int representing a column in the table. + * @return A AtkObject* representing the specified column header, or + * 0 if value does not implement this interface. + */ + Glib::RefPtr get_column_header(int column) const; + + + /** Gets the description text of the specified row in the table + * @param row A int representing a row in @a table . + * @return A gchar* representing the row description, or 0 + * if value does not implement this interface. + */ + Glib::ustring get_row_description(int row) const; + + + /** Gets the row header of a specified row in an accessible table. + * @param row A int representing a row in the table. + * @return A AtkObject* representing the specified row header, or + * 0 if value does not implement this interface. + */ + Glib::RefPtr get_row_header(int row); + + /** Gets the row header of a specified row in an accessible table. + * @param row A int representing a row in the table. + * @return A AtkObject* representing the specified row header, or + * 0 if value does not implement this interface. + */ + Glib::RefPtr get_row_header(int row) const; + + + /** Gets the summary description of the table. + * @return A AtkObject* representing a summary description of the table, + * or zero if value does not implement this interface. + */ + Glib::RefPtr get_summary(); + + /** Gets the summary description of the table. + * @return A AtkObject* representing a summary description of the table, + * or zero if value does not implement this interface. + */ + Glib::RefPtr get_summary() const; + + + /** Sets the caption for the table. + * @param caption A Atk::Object representing the caption to set for @a table . + */ + void set_caption(const Glib::RefPtr& caption); + + /** Sets the description text for the specified @a column of the @a table . + * @param column A int representing a column in @a table . + * @param description A #gchar representing the description text + * to set for the specified @a column of the @a table . + */ + void set_column_description(int column, const Glib::ustring& description); + + /** Sets the specified column header to @a header . + * @param column A int representing a column in @a table . + * @param header An Atk::Table. + */ + void set_column_header(int column, const Glib::RefPtr& header); + + /** Sets the description text for the specified @a row of @a table . + * @param row A int representing a row in @a table . + * @param description A #gchar representing the description text + * to set for the specified @a row of @a table . + */ + void set_row_description(int row, const Glib::ustring& description); + + /** Sets the specified row header to @a header . + * @param row A int representing a row in @a table . + * @param header An Atk::Table. + */ + void set_row_header(int row, const Glib::RefPtr& header); + + /** Sets the summary description of the table. + * @param accessible An Atk::Object representing the summary description + * to set for @a table . + */ + void set_summary(const Glib::RefPtr& accessible); + + + Glib::ArrayHandle get_selected_columns() const; + Glib::ArrayHandle get_selected_rows() const; + + + /** Gets a boolean value indicating whether the specified @a column + * is selected + * @param column A int representing a column in @a table . + * @return A bool representing if the column is selected, or 0 + * if value does not implement this interface. + */ + bool is_column_selected(int column) const; + + /** Gets a boolean value indicating whether the specified @a row + * is selected + * @param row A int representing a row in @a table . + * @return A bool representing if the row is selected, or 0 + * if value does not implement this interface. + */ + bool is_row_selected(int row) const; + + /** Gets a boolean value indicating whether the accessible object + * at the specified @a row and @a column is selected + * @param row A int representing a row in @a table . + * @param column A int representing a column in @a table . + * @return A bool representing if the cell is selected, or 0 + * if value does not implement this interface. + */ + bool is_selected(int row, int column) const; + + /** Adds the specified @a row to the selection. + * @param row A int representing a row in @a table . + * @return A bool representing if row was successfully added to selection, + * or 0 if value does not implement this interface. + */ + bool add_row_selection(int row); + + /** Removes the specified @a row from the selection. + * @param row A int representing a row in @a table . + * @return A bool representing if the row was successfully removed from + * the selection, or 0 if value does not implement this interface. + */ + bool remove_row_selection(int row); + + /** Adds the specified @a column to the selection. + * @param column A int representing a column in @a table . + * @return A bool representing if the column was successfully added to + * the selection, or 0 if value does not implement this interface. + */ + bool add_column_selection(int column); + + /** Adds the specified @a column to the selection. + * @param column A int representing a column in @a table . + * @return A bool representing if the column was successfully removed from + * the selection, or 0 if value does not implement this interface. + */ + bool remove_column_selection(int column); + + + Glib::SignalProxy2< void,int,int > signal_row_inserted(); + + + Glib::SignalProxy2< void,int,int > signal_column_inserted(); + + + Glib::SignalProxy2< void,int,int > signal_row_deleted(); + + + Glib::SignalProxy2< void,int,int > signal_column_deleted(); + + + Glib::SignalProxy0< void > signal_row_reordered(); + + + Glib::SignalProxy0< void > signal_column_reordered(); + + + Glib::SignalProxy0< void > signal_model_changed(); + + +protected: + virtual Glib::RefPtr get_at_vfunc(int row, int column); + virtual int get_index_at_vfunc(int row, int column) const; + virtual int get_column_at_index_vfunc(int index) const; + virtual int get_row_at_index_vfunc(int index) const; + virtual int get_n_columns_vfunc() const; + virtual int get_n_rows_vfunc() const; + virtual int get_column_extent_at_vfunc(int row, int column) const; + virtual int get_row_extent_at_vfunc(int row, int column) const; + virtual Glib::RefPtr get_caption_vfunc(); + virtual const char* get_column_description_vfunc(int column) const; + virtual Glib::RefPtr get_column_header_vfunc(int column); + virtual const char* get_row_description_vfunc(int row) const; + virtual Glib::RefPtr get_row_header_vfunc(int row); + virtual Glib::RefPtr get_summary_vfunc(); + virtual void set_caption_vfunc(const Glib::RefPtr& caption); + virtual void set_column_description_vfunc(int column, const char* description); + virtual void set_column_header_vfunc(int column, const Glib::RefPtr& header); + virtual void set_row_description_vfunc(int row, const char* description); + virtual void set_row_header_vfunc(int row, const Glib::RefPtr& header); + virtual void set_summary_vfunc(const Glib::RefPtr& accessible); + virtual bool is_column_selected_vfunc(int column) const; + virtual bool is_row_selected_vfunc(int row) const; + virtual bool is_selected_vfunc(int row, int column) const; + virtual bool add_row_selection_vfunc(int row); + virtual bool remove_row_selection_vfunc(int row); + virtual bool add_column_selection_vfunc(int column); + virtual bool remove_column_selection_vfunc(int column); + virtual int get_selected_columns_vfunc(int** selected) const; + virtual int get_selected_rows_vfunc(int** selected) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_row_inserted(int row, int num_inserted); + virtual void on_column_inserted(int column, int num_inserted); + virtual void on_row_deleted(int row, int num_deleted); + virtual void on_column_deleted(int column, int num_deleted); + virtual void on_row_reordered(); + virtual void on_column_reordered(); + virtual void on_model_changed(); + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Table + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkTable* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_TABLE_H */ + diff --git a/libs/gtkmm2/atk/atkmm/text.cc b/libs/gtkmm2/atk/atkmm/text.cc new file mode 100644 index 0000000000..af101a5117 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/text.cc @@ -0,0 +1,1563 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include /* for std::swap() */ + + +// static +GType Glib::Value::value_type() +{ + return atk_text_attribute_get_type(); +} + + +namespace Atk +{ + +/**** Atk::Attribute *******************************************************/ + +Attribute::Attribute() +{ + gobject_.name = 0; + gobject_.value = 0; +} + +Attribute::Attribute(const Glib::ustring& name, const Glib::ustring& value) +{ + gobject_.name = g_strndup(name .data(), name .bytes()); + gobject_.value = g_strndup(value.data(), value.bytes()); +} + +Attribute::Attribute(const AtkAttribute* gobject) +{ + g_return_if_fail(gobject != 0); + + gobject_.name = g_strdup(gobject->name); + gobject_.value = g_strdup(gobject->value); +} + +Attribute::~Attribute() +{ + g_free(gobject_.name); + g_free(gobject_.value); +} + +Attribute::Attribute(const Attribute& other) +{ + gobject_.name = g_strdup(other.gobject_.name); + gobject_.value = g_strdup(other.gobject_.value); +} + +Attribute& Attribute::operator=(const Attribute& other) +{ + Attribute temp (other); + swap(temp); + return *this; +} + +void Attribute::swap(Attribute& other) +{ + std::swap(gobject_.name, other.gobject_.name); + std::swap(gobject_.value, other.gobject_.value); +} + + +/**** Atk::TextAttribute ***************************************************/ + +// static +TextAttribute TextAttribute::for_name(const Glib::ustring& name) +{ + return TextAttribute(int(atk_text_attribute_for_name(name.c_str()))); +} + +// static +Glib::ustring TextAttribute::get_name(TextAttribute attribute) +{ + if(const char *const name = atk_text_attribute_get_name(AtkTextAttribute(int(attribute)))) + return Glib::ustring(name); + else + return Glib::ustring(); +} + +// static +Glib::ustring TextAttribute::get_value(TextAttribute attribute, int index) +{ + if(const char *const value = atk_text_attribute_get_value(AtkTextAttribute(int(attribute)), index)) + return Glib::ustring(value); + else + return Glib::ustring(); +} + +} // namespace Atk + + +namespace +{ + +void Text_signal_text_changed_callback(AtkText* self, gint p0,gint p1,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Text_signal_text_changed_info = +{ + "text_changed", + (GCallback) &Text_signal_text_changed_callback, + (GCallback) &Text_signal_text_changed_callback +}; + + +void Text_signal_text_caret_moved_callback(AtkText* self, gint p0,void* data) +{ + using namespace Atk; + typedef sigc::slot< void,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Text_signal_text_caret_moved_info = +{ + "text_caret_moved", + (GCallback) &Text_signal_text_caret_moved_callback, + (GCallback) &Text_signal_text_caret_moved_callback +}; + + +const Glib::SignalProxyInfo Text_signal_text_selection_changed_info = +{ + "text_selection_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Text_signal_text_attributes_changed_info = +{ + "text_attributes_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Atk +{ + + +Glib::ustring Attribute::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name); +} + +Glib::ustring Attribute::get_value() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->value); +} + + +} // namespace Atk + +// static +GType Glib::Value::value_type() +{ + return atk_text_attribute_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return atk_text_boundary_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return atk_text_clip_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkText* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Text_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Text_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_text_get_type(); + } + + return *this; +} + +void Text_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->get_text = &get_text_vfunc_callback; + klass->get_character_at_offset = &get_character_at_offset_vfunc_callback; + klass->get_text_after_offset = &get_text_after_offset_vfunc_callback; + klass->get_text_at_offset = &get_text_at_offset_vfunc_callback; + klass->get_text_before_offset = &get_text_before_offset_vfunc_callback; + klass->get_caret_offset = &get_caret_offset_vfunc_callback; + klass->get_character_extents = &get_character_extents_vfunc_callback; + klass->get_run_attributes = &get_run_attributes_vfunc_callback; + klass->get_default_attributes = &get_default_attributes_vfunc_callback; + klass->get_character_count = &get_character_count_vfunc_callback; + klass->get_offset_at_point = &get_offset_at_point_vfunc_callback; + klass->get_n_selections = &get_n_selections_vfunc_callback; + klass->get_selection = &get_selection_vfunc_callback; + klass->add_selection = &add_selection_vfunc_callback; + klass->remove_selection = &remove_selection_vfunc_callback; + klass->set_selection = &set_selection_vfunc_callback; + klass->set_caret_offset = &set_caret_offset_vfunc_callback; + klass->text_changed = &text_changed_callback; + klass->text_caret_moved = &text_caret_moved_callback; + klass->text_selection_changed = &text_selection_changed_callback; + klass->text_attributes_changed = &text_attributes_changed_callback; +} + +gchar* Text_Class::get_text_vfunc_callback(AtkText* self, gint start_offset, gint end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return g_strdup((obj->get_text_vfunc(start_offset +, end_offset +)).c_str()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_text) + return (*base->get_text)(self, start_offset, end_offset); + } + + typedef gchar* RType; + return RType(); +} + +gunichar Text_Class::get_character_at_offset_vfunc_callback(AtkText* self, gint offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_character_at_offset_vfunc(offset +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_character_at_offset) + return (*base->get_character_at_offset)(self, offset); + } + + typedef gunichar RType; + return RType(); +} + +gchar* Text_Class::get_text_after_offset_vfunc_callback(AtkText* self, gint offset, AtkTextBoundary boundary_type, gint* start_offset, gint* end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return g_strdup((obj->get_text_after_offset_vfunc(offset +, ((TextBoundary)(boundary_type)) +, *(start_offset) +, *(end_offset) +)).c_str()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_text_after_offset) + return (*base->get_text_after_offset)(self, offset, boundary_type, start_offset, end_offset); + } + + typedef gchar* RType; + return RType(); +} + +gchar* Text_Class::get_text_at_offset_vfunc_callback(AtkText* self, gint offset, AtkTextBoundary boundary_type, gint* start_offset, gint* end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return g_strdup((obj->get_text_at_offset_vfunc(offset +, ((TextBoundary)(boundary_type)) +, *(start_offset) +, *(end_offset) +)).c_str()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_text_at_offset) + return (*base->get_text_at_offset)(self, offset, boundary_type, start_offset, end_offset); + } + + typedef gchar* RType; + return RType(); +} + +gchar* Text_Class::get_text_before_offset_vfunc_callback(AtkText* self, gint offset, AtkTextBoundary boundary_type, gint* start_offset, gint* end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return g_strdup((obj->get_text_before_offset_vfunc(offset +, ((TextBoundary)(boundary_type)) +, *(start_offset) +, *(end_offset) +)).c_str()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_text_before_offset) + return (*base->get_text_before_offset)(self, offset, boundary_type, start_offset, end_offset); + } + + typedef gchar* RType; + return RType(); +} + +gint Text_Class::get_caret_offset_vfunc_callback(AtkText* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_caret_offset_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_caret_offset) + return (*base->get_caret_offset)(self); + } + + typedef gint RType; + return RType(); +} + +void Text_Class::get_character_extents_vfunc_callback(AtkText* self, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_character_extents_vfunc(offset +, *(x) +, *(y) +, *(width) +, *(height) +, ((CoordType)(coords)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_character_extents) + (*base->get_character_extents)(self, offset, x, y, width, height, coords); + } +} + +AtkAttributeSet* Text_Class::get_run_attributes_vfunc_callback(AtkText* self, gint offset, gint* start_offset, gint* end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_run_attributes_vfunc(offset +, *(start_offset) +, *(end_offset) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_run_attributes) + return (*base->get_run_attributes)(self, offset, start_offset, end_offset); + } + + typedef AtkAttributeSet* RType; + return RType(); +} + +AtkAttributeSet* Text_Class::get_default_attributes_vfunc_callback(AtkText* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_default_attributes_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_default_attributes) + return (*base->get_default_attributes)(self); + } + + typedef AtkAttributeSet* RType; + return RType(); +} + +gint Text_Class::get_character_count_vfunc_callback(AtkText* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_character_count_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_character_count) + return (*base->get_character_count)(self); + } + + typedef gint RType; + return RType(); +} + +gint Text_Class::get_offset_at_point_vfunc_callback(AtkText* self, gint x, gint y, AtkCoordType coords) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_offset_at_point_vfunc(x +, y +, ((CoordType)(coords)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_offset_at_point) + return (*base->get_offset_at_point)(self, x, y, coords); + } + + typedef gint RType; + return RType(); +} + +gint Text_Class::get_n_selections_vfunc_callback(AtkText* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_n_selections_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_n_selections) + return (*base->get_n_selections)(self); + } + + typedef gint RType; + return RType(); +} + +gchar* Text_Class::get_selection_vfunc_callback(AtkText* self, gint selection_num, gint* start_offset, gint* end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return g_strdup((obj->get_selection_vfunc(selection_num +, *(start_offset) +, *(end_offset) +)).c_str()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_selection) + return (*base->get_selection)(self, selection_num, start_offset, end_offset); + } + + typedef gchar* RType; + return RType(); +} + +gboolean Text_Class::add_selection_vfunc_callback(AtkText* self, gint start_offset, gint end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->add_selection_vfunc(start_offset +, end_offset +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->add_selection) + return (*base->add_selection)(self, start_offset, end_offset); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Text_Class::remove_selection_vfunc_callback(AtkText* self, gint selection_num) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->remove_selection_vfunc(selection_num +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_selection) + return (*base->remove_selection)(self, selection_num); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Text_Class::set_selection_vfunc_callback(AtkText* self, gint selection_num, gint start_offset, gint end_offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_selection_vfunc(selection_num +, start_offset +, end_offset +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_selection) + return (*base->set_selection)(self, selection_num, start_offset, end_offset); + } + + typedef gboolean RType; + return RType(); +} + +gboolean Text_Class::set_caret_offset_vfunc_callback(AtkText* self, gint offset) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_caret_offset_vfunc(offset +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_caret_offset) + return (*base->set_caret_offset)(self, offset); + } + + typedef gboolean RType; + return RType(); +} + + +void Text_Class::text_changed_callback(AtkText* self, gint p0, gint p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_text_changed(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->text_changed) + (*base->text_changed)(self, p0, p1); + } +} + +void Text_Class::text_caret_moved_callback(AtkText* self, gint p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_text_caret_moved(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->text_caret_moved) + (*base->text_caret_moved)(self, p0); + } +} + +void Text_Class::text_selection_changed_callback(AtkText* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_text_selection_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->text_selection_changed) + (*base->text_selection_changed)(self); + } +} + +void Text_Class::text_attributes_changed_callback(AtkText* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_text_attributes_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->text_attributes_changed) + (*base->text_attributes_changed)(self); + } +} + + +Glib::ObjectBase* Text_Class::wrap_new(GObject* object) +{ + return new Text((AtkText*)(object)); +} + + +/* The implementation: */ + +Text::Text() +: + Glib::Interface(text_class_.init()) +{} + +Text::Text(AtkText* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Text::~Text() +{} + +// static +void Text::add_interface(GType gtype_implementer) +{ + text_class_.init().add_interface(gtype_implementer); +} + +Text::CppClassType Text::text_class_; // initialize static member + +GType Text::get_type() +{ + return text_class_.init().get_type(); +} + +GType Text::get_base_type() +{ + return atk_text_get_type(); +} + +Glib::ustring Text::get_text(int start_offset, int end_offset) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(atk_text_get_text(const_cast(gobj()), start_offset, end_offset)); +} + +gunichar Text::get_character_at_offset(int offset) const +{ + return atk_text_get_character_at_offset(const_cast(gobj()), offset); +} + +Glib::ustring Text::get_text_after_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(atk_text_get_text_after_offset(const_cast(gobj()), offset, ((AtkTextBoundary)(boundary_type)), &start_offset, &end_offset)); +} + +Glib::ustring Text::get_text_at_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(atk_text_get_text_at_offset(const_cast(gobj()), offset, ((AtkTextBoundary)(boundary_type)), &start_offset, &end_offset)); +} + +Glib::ustring Text::get_text_before_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(atk_text_get_text_before_offset(const_cast(gobj()), offset, ((AtkTextBoundary)(boundary_type)), &start_offset, &end_offset)); +} + +int Text::get_caret_offset() const +{ + return atk_text_get_caret_offset(const_cast(gobj())); +} + +void Text::get_character_extents(int offset, int& x, int& y, int& width, int& height, CoordType coords) const +{ + atk_text_get_character_extents(const_cast(gobj()), offset, &x, &y, &width, &height, ((AtkCoordType)(coords))); +} + +AttributeSet Text::get_run_attributes(int offset, int& start_offset, int& end_offset) const +{ + return AttributeSet(atk_text_get_run_attributes(const_cast(gobj()), offset, &start_offset, &end_offset), Glib::OWNERSHIP_DEEP); +} + +AttributeSet Text::get_default_attributes() const +{ + return AttributeSet(atk_text_get_default_attributes(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + +int Text::get_character_count() const +{ + return atk_text_get_character_count(const_cast(gobj())); +} + +int Text::get_offset_at_point(int x, int y, CoordType coords) const +{ + return atk_text_get_offset_at_point(const_cast(gobj()), x, y, ((AtkCoordType)(coords))); +} + +int Text::get_n_selections() const +{ + return atk_text_get_n_selections(const_cast(gobj())); +} + +Glib::ustring Text::get_selection(int selection_num, int& start_offset, int& end_offset) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(atk_text_get_selection(const_cast(gobj()), selection_num, &start_offset, &end_offset)); +} + +bool Text::add_selection(int start_offset, int end_offset) +{ + return atk_text_add_selection(gobj(), start_offset, end_offset); +} + +bool Text::remove_selection(int selection_num) +{ + return atk_text_remove_selection(gobj(), selection_num); +} + +bool Text::set_selection(int selection_num, int start_offset, int end_offset) +{ + return atk_text_set_selection(gobj(), selection_num, start_offset, end_offset); +} + +bool Text::set_caret_offset(int offset) +{ + return atk_text_set_caret_offset(gobj(), offset); +} + +void Text::get_range_extents(int start_offset, int end_offset, CoordType coord_type, Rectangle& rect) +{ + atk_text_get_range_extents(gobj(), start_offset, end_offset, ((AtkCoordType)(coord_type)), &(rect)); +} + +AtkTextRange** Text::get_bounded_ranges(const Rectangle& rect, CoordType coord_type, TextClipType x_clip_type, TextClipType y_clip_type) +{ + return atk_text_get_bounded_ranges(gobj(), const_cast(&(rect)), ((AtkCoordType)(coord_type)), ((AtkTextClipType)(x_clip_type)), ((AtkTextClipType)(y_clip_type))); +} + + +Glib::SignalProxy2< void,int,int > Text::signal_text_changed() +{ + return Glib::SignalProxy2< void,int,int >(this, &Text_signal_text_changed_info); +} + +Glib::SignalProxy1< void,int > Text::signal_text_caret_moved() +{ + return Glib::SignalProxy1< void,int >(this, &Text_signal_text_caret_moved_info); +} + +Glib::SignalProxy0< void > Text::signal_text_selection_changed() +{ + return Glib::SignalProxy0< void >(this, &Text_signal_text_selection_changed_info); +} + +Glib::SignalProxy0< void > Text::signal_text_attributes_changed() +{ + return Glib::SignalProxy0< void >(this, &Text_signal_text_attributes_changed_info); +} + + +void Atk::Text::on_text_changed(int position, int length) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->text_changed) + (*base->text_changed)(gobj(),position,length); +} + +void Atk::Text::on_text_caret_moved(int location) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->text_caret_moved) + (*base->text_caret_moved)(gobj(),location); +} + +void Atk::Text::on_text_selection_changed() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->text_selection_changed) + (*base->text_selection_changed)(gobj()); +} + +void Atk::Text::on_text_attributes_changed() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->text_attributes_changed) + (*base->text_attributes_changed)(gobj()); +} + + +Glib::ustring Atk::Text::get_text_vfunc(int start_offset, int end_offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_text) + return Glib::convert_const_gchar_ptr_to_ustring((*base->get_text)(const_cast(gobj()),start_offset,end_offset)); + + typedef Glib::ustring RType; + return RType(); +} + +gunichar Atk::Text::get_character_at_offset_vfunc(int offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_character_at_offset) + return (*base->get_character_at_offset)(const_cast(gobj()),offset); + + typedef gunichar RType; + return RType(); +} + +Glib::ustring Atk::Text::get_text_after_offset_vfunc(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_text_after_offset) + return Glib::convert_const_gchar_ptr_to_ustring((*base->get_text_after_offset)(const_cast(gobj()),offset,((AtkTextBoundary)(boundary_type)),&start_offset,&end_offset)); + + typedef Glib::ustring RType; + return RType(); +} + +Glib::ustring Atk::Text::get_text_at_offset_vfunc(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_text_at_offset) + return Glib::convert_const_gchar_ptr_to_ustring((*base->get_text_at_offset)(const_cast(gobj()),offset,((AtkTextBoundary)(boundary_type)),&start_offset,&end_offset)); + + typedef Glib::ustring RType; + return RType(); +} + +Glib::ustring Atk::Text::get_text_before_offset_vfunc(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_text_before_offset) + return Glib::convert_const_gchar_ptr_to_ustring((*base->get_text_before_offset)(const_cast(gobj()),offset,((AtkTextBoundary)(boundary_type)),&start_offset,&end_offset)); + + typedef Glib::ustring RType; + return RType(); +} + +int Atk::Text::get_caret_offset_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_caret_offset) + return (*base->get_caret_offset)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +void Atk::Text::get_character_extents_vfunc(int offset, int& x, int& y, int& width, int& height, CoordType coords) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_character_extents) + (*base->get_character_extents)(const_cast(gobj()),offset,&x,&y,&width,&height,((AtkCoordType)(coords))); +} + +AtkAttributeSet* Atk::Text::get_run_attributes_vfunc(int offset, int& start_offset, int& end_offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_run_attributes) + return (*base->get_run_attributes)(const_cast(gobj()),offset,&start_offset,&end_offset); + + typedef AtkAttributeSet* RType; + return RType(); +} + +AtkAttributeSet* Atk::Text::get_default_attributes_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_default_attributes) + return (*base->get_default_attributes)(const_cast(gobj())); + + typedef AtkAttributeSet* RType; + return RType(); +} + +int Atk::Text::get_character_count_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_character_count) + return (*base->get_character_count)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +int Atk::Text::get_offset_at_point_vfunc(int x, int y, CoordType coords) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_offset_at_point) + return (*base->get_offset_at_point)(const_cast(gobj()),x,y,((AtkCoordType)(coords))); + + typedef int RType; + return RType(); +} + +int Atk::Text::get_n_selections_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_n_selections) + return (*base->get_n_selections)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + +Glib::ustring Atk::Text::get_selection_vfunc(int selection_num, int& start_offset, int& end_offset) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_selection) + return Glib::convert_const_gchar_ptr_to_ustring((*base->get_selection)(const_cast(gobj()),selection_num,&start_offset,&end_offset)); + + typedef Glib::ustring RType; + return RType(); +} + +bool Atk::Text::add_selection_vfunc(int start_offset, int end_offset) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->add_selection) + return (*base->add_selection)(gobj(),start_offset,end_offset); + + typedef bool RType; + return RType(); +} + +bool Atk::Text::remove_selection_vfunc(int selection_num) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_selection) + return (*base->remove_selection)(gobj(),selection_num); + + typedef bool RType; + return RType(); +} + +bool Atk::Text::set_selection_vfunc(int selection_num, int start_offset, int end_offset) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_selection) + return (*base->set_selection)(gobj(),selection_num,start_offset,end_offset); + + typedef bool RType; + return RType(); +} + +bool Atk::Text::set_caret_offset_vfunc(int offset) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_caret_offset) + return (*base->set_caret_offset)(gobj(),offset); + + typedef bool RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/text.h b/libs/gtkmm2/atk/atkmm/text.h new file mode 100644 index 0000000000..86dee7ee39 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/text.h @@ -0,0 +1,687 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_TEXT_H +#define _ATKMM_TEXT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include /* for Atk::CoordType */ +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkText AtkText; +typedef struct _AtkTextClass AtkTextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Text_Class; } // namespace Atk +namespace Atk +{ + +class Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Attribute CppObjectType; + typedef AtkAttribute BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + Attribute(); + Attribute(const Glib::ustring& name, const Glib::ustring& value); + explicit Attribute(const AtkAttribute* gobject); + ~Attribute(); + + Attribute(const Attribute& other); + Attribute& operator=(const Attribute& other); + + void swap(Attribute& other); + + Glib::ustring get_name() const; + Glib::ustring get_value() const; + + /// Provides access to the underlying C GObject. + AtkAttribute* gobj() { return &gobject_; } + + /// Provides access to the underlying C GObject. + const AtkAttribute* gobj() const { return &gobject_; } + +protected: + AtkAttribute gobject_; + + +}; + +/** @relates Atk::Attribute */ +inline void swap(Attribute& lhs, Attribute& rhs) + { lhs.swap(rhs); } + +struct AttributeTraits +{ + typedef Atk::Attribute CppType; + typedef const AtkAttribute* CType; + typedef AtkAttribute* CTypeNonConst; + + static CType to_c_type(CType item) { return item; } + static CType to_c_type(const CppType& item) { return item.gobj(); } + static CppType to_cpp_type(CType item) { return CppType(item); } + static void release_c_type(CType item) { g_free(const_cast(item)); } +}; + +typedef Glib::SListHandle AttributeSet; + + +/** @addtogroup atkmmEnums Enums and Flags */ + +/** + * @ingroup atkmmEnums + */ +enum BuiltinTextAttribute +{ + TEXT_ATTR_INVALID, + TEXT_ATTR_LEFT_MARGIN, + TEXT_ATTR_RIGHT_MARGIN, + TEXT_ATTR_INDENT, + TEXT_ATTR_INVISIBLE, + TEXT_ATTR_EDITABLE, + TEXT_ATTR_PIXELS_ABOVE_LINES, + TEXT_ATTR_PIXELS_BELOW_LINES, + TEXT_ATTR_PIXELS_INSIDE_WRAP, + TEXT_ATTR_BG_FULL_HEIGHT, + TEXT_ATTR_RISE, + TEXT_ATTR_UNDERLINE, + TEXT_ATTR_STRIKETHROUGH, + TEXT_ATTR_SIZE, + TEXT_ATTR_SCALE, + TEXT_ATTR_WEIGHT, + TEXT_ATTR_LANGUAGE, + TEXT_ATTR_FAMILY_NAME, + TEXT_ATTR_BG_COLOR, + TEXT_ATTR_FG_COLOR, + TEXT_ATTR_BG_STIPPLE, + TEXT_ATTR_FG_STIPPLE, + TEXT_ATTR_WRAP_MODE, + TEXT_ATTR_DIRECTION, + TEXT_ATTR_JUSTIFICATION, + TEXT_ATTR_STRETCH, + TEXT_ATTR_VARIANT, + TEXT_ATTR_STYLE, + TEXT_ATTR_LAST_DEFINED +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + + +class TextAttribute +{ +private: + int attribute_; + +public: + TextAttribute() : attribute_ (0) {} + TextAttribute(BuiltinTextAttribute attribute) : attribute_ (attribute) {} + + // Behave like an ordinary enum. + explicit TextAttribute(int attribute) : attribute_ (attribute) {} + operator int() const { return attribute_; } + + static TextAttribute for_name(const Glib::ustring& name); + static Glib::ustring get_name(TextAttribute attribute); + static Glib::ustring get_value(TextAttribute attribute, int index); +}; + +} // namespace Atk + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +namespace Atk +{ + +/** + * @ingroup atkmmEnums + */ +enum TextBoundary +{ + TEXT_BOUNDARY_CHAR, + TEXT_BOUNDARY_WORD_START, + TEXT_BOUNDARY_WORD_END, + TEXT_BOUNDARY_SENTENCE_START, + TEXT_BOUNDARY_SENTENCE_END, + TEXT_BOUNDARY_LINE_START, + TEXT_BOUNDARY_LINE_END +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + +/** + * @ingroup atkmmEnums + */ +enum TextClipType +{ + TEXT_CLIP_NONE, + TEXT_CLIP_MIN, + TEXT_CLIP_MAX, + TEXT_CLIP_BOTH +}; + +} // namespace Atk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ + + +/** The ATK interface implemented by components with text content. + * This should be implemented by Atk::Objects on behalf of widgets that have text content which is either attributed + * or otherwise non-trivial. Atk::Objects whose text content is simple, unattributed, and very brief may expose that + * content via Atk::Object::get_name() instead; however if the text is editable, multi-line, typically longer than + * three or four words, attributed, selectable, or if the object already uses the 'name' ATK property for other + * information, this Text interface should be used to expose the text content. In the case of editable text content, + * Atk::EditableText (a subtype of the Atk::Text interface) should be implemented instead. + * + * Atk::Text provides not only traversal facilities and change notification for text content, but also caret tracking + * and glyph bounding box calculations. Note that the text strings are exposed as UTF-8, and are therefore potentially + * multi-byte, and caret-to-byte offset mapping makes no assumptions about the character length; also bounding box + * glyph-to-offset mapping may be complex for languages which use ligatures. + */ + +class Text : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Text CppObjectType; + typedef Text_Class CppClassType; + typedef AtkText BaseObjectType; + typedef AtkTextIface BaseClassType; + +private: + friend class Text_Class; + static CppClassType text_class_; + + // noncopyable + Text(const Text&); + Text& operator=(const Text&); + +protected: + Text(); // you must derive from this class + explicit Text(AtkText* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Text(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkText* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkText* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Gets the specified text. + * @param start_offset Start position. + * @param end_offset End position. + * @return The text from @a start_offset up to, but not including @a end_offset . + */ + Glib::ustring get_text(int start_offset, int end_offset) const; + + /** Gets the specified text. + * @param offset Position. + * @return The character at @a offset . + */ + gunichar get_character_at_offset(int offset) const; + + /** Gets the specified text. + * + * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character after the + * offset is returned. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string + * is from the word start after the offset to the next word start. + * + * The returned string will contain the word after the offset if the offset + * is inside a word or if the offset is not inside a word. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_END the returned string + * is from the word end at or after the offset to the next work end. + * + * The returned string will contain the word after the offset if the offset + * is inside a word and will contain the word after the word after the offset + * if the offset is not inside a word. + * + * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned + * string is from the sentence start after the offset to the next sentence + * start. + * + * The returned string will contain the sentence after the offset if the offset + * is inside a sentence or if the offset is not inside a sentence. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_SENTENCE_END the returned string + * is from the sentence end at or after the offset to the next sentence end. + * + * The returned string will contain the sentence after the offset if the offset + * is inside a sentence and will contain the sentence after the sentence + * after the offset if the offset is not inside a sentence. + * + * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned + * string is from the line start after the offset to the next line start. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_LINE_END the returned string + * is from the line end at or after the offset to the next line start. + * @param offset Position. + * @param boundary_type An Atk::TextBoundary. + * @param start_offset The start offset of the returned string. + * @param end_offset The end offset of the returned string. + * @return The text after @a offset bounded by the specified @a boundary_type . + */ + Glib::ustring get_text_after_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const; + + /** Gets the specified text. + * + * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the + * offset is returned. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string + * is from the word start at or before the offset to the word start after + * the offset. + * + * The returned string will contain the word at the offset if the offset + * is inside a word and will contain the word before the offset if the + * offset is not inside a word. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_END the returned string + * is from the word end before the offset to the word end at or after the + * offset. + * + * The returned string will contain the word at the offset if the offset + * is inside a word and will contain the word after to the offset if the + * offset is not inside a word. + * + * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned + * string is from the sentence start at or before the offset to the sentence + * start after the offset. + * + * The returned string will contain the sentence at the offset if the offset + * is inside a sentence and will contain the sentence before the offset + * if the offset is not inside a sentence. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_SENTENCE_END the returned string + * is from the sentence end before the offset to the sentence end at or + * after the offset. + * + * The returned string will contain the sentence at the offset if the offset + * is inside a sentence and will contain the sentence after the offset + * if the offset is not inside a sentence. + * + * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned + * string is from the line start at or before the offset to the line + * start after the offset. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_LINE_END the returned string + * is from the line end before the offset to the line end at or after + * the offset. + * @param offset Position. + * @param boundary_type An Atk::TextBoundary. + * @param start_offset The start offset of the returned string. + * @param end_offset The end offset of the returned string. + * @return The text at @a offset bounded by the specified @a boundary_type . + */ + Glib::ustring get_text_at_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const; + + /** Gets the specified text. + * + * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character before the + * offset is returned. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string + * is from the word start before the word start before the offset to + * the word start before the offset. + * + * The returned string will contain the word before the offset if the offset + * is inside a word and will contain the word before the word before the + * offset if the offset is not inside a word. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_END the returned string + * is from the word end before the word end at or before the offset to the + * word end at or before the offset. + * + * The returned string will contain the word before the offset if the offset + * is inside a word or if the offset is not inside a word. + * + * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned + * string is from the sentence start before the sentence start before + * the offset to the sentence start before the offset. + * + * The returned string will contain the sentence before the offset if the + * offset is inside a sentence and will contain the sentence before the + * sentence before the offset if the offset is not inside a sentence. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_SENTENCE_END the returned string + * is from the sentence end before the sentence end at or before the offset to + * the sentence end at or before the offset. + * + * The returned string will contain the sentence before the offset if the + * offset is inside a sentence or if the offset is not inside a sentence. + * + * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned + * string is from the line start before the line start ar or before the offset + * to the line start ar or before the offset. + * + * If the boundary_type is ATK_TEXT_BOUNDARY_LINE_END the returned string + * is from the line end before the line end before the offset to the + * line end before the offset. + * @param offset Position. + * @param boundary_type An Atk::TextBoundary. + * @param start_offset The start offset of the returned string. + * @param end_offset The end offset of the returned string. + * @return The text before @a offset bounded by the specified @a boundary_type . + */ + Glib::ustring get_text_before_offset(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const; + + /** Gets the offset position of the caret (cursor). + * @return The offset position of the caret (cursor). + */ + int get_caret_offset() const; + + /** Get the bounding box containing the glyph representing the character at + * a particular text offset. + * @param offset The offset of the text character for which bounding information is required. + * @param x Pointer for the x cordinate of the bounding box. + * @param y Pointer for the y cordinate of the bounding box. + * @param width Pointer for the width of the bounding box. + * @param height Pointer for the height of the bounding box. + * @param coords Specify whether coordinates are relative to the screen or widget window. + */ + void get_character_extents(int offset, int& x, int& y, int& width, int& height, CoordType coords) const; + + /** Creates an Atk::AttributeSet which consists of the attributes explicitly + * set at the position @a offset in the text. @a start_offset and @a end_offset are + * set to the start and end of the range around @a offset where the attributes are + * invariant. See the enum AtkTextAttribute for types of text attributes that + * can be returned. Note that other attributes may also be returned. + * @param offset The offset at which to get the attributes. + * @param start_offset The address to put the start offset of the range. + * @param end_offset The address to put the end offset of the range. + * @return An Atk::AttributeSet which contains the attributes explicitly set + * at @a offset . + */ + AttributeSet get_run_attributes(int offset, int& start_offset, int& end_offset) const; + + /** Creates an Atk::AttributeSet which consists of the default values of + * attributes for the text. See the enum AtkTextAttribute for types of text + * attributes that can be returned. Note that other attributes may also be + * returned. + * @return An Atk::AttributeSet which contains the default values of attributes. + * at @a offset . + */ + AttributeSet get_default_attributes() const; + + /** Gets the character count. + * @return The number of characters. + */ + int get_character_count() const; + + /** Gets the offset of the character located at coordinates @a x and @a y . @a x and @a y + * are interpreted as being relative to the screen or this widget's window + * depending on @a coords . + * @param x Screen x-position of character. + * @param y Screen y-position of character. + * @param coords Specify whether coordinates are relative to the screen or + * widget window. + * @return The offset to the character which is located at + * the specified @a x and @a y coordinates. + */ + int get_offset_at_point(int x, int y, CoordType coords) const; + + /** Gets the number of selected regions. + * @return The number of selected regions, or -1 if a failure + * occurred. + */ + int get_n_selections() const; + + /** Gets the text from the specified selection. + * @param selection_num The selection number. The selected regions are + * assigned numbers that correspond to how far the region is from the + * start of the text. The selected region closest to the beginning + * of the text region is assigned the number 0, etc. Note that adding, + * moving or deleting a selected region can change the numbering. + * @param start_offset Passes back the start position of the selected region. + * @param end_offset Passes back the end position of the selected region. + * @return The selected text. + */ + Glib::ustring get_selection(int selection_num, int& start_offset, int& end_offset) const; + + /** Adds a selection bounded by the specified offsets. + * @param start_offset The start position of the selected region. + * @param end_offset The end position of the selected region. + * @return true if success, false otherwise. + */ + bool add_selection(int start_offset, int end_offset); + + /** Removes the specified selection. + * @param selection_num The selection number. The selected regions are + * assigned numbers that correspond to how far the region is from the + * start of the text. The selected region closest to the beginning + * of the text region is assigned the number 0, etc. Note that adding, + * moving or deleting a selected region can change the numbering. + * @return true if success, false otherwise. + */ + bool remove_selection(int selection_num); + + /** Changes the start and end offset of the specified selection. + * @param selection_num The selection number. The selected regions are + * assigned numbers that correspond to how far the region is from the + * start of the text. The selected region closest to the beginning + * of the text region is assigned the number 0, etc. Note that adding, + * moving or deleting a selected region can change the numbering. + * @param start_offset The new start position of the selection. + * @param end_offset The new end position of the selection. + * @return true if success, false otherwise. + */ + bool set_selection(int selection_num, int start_offset, int end_offset); + + /** Sets the caret (cursor) position to the specified @a offset . + * @param offset Position. + * @return true if success, false otherwise. + */ + bool set_caret_offset(int offset); + + typedef AtkTextRectangle Rectangle; + + + /** Get the bounding box for text within the specified range. + * @param start_offset The offset of the first text character for which boundary + * information is required. + * @param end_offset The offset of the text character after the last character + * for which boundary information is required. + * @param coord_type Specify whether coordinates are relative to the screen or widget window. + * @param rect A pointer to a AtkTextRectangle which is filled in by this function. + */ + void get_range_extents(int start_offset, int end_offset, + CoordType coord_type, + Rectangle& rect); + + /** Get the ranges of text in the specified bounding box. + * @param rect An AtkTextRectagle giving the dimensions of the bounding box. + * @param coord_type Specify whether coordinates are relative to the screen or widget window. + * @param x_clip_type Specify the horizontal clip type. + * @param y_clip_type Specify the vertical clip type. + * @return Array of AtkTextRange. The last element of the array returned + * by this function will be 0. + */ + AtkTextRange** get_bounded_ranges(const Rectangle& rect, CoordType coord_type, + TextClipType x_clip_type, TextClipType y_clip_type); + + + Glib::SignalProxy2< void,int,int > signal_text_changed(); + + + Glib::SignalProxy1< void,int > signal_text_caret_moved(); + + + Glib::SignalProxy0< void > signal_text_selection_changed(); + + + Glib::SignalProxy0< void > signal_text_attributes_changed(); + + +protected: + + + virtual Glib::ustring get_text_vfunc(int start_offset, int end_offset) const; + virtual gunichar get_character_at_offset_vfunc(int offset) const; + virtual Glib::ustring get_text_after_offset_vfunc(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const; + virtual Glib::ustring get_text_at_offset_vfunc(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const; + virtual Glib::ustring get_text_before_offset_vfunc(int offset, TextBoundary boundary_type, int& start_offset, int& end_offset) const; + virtual int get_caret_offset_vfunc() const; + virtual void get_character_extents_vfunc(int offset, int& x, int& y, int& width, int& height, CoordType coords) const; + virtual AtkAttributeSet* get_run_attributes_vfunc(int offset, int& start_offset, int& end_offset) const; + virtual AtkAttributeSet* get_default_attributes_vfunc() const; + virtual int get_character_count_vfunc() const; + virtual int get_offset_at_point_vfunc(int x, int y, CoordType coords) const; + virtual int get_n_selections_vfunc() const; + virtual Glib::ustring get_selection_vfunc(int selection_num, int& start_offset, int& end_offset) const; + virtual bool add_selection_vfunc(int start_offset, int end_offset); + virtual bool remove_selection_vfunc(int selection_num); + virtual bool set_selection_vfunc(int selection_num, int start_offset, int end_offset); + virtual bool set_caret_offset_vfunc(int offset); + + //TODO: Add get_range_extents(), and get_bounded_ranges() vfuncs when we can break ABI. + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_text_changed(int position, int length); + virtual void on_text_caret_moved(int location); + virtual void on_text_selection_changed(); + virtual void on_text_attributes_changed(); + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Text + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkText* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_TEXT_H */ + diff --git a/libs/gtkmm2/atk/atkmm/value.cc b/libs/gtkmm2/atk/atkmm/value.cc new file mode 100644 index 0000000000..eeff7dfd2f --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/value.cc @@ -0,0 +1,340 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(AtkValue* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Atk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Value_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Value_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = atk_value_get_type(); + } + + return *this; +} + +void Value_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->get_current_value = &get_current_value_vfunc_callback; + klass->get_maximum_value = &get_maximum_value_vfunc_callback; + klass->get_minimum_value = &get_minimum_value_vfunc_callback; + klass->set_current_value = &set_current_value_vfunc_callback; +} + +void Value_Class::get_current_value_vfunc_callback(AtkValue* self, GValue* value) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_current_value_vfunc(*reinterpret_cast(value) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_current_value) + (*base->get_current_value)(self, value); + } +} + +void Value_Class::get_maximum_value_vfunc_callback(AtkValue* self, GValue* value) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_maximum_value_vfunc(*reinterpret_cast(value) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_maximum_value) + (*base->get_maximum_value)(self, value); + } +} + +void Value_Class::get_minimum_value_vfunc_callback(AtkValue* self, GValue* value) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_minimum_value_vfunc(*reinterpret_cast(value) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_minimum_value) + (*base->get_minimum_value)(self, value); + } +} + +gboolean Value_Class::set_current_value_vfunc_callback(AtkValue* self, const GValue* value) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->set_current_value_vfunc(*reinterpret_cast(value) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_current_value) + return (*base->set_current_value)(self, value); + } + + typedef gboolean RType; + return RType(); +} + + +Glib::ObjectBase* Value_Class::wrap_new(GObject* object) +{ + return new Value((AtkValue*)(object)); +} + + +/* The implementation: */ + +Value::Value() +: + Glib::Interface(value_class_.init()) +{} + +Value::Value(AtkValue* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Value::~Value() +{} + +// static +void Value::add_interface(GType gtype_implementer) +{ + value_class_.init().add_interface(gtype_implementer); +} + +Value::CppClassType Value::value_class_; // initialize static member + +GType Value::get_type() +{ + return value_class_.init().get_type(); +} + +GType Value::get_base_type() +{ + return atk_value_get_type(); +} + + +void Value::get_current_value(Glib::ValueBase& value) const +{ + atk_value_get_current_value(const_cast(gobj()), (value).gobj()); +} + +void Value::get_maximum_value(Glib::ValueBase& value) const +{ + atk_value_get_maximum_value(const_cast(gobj()), (value).gobj()); +} + +void Value::get_minimum_value(Glib::ValueBase& value) const +{ + atk_value_get_minimum_value(const_cast(gobj()), (value).gobj()); +} + +bool Value::set_current_value(const Glib::ValueBase& value) +{ + return atk_value_set_current_value(gobj(), (value).gobj()); +} + + +void Atk::Value::get_current_value_vfunc(Glib::ValueBase& value) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_current_value) + (*base->get_current_value)(const_cast(gobj()),(value).gobj()); +} + +void Atk::Value::get_maximum_value_vfunc(Glib::ValueBase& value) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_maximum_value) + (*base->get_maximum_value)(const_cast(gobj()),(value).gobj()); +} + +void Atk::Value::get_minimum_value_vfunc(Glib::ValueBase& value) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_minimum_value) + (*base->get_minimum_value)(const_cast(gobj()),(value).gobj()); +} + +bool Atk::Value::set_current_value_vfunc(const Glib::ValueBase& value) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_current_value) + return (*base->set_current_value)(gobj(),(value).gobj()); + + typedef bool RType; + return RType(); +} + + +} // namespace Atk + + diff --git a/libs/gtkmm2/atk/atkmm/value.h b/libs/gtkmm2/atk/atkmm/value.h new file mode 100644 index 0000000000..25615dd92e --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/value.h @@ -0,0 +1,157 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _ATKMM_VALUE_H +#define _ATKMM_VALUE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ + typedef struct _AtkValueIface AtkValueIface; + typedef struct _AtkValue AtkValue; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _AtkValue AtkValue; +typedef struct _AtkValueClass AtkValueClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Atk +{ class Value_Class; } // namespace Atk +namespace Atk +{ + +/** The ATK interface implemented by valuators and components which display or select a value from a bounded range of values. + * This should be implemented for components which either display a value from a bounded range, or which allow the user + * to specify a value from a bounded range, or both. For instance, most sliders and range controls, as well as dials, + * should have Atk::Object representations which implement Atk::Value on the component's behalf. Atk::Values may be + * read-only, in which case attempts to alter the value return false to indicate failure. + */ + +class Value : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Value CppObjectType; + typedef Value_Class CppClassType; + typedef AtkValue BaseObjectType; + typedef AtkValueIface BaseClassType; + +private: + friend class Value_Class; + static CppClassType value_class_; + + // noncopyable + Value(const Value&); + Value& operator=(const Value&); + +protected: + Value(); // you must derive from this class + explicit Value(AtkValue* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Value(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + AtkValue* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const AtkValue* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Gets the value of this object. + * @param value A G::Value representing the current accessible value. + */ + void get_current_value(Glib::ValueBase& value) const; + + /** Gets the maximum value of this object. + * @param value A G::Value representing the maximum accessible value. + */ + void get_maximum_value(Glib::ValueBase& value) const; + + /** Gets the minimum value of this object. + * @param value A G::Value representing the minimum accessible value. + */ + void get_minimum_value(Glib::ValueBase& value) const; + + /** Sets the value of this object. + * @param value A G::Value which is the desired new accessible value. + * @return true if new value is successfully set, false otherwise. + */ + bool set_current_value(const Glib::ValueBase& value); + +protected: + virtual void get_current_value_vfunc(Glib::ValueBase& value) const; + virtual void get_maximum_value_vfunc(Glib::ValueBase& value) const; + virtual void get_minimum_value_vfunc(Glib::ValueBase& value) const; + virtual bool set_current_value_vfunc(const Glib::ValueBase& value); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Atk + + +namespace Glib +{ + /** @relates Atk::Value + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(AtkValue* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _ATKMM_VALUE_H */ + diff --git a/libs/gtkmm2/atk/atkmm/wrap_init.cc b/libs/gtkmm2/atk/atkmm/wrap_init.cc new file mode 100644 index 0000000000..1c72a15488 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/wrap_init.cc @@ -0,0 +1,91 @@ + +#include + +// Disable the 'const' function attribute of the get_type() functions. +// GCC would optimize them out because we don't use the return value. +#undef G_GNUC_CONST +#define G_GNUC_CONST /* empty */ + +#include +#include +#include + +// #include the widget headers so that we can call the get_type() static methods: + +#include "action.h" +#include "component.h" +#include "document.h" +#include "editabletext.h" +#include "hyperlink.h" +#include "hypertext.h" +#include "image.h" +#include "implementor.h" +#include "noopobject.h" +#include "object.h" +#include "objectaccessible.h" +#include "relation.h" +#include "relationset.h" +#include "selection.h" +#include "stateset.h" +#include "streamablecontent.h" +#include "table.h" +#include "text.h" +#include "value.h" + +extern "C" +{ + +//Declarations of the *_get_type() functions: + +GType atk_hyperlink_get_type(void); +GType atk_no_op_object_get_type(void); +GType atk_object_get_type(void); +GType atk_gobject_accessible_get_type(void); +GType atk_relation_get_type(void); +GType atk_relation_set_get_type(void); +GType atk_state_set_get_type(void); + +//Declarations of the *_error_quark() functions: + +} // extern "C" + + +//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers: + +namespace Atk { class Hyperlink_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Atk { class NoOpObject_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Atk { class Object_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Atk { class ObjectAccessible_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Atk { class Relation_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Atk { class RelationSet_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Atk { class StateSet_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } + +namespace Atk { + +void wrap_init() +{ + // Register Error domains: + +// Map gtypes to gtkmm wrapper-creation functions: + Glib::wrap_register(atk_hyperlink_get_type(), &Atk::Hyperlink_Class::wrap_new); + Glib::wrap_register(atk_no_op_object_get_type(), &Atk::NoOpObject_Class::wrap_new); + Glib::wrap_register(atk_object_get_type(), &Atk::Object_Class::wrap_new); + Glib::wrap_register(atk_gobject_accessible_get_type(), &Atk::ObjectAccessible_Class::wrap_new); + Glib::wrap_register(atk_relation_get_type(), &Atk::Relation_Class::wrap_new); + Glib::wrap_register(atk_relation_set_get_type(), &Atk::RelationSet_Class::wrap_new); + Glib::wrap_register(atk_state_set_get_type(), &Atk::StateSet_Class::wrap_new); + + // Register the gtkmm gtypes: + Atk::Hyperlink::get_type(); + Atk::NoOpObject::get_type(); + Atk::Object::get_type(); + Atk::ObjectAccessible::get_type(); + Atk::Relation::get_type(); + Atk::RelationSet::get_type(); + Atk::StateSet::get_type(); + +} // wrap_init() + +} //Atk + + diff --git a/libs/gtkmm2/atk/atkmm/wrap_init.h b/libs/gtkmm2/atk/atkmm/wrap_init.h new file mode 100644 index 0000000000..2015280680 --- /dev/null +++ b/libs/gtkmm2/atk/atkmm/wrap_init.h @@ -0,0 +1,32 @@ +#ifndef _ATKMM_WRAP_INIT_H +#define _ATKMM_WRAP_INIT_H + +/* wrap_init.h + * + * Copyright (C) 1998-2001 The Gtk-- Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// wrap_init.cc is generated by tools/generate_wrap_init.pl + +namespace Atk +{ + +void wrap_init(); + +} /* namespace Atk */ + +#endif // _ATKMM_WRAP_INIT_H diff --git a/libs/gtkmm2/gdk/.DS_Store b/libs/gtkmm2/gdk/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* _GDKMM_GDKMM_H_ */ + diff --git a/libs/gtkmm2/gdk/gdkmm/bitmap.cc b/libs/gtkmm2/gdk/gdkmm/bitmap.cc new file mode 100644 index 0000000000..27063537a6 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/bitmap.cc @@ -0,0 +1,71 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Gdk +{ + +Bitmap::Bitmap(GdkBitmap* castitem) +: + Pixmap((GdkPixmap*) castitem) +{} + +Bitmap::Bitmap(const char* data, int width, int height) +: + Pixmap((GdkPixmap*) gdk_bitmap_create_from_data(0, data, width, height)) +{} + +Bitmap::Bitmap(const Glib::RefPtr& drawable, const char* data, int width, int height) +: + Pixmap((GdkPixmap*) gdk_bitmap_create_from_data(Glib::unwrap(drawable), data, width, height)) +{} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Gdk +{ + + +Glib::RefPtr Bitmap::create(const char* data, int width, int height) +{ + return Glib::RefPtr( new Bitmap(data, width, height) ); +} +Glib::RefPtr Bitmap::create(const Glib::RefPtr& drawable, const char* data, int width, int height) +{ + return Glib::RefPtr( new Bitmap(drawable, data, width, height) ); +} + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/bitmap.h b/libs/gtkmm2/gdk/gdkmm/bitmap.h new file mode 100644 index 0000000000..57dc9fb087 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/bitmap.h @@ -0,0 +1,79 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_BITMAP_H +#define _GDKMM_BITMAP_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Gdk +{ + +class Window; + +// In GDK, GdkBitmap has the same type as GdkPixmap. Both are typedefed +// to their base type GdkDrawable, but the real type is GdkPixmapObject. +// A GdkBitmap is a GdkPixmap with a depth of 1. + +/** Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off). + */ +class Bitmap : public Gdk::Pixmap +{ + // The Bitmap type only really exists in gtkmm. We fake its existence + // with a custom Gdk::Pixmap_Class::wrap_new() -- see comments there. + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Bitmap CppObjectType; + typedef GdkBitmap BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + explicit Bitmap(GdkBitmap* castitem); + friend class Gdk::Pixmap_Class; +#endif + + Bitmap(const char* data, int width, int height); + + Bitmap(const Glib::RefPtr& drawable, const char* data, int width, int height); + +public: + + static Glib::RefPtr create(const char* data, int width, int height); + + + static Glib::RefPtr create(const Glib::RefPtr& drawable, const char* data, int width, int height); + + +}; + +} // namespace Gdk + + +#endif /* _GDKMM_BITMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/color.cc b/libs/gtkmm2/gdk/gdkmm/color.cc new file mode 100644 index 0000000000..06c8e70cf5 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/color.cc @@ -0,0 +1,297 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace Gdk +{ + +Color::Color() +{ + GdkColor tmp = { 0, 0, 0, 0, }; + gobject_ = gdk_color_copy(&tmp); +} + +Color::Color(const Glib::ustring& value) +{ + GdkColor tmp = { 0, 0, 0, 0, }; + gobject_ = gdk_color_copy(&tmp); + + set(value); +} + +void Color::set_grey(gushort value) +{ + gobject_->red = gobject_->green = gobject_->blue = value; +} + +void Color::set_grey_p(double g) +{ + gobject_->red = gobject_->green = gobject_->blue = (gushort)(g * 65535.0); +} + +void Color::set_rgb(gushort red_, gushort green_, gushort blue_) +{ + gobject_->red = red_; + gobject_->green = green_; + gobject_->blue = blue_; +} + +void Color::set_rgb_p(double red_, double green_, double blue_) +{ + gobject_->red = (gushort)(red_ * 65535.0); + gobject_->green = (gushort)(green_ * 65535.0); + gobject_->blue = (gushort)(blue_ * 65535.0); +} + +void Color::set_hsv(double h, double s, double v) +{ + //TODO: Comments/Documentation. I have no idea what this code does. murrayc. + + h /= 60.0; + int i = (int)h; + double p = v * (1 - s); + double q = v * (1 - s * (h - i)); + double t = v * (1 - s * (1 - h + i)); + + switch(i) + { + case 0: + set_rgb_p(v, t, p); + break; + case 1: + set_rgb_p(q, v, p); + break; + case 2: + set_rgb_p(p, v, t); + break; + case 3: + set_rgb_p(p, q, v); + break; + case 4: + set_rgb_p(t, p, v); + break; + default: + set_rgb_p(v, p, q); + } +} + +void Color::set_hsl(double h, double s, double l) +{ + //TODO: Comments/Documentation. I have no idea what this code does. murrayc. + + if(s == 0.0) + set_grey_p(l); + else + { + double t2 = (l < 0.5) ? l * (1.0 + s) : l + s - l * s; + double t1 = 2*l-t2; + h /= 360.0; + + double tr = h + 1.0/3.0; + double tg = h; + double tb = h - 1.0/3.0; + if (tb < 0) tb += 1.0; + + double r = 0.0, g = 0.0, b = 0.0; + + if (tr < 1.0/6.0) + r = t1 +(t2-t1) * 6 * tr; + else if (tr < 1.0/2.0) + r = t2; + else if (tr < 2.0/3.0) + r = t1+(t2-t1)*(2.0/3.0 - tr) * 6.0; + + if (tg < 1.0/6.0) + g = t1 + (t2 - t1) * 6 * tg; + else if (tg < 1.0/2.0) + g = t2; + else if (tg < 2.0/3.0) + g = t1+(t2-t1)*(2.0/3.0 - tg) * 6.0; + + if (tb < 1.0/6.0) + b = t1 +(t2-t1) * 6 * tb; + else if (tb < 1.0/2.0) + b = t2; + else if (tb < 2.0/3.0) + b = t1+(t2-t1)*(2.0/3.0 - tb) * 6.0; + + set_rgb_p(r, g, b); + } +} + +bool Color::set(const Glib::ustring& value) +{ + return gdk_color_parse(value.c_str(), gobj()); +} + +bool Color::parse(const Glib::ustring& spec) +{ + return set(spec); +} + +gushort Color::get_red() const +{ + return gobject_->red; +} + +gushort Color::get_green() const +{ + return gobject_->green; + +} +gushort Color::get_blue() const +{ + return gobject_->blue; +} + +void Color::set_red(gushort value) +{ + gobject_->red = value; +} + +void Color::set_green(gushort value) +{ + gobject_->green = value; +} + +void Color::set_blue(gushort value) +{ + gobject_->blue = value; +} + +void Color::rgb_find_color(const Glib::RefPtr& map) +{ + gdk_rgb_find_color(map->gobj(), gobj()); +} + +guint Color::get_pixel() const +{ + return gobject_->pixel; +} + +double Color::get_red_p() const +{ + return gobject_->red / 65535.0; +} + +double Color::get_green_p() const +{ + return gobject_->green / 65535.0; +} + +double Color::get_blue_p() const +{ + return gobject_->blue / 65535.0; +} + + +} //namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gdk::Color wrap(GdkColor* object, bool take_copy) +{ + return Gdk::Color(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Color::get_type() +{ + return gdk_color_get_type(); +} + + +Color::Color(const Color& other) +: + gobject_ ((other.gobject_) ? gdk_color_copy(other.gobject_) : 0) +{} + +Color::Color(GdkColor* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gdk_color_copy(gobject) : gobject) +{} + +Color& Color::operator=(const Color& other) +{ + Color temp (other); + swap(temp); + return *this; +} + +Color::~Color() +{ + if(gobject_) + gdk_color_free(gobject_); +} + +void Color::swap(Color& other) +{ + GdkColor *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GdkColor* Color::gobj_copy() const +{ + return gdk_color_copy(gobject_); +} + + +bool operator==(const Color& lhs, const Color& rhs) +{ + return (gdk_color_equal(lhs.gobj(), rhs.gobj()) != 0); +} + +bool operator!=(const Color& lhs, const Color& rhs) +{ + return (gdk_color_equal(lhs.gobj(), rhs.gobj()) == 0); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/color.h b/libs/gtkmm2/gdk/gdkmm/color.h new file mode 100644 index 0000000000..c40ff67f25 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/color.h @@ -0,0 +1,274 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLOR_H +#define _GDKMM_COLOR_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkColor GdkColor; } +#endif + +namespace Gdk +{ + +class Colormap; + +/** Gdk::Color is used to describe an allocated or unallocated color. + * It contains the following data: + * pixel: For allocated colors, the value used to draw this color on the screen. + * red: The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensitiy. + * green: The green component of the color. + * blue: The blue component of the color. + */ +class Color +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Color CppObjectType; + typedef GdkColor BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + + explicit Color(GdkColor* gobject, bool make_a_copy = true); + + Color(const Color& other); + Color& operator=(const Color& other); + + ~Color(); + + void swap(Color& other); + + ///Provides access to the underlying C instance. + GdkColor* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GdkColor* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkColor* gobj_copy() const; + +protected: + GdkColor* gobject_; + +private: + +public: + + + /** Instantiate a new Gdk::Color. + * You should then use the set methods and call Gdk::Colormap::alloc_color(). + */ + Color(); + + /** Instantiate a new Gdk::Color. + * The color is not allocated - you must call Gdk::Colormap::alloc_color() yourself. + * The text string can be in any of the forms accepted by XParseColor; these include names for a color from rgb.txt, + * such as DarkSlateGray, or a hex specification such as 305050. + * @param value the string specifying the color.. + */ + explicit Color(const Glib::ustring& value); + + /** Set a grey color, by using the same value for all color components. + * @param value The value to be used for the red, green, and blue components. + */ + void set_grey(gushort value); + void set_grey_p(double g); + + /** Set the color, by specifying red, green, and blue color component values. + * @param red_ The red component of the color. + * @param green_ The green component of the color. + * @param blue_ The blue component of the color. + */ + void set_rgb(gushort red_, gushort green_, gushort blue_); + + /** Set the color, by specifying red, green, and blue color component values, as percentages. + * @param red_ The red component of the color, as a percentage. + * @param green_ The green component of the color, as a percentage. + * @param blue_ The blue component of the color, as a percentage. + */ + void set_rgb_p(double red_, double green_, double blue_); + + void set_hsv(double h, double s, double v); + void set_hsl(double h, double s, double l); + + /** Parses a textual specification of a color and fills in the red, green, and blue values. + * The color is not allocated - you must call Gdk::Colormap::alloc_color() yourself. + * The text string can be in any of the forms accepted by XParseColor; these include names for a color from rgb.txt, + * such as DarkSlateGray, or a hex specification such as 305050. + * + * @param value the string specifying the color. + * @result true if the parsing succeeded. + */ + bool set(const Glib::ustring& value); + + #ifndef GDKMM_DEPRECATED + /** + * @deprecated See set(). + */ + bool parse(const Glib::ustring& spec); + #endif //GDKMM_DEPRECATED + + /** Get the red component of the color. + * @result The red component of the color. + */ + gushort get_red() const; + + /** Get the green component of the color. + * @result The green component of the color. + */ + gushort get_green() const; + + /** Get the blue component of the color. + * @result The blue component of the color. + */ + gushort get_blue() const; + + /** Set the red component of the color. + * @param value The red component of the color. + */ + void set_red(gushort value); + + /** Set the green component of the color. + * @param value The green component of the color. + */ + void set_green(gushort value); + + /** Set the blue component of the color. + * @param value The blue component of the color. + */ + void set_blue(gushort value); + + /** This will fill in the pixel field with the best matching pixel from a color cube. + * The color is then ready to be used for drawing, e.g. you can call Gdk::GC::set_foreground() which expects pixel to be initialized. + * Call this after setting the red, green, and blue fields. + * + * In many cases, you can avoid this whole issue by calling Gdk::GC::set_rgb_fg_color() or Gdk::GC::set_rgb_bg_color(), + * which do not expect pixels to be initialized in advance. If you use those methods, there's no need for this method(). + * + * @param map The colormap for the graphics context and drawable you're using to draw. If you're drawing to a Gtk::Widget, call Gtk::Widget::get_colormap(). + */ + void rgb_find_color(const Glib::RefPtr& map); + + /** Get the pixel value, for allocated colors. + * @result For allocated colors, the value used to draw this color on the screen. + */ + guint get_pixel() const; + + /** Get the red component of the color, as a percentage. + * @result The red component of the color, as a percentage. + */ + double get_red_p() const; + + /** Get the green component of the color, as a percentage. + * @result The green component of the color, as a percentage. + */ + double get_green_p() const; + + /** Get the blue component of the color, as a percentage. + * @result The blue component of the color, as a percentage. + */ + double get_blue_p() const; + + +}; + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +/* These traits are for arrays of GdkColor structs -- not pointer arrays. + */ +struct ColorTraits +{ + typedef Gdk::Color CppType; + typedef GdkColor CType; + typedef GdkColor CTypeNonConst; + + static CType to_c_type (const CppType& obj) { return *obj.gobj(); } + static CType to_c_type (const CType& obj) { return obj; } + static CppType to_cpp_type (const CType& obj) { return CppType(const_cast(&obj), true); } + static void release_c_type (const CType&) {} +}; +#endif //DOXYGEN_SHOULD_SKIP_THIS + +typedef Glib::ArrayHandle ArrayHandle_Color; + +} // namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Color + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator==(const Color& lhs, const Color& rhs); + +/** @relates Gdk::Color + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator!=(const Color& lhs, const Color& rhs); + + +} // namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Color + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Color& lhs, Color& rhs) + { lhs.swap(rhs); } + +} // namespace Gdk + +namespace Glib +{ + +/** @relates Gdk::Color + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Color wrap(GdkColor* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value : public Glib::Value_Boxed +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_COLOR_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/colormap.cc b/libs/gtkmm2/gdk/gdkmm/colormap.cc new file mode 100644 index 0000000000..af2d64aec1 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/colormap.cc @@ -0,0 +1,209 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + +Colormap::Colormap(const Glib::RefPtr& visual, bool allocate) +: Glib::Object( G_OBJECT( gdk_colormap_new(visual->gobj(), (gboolean)allocate) ) ) + {} + +} /* namespace Gdk */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkColormap* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Colormap_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Colormap_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_colormap_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Colormap_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Colormap_Class::wrap_new(GObject* object) +{ + return new Colormap((GdkColormap*)object); +} + + +/* The implementation: */ + +GdkColormap* Colormap::gobj_copy() +{ + reference(); + return gobj(); +} + +Colormap::Colormap(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Colormap::Colormap(GdkColormap* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Colormap::~Colormap() +{} + + +Colormap::CppClassType Colormap::colormap_class_; // initialize static member + +GType Colormap::get_type() +{ + return colormap_class_.init().get_type(); +} + +GType Colormap::get_base_type() +{ + return gdk_colormap_get_type(); +} + + +Glib::RefPtr Colormap::create(const Glib::RefPtr& visual, bool allocate) +{ + return Glib::RefPtr( new Colormap(visual, allocate) ); +} +Glib::RefPtr Colormap::get_system() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_colormap_get_system()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Colormap::alloc_colors(ArrayHandle_Color& colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle& success) +{ + return gdk_colormap_alloc_colors(gobj(), const_cast(colors.data()), ncolors, static_cast(writeable), static_cast(best_match), (gboolean*)(success.data())); +} + +bool Colormap::alloc_color(Color& color, bool writeable, bool best_match) +{ + return gdk_colormap_alloc_color(gobj(), (color).gobj(), static_cast(writeable), static_cast(best_match)); +} + +void Colormap::free_colors(Color& colors, int ncolors) +{ + gdk_colormap_free_colors(gobj(), (colors).gobj(), ncolors); +} + +void Colormap::query_color(gulong pixel, Color& result) +{ + gdk_colormap_query_color(gobj(), pixel, (result).gobj()); +} + +Glib::RefPtr Colormap::get_visual() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_colormap_get_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Colormap::get_visual() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_colormap_get_visual(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Colormap::get_screen() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_colormap_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Colormap::get_screen() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_colormap_get_screen(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/colormap.h b/libs/gtkmm2/gdk/gdkmm/colormap.h new file mode 100644 index 0000000000..5f73acbf59 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/colormap.h @@ -0,0 +1,227 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLORMAP_H +#define _GDKMM_COLORMAP_H + +#include + +/* $Id$ */ + +/* box.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkColormap GdkColormap; +typedef struct _GdkColormapClass GdkColormapClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Colormap_Class; } // namespace Gdk +namespace Gdk +{ + +/** A Colormap is an object that contains the mapping between the color values stored in memory and the RGB values that are + * used to display color values. In general, colormaps only contain significant information for pseudo-color visuals, but + * even for other visual types, a colormap object is required in some circumstances. + * + * There are a couple of special colormaps that can be retrieved. The system colormap (retrieved with get_system()) is the + * default colormap of the system. If you are using GdkRGB, there is another colormap that is important - the colormap in + * which GdkRGB works, retrieved with Gdk::rgb_get_colormap(). However, when using GdkRGB, it is not generally necessary to + * allocate colors directly. + */ + +class Colormap : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Colormap CppObjectType; + typedef Colormap_Class CppClassType; + typedef GdkColormap BaseObjectType; + typedef GdkColormapClass BaseClassType; + +private: friend class Colormap_Class; + static CppClassType colormap_class_; + +private: + // noncopyable + Colormap(const Colormap&); + Colormap& operator=(const Colormap&); + +protected: + explicit Colormap(const Glib::ConstructParams& construct_params); + explicit Colormap(GdkColormap* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Colormap(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkColormap* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkColormap* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkColormap* gobj_copy(); + +private: + + +protected: + explicit Colormap(const Glib::RefPtr& visual, bool allocate); + +public: + + + static Glib::RefPtr create(const Glib::RefPtr& visual, bool allocate); + + + /** Gets the system's default colormap for the default screen. (See + * gdk_colormap_get_system_for_screen()) + * @return The default colormap. + */ + static Glib::RefPtr get_system(); + + //_WRAP_METHOD(void change(int ncolors), gdk_colormap_change) + + // Both 'GdkColor* colors' and 'gboolean* success' are _array_ output arguments. + + + /** Allocates colors from a colormap. + * @param colors The color values to allocate. On return, the pixel + * values for allocated colors will be filled in. + * @param ncolors The number of colors in @a colors . + * @param writeable If true, the colors are allocated writeable + * (their values can later be changed using gdk_color_change()). + * Writeable colors cannot be shared between applications. + * @param best_match If true, GDK will attempt to do matching against + * existing colors if the colors cannot be allocated as requested. + * @param success An array of length @a ncolors . On return, this + * indicates whether the corresponding color in @a colors was + * successfully allocated or not. + * @return The number of colors that were not successfully + * allocated. + */ + int alloc_colors(ArrayHandle_Color& colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle& success); + + + /** Allocates a single color from a colormap. + * @param color The color to allocate. On return the + * <structfield>pixel</structfield> field will be + * filled in if allocation succeeds. + * @param writeable If true, the color is allocated writeable + * (their values can later be changed using gdk_color_change()). + * Writeable colors cannot be shared between applications. + * @param best_match If true, GDK will attempt to do matching against + * existing colors if the color cannot be allocated as requested. + * @return true if the allocation succeeded. + */ + bool alloc_color(Color& color, bool writeable = false, bool best_match = true); + + /** Frees previously allocated colors. + * @param colors The colors to free. + * @param ncolors The number of colors in @a colors . + */ + void free_colors(Color& colors, int ncolors); + + /** Locates the RGB color in @a colormap corresponding to the given + * hardware pixel @a pixel . @a pixel must be a valid pixel in the + * colormap; it's a programmer error to call this function with a + * pixel which is not in the colormap. Hardware pixels are normally + * obtained from alloc_colors(), or from a Gdk::Image. (A + * Gdk::Image contains image data in hardware format, a Gdk::Pixbuf + * contains image data in a canonical 24-bit RGB format.) + * + * This function is rarely useful; it's used for example to + * implement the eyedropper feature in Gtk::ColorSelection. + * @param pixel Pixel value in hardware display format. + * @param result Gdk::Color with red, green, blue fields initialized. + */ + void query_color (gulong pixel, Color& result); + + + /** Returns the visual for which a given colormap was created. + * @return The visual of the colormap. + */ + Glib::RefPtr get_visual(); + + /** Returns the visual for which a given colormap was created. + * @return The visual of the colormap. + */ + Glib::RefPtr get_visual() const; + + + /** Gets the screen for which this colormap was created. + * @return The screen for which this colormap was created. + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(); + + /** Gets the screen for which this colormap was created. + * @return The screen for which this colormap was created. + * + * Since: 2.2. + */ + Glib::RefPtr get_screen() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Colormap + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkColormap* object, bool take_copy = false); +} + + +#endif /* _GDKMM_COLORMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/cursor.cc b/libs/gtkmm2/gdk/gdkmm/cursor.cc new file mode 100644 index 0000000000..1a8e639472 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/cursor.cc @@ -0,0 +1,161 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + +Cursor::Cursor(CursorType cursor_type) +{ + gobject_ = gdk_cursor_new((GdkCursorType)cursor_type); +} + +Cursor::Cursor(const Glib::RefPtr& source, const Glib::RefPtr& mask, + const Color& fg, const Color& bg, + int x, int y) +{ + gobject_ = gdk_cursor_new_from_pixmap(source->gobj(), mask->gobj(), + const_cast(fg.gobj()), + const_cast(bg.gobj()), + x, y); +} + +Cursor::Cursor(const Glib::RefPtr& display, CursorType cursor_type) +{ + gobject_ = gdk_cursor_new_for_display(display->gobj(), (GdkCursorType)cursor_type); +} + +Cursor::Cursor(const Glib::RefPtr& display, const Glib::RefPtr& pixbuf, int x, int y) +{ + gobject_ = gdk_cursor_new_from_pixbuf(display->gobj(), pixbuf->gobj(), x, y); +} + +} //namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_cursor_type_get_type(); +} + + +namespace Glib +{ + +Gdk::Cursor wrap(GdkCursor* object, bool take_copy) +{ + return Gdk::Cursor(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Cursor::get_type() +{ + return gdk_cursor_get_type(); +} + +Cursor::Cursor() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +Cursor::Cursor(const Cursor& other) +: + gobject_ ((other.gobject_) ? gdk_cursor_ref(other.gobject_) : 0) +{} + +Cursor::Cursor(GdkCursor* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gdk_cursor_ref(gobject) : gobject) +{} + +Cursor& Cursor::operator=(const Cursor& other) +{ + Cursor temp (other); + swap(temp); + return *this; +} + +Cursor::~Cursor() +{ + if(gobject_) + gdk_cursor_unref(gobject_); +} + +void Cursor::swap(Cursor& other) +{ + GdkCursor *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GdkCursor* Cursor::gobj_copy() const +{ + return gdk_cursor_ref(gobject_); +} + + +Glib::RefPtr Cursor::get_display() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_cursor_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Cursor::get_display() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_cursor_get_display(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/cursor.h b/libs/gtkmm2/gdk/gdkmm/cursor.h new file mode 100644 index 0000000000..59ab2f827f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/cursor.h @@ -0,0 +1,251 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_CURSOR_H +#define _GDKMM_CURSOR_H + +#include + +/* $Id$ */ + +/* drawable.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkCursor GdkCursor; } +#endif + +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum CursorType +{ + X_CURSOR = 0, + ARROW = 2, + BASED_ARROW_DOWN = 4, + BASED_ARROW_UP = 6, + BOAT = 8, + BOGOSITY = 10, + BOTTOM_LEFT_CORNER = 12, + BOTTOM_RIGHT_CORNER = 14, + BOTTOM_SIDE = 16, + BOTTOM_TEE = 18, + BOX_SPIRAL = 20, + CENTER_PTR = 22, + CIRCLE = 24, + CLOCK = 26, + COFFEE_MUG = 28, + CROSS = 30, + CROSS_REVERSE = 32, + CROSSHAIR = 34, + DIAMOND_CROSS = 36, + DOT = 38, + DOTBOX = 40, + DOUBLE_ARROW = 42, + DRAFT_LARGE = 44, + DRAFT_SMALL = 46, + DRAPED_BOX = 48, + EXCHANGE = 50, + FLEUR = 52, + GOBBLER = 54, + GUMBY = 56, + HAND1 = 58, + HAND2 = 60, + HEART = 62, + ICON = 64, + IRON_CROSS = 66, + LEFT_PTR = 68, + LEFT_SIDE = 70, + LEFT_TEE = 72, + LEFTBUTTON = 74, + LL_ANGLE = 76, + LR_ANGLE = 78, + MAN = 80, + MIDDLEBUTTON = 82, + MOUSE = 84, + PENCIL = 86, + PIRATE = 88, + PLUS = 90, + QUESTION_ARROW = 92, + RIGHT_PTR = 94, + RIGHT_SIDE = 96, + RIGHT_TEE = 98, + RIGHTBUTTON = 100, + RTL_LOGO = 102, + SAILBOAT = 104, + SB_DOWN_ARROW = 106, + SB_H_DOUBLE_ARROW = 108, + SB_LEFT_ARROW = 110, + SB_RIGHT_ARROW = 112, + SB_UP_ARROW = 114, + SB_V_DOUBLE_ARROW = 116, + SHUTTLE = 118, + SIZING = 120, + SPIDER = 122, + SPRAYCAN = 124, + STAR = 126, + TARGET = 128, + TCROSS = 130, + TOP_LEFT_ARROW = 132, + TOP_LEFT_CORNER = 134, + TOP_RIGHT_CORNER = 136, + TOP_SIDE = 138, + TOP_TEE = 140, + TREK = 142, + UL_ANGLE = 144, + UMBRELLA = 146, + UR_ANGLE = 148, + WATCH = 150, + XTERM = 152, + LAST_CURSOR = 153, + CURSOR_IS_PIXMAP = -1 +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** This represents a cursor. + */ +class Cursor +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Cursor CppObjectType; + typedef GdkCursor BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Cursor(); + + explicit Cursor(GdkCursor* gobject, bool make_a_copy = true); + + Cursor(const Cursor& other); + Cursor& operator=(const Cursor& other); + + ~Cursor(); + + void swap(Cursor& other); + + ///Provides access to the underlying C instance. + GdkCursor* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GdkCursor* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkCursor* gobj_copy() const; + +protected: + GdkCursor* gobject_; + +private: + + +public: + explicit Cursor(CursorType cursor_type); + Cursor(const Glib::RefPtr& source, const Glib::RefPtr& mask, + const Color& fg, const Color& bg, + int x, int y); + explicit Cursor(const Glib::RefPtr& display, CursorType cursor_type); + Cursor(const Glib::RefPtr& display, const Glib::RefPtr& pixbuf, int x, int y); + + + /** Returns the display on which the Gdk::Cursor is defined. + * @return The Gdk::Display associated to @a cursor + * + * Since: 2.2. + */ + Glib::RefPtr get_display(); + + /** Returns the display on which the Gdk::Cursor is defined. + * @return The Gdk::Display associated to @a cursor + * + * Since: 2.2. + */ + Glib::RefPtr get_display() const; + + +}; + +} //namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Cursor + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Cursor& lhs, Cursor& rhs) + { lhs.swap(rhs); } + +} // namespace Gdk + +namespace Glib +{ + +/** @relates Gdk::Cursor + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Cursor wrap(GdkCursor* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value : public Glib::Value_Boxed +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_CURSOR_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/device.cc b/libs/gtkmm2/gdk/gdkmm/device.cc new file mode 100644 index 0000000000..78d223a363 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/device.cc @@ -0,0 +1,204 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_input_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_input_source_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkDevice* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Device_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Device_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_device_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Device_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Device_Class::wrap_new(GObject* object) +{ + return new Device((GdkDevice*)object); +} + + +/* The implementation: */ + +GdkDevice* Device::gobj_copy() +{ + reference(); + return gobj(); +} + +Device::Device(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Device::Device(GdkDevice* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Device::~Device() +{} + + +Device::CppClassType Device::device_class_; // initialize static member + +GType Device::get_type() +{ + return device_class_.init().get_type(); +} + +GType Device::get_base_type() +{ + return gdk_device_get_type(); +} + + +Device::Device() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(device_class_.init())) +{ + } + +void Device::set_source(InputSource source) +{ + gdk_device_set_source(gobj(), ((GdkInputSource)(source))); +} + +bool Device::set_mode(InputMode mode) +{ + return gdk_device_set_mode(gobj(), ((GdkInputMode)(mode))); +} + +void Device::set_key(guint index_, guint keyval, ModifierType modifiers) +{ + gdk_device_set_key(gobj(), index_, keyval, ((GdkModifierType)(modifiers))); +} + +void Device::set_axis_use(guint index_, AxisUse use) +{ + gdk_device_set_axis_use(gobj(), index_, ((GdkAxisUse)(use))); +} + +void Device::get_state(const Glib::RefPtr& window, double& axes, ModifierType& mask) +{ + gdk_device_get_state(gobj(), Glib::unwrap(window), &(axes), ((GdkModifierType*) &(mask))); +} + +bool Device::get_history(const Glib::RefPtr& window, guint32 start, guint32 stop, GdkTimeCoord**& events, int& n_events) +{ + return gdk_device_get_history(gobj(), Glib::unwrap(window), start, stop, &(events), &n_events); +} + +bool Device::get_axis(double& axes, AxisUse use, double& value) const +{ + return gdk_device_get_axis(const_cast(gobj()), &(axes), ((GdkAxisUse)(use)), &(value)); +} + +Glib::ustring Device::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name); +} + +InputSource Device::get_source() const +{ + return ((InputSource)(gobj()->source)); +} + +InputMode Device::get_mode() const +{ + return ((InputMode)(gobj()->mode)); +} + +bool Device::get_has_cursor() const +{ + return gobj()->has_cursor; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/device.h b/libs/gtkmm2/gdk/gdkmm/device.h new file mode 100644 index 0000000000..c3146c0010 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/device.h @@ -0,0 +1,254 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DEVICE_H +#define _GDKMM_DEVICE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002-2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDevice GdkDevice; +typedef struct _GdkDeviceClass GdkDeviceClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Device_Class; } // namespace Gdk +namespace Gdk +{ + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum InputMode +{ + MODE_DISABLED, + MODE_SCREEN, + MODE_WINDOW +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum InputSource +{ + SOURCE_MOUSE, + SOURCE_PEN, + SOURCE_ERASER, + SOURCE_CURSOR +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** A Gdk::Device instance contains a detailed description of an extended input device. + */ + +class Device : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Device CppObjectType; + typedef Device_Class CppClassType; + typedef GdkDevice BaseObjectType; + typedef GdkDeviceClass BaseClassType; + +private: friend class Device_Class; + static CppClassType device_class_; + +private: + // noncopyable + Device(const Device&); + Device& operator=(const Device&); + +protected: + explicit Device(const Glib::ConstructParams& construct_params); + explicit Device(GdkDevice* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Device(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDevice* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDevice* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDevice* gobj_copy(); + +private: + + +protected: + Device(); + +public: + + + void set_source(InputSource source); + + bool set_mode(InputMode mode); + + void set_key(guint index_, guint keyval, ModifierType modifiers); + + void set_axis_use(guint index_, AxisUse use); + + void get_state(const Glib::RefPtr& window, double& axes, ModifierType& mask); + + /** Obtains the motion history for a device; given a starting and + * ending timestamp, return all events in the motion history for + * the device in the given range of time. Some windowing systems + * do not support motion history, in which case, false will + * be returned. (This is not distinguishable from the case where + * motion history is supported and no events were found.) + * @param window The window with respect to which which the event coordinates will be reported. + * @param start Starting timestamp for range of events to return. + * @param stop Ending timestamp for the range of events to return. + * @param events Location to store a newly-allocated array of Gdk::TimeCoord, or 0. + * @param n_events Location to store the length of @a events , or 0. + * @return true if the windowing system supports motion history and + * at least one event was found. + */ + bool get_history(const Glib::RefPtr& window, guint32 start, guint32 stop, GdkTimeCoord**& events, int& n_events); + + /** Interprets an array of double as axis values for a given device, + * and locates the value in the array for a given axis use. + * @param axes Pointer to an array of axes. + * @param use The use to look for. + * @param value Location to store the found value. + * @return true if the given axis use was found, otherwise false. + */ + bool get_axis(double& axes, AxisUse use, double& value) const; + + /** Gets the name of this device. + * @result The name of this device. + */ + Glib::ustring get_name() const; + + /** Gets the type of this device. + * @result The type of this device. + */ + InputSource get_source() const; + + /** Gets the mode of this device. + * @result The mode of this device. + */ + InputMode get_mode() const; + + /** Discover whether the pointer follows device motion. + * @result true if the pointer follows device motion. + */ + bool get_has_cursor() const; + + //TODO: Add suitable accessor for the information in these fields. For now, people must use gobj() and access them directly. + //gint num_axes the length of the axes array. + //GdkDeviceAxis *axes an array of GdkDeviceAxis, describing the axes of this device. + // + //gint num_keys the length of the keys array. + //GdkDeviceKey *keys an array of GdkDeviceKey, describing the mapped macro buttons of this device. + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Device + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkDevice* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DEVICE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/display.cc b/libs/gtkmm2/gdk/gdkmm/display.cc new file mode 100644 index 0000000000..ff3f528fff --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/display.cc @@ -0,0 +1,596 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gdk +{ + +bool Display::set_selection_owner(const Glib::RefPtr& owner, Glib::ustring& selection, guint32 time_, bool send_event) +{ + return gdk_selection_owner_set_for_display(gobj(), owner->gobj(), Gdk::AtomString::to_c_type(selection), time_, (gboolean)send_event); +} + +Glib::RefPtr Display::get_selection_owner(const Glib::ustring& selection) +{ + return Glib::wrap( (GdkWindowObject*)gdk_selection_owner_get_for_display(gobj(), Gdk::AtomString::to_c_type(selection)) , true); +} + +void Display::selection_send_notify(guint32 requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_) +{ + gdk_selection_send_notify_for_display(gobj(), requestor, Gdk::AtomString::to_c_type(selection), Gdk::AtomString::to_c_type(target), Gdk::AtomString::to_c_type(property), time_); +} + +void Display::get_pointer(Glib::RefPtr& screen, int& x, int& y, ModifierType& mask) +{ + GdkScreen* cScreen = 0; + GdkModifierType cMask = (GdkModifierType)mask; + gdk_display_get_pointer(gobj(), &cScreen, &x, &y, &cMask); + screen = Glib::wrap(cScreen); + mask = (ModifierType)cMask; +} + +void Display::get_pointer(int& x, int& y, ModifierType& mask) +{ + GdkModifierType cMask = (GdkModifierType)mask; + gdk_display_get_pointer(gobj(), 0, &x, &y, &cMask); + mask = (ModifierType)cMask; +} + + +Glib::RefPtr Display::get_window_at_pointer() +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(gobj(), 0, 0))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_window_at_pointer() const +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(const_cast(gobj()), 0, 0))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +GdkDisplayPointerHooks* Display::unset_pointer_hooks() +{ + return gdk_display_set_pointer_hooks(gobj(), 0 /* See GDK docs */); +} + + void Display::store_clipboard(const Glib::RefPtr& clipboard_window, guint32 time_) + { + gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0); + } + + void Display::store_clipboard(const Glib::RefPtr& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets) + { + //Put it into a real container that we can use: + std::vector targets_copy = targets; + + //Create array of target GdkAtoms from target strings: + if(!targets_copy.empty()) + { + GdkAtom* pAtoms = new GdkAtom[targets_copy.size()]; + + for(guint i = 0; i < targets_copy.size(); ++i) + { + *pAtoms = Gdk::AtomString::to_c_type(targets_copy[i]); + } + + gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0); + + delete[] pAtoms; + } + } + +} //Gdk + + +namespace +{ + +void Display_signal_closed_callback(GdkDisplay* self, gboolean p0,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,bool > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Display_signal_closed_info = +{ + "closed", + (GCallback) &Display_signal_closed_callback, + (GCallback) &Display_signal_closed_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkDisplay* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Display_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Display_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_display_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Display_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->closed = &closed_callback; +} + + +void Display_Class::closed_callback(GdkDisplay* self, gboolean p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_closed(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->closed) + (*base->closed)(self, p0); + } +} + + +Glib::ObjectBase* Display_Class::wrap_new(GObject* object) +{ + return new Display((GdkDisplay*)object); +} + + +/* The implementation: */ + +GdkDisplay* Display::gobj_copy() +{ + reference(); + return gobj(); +} + +Display::Display(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Display::Display(GdkDisplay* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Display::~Display() +{} + + +Display::CppClassType Display::display_class_; // initialize static member + +GType Display::get_type() +{ + return display_class_.init().get_type(); +} + +GType Display::get_base_type() +{ + return gdk_display_get_type(); +} + + +Display::Display() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(display_class_.init())) +{ + } + +Glib::RefPtr Display::open(const Glib::ustring& display_name) +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_open(display_name.c_str())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ustring Display::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gdk_display_get_name(const_cast(gobj()))); +} + +int Display::get_n_screens() const +{ + return gdk_display_get_n_screens(const_cast(gobj())); +} + +Glib::RefPtr Display::get_screen(int screen_num) +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_screen(gobj(), screen_num)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_screen(int screen_num) const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_screen(const_cast(gobj()), screen_num)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_default_screen() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_default_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_default_screen() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_default_screen(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Display::pointer_ungrab(guint32 timestamp) +{ + gdk_display_pointer_ungrab(gobj(), timestamp); +} + +void Display::keyboard_ungrab(guint32 timestamp) +{ + gdk_display_keyboard_ungrab(gobj(), timestamp); +} + +bool Display::pointer_is_grabbed() const +{ + return gdk_display_pointer_is_grabbed(const_cast(gobj())); +} + +void Display::beep() +{ + gdk_display_beep(gobj()); +} + +void Display::sync() +{ + gdk_display_sync(gobj()); +} + +void Display::close() +{ + gdk_display_close(gobj()); +} + +Glib::ListHandle< Glib::RefPtr > Display::list_devices() +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_display_list_devices(gobj()), Glib::OWNERSHIP_DEEP); +} + +Glib::ListHandle< Glib::RefPtr > Display::list_devices() const +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_display_list_devices(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + +GdkEvent* Display::get_event() +{ + return gdk_display_get_event(gobj()); +} + +const GdkEvent* Display::get_event() const +{ + return (const GdkEvent*)(gdk_display_get_event(const_cast(gobj()))); +} + +GdkEvent* Display::peek_event() +{ + return gdk_display_peek_event(gobj()); +} + +GdkEvent* Display::peek_event() const +{ + return gdk_display_peek_event(const_cast(gobj())); +} + +void Display::put_event(GdkEvent* event) +{ + gdk_display_put_event(gobj(), event); +} + +void Display::add_client_message_filter(Glib::ustring& message_type, GdkFilterFunc func, gpointer data) +{ + gdk_display_add_client_message_filter(gobj(), Gdk::AtomString::to_c_type(message_type), func, data); +} + +void Display::set_double_click_time(guint msec) +{ + gdk_display_set_double_click_time(gobj(), msec); +} + +void Display::set_double_click_distance(guint distance) +{ + gdk_display_set_double_click_distance(gobj(), distance); +} + +Glib::RefPtr Display::get_default() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_default()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_core_pointer() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_core_pointer(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_core_pointer() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_get_core_pointer(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_window_at_pointer(int& win_x, int& win_y) +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(gobj(), &win_x, &win_y))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_window_at_pointer(int& win_x, int& win_y) const +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_window_at_pointer(const_cast(gobj()), &win_x, &win_y))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +GdkDisplayPointerHooks* Display::set_pointer_hooks(const GdkDisplayPointerHooks* new_hooks) +{ + return gdk_display_set_pointer_hooks(gobj(), new_hooks); +} + +Glib::RefPtr Display::open_default_libgtk_only() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_open_default_libgtk_only()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +guint32 Display::get_drag_protocol(guint32 xid, GdkDragProtocol& protocol) +{ + return gdk_drag_get_protocol_for_display(gobj(), xid, &(protocol)); +} + +GdkKeymap* Display::get_keymap() +{ + return gdk_keymap_get_for_display(gobj()); +} + +const GdkKeymap* Display::get_keymap() const +{ + return gdk_keymap_get_for_display(const_cast(gobj())); +} + +Glib::RefPtr Display::lookup_pixmap(NativeWindow anid) +{ + return Glib::wrap((GdkPixmapObject*)(gdk_pixmap_lookup_for_display(gobj(), (GdkNativeWindow)(anid)))); +} + +Glib::RefPtr Display::lookup_pixmap(NativeWindow anid) const +{ + return Glib::wrap((GdkPixmapObject*)(gdk_pixmap_lookup_for_display(const_cast(gobj()), (GdkNativeWindow)(anid)))); +} + +void Display::flush() +{ + gdk_display_flush(gobj()); +} + +bool Display::supports_cursor_alpha() const +{ + return gdk_display_supports_cursor_alpha(const_cast(gobj())); +} + +bool Display::supports_cursor_color() const +{ + return gdk_display_supports_cursor_color(const_cast(gobj())); +} + +guint Display::get_default_cursor_size() const +{ + return gdk_display_get_default_cursor_size(const_cast(gobj())); +} + +void Display::get_maximal_cursor_size(guint& width, guint& height) +{ + gdk_display_get_maximal_cursor_size(gobj(), &(width), &(height)); +} + +Glib::RefPtr Display::get_default_group() +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_default_group(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Display::get_default_group() const +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_display_get_default_group(const_cast(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +bool Display::supports_selection_notification() const +{ + return gdk_display_supports_selection_notification(const_cast(gobj())); +} + +bool Display::request_selection_notification(const Glib::ustring& selection) +{ + return gdk_display_request_selection_notification(gobj(), Gdk::AtomString::to_c_type(selection)); +} + +bool Display::supports_clipboard_persistence() const +{ + return gdk_display_supports_clipboard_persistence(const_cast(gobj())); +} + + +Glib::SignalProxy1< void,bool > Display::signal_closed() +{ + return Glib::SignalProxy1< void,bool >(this, &Display_signal_closed_info); +} + + +void Gdk::Display::on_closed(bool is_error) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->closed) + (*base->closed)(gobj(),static_cast(is_error)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/display.h b/libs/gtkmm2/gdk/gdkmm/display.h new file mode 100644 index 0000000000..238025599a --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/display.h @@ -0,0 +1,635 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAY_H +#define _GDKMM_DISPLAY_H + +#include + +/* $Id$ */ + +/* display.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include //For ModifierType + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDisplay GdkDisplay; +typedef struct _GdkDisplayClass GdkDisplayClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Display_Class; } // namespace Gdk +namespace Gdk +{ + + +class Drawable; + + /** Gdk::Display object's purpose is two fold: + * To grab/ungrab keyboard focus and mouse pointer + * To manage and provide information about the Gdk::Screen(s) available for this Gdk::Display + * + * Gdk::Display objects are the GDK representation of the X Display which can be described as a workstation consisting + * of a keyboard a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of + * various Gdk::Screen objects currently instantiated by the application. It is also used to grab and release the keyboard + * and the mouse pointer. + */ + +class Display : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Display CppObjectType; + typedef Display_Class CppClassType; + typedef GdkDisplay BaseObjectType; + typedef GdkDisplayClass BaseClassType; + +private: friend class Display_Class; + static CppClassType display_class_; + +private: + // noncopyable + Display(const Display&); + Display& operator=(const Display&); + +protected: + explicit Display(const Glib::ConstructParams& construct_params); + explicit Display(GdkDisplay* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Display(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDisplay* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDisplay* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDisplay* gobj_copy(); + +private: + +protected: + Display(); + +public: + + /** Opens a display. + * + * Since: 2.2 + * @param display_name The name of the display to open. + * @return A Gdk::Display, or 0 if the display + * could not be opened. + */ + static Glib::RefPtr open(const Glib::ustring& display_name); + + + /** Gets the name of the display. + * @return A string representing the display name. This string is owned + * by GDK and should not be modified or freed. + * + * Since: 2.2. + */ + Glib::ustring get_name() const; + + + /** Gets the number of screen managed by the @a display . + * @return Number of screens. + * + * Since: 2.2. + */ + int get_n_screens() const; + + /** Returns a screen object for one of the screens of the display. + * @param screen_num The screen number. + * @return The Gdk::Screen object + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(int screen_num); + + /** Returns a screen object for one of the screens of the display. + * @param screen_num The screen number. + * @return The Gdk::Screen object + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(int screen_num) const; + + + /** Get the default Gdk::Screen for @a display . + * @return The default Gdk::Screen object for @a display + * + * Since: 2.2. + */ + Glib::RefPtr get_default_screen(); + + /** Get the default Gdk::Screen for @a display . + * @return The default Gdk::Screen object for @a display + * + * Since: 2.2. + */ + Glib::RefPtr get_default_screen() const; + + + /** Release any pointer grab. + * + * Since: 2.2 + * @param timestamp A timestap (e.g. GDK_CURRENT_TIME). + */ + void pointer_ungrab(guint32 timestamp); + + /** Release any keyboard grab + * + * Since: 2.2 + * @param timestamp A timestap (e.g Gdk::CURRENT_TIME). + */ + void keyboard_ungrab(guint32 timestamp); + + /** Test if the pointer is grabbed. + * @return true if an active X pointer grab is in effect + * + * Since: 2.2. + */ + bool pointer_is_grabbed() const; + + /** Emits a short beep on @a display + * + * Since: 2.2 + */ + void beep(); + + /** Flushes any requests queued for the windowing system and waits until all + * requests have been handled. This is often used for making sure that the + * display is synchronized with the current state of the program. Calling + * sync() before gdk_error_trap_pop() makes sure that any errors + * generated from earlier requests are handled before the error trap is + * removed. + * + * This is most useful for X11. On windowing systems where requests are + * handled synchronously, this function will do nothing. + * + * Since: 2.2 + */ + void sync(); + + /** Closes the connection to the windowing system for the given display, + * and cleans up associated resources. + * + * Since: 2.2 + */ + void close(); + + + /** Returns the list of available input devices attached to @a display . + * The list is statically allocated and should not be freed. + * @return A list of Gdk::Device + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr > list_devices(); + + /** Returns the list of available input devices attached to @a display . + * The list is statically allocated and should not be freed. + * @return A list of Gdk::Device + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr > list_devices() const; + + //TODO: Use C++ Gdk::Event: + //TODO: get_event() might remove the event - if so, then there should not be a const version: + + /** Gets the next Gdk::Event to be processed for @a display , fetching events from the + * windowing system if necessary. + * @return The next Gdk::Event to be processed, or 0 if no events + * are pending. The returned Gdk::Event should be freed with gdk_event_free(). + * + * Since: 2.2. + */ + GdkEvent* get_event(); + + /** Gets the next Gdk::Event to be processed for @a display , fetching events from the + * windowing system if necessary. + * @return The next Gdk::Event to be processed, or 0 if no events + * are pending. The returned Gdk::Event should be freed with gdk_event_free(). + * + * Since: 2.2. + */ + const GdkEvent* get_event() const; + + + /** Gets a copy of the first Gdk::Event in the @a display 's event queue, without + * removing the event from the queue. (Note that this function will + * not get more events from the windowing system. It only checks the events + * that have already been moved to the GDK event queue.) + * @return A copy of the first Gdk::Event on the event queue, or 0 + * if no events are in the queue. The returned Gdk::Event should be freed with + * gdk_event_free(). + * + * Since: 2.2. + */ + GdkEvent* peek_event(); + + /** Gets a copy of the first Gdk::Event in the @a display 's event queue, without + * removing the event from the queue. (Note that this function will + * not get more events from the windowing system. It only checks the events + * that have already been moved to the GDK event queue.) + * @return A copy of the first Gdk::Event on the event queue, or 0 + * if no events are in the queue. The returned Gdk::Event should be freed with + * gdk_event_free(). + * + * Since: 2.2. + */ + GdkEvent* peek_event() const; + + /** Appends a copy of the given event onto the front of the event + * queue for @a display . + * + * Since: 2.2 + * @param event A Gdk::Event. + */ + void put_event(GdkEvent* event); + + //TODO: Use a slot here, though this is probably never used anyway: + //Find out whether we can use a string representation for the atom - look for examples of this function's use. + + /** Adds a filter to be called when X ClientMessage events are received. + * + * Since: 2.2 + * @param message_type The type of ClientMessage events to receive. + * This will be checked against the @a message_type field + * of the XClientMessage event struct. + * @param func The function to call to process the event. + * @param data User data to pass to @a func . + */ + void add_client_message_filter(Glib::ustring& message_type, GdkFilterFunc func, gpointer data); + + + /** Sets the double click time (two clicks within this time interval + * count as a double click and result in a Gdk::2BUTTON_PRESS event). + * Applications should not set this, it is a global + * user-configured setting. + * + * Since: 2.2 + * @param msec Double click time in milliseconds (thousandths of a second). + */ + void set_double_click_time(guint msec); + + /** Sets the double click distance (two clicks within this distance + * count as a double click and result in a Gdk::2BUTTON_PRESS event). + * See also set_double_click_time(). + * Applications should not set this, it is a global + * user-configured setting. + * + * Since: 2.4 + * @param distance Distance in pixels. + */ + void set_double_click_distance(guint distance); + + + /** Gets the default Gdk::Display. This is a convenience + * function for: + * + * gdk_display_manager_get_default_display (manager_get()) + * + * @return A Gdk::Display, or 0 if there is no default + * display. + * + * Since: 2.2. + */ + static Glib::RefPtr get_default(); + + + /** Returns the core pointer device for the given display + * @return The core pointer device; this is owned by the + * display and should not be freed. + * + * Since: 2.2. + */ + Glib::RefPtr get_core_pointer(); + + /** Returns the core pointer device for the given display + * @return The core pointer device; this is owned by the + * display and should not be freed. + * + * Since: 2.2. + */ + Glib::RefPtr get_core_pointer() const; + + /** Gets the current location of the pointer and the current modifier + * mask for a given display. + * + * @param screen location to store the screen that the cursor is on. + * @param x location to store root window X coordinate of pointer. + * @param y location to store root window Y coordinate of pointer. + * @param mask location to store current modifier mask. + * + **/ + void get_pointer(Glib::RefPtr& screen, int& x, int& y, ModifierType& mask); + + // In fact, any one of these gdk_display_get_pointer() args can be NULL, but we don't need so many overloads. + /** + * Gets the current location of the pointer and the current modifier + * mask for a given display. + * + * @param x location to store root window X coordinate of pointer. + * @param y location to store root window Y coordinate of pointer. + * @param mask location to store current modifier mask. + * + **/ + void get_pointer(int& x, int& y, ModifierType& mask); + + + /** Obtains the window underneath the mouse pointer, returning the location + * of that window in @a win_x , @a win_y for @a screen . Returns 0 if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @param win_x Return location for origin of the window under the pointer. + * @param win_y Return location for origin of the window under the pointer. + * @return The window under the mouse pointer, or 0 + * + * Since: 2.2. + */ + Glib::RefPtr get_window_at_pointer(int& win_x, int& win_y); + + /** Obtains the window underneath the mouse pointer, returning the location + * of that window in @a win_x , @a win_y for @a screen . Returns 0 if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @param win_x Return location for origin of the window under the pointer. + * @param win_y Return location for origin of the window under the pointer. + * @return The window under the mouse pointer, or 0 + * + * Since: 2.2. + */ + Glib::RefPtr get_window_at_pointer(int& win_x, int& win_y) const; + + /** Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @result The window underneath the mouse pointer. + */ + Glib::RefPtr get_window_at_pointer(); + + /** Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * @result The window underneath the mouse pointer. + */ + Glib::RefPtr get_window_at_pointer() const; + + + /** This function allows for hooking into the operation + * of getting the current location of the pointer on a particular + * display. This is only useful for such low-level tools as an + * event recorder. Applications should never have any + * reason to use this facility. + * @param new_hooks A table of pointers to functions for getting + * quantities related to the current pointer position. + * @return The previous pointer hook table + * + * Since: 2.2. + */ + GdkDisplayPointerHooks* set_pointer_hooks(const GdkDisplayPointerHooks* new_hooks); + GdkDisplayPointerHooks* unset_pointer_hooks(); + + + /** Opens the default display specified by command line arguments or + * environment variables, sets it as the default display, and returns + * it. gdk_parse_args must have been called first. If the default + * display has previously been set, simply returns that. An internal + * function that should not be used by applications. + * @return The default display, if it could be opened, + * otherwise 0. + */ + static Glib::RefPtr open_default_libgtk_only(); + + + /** Finds out the DND protocol supported by a window. + * + * Since: 2.2 + * @param xid The X id of the destination window. + * @param protocol Location where the supported DND protocol is returned. + * @return The X id of the window where the drop should happen. This + * may be @a xid or the X id of a proxy window, or None if @a xid doesn't + * support Drag and Drop. + */ + guint32 get_drag_protocol(guint32 xid, GdkDragProtocol& protocol); + + + /** + * @return The Gdk::Keymap attached to @a display . + * the Gdk::Keymap attached to @a display . + * + * Since: 2.2. + */ + GdkKeymap* get_keymap(); + + /** + * @return The Gdk::Keymap attached to @a display . + * the Gdk::Keymap attached to @a display . + * + * Since: 2.2. + */ + const GdkKeymap* get_keymap() const; + + bool set_selection_owner(const Glib::RefPtr& owner, Glib::ustring& selection, guint32 time_, bool send_event); + Glib::RefPtr get_selection_owner(const Glib::ustring& selection); + void selection_send_notify(guint32 requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_); + + + /** Looks up the Gdk::Pixmap that wraps the given native pixmap handle. + * + * For example in the X backend, a native pixmap handle is an Xlib + * <type>XID</type>. + * @param anid A native pixmap handle. + * @return The Gdk::Pixmap wrapper for the native pixmap, + * or 0 if there is none. + * + * Since: 2.2. + */ + Glib::RefPtr lookup_pixmap(NativeWindow anid); + + /** Looks up the Gdk::Pixmap that wraps the given native pixmap handle. + * + * For example in the X backend, a native pixmap handle is an Xlib + * <type>XID</type>. + * @param anid A native pixmap handle. + * @return The Gdk::Pixmap wrapper for the native pixmap, + * or 0 if there is none. + * + * Since: 2.2. + */ + Glib::RefPtr lookup_pixmap(NativeWindow anid) const; + + + /** Flushes any requests queued for the windowing system; this happens automatically + * when the main loop blocks waiting for new events, but if your application + * is drawing without returning control to the main loop, you may need + * to call this function explicitely. A common case where this function + * needs to be called is when an application is executing drawing commands + * from a thread other than the thread where the main loop is running. + * + * This is most useful for X11. On windowing systems where requests are + * handled synchronously, this function will do nothing. + * + * Since: 2.4 + */ + void flush(); + + /** Returns true if cursors can use an 8bit alpha channel + * on @a display . Otherwise, cursors are restricted to bilevel + * alpha (i.e. a mask). + * @return Whether cursors can have alpha channels. + * + * Since: 2.4. + */ + bool supports_cursor_alpha() const; + + /** Returns true if multicolored cursors are supported + * on @a display . Otherwise, cursors have only a forground + * and a background color. + * @return Whether cursors can have multiple colors. + * + * Since: 2.4. + */ + bool supports_cursor_color() const; + + /** Returns the default size to use for cursors on @a display . + * @return The default cursor size. + * + * Since: 2.4. + */ + guint get_default_cursor_size() const; + + /** Gets the maximal size to use for cursors on @a display . + * + * Since: 2.4 + * @param width The return location for the maximal cursor width. + * @param height The return location for the maximal cursor height. + */ + void get_maximal_cursor_size(guint& width, guint& height); + + + /** Returns the default group leader window for all toplevel windows + * on @a display . This window is implicitly created by GDK. + * See gdk_window_set_group(). + * @return The default group leader window for @a display + * + * Since: 2.4. + */ + Glib::RefPtr get_default_group(); + + /** Returns the default group leader window for all toplevel windows + * on @a display . This window is implicitly created by GDK. + * See gdk_window_set_group(). + * @return The default group leader window for @a display + * + * Since: 2.4. + */ + Glib::RefPtr get_default_group() const; + + //TODO: wrap the vfuncs, though they are not very useful because people will not derive from this class? murrayc. + + + /** Returns whether Gdk::EventOwnerChange events will be + * sent when the owner of a selection changes. + * @return Whether Gdk::EventOwnerChange events will + * be sent. + * + * Since: 2.6. + */ + bool supports_selection_notification() const; + + /** Request Gdk::EventOwnerChange events for ownership changes + * of the selection named by the given atom. + * @param selection The Gdk::Atom naming the selection for which + * ownership change notification is requested. + * @return Whether Gdk::EventOwnerChange events will + * be sent. + * + * Since: 2.6. + */ + bool request_selection_notification(const Glib::ustring& selection); + + + /** Returns whether the speicifed display supports clipboard + * persistance; i.e.\ if it's possible to store the clipboard data after an + * application has quit. On X11 this checks if a clipboard daemon is + * running. + * @return true if the display supports clipboard persistance. + * + * Since: 2.6. + */ + bool supports_clipboard_persistence() const; + + //TODO: Documentation, based on C docs: + void store_clipboard(const Glib::RefPtr& clipboard_window, guint32 time_); + + void store_clipboard(const Glib::RefPtr& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets); + + + Glib::SignalProxy1< void,bool > signal_closed(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_closed(bool is_error); + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Display + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkDisplay* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DISPLAY_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/displaymanager.cc b/libs/gtkmm2/gdk/gdkmm/displaymanager.cc new file mode 100644 index 0000000000..5edb22e506 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/displaymanager.cc @@ -0,0 +1,265 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +namespace Gdk +{ + + +} //Gdk + + +namespace +{ + +void DisplayManager_signal_display_opened_callback(GdkDisplayManager* self, GdkDisplay* p0,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,const Glib::RefPtr& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo DisplayManager_signal_display_opened_info = +{ + "display-opened", + (GCallback) &DisplayManager_signal_display_opened_callback, + (GCallback) &DisplayManager_signal_display_opened_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkDisplayManager* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& DisplayManager_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &DisplayManager_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_display_manager_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void DisplayManager_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->display_opened = &display_opened_callback; +} + + +void DisplayManager_Class::display_opened_callback(GdkDisplayManager* self, GdkDisplay* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_display_opened(Glib::wrap(p0, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->display_opened) + (*base->display_opened)(self, p0); + } +} + + +Glib::ObjectBase* DisplayManager_Class::wrap_new(GObject* object) +{ + return new DisplayManager((GdkDisplayManager*)object); +} + + +/* The implementation: */ + +GdkDisplayManager* DisplayManager::gobj_copy() +{ + reference(); + return gobj(); +} + +DisplayManager::DisplayManager(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +DisplayManager::DisplayManager(GdkDisplayManager* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +DisplayManager::~DisplayManager() +{} + + +DisplayManager::CppClassType DisplayManager::displaymanager_class_; // initialize static member + +GType DisplayManager::get_type() +{ + return displaymanager_class_.init().get_type(); +} + +GType DisplayManager::get_base_type() +{ + return gdk_display_manager_get_type(); +} + + +Glib::RefPtr DisplayManager::get() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_manager_get()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr DisplayManager::get_default_display() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_manager_get_default_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr DisplayManager::get_default_display() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_display_manager_get_default_display(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void DisplayManager::set_default_display(const Glib::RefPtr& display) +{ + gdk_display_manager_set_default_display(gobj(), Glib::unwrap(display)); +} + +Glib::SListHandle< Glib::RefPtr > DisplayManager::list_displays() +{ + return Glib::SListHandle< Glib::RefPtr >(gdk_display_manager_list_displays(gobj()), Glib::OWNERSHIP_SHALLOW); +} + + +Glib::SignalProxy1< void,const Glib::RefPtr& > DisplayManager::signal_display_opened() +{ + return Glib::SignalProxy1< void,const Glib::RefPtr& >(this, &DisplayManager_signal_display_opened_info); +} + + +Glib::PropertyProxy< Glib::RefPtr > DisplayManager::property_default_display() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "default-display"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > DisplayManager::property_default_display() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "default-display"); +} + + +void Gdk::DisplayManager::on_display_opened(const Glib::RefPtr& display) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->display_opened) + (*base->display_opened)(gobj(),Glib::unwrap(display)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/displaymanager.h b/libs/gtkmm2/gdk/gdkmm/displaymanager.h new file mode 100644 index 0000000000..fb223270d6 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/displaymanager.h @@ -0,0 +1,186 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAYMANAGER_H +#define _GDKMM_DISPLAYMANAGER_H + +#include + +/* $Id$ */ + +/* displaymanager.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDisplayManager GdkDisplayManager; +typedef struct _GdkDisplayManagerClass GdkDisplayManagerClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class DisplayManager_Class; } // namespace Gdk +namespace Gdk +{ + +/** The purpose of the GdkDisplayManager singleton object is to offer notification when displays appear or disappear or the + * default display changes. + */ + +class DisplayManager : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef DisplayManager CppObjectType; + typedef DisplayManager_Class CppClassType; + typedef GdkDisplayManager BaseObjectType; + typedef GdkDisplayManagerClass BaseClassType; + +private: friend class DisplayManager_Class; + static CppClassType displaymanager_class_; + +private: + // noncopyable + DisplayManager(const DisplayManager&); + DisplayManager& operator=(const DisplayManager&); + +protected: + explicit DisplayManager(const Glib::ConstructParams& construct_params); + explicit DisplayManager(GdkDisplayManager* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~DisplayManager(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDisplayManager* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDisplayManager* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDisplayManager* gobj_copy(); + +private: + +protected: + +public: + + + /** + * @return The singleton Gdk::DisplayManager object. + * the global Gdk::DisplayManager singleton; gdk_parse_pargs(), + * gdk_init(), or gdk_init_check() must have been called first. + * + * Since: 2.2. + */ + static Glib::RefPtr get(); + + /** Gets the default Gdk::Display. + * @return A Gdk::Display, or 0 if there is no default + * display. + * + * Since: 2.2. + */ + Glib::RefPtr get_default_display(); + + /** Gets the default Gdk::Display. + * @return A Gdk::Display, or 0 if there is no default + * display. + * + * Since: 2.2. + */ + Glib::RefPtr get_default_display() const; + + + /** Sets @a display as the default display. + * + * Since: 2.2 + * @param display A Gdk::Display. + */ + void set_default_display(const Glib::RefPtr& display); + + + /** List all currently open displays. + * @return A list of Gdk::Display objects. + * Since: 2.2. + */ + Glib::SListHandle< Glib::RefPtr > list_displays(); + + /** The default display for GDK. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_default_display() ; + +/** The default display for GDK. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_default_display() const; + + + Glib::SignalProxy1< void,const Glib::RefPtr& > signal_display_opened(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_display_opened(const Glib::RefPtr& display); + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::DisplayManager + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkDisplayManager* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DISPLAYMANAGER_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/dragcontext.cc b/libs/gtkmm2/gdk/gdkmm/dragcontext.cc new file mode 100644 index 0000000000..3a2574fb72 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/dragcontext.cc @@ -0,0 +1,310 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include //For ScopedPtr<>. + +namespace Gdk +{ + +void DragContext::find_window_for_screen(const Glib::RefPtr& drag_window, const Glib::RefPtr& screen, int x_root, int y_root, Glib::RefPtr& dest_window, DragProtocol* protocol) const +{ + GdkWindow* cWindow = 0; + gdk_drag_find_window_for_screen(const_cast(gobj()), drag_window->gobj(), screen->gobj(), x_root, y_root, &cWindow, (GdkDragProtocol*)(protocol)); + dest_window = Glib::wrap((GdkWindowObject*)cWindow); +} + +void DragContext::drag_refuse(guint32 time) +{ + gdk_drag_status(gobj(), ((GdkDragAction)(0)) /* see GDK docs */, time); +} + +Glib::StringArrayHandle DragContext::get_targets() const +{ + std::list listTargets; + + //Get a newly-allocated array of atoms: + GList* list = gobj()->targets; + while(list) + { + GdkAtom atom = (GdkAtom)list->data; + + //Convert the atom to a string: + gchar* const atom_name = gdk_atom_name(atom); + + Glib::ustring target; + if(atom_name) + target = Glib::ScopedPtr(atom_name).get(); //This frees the gchar*. + + listTargets.push_back(target); + + list = list->next; + } + + return listTargets; +} + +} /* namespace Gdk */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_drag_action_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_drag_protocol_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkDragContext* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& DragContext_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &DragContext_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_drag_context_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void DragContext_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* DragContext_Class::wrap_new(GObject* object) +{ + return new DragContext((GdkDragContext*)object); +} + + +/* The implementation: */ + +GdkDragContext* DragContext::gobj_copy() +{ + reference(); + return gobj(); +} + +DragContext::DragContext(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +DragContext::DragContext(GdkDragContext* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +DragContext::~DragContext() +{} + + +DragContext::CppClassType DragContext::dragcontext_class_; // initialize static member + +GType DragContext::get_type() +{ + return dragcontext_class_.init().get_type(); +} + +GType DragContext::get_base_type() +{ + return gdk_drag_context_get_type(); +} + + +DragContext::DragContext() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(dragcontext_class_.init())) +{ + } + +Glib::RefPtr DragContext::create() +{ + return Glib::RefPtr( new DragContext() ); +} +void DragContext::drag_status(DragAction action, guint32 time) +{ + gdk_drag_status(gobj(), ((GdkDragAction)(action)), time); +} + +void DragContext::drop_reply(bool ok, guint32 time) +{ + gdk_drop_reply(gobj(), static_cast(ok), time); +} + +void DragContext::drop_finish(bool success, guint32 time) +{ + gdk_drop_finish(gobj(), static_cast(success), time); +} + +Glib::ustring DragContext::get_selection() const +{ + return Gdk::AtomString::to_cpp_type(gdk_drag_get_selection(const_cast(gobj()))); +} + +void DragContext::drag_finish(bool success, bool del, guint32 time) +{ + gtk_drag_finish(gobj(), static_cast(success), static_cast(del), time); +} + +void DragContext::set_icon(const Glib::RefPtr& colormap, const Glib::RefPtr& pixmap, const Glib::RefPtr& mask, int hot_x, int hot_y) +{ + gtk_drag_set_icon_pixmap(gobj(), Glib::unwrap(colormap), Glib::unwrap(pixmap), Glib::unwrap(mask), hot_x, hot_y); +} + +void DragContext::set_icon(const Glib::RefPtr& pixbuf, int hot_x, int hot_y) +{ + gtk_drag_set_icon_pixbuf(gobj(), Glib::unwrap(pixbuf), hot_x, hot_y); +} + +void DragContext::set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y) +{ + gtk_drag_set_icon_stock(gobj(), stock_id.c_str(), hot_x, hot_y); +} + +void DragContext::set_icon() +{ + gtk_drag_set_icon_default(gobj()); +} + +Glib::RefPtr DragContext::get_source_window() +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->source_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr DragContext::get_source_window() const +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->source_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr DragContext::get_destination_window() +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->dest_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr DragContext::get_destination_window() const +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->dest_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +DragProtocol DragContext::get_protocol() const +{ + return ((DragProtocol)(gobj()->protocol)); +} + +bool DragContext::get_is_source() const +{ + return gobj()->is_source; +} + +DragAction DragContext::get_actions() const +{ + return ((DragAction)(gobj()->actions)); +} + +DragAction DragContext::get_suggested_action() const +{ + return ((DragAction)(gobj()->suggested_action)); +} + +DragAction DragContext::get_action() const +{ + return ((DragAction)(gobj()->action)); +} + +guint32 DragContext::get_start_time() const +{ + return gobj()->start_time; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/dragcontext.h b/libs/gtkmm2/gdk/gdkmm/dragcontext.h new file mode 100644 index 0000000000..57507df105 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/dragcontext.h @@ -0,0 +1,369 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAGCONTEXT_H +#define _GDKMM_DRAGCONTEXT_H + +#include + +/* $Id$ */ + +/* dragcontext.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDragContext GdkDragContext; +typedef struct _GdkDragContextClass GdkDragContextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class DragContext_Class; } // namespace Gdk +namespace Gtk +{ + class Widget; +} /* namespace Gtk */ + +//typedef struct _GdkAtom *GdkAtom; + +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %DragAction operator|(DragAction, DragAction)
+ * %DragAction operator&(DragAction, DragAction)
+ * %DragAction operator^(DragAction, DragAction)
+ * %DragAction operator~(DragAction)
+ * %DragAction& operator|=(DragAction&, DragAction)
+ * %DragAction& operator&=(DragAction&, DragAction)
+ * %DragAction& operator^=(DragAction&, DragAction)
+ */ +enum DragAction +{ + ACTION_DEFAULT = 1 << 0, + ACTION_COPY = 1 << 1, + ACTION_MOVE = 1 << 2, + ACTION_LINK = 1 << 3, + ACTION_PRIVATE = 1 << 4, + ACTION_ASK = 1 << 5 +}; + +/** @ingroup gdkmmEnums */ +inline DragAction operator|(DragAction lhs, DragAction rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline DragAction operator&(DragAction lhs, DragAction rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline DragAction operator^(DragAction lhs, DragAction rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline DragAction operator~(DragAction flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline DragAction& operator|=(DragAction& lhs, DragAction rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline DragAction& operator&=(DragAction& lhs, DragAction rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline DragAction& operator^=(DragAction& lhs, DragAction rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum DragProtocol +{ + DRAG_PROTO_MOTIF, + DRAG_PROTO_XDND, + DRAG_PROTO_NONE, + DRAG_PROTO_WIN32_DROPFILES, + DRAG_PROTO_OLE2, + DRAG_PROTO_LOCAL +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** A Gdk::DragContext holds information about a drag in progress. It is used on both source and destination sides. + */ + +class DragContext : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef DragContext CppObjectType; + typedef DragContext_Class CppClassType; + typedef GdkDragContext BaseObjectType; + typedef GdkDragContextClass BaseClassType; + +private: friend class DragContext_Class; + static CppClassType dragcontext_class_; + +private: + // noncopyable + DragContext(const DragContext&); + DragContext& operator=(const DragContext&); + +protected: + explicit DragContext(const Glib::ConstructParams& construct_params); + explicit DragContext(GdkDragContext* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~DragContext(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDragContext* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDragContext* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDragContext* gobj_copy(); + +private: + + +protected: + DragContext(); + +public: + + static Glib::RefPtr create(); + + + /** Selects one of the actions offered by the drag source. + * + * This function is called by the drag destination in response to + * gdk_drag_motion() called by the drag source. + * @param action The selected action which will be taken when a drop happens, + * or 0 to indicate that a drop will not be accepted. + * @param time The timestamp for this operation. + */ + void drag_status(DragAction action, guint32 time); + void drag_refuse(guint32 time); + + //gdk_drag_motion is only used in GDK internally. + + + /** Accepts or rejects a drop. + * + * This function is called by the drag destination in response + * to a drop initiated by the drag source. + * @param ok true if the drop is accepted. + * @param time The timestamp for this operation. + */ + void drop_reply(bool ok, guint32 time); + + /** Ends the drag operation after a drop. + * + * This function is called by the drag destination. + * @param success true if the data was successfully received. + * @param time The timestamp for this operation. + */ + void drop_finish(bool success, guint32 time); + + /** Returns the selection atom for the current source window. + * @return The selection atom. + */ + Glib::ustring get_selection() const; + + + void drag_finish(bool success, bool del, guint32 time); + //Gtk::Widget* get_source_widget() - see Gtk::Widget::drag_get_source_widget() + + // void set_icon(Gtk::Widget* widget, int hot_x, int hot_y) - see Gtk::Widget::set_as_icon(). + + void set_icon(const Glib::RefPtr& colormap, const Glib::RefPtr& pixmap, const Glib::RefPtr& mask, int hot_x, int hot_y); + + void set_icon(const Glib::RefPtr& pixbuf, int hot_x, int hot_y); + + // The first argument was changed from StockID to ustring to avoid + // cross-dependence between gdkmm and gtkmm. + // See http://bugzilla.gnome.org/show_bug.cgi?id=79124 for details + + void set_icon(const Glib::ustring& stock_id, int hot_x, int hot_y); + + void set_icon(); + + /** Get the the source window of this drag. + * @result the source window of this drag. + */ + Glib::RefPtr get_source_window(); + Glib::RefPtr get_source_window() const; + + /** Get the the source window of this drag. + * @result the source window of this drag. + */ + Glib::RefPtr get_destination_window(); + Glib::RefPtr get_destination_window() const; + + /** Get a list of targets offered by the source. + * @result a list of targets offered by the source. + */ + Glib::StringArrayHandle get_targets() const; + + /** Get the DND protocol which governs this drag. + * @result the DND protocol which governs this drag. + */ + DragProtocol get_protocol() const; + + /** Discover whether the context is used on the source side. + * @result true if the context is used on the source side. + */ + bool get_is_source() const; + + /** Get a bitmask of actions proposed by the source when the suggested_action is Gdk::ACTION_ASK + * @result a bitmask of actions proposed by the source when the suggested_action is Gdk::ACTION_ASK + */ + DragAction get_actions() const; + + /** Get the action suggested by the source. + * @result The action suggested by the source. + */ + DragAction get_suggested_action() const; + + /** Get the action chosen by the destination. + * @result the action chosen byt the destination. + */ + DragAction get_action() const; + + /** Get a timestamp recording the start time of this drag. + * @result a timestamp recording the start time of this drag. + */ + guint32 get_start_time() const; + + + /** Finds the destination window and DND protocol to use at the + * given pointer position. + * + * This function is called by the drag source to obtain the + * @a dest_window and @a protocol parameters for gdk_drag_motion(). + * + * Since: 2.2 + * @param drag_window A window which may be at the pointer position, but + * should be ignored, since it is put up by the drag source as an icon. + * @param screen The screen where the destination window is sought. + * @param x_root The x position of the pointer in root coordinates. + * @param y_root The y position of the pointer in root coordinates. + * @param dest_window Location to store the destination window in. + * @param protocol Location to store the DND protocol in. + */ + + void find_window_for_screen(const Glib::RefPtr& drag_window, const Glib::RefPtr& screen, int x_root, int y_root, Glib::RefPtr& dest_window, DragProtocol* protocol) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::DragContext + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkDragContext* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DRAGCONTEXT_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/drawable.cc b/libs/gtkmm2/gdk/gdkmm/drawable.cc new file mode 100644 index 0000000000..58adc15cec --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/drawable.cc @@ -0,0 +1,369 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +namespace Gdk +{ + +void Drawable::draw_points(const Glib::RefPtr& gc, const Glib::ArrayHandle& points) +{ + // Don't assume the reinterpret_cast<> works everywhere. Gdk::Point is *special*. + gdk_draw_points( + gobj(), const_cast(Glib::unwrap(gc)), + reinterpret_cast(const_cast(points.data())), + points.size()); +} + +void Drawable::draw_lines(const Glib::RefPtr& gc, const Glib::ArrayHandle& points) +{ + // Don't assume the reinterpret_cast<> works everywhere. Gdk::Point is *special*. + gdk_draw_lines( + gobj(), const_cast(Glib::unwrap(gc)), + reinterpret_cast(const_cast(points.data())), + points.size()); +} + +void Drawable::draw_polygon(const Glib::RefPtr& gc, bool filled, + const Glib::ArrayHandle& points) +{ + // Don't assume the reinterpret_cast<> works everywhere. Gdk::Point is *special*. + gdk_draw_polygon( + gobj(), const_cast(Glib::unwrap(gc)), filled, + reinterpret_cast(const_cast(points.data())), + points.size()); +} + +void Drawable::copy_to_image(const Glib::RefPtr& image, int src_x, int src_y, int dest_x, int dest_y, int width, int height) const +{ + gdk_drawable_copy_to_image(const_cast(gobj()), Glib::unwrap(image), src_x, src_y, dest_x, dest_y, width, height); +} + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_rgb_dither_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkDrawable* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Drawable_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Drawable_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_drawable_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Drawable_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Drawable_Class::wrap_new(GObject* object) +{ + return new Drawable((GdkDrawable*)object); +} + + +/* The implementation: */ + +GdkDrawable* Drawable::gobj_copy() +{ + reference(); + return gobj(); +} + +Drawable::Drawable(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Drawable::Drawable(GdkDrawable* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Drawable::~Drawable() +{} + + +Drawable::CppClassType Drawable::drawable_class_; // initialize static member + +GType Drawable::get_type() +{ + return drawable_class_.init().get_type(); +} + +GType Drawable::get_base_type() +{ + return gdk_drawable_get_type(); +} + + +Drawable::Drawable() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(drawable_class_.init())) +{ + } + +Glib::RefPtr Drawable::create() +{ + return Glib::RefPtr( new Drawable() ); +} +void Drawable::get_size(int& width, int& height) +{ + gdk_drawable_get_size(gobj(), &width, &height); +} + +int Drawable::get_depth() const +{ + return gdk_drawable_get_depth(const_cast(gobj())); +} + +void Drawable::set_colormap(const Glib::RefPtr& colormap) +{ + gdk_drawable_set_colormap(gobj(), Glib::unwrap(colormap)); +} + +Glib::RefPtr Drawable::get_colormap() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_drawable_get_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Drawable::get_visual() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_drawable_get_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Drawable::draw_point(const Glib::RefPtr& gc, int x, int y) +{ + gdk_draw_point(gobj(), const_cast(Glib::unwrap(gc)), x, y); +} + +void Drawable::draw_line(const Glib::RefPtr& gc, int x1, int y1, int x2, int y2) +{ + gdk_draw_line(gobj(), const_cast(Glib::unwrap(gc)), x1, y1, x2, y2); +} + +void Drawable::draw_rectangle(const Glib::RefPtr& gc, bool filled, int x, int y, int width, int height) +{ + gdk_draw_rectangle(gobj(), const_cast(Glib::unwrap(gc)), static_cast(filled), x, y, width, height); +} + +void Drawable::draw_arc(const Glib::RefPtr& gc, bool filled, int x, int y, int width, int height, int angle1, int angle2) +{ + gdk_draw_arc(gobj(), const_cast(Glib::unwrap(gc)), static_cast(filled), x, y, width, height, angle1, angle2); +} + +void Drawable::draw_drawable(const Glib::RefPtr& gc, const Glib::RefPtr& src, int xsrc, int ysrc, int xdest, int ydest, int width, int height) +{ + gdk_draw_drawable(gobj(), const_cast(Glib::unwrap(gc)), const_cast(Glib::unwrap(src)), xsrc, ysrc, xdest, ydest, width, height); +} + +void Drawable::draw_image(const Glib::RefPtr& gc, const Glib::RefPtr& image, int xsrc, int ysrc, int xdest, int ydest, int width, int height) +{ + gdk_draw_image(gobj(), const_cast(Glib::unwrap(gc)), const_cast(Glib::unwrap(image)), xsrc, ysrc, xdest, ydest, width, height); +} + +void Drawable::draw_segments(const Glib::RefPtr& gc, GdkSegment* segs, int nsegs) +{ + gdk_draw_segments(gobj(), const_cast(Glib::unwrap(gc)), segs, nsegs); +} + +void Drawable::draw_glyphs(const Glib::RefPtr& gc, const Glib::RefPtr& font, int x, int y, const Pango::GlyphString& glyphs) +{ + gdk_draw_glyphs(gobj(), const_cast(Glib::unwrap(gc)), const_cast(Glib::unwrap(font)), x, y, const_cast(glyphs.gobj())); +} + +void Drawable::draw_layout_line(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& line) +{ + gdk_draw_layout_line(gobj(), const_cast(Glib::unwrap(gc)), x, y, const_cast(Glib::unwrap(line))); +} + +void Drawable::draw_layout_line(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& line, const Color& foreground, const Color& background) +{ + gdk_draw_layout_line_with_colors(gobj(), const_cast(Glib::unwrap(gc)), x, y, const_cast(Glib::unwrap(line)), (foreground).gobj(), (background).gobj()); +} + +void Drawable::draw_layout(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& layout) +{ + gdk_draw_layout(gobj(), const_cast(Glib::unwrap(gc)), x, y, const_cast(Glib::unwrap(layout))); +} + +void Drawable::draw_layout(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& layout, const Color& foreground, const Color& background) +{ + gdk_draw_layout_with_colors(gobj(), const_cast(Glib::unwrap(gc)), x, y, const_cast(Glib::unwrap(layout)), (foreground).gobj(), (background).gobj()); +} + +void Drawable::draw_pixbuf(const Glib::RefPtr& gc, const Glib::RefPtr& pixbuf, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither) +{ + gdk_draw_pixbuf(gobj(), const_cast(Glib::unwrap(gc)), Glib::unwrap(pixbuf), src_x, src_y, dest_x, dest_y, width, height, ((GdkRgbDither)(dither)), x_dither, y_dither); +} + +Glib::RefPtr Drawable::get_image(int x, int y, int width, int height) const +{ + return Glib::wrap(gdk_drawable_get_image(const_cast(gobj()), x, y, width, height)); +} + +Region Drawable::get_clip_region() const +{ + return Region(gdk_drawable_get_clip_region(const_cast(gobj()))); +} + +Region Drawable::get_visible_region() const +{ + return Region(gdk_drawable_get_visible_region(const_cast(gobj()))); +} + +void Drawable::draw_rgb_image(const Glib::RefPtr& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) +{ + gdk_draw_rgb_image(gobj(), const_cast(Glib::unwrap(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast(rgb_buf), rowstride); +} + +void Drawable::draw_rgb_image_dithalign(const Glib::RefPtr& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, int xdith, int ydith) +{ + gdk_draw_rgb_image_dithalign(gobj(), const_cast(Glib::unwrap(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast(rgb_buf), rowstride, xdith, ydith); +} + +void Drawable::draw_rgb_32_image(const Glib::RefPtr& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) +{ + gdk_draw_rgb_32_image(gobj(), const_cast(Glib::unwrap(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast(rgb_buf), rowstride); +} + +void Drawable::draw_rgb_32_image_dithalign(const Glib::RefPtr& gc, int x, int y, int width, int height, RgbDither dith, const guchar* buf, int rowstride, int xdith, int ydith) +{ + gdk_draw_rgb_32_image_dithalign(gobj(), const_cast(Glib::unwrap(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast(buf), rowstride, xdith, ydith); +} + +void Drawable::draw_gray_image(const Glib::RefPtr& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride) +{ + gdk_draw_gray_image(gobj(), const_cast(Glib::unwrap(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast(rgb_buf), rowstride); +} + +void Drawable::draw_indexed_image(const Glib::RefPtr& gc, int x, int y, int width, int height, RgbDither dith, const guchar* rgb_buf, int rowstride, const RgbCmap& cmap) +{ + gdk_draw_indexed_image(gobj(), const_cast(Glib::unwrap(gc)), x, y, width, height, ((GdkRgbDither)(dith)), const_cast(rgb_buf), rowstride, const_cast(cmap.gobj())); +} + +Glib::RefPtr Drawable::get_screen() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_drawable_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Drawable::get_screen() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_drawable_get_screen(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Drawable::get_display() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_drawable_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Drawable::get_display() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_drawable_get_display(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/drawable.h b/libs/gtkmm2/gdk/gdkmm/drawable.h new file mode 100644 index 0000000000..6331e46ff2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/drawable.h @@ -0,0 +1,601 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAWABLE_H +#define _GDKMM_DRAWABLE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkDrawable GdkDrawable; +typedef struct _GdkDrawableClass GdkDrawableClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Drawable_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum RgbDither +{ + RGB_DITHER_NONE, + RGB_DITHER_NORMAL, + RGB_DITHER_MAX +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +class GC; +class Pixbuf; + +/** Drawing Primitives. + * Gdk::Drawable is the base class for all of the objects that accept drawing + * commands. The available drawables include pixmaps, windows, and bitmaps. + * Drawable is abstract as there is no such type on the server side. + * + * To use a drawable, create a concrete Drawable of the type you wish to use + * and a Gdk::GC (graphics context) for that Drawable. With the GC you can + * draw lines, text, arcs and such. + */ + +class Drawable : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Drawable CppObjectType; + typedef Drawable_Class CppClassType; + typedef GdkDrawable BaseObjectType; + typedef GdkDrawableClass BaseClassType; + +private: friend class Drawable_Class; + static CppClassType drawable_class_; + +private: + // noncopyable + Drawable(const Drawable&); + Drawable& operator=(const Drawable&); + +protected: + explicit Drawable(const Glib::ConstructParams& construct_params); + explicit Drawable(GdkDrawable* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Drawable(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkDrawable* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkDrawable* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkDrawable* gobj_copy(); + +private: + + +protected: + Drawable(); + +public: + + static Glib::RefPtr create(); + + + /** Fills * @a width and * @a height with the size of @a drawable . + * @a width or @a height can be 0 if you only want the other one. + * + * On the X11 platform, if @a drawable is a Gdk::Window, the returned + * size is the size reported in the most-recently-processed configure + * event, rather than the current size on the X server. + * @param width Location to store drawable's width, or 0. + * @param height Location to store drawable's height, or 0. + */ + void get_size(int& width, int& height); + + /** Obtains the bit depth of the drawable, that is, the number of bits + * that make up a pixel in the drawable's visual. Examples are 8 bits + * per pixel, 24 bits per pixel, etc. + * @return Number of bits per pixel. + */ + int get_depth() const; + + + /** Sets the colormap associated with @a drawable . Normally this will + * happen automatically when the drawable is created; you only need to + * use this function if the drawable-creating function did not have a + * way to determine the colormap, and you then use drawable operations + * that require a colormap. The colormap for all drawables and + * graphics contexts you intend to use together should match. i.e. + * when using a Gdk::GC to draw to a drawable, or copying one drawable + * to another, the colormaps should match. + * @param colormap A Gdk::Colormap. + */ + void set_colormap(const Glib::RefPtr& colormap); + + /** Gets the colormap for @a drawable , if one is set; returns + * 0 otherwise. + * @return The colormap, or 0. + */ + Glib::RefPtr get_colormap(); + + /** Gets the Gdk::Visual describing the pixel format of @a drawable . + * @return A Gdk::Visual. + */ + Glib::RefPtr get_visual(); + + + /** Draws a point, using the foreground color and other attributes of + * the Gdk::GC. + * @param gc A Gdk::GC. + * @param x The x coordinate of the point. + * @param y The y coordinate of the point. + */ + void draw_point(const Glib::RefPtr& gc, int x, int y); + void draw_points(const Glib::RefPtr& gc, const Glib::ArrayHandle& points); + + + /** Draws a line, using the foreground color and other attributes of + * the Gdk::GC. + * @param gc A Gdk::GC. + * @param x1 The x coordinate of the start point. + * @param y1 The y coordinate of the start point. + * @param x2 The x coordinate of the end point. + * @param y2 The y coordinate of the end point. + */ + void draw_line(const Glib::RefPtr& gc, int x1, int y1, int x2, int y2); + void draw_lines(const Glib::RefPtr& gc, const Glib::ArrayHandle& points); + + + /** Draws a rectangular outline or filled rectangle, using the foreground color + * and other attributes of the Gdk::GC. + * + * A rectangle drawn filled is 1 pixel smaller in both dimensions than a + * rectangle outlined. Calling + * gdk_draw_rectangle (window, gc, true, 0, 0, 20, 20) + * results in a filled rectangle 20 pixels wide and 20 pixels high. Calling + * gdk_draw_rectangle (window, gc, false, 0, 0, 20, 20) + * results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20), + * and (20, 0), which makes it 21 pixels wide and 21 pixels high. + * @param gc A Gdk::GC. + * @param filled true if the rectangle should be filled. + * @param x The x coordinate of the left edge of the rectangle. + * @param y The y coordinate of the top edge of the rectangle. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + */ + void draw_rectangle(const Glib::RefPtr& gc, bool filled, int x, int y, int width, int height); + + /** Draws an arc or a filled 'pie slice'. The arc is defined by the bounding + * rectangle of the entire ellipse, and the start and end angles of the part + * of the ellipse to be drawn. + * @param gc A Gdk::GC. + * @param filled true if the arc should be filled, producing a 'pie slice'. + * @param x The x coordinate of the left edge of the bounding rectangle. + * @param y The y coordinate of the top edge of the bounding rectangle. + * @param width The width of the bounding rectangle. + * @param height The height of the bounding rectangle. + * @param angle1 The start angle of the arc, relative to the 3 o'clock position, + * counter-clockwise, in 1/64ths of a degree. + * @param angle2 The end angle of the arc, relative to @a angle1 , in 1/64ths + * of a degree. + */ + void draw_arc(const Glib::RefPtr& gc, bool filled, int x, int y, int width, int height, int angle1, int angle2); + void draw_polygon(const Glib::RefPtr& gc, bool filled, const Glib::ArrayHandle& points); + + + /** Copies the @a width x @a height region of @a src at coordinates ( @a xsrc , + * @a ysrc ) to coordinates ( @a xdest , @a ydest ) in @a drawable . + * @a width and/or @a height may be given as -1, in which case the entire + * @a src drawable will be copied. + * + * Most fields in @a gc are not used for this operation, but notably the + * clip mask or clip region will be honored. + * + * The source and destination drawables must have the same visual and + * colormap, or errors will result. (On X11, failure to match + * visual/colormap results in a BadMatch error from the X server.) + * A common cause of this problem is an attempt to draw a bitmap to + * a color drawable. The way to draw a bitmap is to set the + * bitmap as a clip mask on your Gdk::GC, then use gdk_draw_rectangle() + * to draw a rectangle clipped to the bitmap. + * @param gc A Gdk::GC sharing the drawable's visual and colormap. + * @param src The source Gdk::Drawable, which may be the same as @a drawable . + * @param xsrc X position in @a src of rectangle to draw. + * @param ysrc Y position in @a src of rectangle to draw. + * @param xdest X position in @a drawable where the rectangle should be drawn. + * @param ydest Y position in @a drawable where the rectangle should be drawn. + * @param width Width of rectangle to draw, or -1 for entire @a src width. + * @param height Height of rectangle to draw, or -1 for entire @a src height. + */ + void draw_drawable(const Glib::RefPtr& gc, const Glib::RefPtr& src, int xsrc, int ysrc, int xdest, int ydest, int width = -1, int height = -1); + + /** Draws a Gdk::Image onto a drawable. + * The depth of the Gdk::Image must match the depth of the Gdk::Drawable. + * @param gc A Gdk::GC. + * @param image The Gdk::Image to draw. + * @param xsrc The left edge of the source rectangle within @a image . + * @param ysrc The top of the source rectangle within @a image . + * @param xdest The x coordinate of the destination within @a drawable . + * @param ydest The y coordinate of the destination within @a drawable . + * @param width The width of the area to be copied, or -1 to make the area + * extend to the right edge of @a image . + * @param height The height of the area to be copied, or -1 to make the area + * extend to the bottom edge of @a image . + */ + void draw_image(const Glib::RefPtr& gc, const Glib::RefPtr& image, int xsrc, int ysrc, int xdest, int ydest, int width = -1, int height = -1); + + //segs is an array, and this function will be used so little that it doesn't seem worth wrapping it to use a container of C++ types. + + /** Draws a number of unconnected lines. + * @param gc A Gdk::GC. + * @param segs An array of Gdk::Segment structures specifying the start and + * end points of the lines to be drawn. + * @param nsegs The number of line segments to draw, i.e. the size of the + * @a segs array. + */ + void draw_segments(const Glib::RefPtr& gc, GdkSegment* segs, int nsegs); // TODO + + //glyphs is not an array. I went down to pango_xft_render in pango and saw that PangoGlyphString here is not an array. -Bryan + + /** This is a low-level function; 99% of text rendering should be done + * using gdk_draw_layout() instead. + * + * A glyph is a single image in a font. This function draws a sequence of + * glyphs. To obtain a sequence of glyphs you have to understand a + * lot about internationalized text handling, which you don't want to + * understand; thus, use gdk_draw_layout() instead of this function, + * gdk_draw_layout() handles the details. + * @param gc A Gdk::GC. + * @param font Font to be used. + * @param x X coordinate of baseline origin. + * @param y Y coordinate of baseline origin. + * @param glyphs The glyph string to draw. + */ + void draw_glyphs(const Glib::RefPtr& gc, const Glib::RefPtr& font, int x, int y, const Pango::GlyphString& glyphs); + + + /** Render a Pango::LayoutLine onto an GDK drawable + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the left edge of the baseline + * (left is in before-tranform user coordinates) in after-transform + * device coordinates. + * @param gc Base graphics to use. + * @param x The x position of start of string (in pixels). + * @param y The y position of baseline (in pixels). + * @param line A Pango::LayoutLine. + */ + void draw_layout_line(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& line); + + /** Render a Pango::LayoutLine onto a Gdk::Drawable, overriding the + * layout's normal colors with @a foreground and/or @a background . + * @a foreground and @a background need not be allocated. + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the left edge of the baseline + * (left is in before-tranform user coordinates) in after-transform + * device coordinates. + * @param gc Base graphics to use. + * @param x The x position of start of string (in pixels). + * @param y The y position of baseline (in pixels). + * @param line A Pango::LayoutLine. + * @param foreground Foreground override color, or 0 for none. + * @param background Background override color, or 0 for none. + */ + void draw_layout_line(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& line, const Color& foreground, const Color& background); + + + /** Render a Pango::Layout onto a GDK drawable + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the top left corner of the + * bounding box (in device space) of the transformed layout. + * + * If you're using GTK+, the usual way to obtain a Pango::Layout + * is gtk_widget_create_pango_layout(). + * @param gc Base graphics context to use. + * @param x The X position of the left of the layout (in pixels). + * @param y The Y position of the top of the layout (in pixels). + * @param layout A Pango::Layout. + */ + void draw_layout(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& layout); + + /** Render a Pango::Layout onto a Gdk::Drawable, overriding the + * layout's normal colors with @a foreground and/or @a background . + * @a foreground and @a background need not be allocated. + * + * If the layout's Pango::Context has a transformation matrix set, then + * @a x and @a y specify the position of the top left corner of the + * bounding box (in device space) of the transformed layout. + * + * If you're using GTK+, the ususal way to obtain a Pango::Layout + * is gtk_widget_create_pango_layout(). + * @param gc Base graphics context to use. + * @param x The X position of the left of the layout (in pixels). + * @param y The Y position of the top of the layout (in pixels). + * @param layout A Pango::Layout. + * @param foreground Foreground override color, or 0 for none. + * @param background Background override color, or 0 for none. + */ + void draw_layout(const Glib::RefPtr& gc, int x, int y, const Glib::RefPtr& layout, const Color& foreground, const Color& background); + + + /** Renders a rectangular portion of a pixbuf to a drawable. The destination + * drawable must have a colormap. All windows have a colormap, however, pixmaps + * only have colormap by default if they were created with a non-0 window + * argument. Otherwise a colormap must be set on them with + * Gdk::Drawable::set_colormap(). + * + * On older X servers, rendering pixbufs with an alpha channel involves round + * trips to the X server, and may be somewhat slow. + * + * The clip mask of @a gc is ignored, but clip rectangles and clip regions work + * fine. + * + * Since: 2.2 + * @param gc A Gdk::GC, used for clipping, or 0. + * @param pixbuf A Gdk::Pixbuf. + * @param src_x Source X coordinate within pixbuf. + * @param src_y Source Y coordinates within pixbuf. + * @param dest_x Destination X coordinate within drawable. + * @param dest_y Destination Y coordinate within drawable. + * @param width Width of region to render, in pixels, or -1 to use pixbuf width. + * @param height Height of region to render, in pixels, or -1 to use pixbuf height. + * @param dither Dithering mode for Gdk::RGB. + * @param x_dither X offset for dither. + * @param y_dither Y offset for dither. + */ + void draw_pixbuf(const Glib::RefPtr& gc, const Glib::RefPtr& pixbuf, + int src_x, int src_y, int dest_x, int dest_y, + int width, int height, + RgbDither dither, int x_dither, int y_dither); + + // Note: This has no 'refreturn' because get_image() returns a newly created Image object. + + /** A Gdk::Image stores client-side image data (pixels). In contrast, + * Gdk::Pixmap and Gdk::Window are server-side + * objects. get_image() obtains the pixels from a + * server-side drawable as a client-side Gdk::Image. The format of a + * Gdk::Image depends on the Gdk::Visual of the current display, which + * makes manipulating Gdk::Image extremely difficult; therefore, in + * most cases you should use Gdk::Pixbuf::get_from_drawable() instead of + * this lower-level function. A Gdk::Pixbuf contains image data in a + * canonicalized RGB format, rather than a display-dependent format. + * Of course, there's a convenience vs. speed tradeoff here, so you'll + * want to think about what makes sense for your application. + * + * @a x , @a y , @a width , and @a height define the region of @a drawable to + * obtain as an image. + * + * You would usually copy image data to the client side if you intend + * to examine the values of individual pixels, for example to darken + * an image or add a red tint. It would be prohibitively slow to + * make a round-trip request to the windowing system for each pixel, + * so instead you get all of them at once, modify them, then copy + * them all back at once. + * + * If the X server or other windowing system backend is on the local + * machine, this function may use shared memory to avoid copying + * the image data. + * + * If the source drawable is a Gdk::Window and partially offscreen + * or obscured, then the obscured portions of the returned image + * will contain undefined data. + * @param x X coordinate on @a drawable . + * @param y Y coordinate on @a drawable . + * @param width Width of region to get. + * @param height Height or region to get. + * @return A Gdk::Image containing the contents of @a drawable . + */ + Glib::RefPtr get_image(int x, int y, int width, int height) const; + + // gdk_drawable_copy_to_image() returns a new GdkImage when the image parameter is NULL, but that seems to be much the + // same as gdk_drawable_get_image(). + void copy_to_image(const Glib::RefPtr& image, int src_x, int src_y, int dest_x, int dest_y, int width, int height) const; + + + /** Computes the region of a drawable that potentially can be written + * to by drawing primitives. This region will not take into account + * the clip region for the GC, and may also not take into account + * other factors such as if the window is obscured by other windows, + * but no area outside of this region will be affected by drawing + * primitives. + * @return A Gdk::Region. This must be freed with gdk_region_destroy() + * when you are done. + */ + Region get_clip_region() const; + + /** Computes the region of a drawable that is potentially visible. + * This does not necessarily take into account if the window is + * obscured by other windows, but no area outside of this region + * is visible. + * @return A Gdk::Region. This must be freed with gdk_region_destroy() + * when you are done. + */ + Region get_visible_region() const; + + + // **** RGB stuff **** + + + void draw_rgb_image( + const Glib::RefPtr& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride); + + + void draw_rgb_image_dithalign( + const Glib::RefPtr& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride, + int xdith, int ydith); + + + void draw_rgb_32_image( + const Glib::RefPtr& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride); + + + /** Like gdk_draw_rgb_32_image(), but allows you to specify the dither + * offsets. See gdk_draw_rgb_image_dithalign() for more details. + * @param gc A Gdk::GC. + * @param x X coordinate on @a drawable where image should go. + * @param y Y coordinate on @a drawable where image should go. + * @param width Width of area of image to draw. + * @param height Height of area of image to draw. + * @param dith Dithering mode. + * @param buf RGB image data. + * @param rowstride Rowstride of RGB image data. + * @param xdith X dither offset. + * @param ydith Y dither offset. + */ + void draw_rgb_32_image_dithalign( + const Glib::RefPtr& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* buf, int rowstride, + int xdith, int ydith); + + + void draw_gray_image( + const Glib::RefPtr& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride); + + + void draw_indexed_image( + const Glib::RefPtr& gc, + int x, int y, int width, int height, + RgbDither dith, const guchar* rgb_buf, int rowstride, + const RgbCmap& cmap); + + + /** Gets the Gdk::Screen associated with a Gdk::Drawable. + * @return The Gdk::Screen associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(); + + /** Gets the Gdk::Screen associated with a Gdk::Drawable. + * @return The Gdk::Screen associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr get_screen() const; + + + /** Gets the Gdk::Display associated with a Gdk::Drawable. + * @return The Gdk::Display associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr get_display(); + + /** Gets the Gdk::Display associated with a Gdk::Drawable. + * @return The Gdk::Display associated with @a drawable + * + * Since: 2.2. + */ + Glib::RefPtr get_display() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Drawable + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkDrawable* object, bool take_copy = false); +} + + +#endif /* _GDKMM_DRAWABLE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/event.cc b/libs/gtkmm2/gdk/gdkmm/event.cc new file mode 100644 index 0000000000..e9a71e918c --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/event.cc @@ -0,0 +1,223 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + +bool Event::send_client_message(const Glib::RefPtr& display, NativeWindow winid) +{ + return gdk_event_send_client_message_for_display(display->gobj(), gobj(), winid); +} + +} //namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_event_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_extension_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_axis_use_get_type(); +} + + +namespace Glib +{ + +Gdk::Event wrap(GdkEvent* object, bool take_copy) +{ + return Gdk::Event(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Event::get_type() +{ + return gdk_event_get_type(); +} + +Event::Event() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +Event::Event(const Event& other) +: + gobject_ ((other.gobject_) ? gdk_event_copy(other.gobject_) : 0) +{} + +Event::Event(GdkEvent* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gdk_event_copy(gobject) : gobject) +{} + +Event& Event::operator=(const Event& other) +{ + Event temp (other); + swap(temp); + return *this; +} + +Event::~Event() +{ + if(gobject_) + gdk_event_free(gobject_); +} + +void Event::swap(Event& other) +{ + GdkEvent *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GdkEvent* Event::gobj_copy() const +{ + return gdk_event_copy(gobject_); +} + + +Event Event::get() +{ + return Event(gdk_event_get()); +} + +Event Event::peek() +{ + return Event(gdk_event_peek()); +} + +Event Event::get_graphics_expose(const Glib::RefPtr& window) +{ + return Event(gdk_event_get_graphics_expose(Glib::unwrap(window))); +} + +void Event::put() +{ + gdk_event_put(gobj()); +} + +bool Event::events_pending() +{ + return gdk_events_pending(); +} + +guint32 Event::get_time() const +{ + return gdk_event_get_time(const_cast(gobj())); +} + +bool Event::get_state(ModifierType& state) const +{ + return gdk_event_get_state(const_cast(gobj()), ((GdkModifierType*) &(state))); +} + +bool Event::get_coords(double& x_win, double& y_win) const +{ + return gdk_event_get_coords(const_cast(gobj()), &(x_win), &(y_win)); +} + +bool Event::get_root_coords(double& x_root, double& y_root) const +{ + return gdk_event_get_root_coords(const_cast(gobj()), &(x_root), &(y_root)); +} + +bool Event::get_axis(AxisUse axis_use, double& value) const +{ + return gdk_event_get_axis(const_cast(gobj()), ((GdkAxisUse)(axis_use)), &(value)); +} + +void Event::set_show_events(bool show_events) +{ + gdk_set_show_events(static_cast(show_events)); +} + +bool Event::get_show_events() +{ + return gdk_get_show_events(); +} + +void Event::set_screen(const Glib::RefPtr& screen) +{ + gdk_event_set_screen(gobj(), Glib::unwrap(screen)); +} + +Glib::RefPtr Event::get_screen() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_event_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Event::get_screen() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_event_get_screen(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +bool Event::send_client_message(NativeWindow winid) +{ + return gdk_event_send_client_message(gobj(), (GdkNativeWindow)(winid)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/event.h b/libs/gtkmm2/gdk/gdkmm/event.h new file mode 100644 index 0000000000..8d1095d46b --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/event.h @@ -0,0 +1,398 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_EVENT_H +#define _GDKMM_EVENT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +/* Shadow DELETE macro (from winnt.h). + */ +#if defined(DELETE) && !defined(GTKMM_MACRO_SHADOW_DELETE) +enum { GTKMM_MACRO_DEFINITION_DELETE = DELETE }; +#undef DELETE +enum { DELETE = GTKMM_MACRO_DEFINITION_DELETE }; +#define DELETE DELETE +#define GTKMM_MACRO_SHADOW_DELETE 1 +#endif + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef union _GdkEvent GdkEvent; } +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum EventType +{ + NOTHING = -1, + DELETE, + DESTROY, + EXPOSE, + MOTION_NOTIFY, + BUTTON_PRESS, + DOUBLE_BUTTON_PRESS, + TRIPLE_BUTTON_PRESS, + BUTTON_RELEASE, + KEY_PRESS, + KEY_RELEASE, + ENTER_NOTIFY, + LEAVE_NOTIFY, + FOCUS_CHANGE, + CONFIGURE, + MAP, + UNMAP, + PROPERTY_NOTIFY, + SELECTION_CLEAR, + SELECTION_REQUEST, + SELECTION_NOTIFY, + PROXIMITY_IN, + PROXIMITY_OUT, + DRAG_ENTER, + DRAG_LEAVE, + DRAG_MOTION, + DRAG_STATUS, + DROP_START, + DROP_FINISHED, + CLIENT_EVENT, + VISIBILITY_NOTIFY, + NO_EXPOSE, + SCROLL, + WINDOW_STATE, + SETTING, + OWNER_CHANGE +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** + * @ingroup gdkmmEnums + */ +enum ExtensionMode +{ + EXTENSION_EVENTS_NONE, + EXTENSION_EVENTS_ALL, + EXTENSION_EVENTS_CURSOR +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum AxisUse +{ + AXIS_IGNORE, + AXIS_X, + AXIS_Y, + AXIS_PRESSURE, + AXIS_XTILT, + AXIS_YTILT, + AXIS_WHEEL, + AXIS_LAST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +//TODO: Actually use this class instead of GdkEvent? +class Event +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Event CppObjectType; + typedef GdkEvent BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Event(); + + explicit Event(GdkEvent* gobject, bool make_a_copy = true); + + Event(const Event& other); + Event& operator=(const Event& other); + + ~Event(); + + void swap(Event& other); + + ///Provides access to the underlying C instance. + GdkEvent* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GdkEvent* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkEvent* gobj_copy() const; + +protected: + GdkEvent* gobject_; + +private: + + +public: + + + /** Checks all open displays for a Gdk::Event to process,to be processed + * on, fetching events from the windowing system if necessary. + * See Gdk::Display::get_event(). + * @return The next Gdk::Event to be processed, or 0 if no events + * are pending. The returned Gdk::Event should be freed with gdk_event_free(). + */ + static Event get(); + + /** If there is an event waiting in the event queue of some open + * display, returns a copy of it. See Gdk::Display::peek_event(). + * @return A copy of the first Gdk::Event on some event queue, or 0 if no + * events are in any queues. The returned Gdk::Event should be freed with + * gdk_event_free(). + */ + static Event peek(); + + /** Waits for a GraphicsExpose or NoExpose event from the X server. + * This is used in the Gtk::Text and Gtk::CList widgets in GTK+ to make sure any + * GraphicsExpose events are handled before the widget is scrolled. + * @param window The Gdk::Window to wait for the events for. + * @return A Gdk::EventExpose if a GraphicsExpose was received, or 0 if a + * NoExpose event was received. + */ + static Event get_graphics_expose(const Glib::RefPtr& window); + + /** Appends a copy of the given event onto the front of the event + * queue for event->any.window's display, or the default event + * queue if event->any.window is 0. See Gdk::Display::put_event(). + */ + void put(); + + + /** Checks if any events are ready to be processed for any display. + * @return true if any events are pending. + */ + static bool events_pending(); + + + /** Returns the time stamp from @a event , if there is one; otherwise + * returns Gdk::CURRENT_TIME. If @a event is 0, returns Gdk::CURRENT_TIME. + * @return Time stamp field from @a event . + */ + guint32 get_time() const; + + /** If the event contains a "state" field, puts that field in @a state . Otherwise + * stores an empty state (0). Returns true if there was a state field + * in the event. @a event may be 0, in which case it's treated + * as if the event had no state field. + * @param state Return location for state. + * @return true if there was a state field in the event. + */ + bool get_state(ModifierType& state) const; + + /** Extract the event window relative x/y coordinates from an event. + * @param x_win Location to put event window x coordinate. + * @param y_win Location to put event window y coordinate. + * @return true if the event delivered event window coordinates. + */ + bool get_coords(double& x_win, double& y_win) const; + + /** Extract the root window relative x/y coordinates from an event. + * @param x_root Location to put root window x coordinate. + * @param y_root Location to put root window y coordinate. + * @return true if the event delivered root window coordinates. + */ + bool get_root_coords(double& x_root, double& y_root) const; + + /** Extract the axis value for a particular axis use from + * an event structure. + * @param axis_use The axis use to look for. + * @param value Location to store the value found. + * @return true if the specified axis was found, otherwise false. + */ + bool get_axis(AxisUse axis_use, double& value) const; + //_WRAP_METHOD(void gdk_event_handler_set(GdkEventFunc func, gpointer data, GDestroyNotify notify), gdk_event_handler_set) + + + /** Sets whether a trace of received events is output. + * Note that GTK+ must be compiled with debugging (that is, + * configured using the <option>--enable-debug</option> option) + * to use this option. + * @param show_events true to output event debugging information. + */ + static void set_show_events(bool show_events); + + /** Gets whether event debugging output is enabled. + * @return true if event debugging output is enabled. + */ + static bool get_show_events(); + + + /** Sets the screen for @a event to @a screen . The event must + * have been allocated by GTK+, for instance, by + * gdk_event_copy(). + * + * Since: 2.2 + * @param screen A Gdk::Screen. + */ + void set_screen(const Glib::RefPtr& screen); + + /** Returns the screen for the event. The screen is + * typically the screen for event->any.window, but + * for events such as mouse events, it is the screen + * where the the pointer was when the event occurs - + * that is, the screen which has the root window + * to which event->motion.x_root and + * event->motion.y_root are relative. + * @return The screen for the event + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(); + + /** Returns the screen for the event. The screen is + * typically the screen for event->any.window, but + * for events such as mouse events, it is the screen + * where the the pointer was when the event occurs - + * that is, the screen which has the root window + * to which event->motion.x_root and + * event->motion.y_root are relative. + * @return The screen for the event + * + * Since: 2.2. + */ + Glib::RefPtr get_screen() const; + + + /** Sends an X ClientMessage event to a given window (which must be + * on the default Gdk::Display.) + * This could be used for communicating between different applications, + * though the amount of data is limited to 20 bytes. + * @param winid The window to send the X ClientMessage event to. + * @return Non-zero on success. + */ + bool send_client_message(NativeWindow winid); + bool send_client_message(const Glib::RefPtr& display, NativeWindow winid); + + +}; + +} // namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Event + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Event& lhs, Event& rhs) + { lhs.swap(rhs); } + +} // namespace Gdk + +namespace Glib +{ + +/** @relates Gdk::Event + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Event wrap(GdkEvent* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value : public Glib::Value_Boxed +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_EVENT_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/gc.cc b/libs/gtkmm2/gdk/gdkmm/gc.cc new file mode 100644 index 0000000000..456cad5f9e --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/gc.cc @@ -0,0 +1,326 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +//#include +//#include +#include +#include + +namespace Gdk +{ + +GC::GC(const Glib::RefPtr& drawable) +: Object( G_OBJECT( gdk_gc_new(drawable->gobj()) ) ) +{ + //We need a construct function if we really want to use our own GClass. Bug #86867 +} + + +} + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_line_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_cap_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_join_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_fill_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_function_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_subwindow_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_gc_values_mask_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkGC* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& GC_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &GC_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_gc_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void GC_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* GC_Class::wrap_new(GObject* object) +{ + return new GC((GdkGC*)object); +} + + +/* The implementation: */ + +GdkGC* GC::gobj_copy() +{ + reference(); + return gobj(); +} + +GC::GC(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +GC::GC(GdkGC* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +GC::~GC() +{} + + +GC::CppClassType GC::gc_class_; // initialize static member + +GType GC::get_type() +{ + return gc_class_.init().get_type(); +} + +GType GC::get_base_type() +{ + return gdk_gc_get_type(); +} + + +GC::GC() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(gc_class_.init())) +{ + } + +Glib::RefPtr GC::create() +{ + return Glib::RefPtr( new GC() ); +} +Glib::RefPtr GC::create(const Glib::RefPtr& drawable) +{ + return Glib::RefPtr( new GC(drawable) ); +} +void GC::set_foreground(const Color& color) +{ + gdk_gc_set_foreground(gobj(), (color).gobj()); +} + +void GC::set_background(const Color& color) +{ + gdk_gc_set_background(gobj(), (color).gobj()); +} + +void GC::set_function(Function function) +{ + gdk_gc_set_function(gobj(), ((GdkFunction)(function))); +} + +void GC::set_fill(Fill fill) +{ + gdk_gc_set_fill(gobj(), ((GdkFill)(fill))); +} + +void GC::set_tile(const Glib::RefPtr& tile) +{ + gdk_gc_set_tile(gobj(), Glib::unwrap(tile)); +} + +void GC::set_stipple(const Glib::RefPtr& stipple) +{ + gdk_gc_set_stipple(gobj(), Glib::unwrap(stipple)); +} + +void GC::set_ts_origin(int x, int y) +{ + gdk_gc_set_ts_origin(gobj(), x, y); +} + +void GC::set_clip_origin(int x, int y) +{ + gdk_gc_set_clip_origin(gobj(), x, y); +} + +void GC::set_clip_mask(const Glib::RefPtr& mask) +{ + gdk_gc_set_clip_mask(gobj(), Glib::unwrap(mask)); +} + +void GC::set_clip_rectangle(Rectangle& rectangle) +{ + gdk_gc_set_clip_rectangle(gobj(), (rectangle).gobj()); +} + +void GC::set_clip_region(const Region& region) +{ + gdk_gc_set_clip_region(gobj(), const_cast((region).gobj())); +} + +void GC::set_subwindow(SubwindowMode mode) +{ + gdk_gc_set_subwindow(gobj(), ((GdkSubwindowMode)(mode))); +} + +void GC::set_exposures(bool exposures) +{ + gdk_gc_set_exposures(gobj(), static_cast(exposures)); +} + +void GC::set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style) +{ + gdk_gc_set_line_attributes(gobj(), line_width, ((GdkLineStyle)(line_style)), ((GdkCapStyle)(cap_style)), ((GdkJoinStyle)(join_style))); +} + +void GC::set_dashes(int dash_offset, gint8* dash_list, int n) +{ + gdk_gc_set_dashes(gobj(), dash_offset, dash_list, n); +} + +void GC::offset(int x_offset, int y_offset) +{ + gdk_gc_offset(gobj(), x_offset, y_offset); +} + +void GC::set_colormap(const Glib::RefPtr& colormap) +{ + gdk_gc_set_colormap(gobj(), Glib::unwrap(colormap)); +} + +Glib::RefPtr GC::get_colormap() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_gc_get_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void GC::set_rgb_fg_color(const Color& color) +{ + gdk_gc_set_rgb_fg_color(gobj(), (color).gobj()); +} + +void GC::set_rgb_bg_color(const Color& color) +{ + gdk_gc_set_rgb_bg_color(gobj(), (color).gobj()); +} + +Glib::RefPtr GC::get_screen() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_gc_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr GC::get_screen() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_gc_get_screen(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/gc.h b/libs/gtkmm2/gdk/gdkmm/gc.h new file mode 100644 index 0000000000..854995eee5 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/gc.h @@ -0,0 +1,617 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_GC_H +#define _GDKMM_GC_H + +#include + +/* $Id$ */ + +/* gc.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkGC GdkGC; +typedef struct _GdkGCClass GdkGCClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class GC_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum LineStyle +{ + LINE_SOLID, + LINE_ON_OFF_DASH, + LINE_DOUBLE_DASH +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum CapStyle +{ + CAP_NOT_LAST, + CAP_BUTT, + CAP_ROUND, + CAP_PROJECTING +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum JoinStyle +{ + JOIN_MITER, + JOIN_ROUND, + JOIN_BEVEL +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Fill +{ + SOLID, + TILED, + STIPPLED, + OPAQUE_STIPPLED +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Function +{ + COPY, + INVERT, + XOR, + CLEAR, + AND, + AND_REVERSE, + AND_INVERT, + NOOP, + OR, + EQUIV, + OR_REVERSE, + COPY_INVERT, + OR_INVERT, + NAND, + NOR, + SET +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum SubwindowMode +{ + CLIP_BY_CHILDREN, + INCLUDE_INFERIORS +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %GCValuesMask operator|(GCValuesMask, GCValuesMask)
+ * %GCValuesMask operator&(GCValuesMask, GCValuesMask)
+ * %GCValuesMask operator^(GCValuesMask, GCValuesMask)
+ * %GCValuesMask operator~(GCValuesMask)
+ * %GCValuesMask& operator|=(GCValuesMask&, GCValuesMask)
+ * %GCValuesMask& operator&=(GCValuesMask&, GCValuesMask)
+ * %GCValuesMask& operator^=(GCValuesMask&, GCValuesMask)
+ */ +enum GCValuesMask +{ + GC_FOREGROUND = 1 << 0, + GC_BACKGROUND = 1 << 1, + GC_FONT = 1 << 2, + GC_FUNCTION = 1 << 3, + GC_FILL = 1 << 4, + GC_TILE = 1 << 5, + GC_STIPPLE = 1 << 6, + GC_CLIP_MASK = 1 << 7, + GC_SUBWINDOW = 1 << 8, + GC_TS_X_ORIGIN = 1 << 9, + GC_TS_Y_ORIGIN = 1 << 10, + GC_CLIP_X_ORIGIN = 1 << 11, + GC_CLIP_Y_ORIGIN = 1 << 12, + GC_EXPOSURES = 1 << 13, + GC_LINE_WIDTH = 1 << 14, + GC_LINE_STYLE = 1 << 15, + GC_CAP_STYLE = 1 << 16, + GC_JOIN_STYLE = 1 << 17 +}; + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator|(GCValuesMask lhs, GCValuesMask rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator&(GCValuesMask lhs, GCValuesMask rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator^(GCValuesMask lhs, GCValuesMask rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask operator~(GCValuesMask flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask& operator|=(GCValuesMask& lhs, GCValuesMask rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask& operator&=(GCValuesMask& lhs, GCValuesMask rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline GCValuesMask& operator^=(GCValuesMask& lhs, GCValuesMask rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +class Drawable; + +/** All drawing operations in GDK take a graphics context (GC) argument. + * A graphics context encapsulates information about the way things are drawn, such as the foreground color or line width. + * By using graphics contexts, the number of arguments to each drawing call is greatly reduced, and communication overhead + * is minimized, since identical arguments do not need to be passed repeatedly. + */ + +class GC : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef GC CppObjectType; + typedef GC_Class CppClassType; + typedef GdkGC BaseObjectType; + typedef GdkGCClass BaseClassType; + +private: friend class GC_Class; + static CppClassType gc_class_; + +private: + // noncopyable + GC(const GC&); + GC& operator=(const GC&); + +protected: + explicit GC(const Glib::ConstructParams& construct_params); + explicit GC(GdkGC* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~GC(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkGC* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkGC* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkGC* gobj_copy(); + +private: + + +protected: + GC(); + explicit GC(const Glib::RefPtr& drawable); + +public: + + static Glib::RefPtr create(); + + + static Glib::RefPtr create(const Glib::RefPtr& drawable); + + + // Custom wrap these?, maybe with a Gdk::GC::Value class. Need to do take care of refcounts of GdkGCValue's fields. + // Actually, I don't see the need for these methods. murrayc. + //_WRAP_METHOD(void get_values(GdkGCValues& values) const, gdk_gc_get_values) + //_WRAP_METHOD(void set_values(const GdkGCValues& values, GCValuesMask values_mask), gdk_gc_set_values) + //__IGNORE(gdk_gc_get_values, gdk_gc_set_values) + + + /** Sets the foreground color for a graphics context. + * Note that this function uses @a color ->pixel, use + * set_rgb_fg_color() to specify the foreground + * color as red, green, blue components. + * @param color The new foreground color. + */ + void set_foreground(const Color& color); + + /** Sets the background color for a graphics context. + * Note that this function uses @a color ->pixel, use + * set_rgb_bg_color() to specify the background + * color as red, green, blue components. + * @param color The new background color. + */ + void set_background(const Color& color); + + /** Determines how the current pixel values and the + * pixel values being drawn are combined to produce + * the final pixel values. + * @param function The Gdk::Function to use. + */ + void set_function(Function function); + + /** Set the fill mode for a graphics context. + * @param fill The new fill mode. + */ + void set_fill(Fill fill); + + /** Set a tile pixmap for a graphics context. + * This will only be used if the fill mode + * is Gdk::TILED. + * @param tile The new tile pixmap. + */ + void set_tile(const Glib::RefPtr& tile); + + /** Set the stipple bitmap for a graphics context. The + * stipple will only be used if the fill mode is + * Gdk::STIPPLED or Gdk::OPAQUE_STIPPLED. + * @param stipple The new stipple bitmap. + */ + void set_stipple(const Glib::RefPtr& stipple); + + /** Set the origin when using tiles or stipples with + * the GC. The tile or stipple will be aligned such + * that the upper left corner of the tile or stipple + * will coincide with this point. + * @param x The x-coordinate of the origin. + * @param y The y-coordinate of the origin. + */ + void set_ts_origin(int x, int y); + + /** Sets the origin of the clip mask. The coordinates are + * interpreted relative to the upper-left corner of + * the destination drawable of the current operation. + * @param x The x-coordinate of the origin. + * @param y The y-coordinate of the origin. + */ + void set_clip_origin(int x, int y); + + /** Sets the clip mask for a graphics context from a bitmap. + * The clip mask is interpreted relative to the clip + * origin. (See set_clip_origin()). + * @param mask A bitmap. + */ + void set_clip_mask(const Glib::RefPtr& mask); + + /** Sets the clip mask for a graphics context from a + * rectangle. The clip mask is interpreted relative to the clip + * origin. (See set_clip_origin()). + * @param rectangle The rectangle to clip to. + */ + void set_clip_rectangle(Rectangle& rectangle); + + /** Sets the clip mask for a graphics context from a region structure. + * The clip mask is interpreted relative to the clip origin. (See + * set_clip_origin()). + * @param region The Gdk::Region. + */ + void set_clip_region(const Region& region); + + /** Sets how drawing with this GC on a window will affect child + * windows of that window. + * @param mode The subwindow mode. + */ + void set_subwindow(SubwindowMode mode); + + /** Sets whether copying non-visible portions of a drawable + * using this graphics context generate exposure events + * for the corresponding regions of the destination + * drawable. (See gdk_draw_drawable()). + * @param exposures If true, exposure events will be generated. + */ + void set_exposures(bool exposures); + + /** Sets various attributes of how lines are drawn. See + * the corresponding members of Gdk::GCValues for full + * explanations of the arguments. + * @param line_width The width of lines. + * @param line_style The dash-style for lines. + * @param cap_style The manner in which the ends of lines are drawn. + * @param join_style The in which lines are joined together. + */ + void set_line_attributes(int line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style); + + /** Sets the way dashed-lines are drawn. Lines will be + * drawn with alternating on and off segments of the + * lengths specified in @a dash_list . The manner in + * which the on and off segments are drawn is determined + * by the @a line_style value of the GC. (This can + * be changed with set_line_attributes().) + * + * The @a dash_offset defines the phase of the pattern, + * specifying how many pixels into the dash-list the pattern + * should actually begin. + * @param dash_offset The phase of the dash pattern. + * @param dash_list An array of dash lengths. + * @param n The number of elements in @a dash_list . + */ + void set_dashes(int dash_offset, gint8* dash_list, int n); + + /** Offset attributes such as the clip and tile-stipple origins + * of the GC so that drawing at x - x_offset, y - y_offset with + * the offset GC has the same effect as drawing at x, y with the original + * GC. + * @param x_offset Amount by which to offset the GC in the X direction. + * @param y_offset Amount by which to offset the GC in the Y direction. + */ + void offset(int x_offset, int y_offset); + + /** Sets the colormap for the GC to the given colormap. The depth + * of the colormap's visual must match the depth of the drawable + * for which the GC was created. + * @param colormap A Gdk::Colormap. + */ + void set_colormap(const Glib::RefPtr& colormap); + + /** Retrieves the colormap for a given GC, if it exists. + * A GC will have a colormap if the drawable for which it was created + * has a colormap, or if a colormap was set explicitely with + * gdk_gc_set_colormap. + * @return The colormap of @a gc , or 0 if @a gc doesn't have one. + */ + Glib::RefPtr get_colormap(); + + /** Set the foreground color of a GC using an unallocated color. The + * pixel value for the color will be determined using GdkRGB. If the + * colormap for the GC has not previously been initialized for GdkRGB, + * then for pseudo-color colormaps (colormaps with a small modifiable + * number of colors), a colorcube will be allocated in the colormap. + * + * Calling this function for a GC without a colormap is an error. + * @param color An unallocated Gdk::Color. + */ + void set_rgb_fg_color(const Color& color); + + /** Set the background color of a GC using an unallocated color. The + * pixel value for the color will be determined using GdkRGB. If the + * colormap for the GC has not previously been initialized for GdkRGB, + * then for pseudo-color colormaps (colormaps with a small modifiable + * number of colors), a colorcube will be allocated in the colormap. + * + * Calling this function for a GC without a colormap is an error. + * @param color An unallocated Gdk::Color. + */ + void set_rgb_bg_color(const Color& color); + + + /** Gets the Gdk::Screen for which @a gc was created + * @return The Gdk::Screen for @a gc . + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(); + + /** Gets the Gdk::Screen for which @a gc was created + * @return The Gdk::Screen for @a gc . + * + * Since: 2.2. + */ + Glib::RefPtr get_screen() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::GC + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkGC* object, bool take_copy = false); +} + + +#endif /* _GDKMM_GC_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/general.cc b/libs/gtkmm2/gdk/gdkmm/general.cc new file mode 100644 index 0000000000..f07cce2b14 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/general.cc @@ -0,0 +1,54 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gdk +{ + +int screen_width() +{ + return gdk_screen_width(); +} + +int screen_height() +{ + return gdk_screen_height(); +} + +int screen_width_mm() +{ + return gdk_screen_width_mm(); +} + +int screen_height_mm() +{ + return gdk_screen_height_mm(); +} + + +void flush() +{ + gdk_flush(); +} + +} //namespace Gdk + diff --git a/libs/gtkmm2/gdk/gdkmm/general.h b/libs/gtkmm2/gdk/gdkmm/general.h new file mode 100644 index 0000000000..1d37ab0e3b --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/general.h @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GDKMM_GENERAL_H +#define _GDKMM_GENERAL_H + +namespace Gdk +{ + +int screen_width(); +int screen_height(); + +int screen_width_mm(); +int screen_height_mm(); + +void flush(); + +} //namespace Gdk + +#endif //_GDKMM_GENERAL_H + diff --git a/libs/gtkmm2/gdk/gdkmm/image.cc b/libs/gtkmm2/gdk/gdkmm/image.cc new file mode 100644 index 0000000000..787124f36f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/image.cc @@ -0,0 +1,250 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Gdk +{ + +Image::Image(ImageType type, const Glib::RefPtr& visual, int width, int height) +: + Object( G_OBJECT( gdk_image_new((GdkImageType)type, visual->gobj(), width, height) ) ) +{} + +} /* namespace Gdk */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_image_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkImage* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Image_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Image_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_image_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Image_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Image_Class::wrap_new(GObject* object) +{ + return new Image((GdkImage*)object); +} + + +/* The implementation: */ + +GdkImage* Image::gobj_copy() +{ + reference(); + return gobj(); +} + +Image::Image(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Image::Image(GdkImage* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Image::~Image() +{} + + +Image::CppClassType Image::image_class_; // initialize static member + +GType Image::get_type() +{ + return image_class_.init().get_type(); +} + +GType Image::get_base_type() +{ + return gdk_image_get_type(); +} + + +Glib::RefPtr Image::create(ImageType type, const Glib::RefPtr& visual, int width, int height) +{ + return Glib::RefPtr( new Image(type, visual, width, height) ); +} +void Image::put_pixel(int x, int y, guint32 pixel) +{ + gdk_image_put_pixel(gobj(), x, y, pixel); +} + +guint32 Image::get_pixel(int x, int y) const +{ + return gdk_image_get_pixel(const_cast(gobj()), x, y); +} + +void Image::set_colormap(const Glib::RefPtr& colormap) +{ + gdk_image_set_colormap(gobj(), Glib::unwrap(colormap)); +} + +Glib::RefPtr Image::get_colormap() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_image_get_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Image::get_colormap() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_image_get_colormap(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +ImageType Image::get_image_type() const +{ + return ((ImageType)(gobj()->type)); +} + +Glib::RefPtr Image::get_visual() +{ + Glib::RefPtr ref_ptr(Glib::wrap(gobj()->visual)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr Image::get_visual() const +{ + Glib::RefPtr ref_ptr(Glib::wrap(gobj()->visual)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +ByteOrder Image::get_byte_order() const +{ + return ((ByteOrder)(gobj()->byte_order)); +} + +int Image::get_width() const +{ + return gobj()->width; +} + +int Image::get_height() const +{ + return gobj()->height; +} + +guint16 Image::get_bpp() const +{ + return gobj()->bpp; +} + +guint16 Image::get_bpl() const +{ + return gobj()->bpl; +} + +guint16 Image::get_bits_per_pixel() const +{ + return gobj()->bits_per_pixel; +} + +void* Image::get_mem() +{ + return gobj()->mem; +} + +const void* Image::get_mem() const +{ + return (const void*)(gobj()->mem); +} + +void* Image::get_windowing_data() const +{ + return gobj()->windowing_data; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/image.h b/libs/gtkmm2/gdk/gdkmm/image.h new file mode 100644 index 0000000000..7d5f8f6078 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/image.h @@ -0,0 +1,231 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_IMAGE_H +#define _GDKMM_IMAGE_H + +#include + +/* $Id$ */ + +/* bitmap.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include //For ByteOrder. +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkImage GdkImage; +typedef struct _GdkImageClass GdkImageClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Image_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum ImageType +{ + IMAGE_NORMAL, + IMAGE_SHARED, + IMAGE_FASTEST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** This represents an area for drawing graphics. It has now been superceded to a large extent by the much more flexible + * Gdk::Drawable RGB functions. + * To create an image from part of a Gdk::Window use Gdk::Drawable::get_image(). + * + * The image can be manipulated with get_pixel() and put_pixel(), or alternatively by changing the actual pixel data, though + * manipulating the pixel data requires complicated code to cope with the different formats that may be used. + * To draw a Gdk::Image in a Gdk::Window or Gdk::Pixmap use Gdk::Drawable::draw_image(). + */ + +class Image : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Image CppObjectType; + typedef Image_Class CppClassType; + typedef GdkImage BaseObjectType; + typedef GdkImageClass BaseClassType; + +private: friend class Image_Class; + static CppClassType image_class_; + +private: + // noncopyable + Image(const Image&); + Image& operator=(const Image&); + +protected: + explicit Image(const Glib::ConstructParams& construct_params); + explicit Image(GdkImage* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Image(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkImage* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkImage* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkImage* gobj_copy(); + +private: + + +protected: + + /** Instantiate a new Gdk::Image. + * + * @param type The type of the Gdk::Image. Gdk::IMAGE_FASTEST is probably the best choice, since it will try to create a Gdk::IMAGE_SHARED image first and if that fails it will then use Gdk::IMAGE_NORMAL. + * @param visual The Gdk::Visual to use for the image. + * @param width The width of the image in pixels. + * @param height The height of the image in pixels. + */ + Image(ImageType type, const Glib::RefPtr& visual, int width, int height); + + +public: + + static Glib::RefPtr create(ImageType type, const Glib::RefPtr& visual, int width, int height); + + + //We ignore gdk_image_new_bitmap() because the documentation says that it is incredibly broken. + + + void put_pixel(int x, int y, guint32 pixel); + + guint32 get_pixel(int x, int y) const; + + /** Sets the colormap for the image to the given colormap. Normally + * there's no need to use this function, images are created with the + * correct colormap if you get the image from a drawable. If you + * create the image from scratch, use the colormap of the drawable you + * intend to render the image to. + * @param colormap A Gdk::Colormap. + */ + void set_colormap(const Glib::RefPtr& colormap); + + /** Retrieves the colormap for a given image, if it exists. An image + * will have a colormap if the drawable from which it was created has + * a colormap, or if a colormap was set explicitely with + * set_colormap(). + * @return Colormap for the image. + */ + Glib::RefPtr get_colormap(); + + /** Retrieves the colormap for a given image, if it exists. An image + * will have a colormap if the drawable from which it was created has + * a colormap, or if a colormap was set explicitely with + * set_colormap(). + * @return Colormap for the image. + */ + Glib::RefPtr get_colormap() const; + + ImageType get_image_type() const; + Glib::RefPtr get_visual(); + Glib::RefPtr get_visual() const; + ByteOrder get_byte_order() const; + int get_width() const; + int get_height() const; + guint16 get_bpp() const; + guint16 get_bpl() const; + guint16 get_bits_per_pixel() const; + + //This memory block is not read-only, apparently: + void* get_mem(); + const void* get_mem() const; + + //TODO: This should be const really. + void* get_windowing_data() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Image + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkImage* object, bool take_copy = false); +} + + +#endif /* _GDKMM_IMAGE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/list.h b/libs/gtkmm2/gdk/gdkmm/list.h new file mode 100644 index 0000000000..2c4da23bb7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/list.h @@ -0,0 +1,157 @@ +#ifndef _GDKMM_LIST_H_ +#define _GDKMM_LIST_H_ + +namespace Gdk { + +#ifdef GTKMM_CXX_HAVE_PARTIAL_SPECIALIZATION +// Dummy class to make it appear as though the user has the list. +/* +template + class List + { + public: + typedef List List; + private: + Parent* parent; + public: + List(Parent& p):parent(p) {} + List():parent(0) {} + List(const List& list):parent(list.parent) {} + + Iterator begin() + { + if (parent) + return Access::begin(parent); + return Iterator(); + } + Iterator end(); + { + if (parent) + return Access::end(parent); + return Iterator(); + } + }; +*/ + +// An iterator that caches the current object to C++ for speed +template + class List_Iterator + { + public: + typedef List_Iterator self; + + private: + GList *node; + Cpp_Obj cache; + + public: + self& operator=(const self& x) + { + cache.free(); + node=x.node; + } + + bool operator==(const self& x) const + { return node == x.node; } + bool operator!=(const self& x) const + { return node != x.node; } + + List_Iterator(GList *n) : node(n),cache(0) + {} + List_Iterator() :node(0),cache(0) + {} + List_Iterator(const self& x) + : node(x.node),cache(0) + {} + + Cpp_Obj& operator*() const + { + if (node) + {if (cache.gobj()!=node->data) + cache=Cpp_Obj(node->data); + } + else + cache=Cpp_Obj(0); + cache=0; + return ; + } + + Cpp_Obj* operator->() const + { + return &(operator*()); + } + + self& operator++() + { + cache.free(); + if (node && node->next) + node = node->next; + return *this; + } + + self operator++(int) + { + self tmp = *this; + ++*this; + return tmp; + } + + self& operator--() + { + cache.free(); + if (node && node->prev) + node=node->prev; + return *this; + } + + self operator--(int) + { + self tmp = *this; + --*this; + return tmp; + } + + }; + +/* +List_Iterator iter; +(*iter) should be a Widget + +Example usage: + + class Foo() + { + public: + typedef List_Iterator Iterator; + typedef List +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace +{ + +void pixbuf_destroy_data_callback(guint8* pixels, void* user_data) +{ + Gdk::Pixbuf::SlotDestroyData *const slot = static_cast(user_data); + g_return_if_fail(slot != 0); + + try + { + (*slot)(pixels); // invoke callback + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete slot; +} + +} // anonymous namespace + + +namespace Gdk +{ + +Pixbuf::Pixbuf(const Glib::RefPtr& src, + const Glib::RefPtr& cmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height) +: + Object((GObject*) gdk_pixbuf_get_from_image( + 0, src->gobj(), cmap->gobj(), src_x, src_y, dest_x, dest_y, width, height)) +{} + +Pixbuf::Pixbuf(const Glib::RefPtr& src, + const Glib::RefPtr& cmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height) +: + Object((GObject*) gdk_pixbuf_get_from_drawable( + 0, src->gobj(), cmap->gobj(), src_x, src_y, dest_x, dest_y, width, height)) +{} + +Glib::RefPtr Pixbuf::create_from_file(const std::string& filename) +{ + GError* error = 0; + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_file(filename.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr Pixbuf::create_from_file(const std::string& filename, int width, int size, bool preserve_aspect_ratio) +{ + GError* error = 0; + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_file_at_scale(filename.c_str(), width, size, preserve_aspect_ratio, &error); + //gdk_pixbuf_new_from_file_at_size() just calls gdk_pixbuf_new_from_file_at_scale(). + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr Pixbuf::create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride) +{ + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_data( + data, (GdkColorspace) colorspace, has_alpha, bits_per_sample, width, height, rowstride, + 0, 0); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr Pixbuf::create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride, + const Pixbuf::SlotDestroyData& destroy_slot) +{ + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_data( + data, (GdkColorspace) colorspace, has_alpha, bits_per_sample, width, height, rowstride, + &pixbuf_destroy_data_callback, new SlotDestroyData(destroy_slot)); + + return Glib::wrap(pixbuf); +} + +Glib::RefPtr Pixbuf::create_from_inline(int data_length, const guint8* data, bool copy_pixels) +{ + GError* error = 0; + GdkPixbuf *const pixbuf = gdk_pixbuf_new_from_inline(data_length, data, copy_pixels, &error); + + if(error) + Glib::Error::throw_exception(error); + + return Glib::wrap(pixbuf); +} + +void Pixbuf::render_pixmap_and_mask_for_colormap(const Glib::RefPtr& colormap, + Glib::RefPtr& pixmap_return, + Glib::RefPtr& mask_return, + int alpha_threshold) +{ + GdkPixmap* pPixmap = 0; + GdkBitmap* pBitmap = 0; + + gdk_pixbuf_render_pixmap_and_mask_for_colormap( + gobj(), colormap->gobj(), &pPixmap, &pBitmap, alpha_threshold); + + pixmap_return = Glib::wrap((GdkPixmapObject*) pPixmap); + mask_return = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap)); +} + +void Pixbuf::render_pixmap_and_mask(Glib::RefPtr& pixmap_return, + Glib::RefPtr& mask_return, + int alpha_threshold) +{ + GdkPixmap* pPixmap = 0; + GdkBitmap* pBitmap = 0; + + gdk_pixbuf_render_pixmap_and_mask(gobj(), &pPixmap, &pBitmap, alpha_threshold); + + pixmap_return = Glib::wrap((GdkPixmapObject*) pPixmap); + mask_return = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) pBitmap)); +} + +void Pixbuf::save(const std::string& filename, const Glib::ustring& type) +{ + GError* error = 0; + gdk_pixbuf_savev(gobj(), filename.c_str(), type.c_str(), 0, 0, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void Pixbuf::save(const std::string& filename, const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values) +{ + GError* error = 0; + + gdk_pixbuf_savev( + gobj(), filename.c_str(), type.c_str(), + const_cast(option_keys.data()), const_cast(option_values.data()), + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void Pixbuf::save_to_buffer(gchar*& buffer, gsize& buffer_size, + const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values) +{ + GError* error = 0; + + gdk_pixbuf_save_to_bufferv( + gobj(), &buffer, &buffer_size, + type.c_str(), + const_cast(option_keys.data()), const_cast(option_values.data()), + &error); + + if(error) + Glib::Error::throw_exception(error); +} + +Pixbuf::SListHandle_PixbufFormat Pixbuf::get_formats() +{ + //TODO: Check that this ownership is appropriate. murrayc. + return SListHandle_PixbufFormat(gdk_pixbuf_get_formats(), Glib::OWNERSHIP_DEEP); +} + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_colorspace_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_interp_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_pixbuf_alpha_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_pixbuf_rotation_get_type(); +} + + +Gdk::PixbufError::PixbufError(Gdk::PixbufError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (GDK_PIXBUF_ERROR, error_code, error_message) +{} + +Gdk::PixbufError::PixbufError(GError* gobject) +: + Glib::Error (gobject) +{} + +Gdk::PixbufError::Code Gdk::PixbufError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Gdk::PixbufError::throw_func(GError* gobject) +{ + throw Gdk::PixbufError(gobject); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_pixbuf_error_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkPixbuf* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Pixbuf_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Pixbuf_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Pixbuf_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Pixbuf_Class::wrap_new(GObject* object) +{ + return new Pixbuf((GdkPixbuf*)object); +} + + +/* The implementation: */ + +GdkPixbuf* Pixbuf::gobj_copy() +{ + reference(); + return gobj(); +} + +Pixbuf::Pixbuf(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Pixbuf::Pixbuf(GdkPixbuf* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Pixbuf::~Pixbuf() +{} + + +Pixbuf::CppClassType Pixbuf::pixbuf_class_; // initialize static member + +GType Pixbuf::get_type() +{ + return pixbuf_class_.init().get_type(); +} + +GType Pixbuf::get_base_type() +{ + return gdk_pixbuf_get_type(); +} + + +Glib::RefPtr Pixbuf::create(const Glib::RefPtr& src, const Glib::RefPtr& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) +{ + return Glib::RefPtr( new Pixbuf(src, cmap, src_x, src_y, dest_x, dest_y, width, height) ); +} +Glib::RefPtr Pixbuf::create(const Glib::RefPtr& src, const Glib::RefPtr& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height) +{ + return Glib::RefPtr( new Pixbuf(src, cmap, src_x, src_y, dest_x, dest_y, width, height) ); +} +Glib::RefPtr Pixbuf::copy() const +{ + return Glib::wrap(gdk_pixbuf_copy(const_cast(gobj()))); +} + +Glib::RefPtr Pixbuf::create(Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height) +{ + return Glib::wrap(gdk_pixbuf_new(((GdkColorspace)(colorspace)), static_cast(has_alpha), bits_per_sample, width, height)); +} + +Glib::RefPtr Pixbuf::create_subpixbuf(const Glib::RefPtr& src_pixbuf, int src_x, int src_y, int width, int height) +{ + return Glib::wrap(gdk_pixbuf_new_subpixbuf(Glib::unwrap(src_pixbuf), src_x, src_y, width, height)); +} + +Glib::RefPtr Pixbuf::create_from_xpm_data(const char *const * data) +{ + return Glib::wrap(gdk_pixbuf_new_from_xpm_data(const_cast(data))); +} + +Colorspace Pixbuf::get_colorspace() const +{ + return ((Colorspace)(gdk_pixbuf_get_colorspace(const_cast(gobj())))); +} + +int Pixbuf::get_n_channels() const +{ + return gdk_pixbuf_get_n_channels(const_cast(gobj())); +} + +bool Pixbuf::get_has_alpha() const +{ + return gdk_pixbuf_get_has_alpha(const_cast(gobj())); +} + +int Pixbuf::get_bits_per_sample() const +{ + return gdk_pixbuf_get_bits_per_sample(const_cast(gobj())); +} + +guint8* Pixbuf::get_pixels() const +{ + return gdk_pixbuf_get_pixels(const_cast(gobj())); +} + +int Pixbuf::get_width() const +{ + return gdk_pixbuf_get_width(const_cast(gobj())); +} + +int Pixbuf::get_height() const +{ + return gdk_pixbuf_get_height(const_cast(gobj())); +} + +int Pixbuf::get_rowstride() const +{ + return gdk_pixbuf_get_rowstride(const_cast(gobj())); +} + +void Pixbuf::fill(guint32 pixel) +{ + gdk_pixbuf_fill(gobj(), pixel); +} + +Glib::RefPtr Pixbuf::add_alpha(bool substitute_color, guint8 r, guint8 g, guint8 b) const +{ + return Glib::wrap(gdk_pixbuf_add_alpha(const_cast(gobj()), static_cast(substitute_color), r, g, b)); +} + +void Pixbuf::copy_area(int src_x, int src_y, int width, int height, const Glib::RefPtr& dest_pixbuf, int dest_x, int dest_y) const +{ + gdk_pixbuf_copy_area(const_cast(gobj()), src_x, src_y, width, height, Glib::unwrap(dest_pixbuf), dest_x, dest_y); +} + +void Pixbuf::saturate_and_pixelate(const Glib::RefPtr& dest, float saturation, bool pixelate) const +{ + gdk_pixbuf_saturate_and_pixelate(const_cast(gobj()), Glib::unwrap(dest), saturation, static_cast(pixelate)); +} + +void Pixbuf::scale(const Glib::RefPtr& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type) const +{ + gdk_pixbuf_scale(const_cast(gobj()), Glib::unwrap(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, ((GdkInterpType)(interp_type))); +} + +void Pixbuf::composite(const Glib::RefPtr& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha) const +{ + gdk_pixbuf_composite(const_cast(gobj()), Glib::unwrap(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, ((GdkInterpType)(interp_type)), overall_alpha); +} + +void Pixbuf::composite_color(const Glib::RefPtr& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, guint32 color1, guint32 color2) const +{ + gdk_pixbuf_composite_color(const_cast(gobj()), Glib::unwrap(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, ((GdkInterpType)(interp_type)), overall_alpha, check_x, check_y, check_size, color1, color2); +} + +Glib::RefPtr Pixbuf::scale_simple(int dest_width, int dest_height, InterpType interp_type) const +{ + return Glib::wrap(gdk_pixbuf_scale_simple(const_cast(gobj()), dest_width, dest_height, ((GdkInterpType)(interp_type)))); +} + +Glib::RefPtr Pixbuf::composite_color_simple(int dest_width, int dest_height, InterpType interp_type, int overall_alpha, int check_size, guint32 color1, guint32 color2) const +{ + return Glib::wrap(gdk_pixbuf_composite_color_simple(const_cast(gobj()), dest_width, dest_height, ((GdkInterpType)(interp_type)), overall_alpha, check_size, color1, color2)); +} + +Glib::RefPtr Pixbuf::rotate_simple(PixbufRotation angle) const +{ + return Glib::wrap(gdk_pixbuf_rotate_simple(const_cast(gobj()), ((GdkPixbufRotation)(angle)))); +} + +Glib::RefPtr Pixbuf::flip(bool horizontal) const +{ + return Glib::wrap(gdk_pixbuf_flip(const_cast(gobj()), static_cast(horizontal))); +} + +void Pixbuf::render_threshold_alpha(const Glib::RefPtr& bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold) +{ + gdk_pixbuf_render_threshold_alpha(gobj(), Glib::unwrap(bitmap), src_x, src_y, dest_x, dest_y, width, height, alpha_threshold); +} + +void Pixbuf::render_to_drawable(const Glib::RefPtr& drawable, const Glib::RefPtr& gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither) +{ + gdk_pixbuf_render_to_drawable(gobj(), Glib::unwrap(drawable), Glib::unwrap(gc), src_x, src_y, dest_x, dest_y, width, height, ((GdkRgbDither)(dither)), x_dither, y_dither); +} + +void Pixbuf::render_to_drawable_alpha(const Glib::RefPtr& drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, PixbufAlphaMode alpha_mode, int alpha_threshold, RgbDither dither, int x_dither, int y_dither) +{ + gdk_pixbuf_render_to_drawable_alpha(gobj(), Glib::unwrap(drawable), src_x, src_y, dest_x, dest_y, width, height, ((GdkPixbufAlphaMode)(alpha_mode)), alpha_threshold, ((GdkRgbDither)(dither)), x_dither, y_dither); +} + +Glib::ustring Pixbuf::get_option(const Glib::ustring& key) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gdk_pixbuf_get_option(const_cast(gobj()), key.c_str())); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbuf.h b/libs/gtkmm2/gdk/gdkmm/pixbuf.h new file mode 100644 index 0000000000..712020a8b1 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbuf.h @@ -0,0 +1,884 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUF_H +#define _GDKMM_PIXBUF_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _GdkPixbufClass GdkPixbufClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Pixbuf_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum Colorspace +{ + COLORSPACE_RGB +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum InterpType +{ + INTERP_NEAREST, + INTERP_TILES, + INTERP_BILINEAR, + INTERP_HYPER +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum PixbufAlphaMode +{ + PIXBUF_ALPHA_BILEVEL, + PIXBUF_ALPHA_FULL +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum PixbufRotation +{ + PIXBUF_ROTATE_NONE = 0, + PIXBUF_ROTATE_COUNTERCLOCKWISE = 90, + PIXBUF_ROTATE_UPSIDEDOWN = 180, + PIXBUF_ROTATE_CLOCKWISE = 270 +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** Exception class for Gdk::Pixbuf errors. + */ +class PixbufError : public Glib::Error +{ +public: + enum Code + { + CORRUPT_IMAGE, + INSUFFICIENT_MEMORY, + BAD_OPTION, + UNKNOWN_TYPE, + UNSUPPORTED_OPERATION, + FAILED + }; + + PixbufError(Code error_code, const Glib::ustring& error_message); + explicit PixbufError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + +} // namespace Gdk + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +struct PixbufFormatTraits +{ + typedef PixbufFormat CppType; + typedef const GdkPixbufFormat* CType; + typedef GdkPixbufFormat* CTypeNonConst; + + static CType to_c_type (const CppType& obj) { return obj.gobj(); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) { return PixbufFormat(ptr); /* Does not take ownership */ } + static void release_c_type (CType /* ptr */) { /* Doesn't happen */ } +}; +#endif //DOXYGEN_SHOULD_SKIP_THIS + + +class Pixbuf : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Pixbuf CppObjectType; + typedef Pixbuf_Class CppClassType; + typedef GdkPixbuf BaseObjectType; + typedef GdkPixbufClass BaseClassType; + +private: friend class Pixbuf_Class; + static CppClassType pixbuf_class_; + +private: + // noncopyable + Pixbuf(const Pixbuf&); + Pixbuf& operator=(const Pixbuf&); + +protected: + explicit Pixbuf(const Glib::ConstructParams& construct_params); + explicit Pixbuf(GdkPixbuf* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Pixbuf(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbuf* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbuf* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbuf* gobj_copy(); + +private: + + +protected: + + //TODO: Documente these, based on the docs for the C functions. + Pixbuf(const Glib::RefPtr& src, const Glib::RefPtr& cmap, + int src_x, int src_y, int dest_x, int dest_y, int width, int height); + Pixbuf(const Glib::RefPtr& src, const Glib::RefPtr& cmap, + int src_x, int src_y, int dest_x, int dest_y, int width, int height); + +public: + typedef sigc::slot SlotDestroyData; + + + static Glib::RefPtr create(const Glib::RefPtr& src, const Glib::RefPtr& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); + + + static Glib::RefPtr create(const Glib::RefPtr& src, const Glib::RefPtr& cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); + + + /** Creates a new Gdk::Pixbuf with a copy of the information in the specified + * @a pixbuf . + * @return A newly-created pixbuf with a reference count of 1, or 0 if + * not enough memory could be allocated. + */ + Glib::RefPtr copy() const; + + + /** Creates a new Gdk::Pixbuf structure and allocates a buffer for it. The + * buffer has an optimal rowstride. Note that the buffer is not cleared; + * you will have to fill it completely yourself. + * @param colorspace Color space for image. + * @param has_alpha Whether the image should have transparency information. + * @param bits_per_sample Number of bits per color sample. + * @param width Width of image in pixels. + * @param height Height of image in pixels. + * @return A newly-created Gdk::Pixbuf with a reference count of 1, or + * 0 if not enough memory could be allocated for the image buffer. + */ + static Glib::RefPtr create( + Colorspace colorspace, bool has_alpha, + int bits_per_sample, int width, int height); + + + /** Creates a new pixbuf which represents a sub-region of + * @a src_pixbuf . The new pixbuf shares its pixels with the + * original pixbuf, so writing to one affects both. + * The new pixbuf holds a reference to @a src_pixbuf , so + * @a src_pixbuf will not be finalized until the new pixbuf + * is finalized. + * @param src_pixbuf A Gdk::Pixbuf. + * @param src_x X coord in @a src_pixbuf . + * @param src_y Y coord in @a src_pixbuf . + * @param width Width of region in @a src_pixbuf . + * @param height Height of region in @a src_pixbuf . + * @return A new pixbuf. + */ + static Glib::RefPtr create_subpixbuf( + const Glib::RefPtr& src_pixbuf, + int src_x, int src_y, int width, int height); + + /** Creates a new pixbuf by loading an image from a file. The file format is detected automatically. + * @param filename The path to the pixbuf file. + * + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + static Glib::RefPtr create_from_file(const std::string& filename); + + /** Creates a new pixbuf by loading an image from a file. The file format is detected automatically. + * The image will be scaled to fit in the requested size. + * @param filename The path to the pixbuf file. + * @param width The desired width + * @param height The desired height + * @param preserve_aspect_ratio: Whether the image's aspect ratio will be preserved when scaling. + * + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + static Glib::RefPtr create_from_file(const std::string& filename, int width, int height, bool preserve_aspect_ratio = true); + + + /** Creates a new Gdk::Pixbuf out of in-memory image data. + * Currently only RGB images with 8 bits per sample are supported. + * + * @param data %Image data in 8-bit/sample packed format. + * @param colorspace Colorspace for the image data. + * @param has_alpha Whether the data has an opacity channel. + * @param bits_per_sample Number of bits per sample. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + * @param rowstride Distance in bytes between rows. + * @return A newly-created Gdk::Pixbuf object. + */ + static Glib::RefPtr create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride); + + /** Creates a new Gdk::Pixbuf out of in-memory image data. + * Currently only RGB images with 8 bits per sample are supported. + * + * @param data %Image data in 8-bit/sample packed format. + * @param colorspace Colorspace for the image data. + * @param has_alpha Whether the data has an opacity channel. + * @param bits_per_sample Number of bits per sample. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + * @param rowstride Distance in bytes between rows. + * @param destroy_slot Slot used to free the data when the pixbuf's + * reference count drops to zero. + * @return A newly-created Gdk::Pixbuf object. + */ + static Glib::RefPtr create_from_data(const guint8* data, Colorspace colorspace, + bool has_alpha, int bits_per_sample, + int width, int height, int rowstride, + const SlotDestroyData& destroy_slot); + + + /** Creates a new pixbuf by parsing XPM data in memory. This data is commonly + * the result of including an XPM file into a program's C source. + * @param data Pointer to inline XPM data. + * @return A newly-created pixbuf with a reference count of 1. + */ + static Glib::RefPtr create_from_xpm_data(const char *const * data); + + /** Create a Gdk::Pixbuf from a flat representation that is suitable for + * storing as inline data in a program. This is useful if you want to ship a + * program with images, but don't want to depend on any external files. + * + * GTK+ ships with a program called gdk-pixbuf-csource which allows + * for conversion of GdkPixbufs into such a inline representation. In almost + * all cases, you should pass the --raw flag to + * gdk-pixbuf-csource. A sample invocation would be: + * + * gdk-pixbuf-csource --raw --name=myimage_inline myimage.png + * + * For the typical case where the inline pixbuf is read-only static data, you + * don't need to copy the pixel data unless you intend to write to it, so you + * can pass false for @a copy_pixels. (If you pass --rle to + * gdk-pixbuf-csource, a copy will be made even if @a copy_pixels is + * false, so using this option is generally a bad idea.) + * + * If you create a pixbuf from const inline data compiled into your program, + * it's probably safe to ignore errors, since things will always succeed. For + * non-const inline data, you could get out of memory. For untrusted inline + * data located at runtime, you could have corrupt inline data in addition. + * + * @param data_length Length in bytes of the @a data argument. + * @param data Byte data containing a serialized GdkPixdata structure. + * @param copy_pixels Whether to copy the pixel data, or use direct pointers + * to @a data for the resulting pixbuf. + * @throw Gdk::PixbufError + */ + static Glib::RefPtr create_from_inline(int data_length, const guint8* data, + bool copy_pixels = false); + + + /** Queries the color space of a pixbuf. + * @return Color space. + */ + Colorspace get_colorspace() const; + + + /** Queries the number of channels of a pixbuf. + * @return Number of channels. + */ + int get_n_channels() const; + + /** Queries whether a pixbuf has an alpha channel (opacity information). + * @return true if it has an alpha channel, false otherwise. + */ + bool get_has_alpha() const; + + /** Queries the number of bits per color sample in a pixbuf. + * @return Number of bits per color sample. + */ + int get_bits_per_sample() const; + + /** Queries a pointer to the pixel data of a pixbuf. + * @return A pointer to the pixbuf's pixel data. Please see <xref linkend="image-data"/> + * for information about how the pixel data is stored in + * memory. + */ + guint8* get_pixels() const; + + /** Queries the width of a pixbuf. + * @return Width in pixels. + */ + int get_width() const; + + /** Queries the height of a pixbuf. + * @return Height in pixels. + */ + int get_height() const; + + /** Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row + * and the start of the next row. + * @return Distance between row starts. + */ + int get_rowstride() const; + + + /** Clears a pixbuf to the given RGBA value, converting the RGBA value into + * the pixbuf's pixel format. The alpha will be ignored if the pixbuf + * doesn't have an alpha channel. + * @param pixel RGBA pixel to clear to + * (0xffffffff is opaque white, 0x00000000 transparent black). + */ + void fill(guint32 pixel); + + /** Save an image file. + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + void save(const std::string& filename, const Glib::ustring& type); + + + /** Save an image file. + * @throw Glib::FileError + * @throw Gdk::PixbufError + */ + void save(const std::string& filename, const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values); + + +/* TODO: +typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf, + gsize count, + GError **error, + gpointer data); + +gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf, + GdkPixbufSaveFunc save_func, + gpointer user_data, + const char *type, + GError **error, + ...); + +gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf, + GdkPixbufSaveFunc save_func, + gpointer user_data, + const char *type, + char **option_keys, + char **option_values, + GError **error); + +*/ + + void save_to_buffer(gchar*& buffer, gsize& buffer_size, + const Glib::ustring& type, + const Glib::StringArrayHandle& option_keys, + const Glib::StringArrayHandle& option_values); + + + /** Takes an existing pixbuf and adds an alpha channel to it. + * If the existing pixbuf already had an alpha channel, the channel + * values are copied from the original; otherwise, the alpha channel + * is initialized to 255 (full opacity). + * + * If @a substitute_color is true, then the color specified by ( @a r , @a g , @a b ) will be + * assigned zero opacity. That is, if you pass (255, 255, 255) for the + * substitute color, all white pixels will become fully transparent. + * @param substitute_color Whether to set a color to zero opacity. If this + * is false, then the ( @a r , @a g , @a b ) arguments will be ignored. + * @param r Red value to substitute. + * @param g Green value to substitute. + * @param b Blue value to substitute. + * @return A newly-created pixbuf with a reference count of 1. + */ + Glib::RefPtr add_alpha( + bool substitute_color, guint8 r, guint8 g, guint8 b) const; + + + /** Copies a rectangular area from @a src_pixbuf to @a dest_pixbuf . Conversion of + * pixbuf formats is done automatically. + * @param src_x Source X coordinate within @a src_pixbuf . + * @param src_y Source Y coordinate within @a src_pixbuf . + * @param width Width of the area to copy. + * @param height Height of the area to copy. + * @param dest_pixbuf Destination pixbuf. + * @param dest_x X coordinate within @a dest_pixbuf . + * @param dest_y Y coordinate within @a dest_pixbuf . + */ + void copy_area( + int src_x, int src_y, int width, int height, + const Glib::RefPtr& dest_pixbuf, + int dest_x, int dest_y) const; + + + /** Modifies saturation and optionally pixelates @a src , placing the + * result in @a dest . @a src and @a dest may be the same pixbuf with no ill + * effects. If @a saturation is 1.0 then saturation is not changed. If + * it's less than 1.0, saturation is reduced (the image is darkened); + * if greater than 1.0, saturation is increased (the image is + * brightened). If @a pixelate is true, then pixels are faded in a + * checkerboard pattern to create a pixelated image. @a src and @a dest + * must have the same image format, size, and rowstride. + * @param dest Place to write modified version of @a src . + * @param saturation Saturation factor. + * @param pixelate Whether to pixelate. + */ + void saturate_and_pixelate( + const Glib::RefPtr& dest, + float saturation, bool pixelate) const; + + + /** Creates a transformation of the source image @a src by scaling by + * @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y , + * then renders the rectangle ( @a dest_x , @a dest_y , @a dest_width , + * @a dest_height ) of the resulting image onto the destination image + * replacing the previous contents. + * + * Try to use scale_simple() first, this function is + * the industrial-strength power tool you can fall back to if + * scale_simple() isn't powerful enough. + * @param dest The Gdk::Pixbuf into which to render the results. + * @param dest_x The left coordinate for region to render. + * @param dest_y The top coordinate for region to render. + * @param dest_width The width of the region to render. + * @param dest_height The height of the region to render. + * @param offset_x The offset in the X direction (currently rounded to an integer). + * @param offset_y The offset in the Y direction (currently rounded to an integer). + * @param scale_x The scale factor in the X direction. + * @param scale_y The scale factor in the Y direction. + * @param interp_type The interpolation type for the transformation. + */ + void scale(const Glib::RefPtr& dest, + int dest_x, int dest_y, + int dest_width, int dest_height, + double offset_x, double offset_y, + double scale_x, double scale_y, + InterpType interp_type) const; + + + /** Creates a transformation of the source image @a src by scaling by + * @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y . + * This gives an image in the coordinates of the destination pixbuf. + * The rectangle ( @a dest_x , @a dest_y , @a dest_width , @a dest_height ) + * is then composited onto the corresponding rectangle of the + * original destination image. + * + * When the destination rectangle contains parts not in the source + * image, the data at the edges of the source image is replicated + * to infinity. + * + * <figure id="pixbuf-composite-diagram"> + * <title>Compositing of pixbufs</title> + * <graphic fileref="composite.png" format="PNG"/> + * </figure> + * @param dest The Gdk::Pixbuf into which to render the results. + * @param dest_x The left coordinate for region to render. + * @param dest_y The top coordinate for region to render. + * @param dest_width The width of the region to render. + * @param dest_height The height of the region to render. + * @param offset_x The offset in the X direction (currently rounded to an integer). + * @param offset_y The offset in the Y direction (currently rounded to an integer). + * @param scale_x The scale factor in the X direction. + * @param scale_y The scale factor in the Y direction. + * @param interp_type The interpolation type for the transformation. + * @param overall_alpha Overall alpha for source image (0..255). + */ + void composite(const Glib::RefPtr& dest, + int dest_x, int dest_y, + int dest_width, int dest_height, + double offset_x, double offset_y, + double scale_x, double scale_y, + InterpType interp_type, + int overall_alpha) const; + + + /** Creates a transformation of the source image @a src by scaling by + * @a scale_x and @a scale_y then translating by @a offset_x and @a offset_y , + * then composites the rectangle ( @a dest_x , @a dest_y , @a dest_width , + * @a dest_height ) of the resulting image with a checkboard of the + * colors @a color1 and @a color2 and renders it onto the destination + * image. + * + * See composite_color_simple() for a simpler variant of this + * function suitable for many tasks. + * @param dest The Gdk::Pixbuf into which to render the results. + * @param dest_x The left coordinate for region to render. + * @param dest_y The top coordinate for region to render. + * @param dest_width The width of the region to render. + * @param dest_height The height of the region to render. + * @param offset_x The offset in the X direction (currently rounded to an integer). + * @param offset_y The offset in the Y direction (currently rounded to an integer). + * @param scale_x The scale factor in the X direction. + * @param scale_y The scale factor in the Y direction. + * @param interp_type The interpolation type for the transformation. + * @param overall_alpha Overall alpha for source image (0..255). + * @param check_x The X offset for the checkboard (origin of checkboard is at - @a check_x , - @a check_y ). + * @param check_y The Y offset for the checkboard. + * @param check_size The size of checks in the checkboard (must be a power of two). + * @param color1 The color of check at upper left. + * @param color2 The color of the other check. + */ + void composite_color(const Glib::RefPtr& dest, + int dest_x, int dest_y, + int dest_width, int dest_height, + double offset_x, double offset_y, + double scale_x, double scale_y, + InterpType interp_type, + int overall_alpha, + int check_x, int check_y, + int check_size, + guint32 color1, guint32 color2) const; + + + /** Create a new Gdk::Pixbuf containing a copy of @a src scaled to + * @a dest_width x @a dest_height . Leaves @a src unaffected. @a interp_type + * should be Gdk::INTERP_NEAREST if you want maximum speed (but when + * scaling down Gdk::INTERP_NEAREST is usually unusably ugly). The + * default @a interp_type should be Gdk::INTERP_BILINEAR which offers + * reasonable quality and speed. + * + * You can scale a sub-portion of @a src by creating a sub-pixbuf + * pointing into @a src ; see new_subpixbuf(). + * + * For more complicated scaling/compositing see scale() + * and composite(). + * @param dest_width The width of destination image. + * @param dest_height The height of destination image. + * @param interp_type The interpolation type for the transformation. + * @return The new Gdk::Pixbuf, or 0 if not enough memory could be + * allocated for it. + */ + Glib::RefPtr scale_simple( + int dest_width, int dest_height, + InterpType interp_type) const; + + + /** Creates a new Gdk::Pixbuf by scaling @a src to @a dest_width x + * @a dest_height and compositing the result with a checkboard of colors + * @a color1 and @a color2 . + * @param dest_width The width of destination image. + * @param dest_height The height of destination image. + * @param interp_type The interpolation type for the transformation. + * @param overall_alpha Overall alpha for source image (0..255). + * @param check_size The size of checks in the checkboard (must be a power of two). + * @param color1 The color of check at upper left. + * @param color2 The color of the other check. + * @return The new Gdk::Pixbuf, or 0 if not enough memory could be + * allocated for it. + */ + Glib::RefPtr composite_color_simple( + int dest_width, int dest_height, + InterpType interp_type, + int overall_alpha, int check_size, + guint32 color1, guint32 color2) const; + + + /** Rotates a pixbuf by a multiple of 90 degrees, and returns the + * result in a new pixbuf. + * @param angle The angle to rotate by. + * @return A new pixbuf + * + * Since: 2.6. + */ + Glib::RefPtr rotate_simple(PixbufRotation angle) const; + + /** Flips a pixbuf horizontally or vertically and returns the + * result in a new pixbuf. + * @param horizontal true to flip horizontally, false to flip vertically. + * @return A new pixbuf. + * + * Since: 2.6. + */ + Glib::RefPtr flip(bool horizontal = true) const; + + + /** Takes the opacity values in a rectangular portion of a pixbuf and thresholds + * them to produce a bi-level alpha mask that can be used as a clipping mask for + * a drawable. + * @param bitmap Bitmap where the bilevel mask will be painted to. + * @param src_x Source X coordinate. + * @param src_y Source Y coordinate. + * @param dest_x Destination X coordinate. + * @param dest_y Destination Y coordinate. + * @param width Width of region to threshold, or -1 to use pixbuf width. + * @param height Height of region to threshold, or -1 to use pixbuf height. + * @param alpha_threshold Opacity values below this will be painted as zero; all + * other values will be painted as one. + */ + void render_threshold_alpha(const Glib::RefPtr& bitmap, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + int alpha_threshold); + + + /** Renders a rectangular portion of a pixbuf to a drawable while using the + * specified GC. This is done using GdkRGB, so the specified drawable must have + * the GdkRGB visual and colormap. Note that this function will ignore the + * opacity information for images with an alpha channel; the GC must already + * have the clipping mask set if you want transparent regions to show through. + * + * For an explanation of dither offsets, see the GdkRGB documentation. In + * brief, the dither offset is important when re-rendering partial regions of an + * image to a rendered version of the full image, or for when the offsets to a + * base position change, as in scrolling. The dither matrix has to be shifted + * for consistent visual results. If you do not have any of these cases, the + * dither offsets can be both zero. + * + * Deprecated: This function is obsolete. Use gdk_draw_pixbuf() instead. + * @param drawable Destination drawable. + * @param gc GC used for rendering. + * @param src_x Source X coordinate within pixbuf. + * @param src_y Source Y coordinate within pixbuf. + * @param dest_x Destination X coordinate within drawable. + * @param dest_y Destination Y coordinate within drawable. + * @param width Width of region to render, in pixels, or -1 to use pixbuf width. + * @param height Height of region to render, in pixels, or -1 to use pixbuf height. + * @param dither Dithering mode for GdkRGB. + * @param x_dither X offset for dither. + * @param y_dither Y offset for dither. + */ + void render_to_drawable(const Glib::RefPtr& drawable, + const Glib::RefPtr& gc, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + RgbDither dither, + int x_dither, int y_dither); + + /** Renders a rectangular portion of a pixbuf to a drawable. The destination + * drawable must have a colormap. All windows have a colormap, however, pixmaps + * only have colormap by default if they were created with a non-0 window argument. + * Otherwise a colormap must be set on them with gdk_drawable_set_colormap. + * + * On older X servers, rendering pixbufs with an alpha channel involves round trips + * to the X server, and may be somewhat slow. + * + * Deprecated: This function is obsolete. Use gdk_draw_pixbuf() instead. + * @param drawable Destination drawable. + * @param src_x Source X coordinate within pixbuf. + * @param src_y Source Y coordinates within pixbuf. + * @param dest_x Destination X coordinate within drawable. + * @param dest_y Destination Y coordinate within drawable. + * @param width Width of region to render, in pixels, or -1 to use pixbuf width. + * @param height Height of region to render, in pixels, or -1 to use pixbuf height. + * @param alpha_mode Ignored. Present for backwards compatibility. + * @param alpha_threshold Ignored. Present for backwards compatibility. + * @param dither Dithering mode for GdkRGB. + * @param x_dither X offset for dither. + * @param y_dither Y offset for dither. + */ + void render_to_drawable_alpha(const Glib::RefPtr& drawable, + int src_x, int src_y, + int dest_x, int dest_y, + int width, int height, + PixbufAlphaMode alpha_mode, + int alpha_threshold, + RgbDither dither, + int x_dither, int y_dither); + + void render_pixmap_and_mask_for_colormap(const Glib::RefPtr& colormap, + Glib::RefPtr& pixmap_return, + Glib::RefPtr& mask_return, + int alpha_threshold); + + void render_pixmap_and_mask(Glib::RefPtr& pixmap_return, + Glib::RefPtr& mask_return, int alpha_threshold); + + + /** Looks up @a key in the list of options that may have been attached to the + * @a pixbuf when it was loaded. + * @param key A nul-terminated string. + * @return The value associated with @a key . This is a nul-terminated + * string that should not be freed or 0 if @a key was not found. + */ + Glib::ustring get_option(const Glib::ustring& key) const; + + + typedef Glib::SListHandle< Glib::RefPtr, PixbufFormatTraits > SListHandle_PixbufFormat; + static SListHandle_PixbufFormat get_formats(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Pixbuf + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkPixbuf* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUF_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc new file mode 100644 index 0000000000..a558a55044 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.cc @@ -0,0 +1,172 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + +Glib::RefPtr PixbufAnimation::create_from_file(const Glib::ustring& filename) +{ + GError* pError = 0; + return Glib::wrap(gdk_pixbuf_animation_new_from_file(filename.c_str(), &pError)); +} + +} //Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkPixbufAnimation* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& PixbufAnimation_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &PixbufAnimation_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_animation_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void PixbufAnimation_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* PixbufAnimation_Class::wrap_new(GObject* object) +{ + return new PixbufAnimation((GdkPixbufAnimation*)object); +} + + +/* The implementation: */ + +GdkPixbufAnimation* PixbufAnimation::gobj_copy() +{ + reference(); + return gobj(); +} + +PixbufAnimation::PixbufAnimation(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +PixbufAnimation::PixbufAnimation(GdkPixbufAnimation* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +PixbufAnimation::~PixbufAnimation() +{} + + +PixbufAnimation::CppClassType PixbufAnimation::pixbufanimation_class_; // initialize static member + +GType PixbufAnimation::get_type() +{ + return pixbufanimation_class_.init().get_type(); +} + +GType PixbufAnimation::get_base_type() +{ + return gdk_pixbuf_animation_get_type(); +} + + +int PixbufAnimation::get_width() const +{ + return gdk_pixbuf_animation_get_width(const_cast(gobj())); +} + +int PixbufAnimation::get_height() const +{ + return gdk_pixbuf_animation_get_height(const_cast(gobj())); +} + +bool PixbufAnimation::is_static_image() const +{ + return gdk_pixbuf_animation_is_static_image(const_cast(gobj())); +} + +Glib::RefPtr PixbufAnimation::get_static_image() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_pixbuf_animation_get_static_image(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr PixbufAnimation::get_iter(const GTimeVal* start_time) +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_pixbuf_animation_get_iter(gobj(), start_time)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimation.h b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.h new file mode 100644 index 0000000000..dd5afec672 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimation.h @@ -0,0 +1,194 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATION_H +#define _GDKMM_PIXBUFANIMATION_H + +#include + +/* $Id$ */ + +/* box.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbufAnimation GdkPixbufAnimation; +typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class PixbufAnimation_Class; } // namespace Gdk +namespace Gdk +{ + + +class PixbufAnimation : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef PixbufAnimation CppObjectType; + typedef PixbufAnimation_Class CppClassType; + typedef GdkPixbufAnimation BaseObjectType; + typedef GdkPixbufAnimationClass BaseClassType; + +private: friend class PixbufAnimation_Class; + static CppClassType pixbufanimation_class_; + +private: + // noncopyable + PixbufAnimation(const PixbufAnimation&); + PixbufAnimation& operator=(const PixbufAnimation&); + +protected: + explicit PixbufAnimation(const Glib::ConstructParams& construct_params); + explicit PixbufAnimation(GdkPixbufAnimation* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~PixbufAnimation(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbufAnimation* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbufAnimation* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbufAnimation* gobj_copy(); + +private: + + +protected: + +public: + + static Glib::RefPtr create_from_file(const Glib::ustring& filename); + + + /** Queries the width of the bounding box of a pixbuf animation. + * @return Width of the bounding box of the animation. + */ + int get_width() const; + + /** Queries the height of the bounding box of a pixbuf animation. + * @return Height of the bounding box of the animation. + */ + int get_height() const; + + /** If you load a file with new_from_file() and it turns + * out to be a plain, unanimated image, then this function will return + * true. Use get_static_image() to retrieve + * the image. + * @return true if the "animation" was really just an image. + */ + bool is_static_image() const; + + /** If an animation is really just a plain image (has only one frame), + * this function returns that image. If the animation is an animation, + * this function returns a reasonable thing to display as a static + * unanimated image, which might be the first frame, or something more + * sophisticated. If an animation hasn't loaded any frames yet, this + * function will return 0. + * @return Unanimated image representing the animation. + */ + Glib::RefPtr get_static_image(); + + /** Get an iterator for displaying an animation. The iterator provides + * the frames that should be displayed at a given time. + * It should be freed after use with Glib::object_unref(). + * + * @a start_time would normally come from Glib::get_current_time(), and + * marks the beginning of animation playback. After creating an + * iterator, you should immediately display the pixbuf returned by + * Gdk::PixbufAnimationIter::get_pixbuf(). Then, you should install a + * timeout (with Glib::timeout_add()) or by some other mechanism ensure + * that you'll update the image after + * Gdk::PixbufAnimationIter::get_delay_time() milliseconds. Each time + * the image is updated, you should reinstall the timeout with the new, + * possibly-changed delay time. + * + * As a shortcut, if @a start_time is 0, the result of + * Glib::get_current_time() will be used automatically. + * + * To update the image (i.e. possibly change the result of + * Gdk::PixbufAnimationIter::get_pixbuf() to a new frame of the animation), + * call Gdk::PixbufAnimationIter::advance(). + * + * If you're using Gdk::PixbufLoader, in addition to updating the image + * after the delay time, you should also update it whenever you + * receive the area_updated signal and + * Gdk::PixbufAnimationIter::on_currently_loading_frame() returns + * true. In this case, the frame currently being fed into the loader + * has received new data, so needs to be refreshed. The delay time for + * a frame may also be modified after an area_updated signal, for + * example if the delay time for a frame is encoded in the data after + * the frame itself. So your timeout should be reinstalled after any + * area_updated signal. + * + * A delay time of -1 is possible, indicating "infinite." + * @param start_time Time when the animation starts playing. + * @return An iterator to move over the animation. + */ + Glib::RefPtr get_iter(const GTimeVal* start_time); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::PixbufAnimation + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkPixbufAnimation* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUFANIMATION_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc new file mode 100644 index 0000000000..60046e4eff --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.cc @@ -0,0 +1,123 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkPixbufAnimationIter* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& PixbufAnimationIter_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &PixbufAnimationIter_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_animation_iter_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void PixbufAnimationIter_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* PixbufAnimationIter_Class::wrap_new(GObject* object) +{ + return new PixbufAnimationIter((GdkPixbufAnimationIter*)object); +} + + +/* The implementation: */ + +GdkPixbufAnimationIter* PixbufAnimationIter::gobj_copy() +{ + reference(); + return gobj(); +} + +PixbufAnimationIter::PixbufAnimationIter(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +PixbufAnimationIter::PixbufAnimationIter(GdkPixbufAnimationIter* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +PixbufAnimationIter::~PixbufAnimationIter() +{} + + +PixbufAnimationIter::CppClassType PixbufAnimationIter::pixbufanimationiter_class_; // initialize static member + +GType PixbufAnimationIter::get_type() +{ + return pixbufanimationiter_class_.init().get_type(); +} + +GType PixbufAnimationIter::get_base_type() +{ + return gdk_pixbuf_animation_iter_get_type(); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h new file mode 100644 index 0000000000..ceba0da1e9 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufanimationiter.h @@ -0,0 +1,120 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATIONITER_H +#define _GDKMM_PIXBUFANIMATIONITER_H + +#include + +/* $Id$ */ + +/* pixbufanimationiter.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter; +typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class PixbufAnimationIter_Class; } // namespace Gdk +namespace Gdk +{ + + +class PixbufAnimationIter : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef PixbufAnimationIter CppObjectType; + typedef PixbufAnimationIter_Class CppClassType; + typedef GdkPixbufAnimationIter BaseObjectType; + typedef GdkPixbufAnimationIterClass BaseClassType; + +private: friend class PixbufAnimationIter_Class; + static CppClassType pixbufanimationiter_class_; + +private: + // noncopyable + PixbufAnimationIter(const PixbufAnimationIter&); + PixbufAnimationIter& operator=(const PixbufAnimationIter&); + +protected: + explicit PixbufAnimationIter(const Glib::ConstructParams& construct_params); + explicit PixbufAnimationIter(GdkPixbufAnimationIter* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~PixbufAnimationIter(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbufAnimationIter* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbufAnimationIter* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbufAnimationIter* gobj_copy(); + +private: + +protected: + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::PixbufAnimationIter + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkPixbufAnimationIter* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUFANIMATIONITER_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufformat.cc b/libs/gtkmm2/gdk/gdkmm/pixbufformat.cc new file mode 100644 index 0000000000..63dc4c43a4 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufformat.cc @@ -0,0 +1,118 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gdk +{ + +PixbufFormat::PixbufFormat() +: gobject_ (0) +{} + +PixbufFormat::PixbufFormat(const GdkPixbufFormat* gobject) +: gobject_ (gobject) +{} + +PixbufFormat::~PixbufFormat() +{ + //We don't free anything because we did not take ownership of the underlying C instance + //(because we can't.) +} + +PixbufFormat::PixbufFormat(const PixbufFormat& src) +: gobject_(src.gobject_) +{ +} + +PixbufFormat& PixbufFormat::operator=(const PixbufFormat& src) +{ + gobject_ = src.gobject_; + return *this; +} + + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Gdk +{ + + +Glib::ustring PixbufFormat::get_name() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_pixbuf_format_get_name(const_cast(gobj()))); +} + +Glib::ustring PixbufFormat::get_description() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_pixbuf_format_get_description(const_cast(gobj()))); +} + +Glib::StringArrayHandle PixbufFormat::get_mime_types() const +{ + return Glib::StringArrayHandle(gdk_pixbuf_format_get_mime_types(const_cast(gobj()))); +} + +Glib::StringArrayHandle PixbufFormat::get_extensions() const +{ + return Glib::StringArrayHandle(gdk_pixbuf_format_get_extensions(const_cast(gobj()))); +} + +bool PixbufFormat::is_writable() const +{ + return gdk_pixbuf_format_is_writable(const_cast(gobj())); +} + +bool PixbufFormat::is_scalable() const +{ + return gdk_pixbuf_format_is_scalable(const_cast(gobj())); +} + +bool PixbufFormat::is_disabled() const +{ + return gdk_pixbuf_format_is_disabled(const_cast(gobj())); +} + +void PixbufFormat::set_disabled(bool disabled) +{ + gdk_pixbuf_format_set_disabled(gobj(), static_cast(disabled)); +} + +Glib::ustring PixbufFormat::get_license() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_pixbuf_format_get_license(const_cast(gobj()))); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufformat.h b/libs/gtkmm2/gdk/gdkmm/pixbufformat.h new file mode 100644 index 0000000000..b9adddf08d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufformat.h @@ -0,0 +1,150 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFFORMAT_H +#define _GDKMM_PIXBUFFORMAT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkPixbufFormat GdkPixbufFormat; } +#endif + +namespace Gdk +{ + +class PixbufFormat +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufFormat CppObjectType; + typedef GdkPixbufFormat BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + PixbufFormat(); + explicit PixbufFormat(const GdkPixbufFormat* gobject); + virtual ~PixbufFormat(); + + PixbufFormat(const PixbufFormat& src); + PixbufFormat& operator=(const PixbufFormat& src); + + + /** Returns the name of the format. + * @return The name of the format. + * + * Since: 2.2. + */ + Glib::ustring get_name() const; + + /** Returns a description of the format. + * @return A description of the format. + * + * Since: 2.2. + */ + Glib::ustring get_description() const; + + /** Returns the mime types supported by the format. + * @return A 0-terminated array of mime types which must be freed with + * Glib::strfreev() when it is no longer needed. + * + * Since: 2.2. + */ + Glib::StringArrayHandle get_mime_types() const; + + /** Returns the filename extensions typically used for files in the + * given format. + * @return A 0-terminated array of filename extensions which must be + * freed with Glib::strfreev() when it is no longer needed. + * + * Since: 2.2. + */ + Glib::StringArrayHandle get_extensions() const; + + /** Returns whether pixbufs can be saved in the given format. + * @return Whether pixbufs can be saved in the given format. + * + * Since: 2.2. + */ + bool is_writable() const; + + + /** Returns whether this image format is scalable. If a file is in a + * scalable format, it is preferable to load it at the desired size, + * rather than loading it at the default size and scaling the + * resulting pixbuf to the desired size. + * @return Whether this image format is scalable. + * + * Since: 2.6. + */ + bool is_scalable() const; + + /** Returns whether this image format is disabled. See + * gdk_pixbuf_format_set_disabled(). + * @return Whether this image format is disabled. + * + * Since: 2.6. + */ + bool is_disabled() const; + + /** Disables or enables an image format. If a format is disabled, + * gdk-pixbuf won't use the image loader for this format to load + * images. Applications can use this to avoid using image loaders + * with an inappropriate license, see gdk_pixbuf_format_get_license(). + * + * Since: 2.6 + * @param disabled true to disable the format @a format . + */ + void set_disabled(bool disabled = true); + + /** Returns information about the license of the image loader + * for the format. The returned string should be a shorthand for + * a wellknown license, e.g. "LGPL", "GPL", "QPL", "GPL/QPL", + * or "other" to indicate some other license. + * @return A string describing the license of @a format . + * + * Since: 2.6. + */ + Glib::ustring get_license() const; + + /// Provides access to the underlying C GObject. + GdkPixbufFormat* gobj() { return const_cast(gobject_); } + /// Provides access to the underlying C GObject. + const GdkPixbufFormat* gobj() const { return gobject_; } + +protected: + const GdkPixbufFormat* gobject_; + + +}; + +} // namespace Gdk + + +#endif /* _GDKMM_PIXBUFFORMAT_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufloader.cc b/libs/gtkmm2/gdk/gdkmm/pixbufloader.cc new file mode 100644 index 0000000000..41af07e520 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufloader.cc @@ -0,0 +1,465 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ + +/* We use this helper function in the constructor to be able to throw + * before the base class' (Glib::Object) constructor is called. + */ +GdkPixbufLoader* pixbuf_loader_create_with_type(const Glib::ustring& image_type, bool mime_type) +{ + GError* error = 0; + GdkPixbufLoader *const loader = 0; + + if(mime_type) + gdk_pixbuf_loader_new_with_mime_type(image_type.c_str(), &error); + else + gdk_pixbuf_loader_new_with_type(image_type.c_str(), &error); + + if(error) + Glib::Error::throw_exception(error); + + return loader; +} + +} // anonymous namespace + + +namespace Gdk +{ + +PixbufLoader::PixbufLoader(const Glib::ustring& image_type, bool mime_type) +: + Glib::ObjectBase(0), + Glib::Object((GObject*) pixbuf_loader_create_with_type(image_type, mime_type)) +{} + +void PixbufLoader::write(const guint8* buf, gsize count) +{ + GError* error = 0; + gdk_pixbuf_loader_write(gobj(), buf, count, &error); + + if(error) + Glib::Error::throw_exception(error); +} + +void PixbufLoader::close() +{ + GError* error = 0; + gdk_pixbuf_loader_close(gobj(), &error); + + if(error) + Glib::Error::throw_exception(error); +} + +} // namespace Gdk + + +namespace +{ + +const Glib::SignalProxyInfo PixbufLoader_signal_area_prepared_info = +{ + "area_prepared", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void PixbufLoader_signal_area_updated_callback(GdkPixbufLoader* self, gint p0,gint p1,gint p2,gint p3,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,int,int,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +, p2 +, p3 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo PixbufLoader_signal_area_updated_info = +{ + "area_updated", + (GCallback) &PixbufLoader_signal_area_updated_callback, + (GCallback) &PixbufLoader_signal_area_updated_callback +}; + + +const Glib::SignalProxyInfo PixbufLoader_signal_closed_info = +{ + "closed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void PixbufLoader_signal_size_prepared_callback(GdkPixbufLoader* self, gint p0,gint p1,void* data) +{ + using namespace Gdk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo PixbufLoader_signal_size_prepared_info = +{ + "size_prepared", + (GCallback) &PixbufLoader_signal_size_prepared_callback, + (GCallback) &PixbufLoader_signal_size_prepared_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkPixbufLoader* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& PixbufLoader_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &PixbufLoader_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixbuf_loader_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void PixbufLoader_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->area_prepared = &area_prepared_callback; + klass->area_updated = &area_updated_callback; + klass->closed = &closed_callback; +} + + +void PixbufLoader_Class::area_prepared_callback(GdkPixbufLoader* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_area_prepared(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->area_prepared) + (*base->area_prepared)(self); + } +} + +void PixbufLoader_Class::area_updated_callback(GdkPixbufLoader* self, gint p0, gint p1, gint p2, gint p3) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_area_updated(p0 +, p1 +, p2 +, p3 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->area_updated) + (*base->area_updated)(self, p0, p1, p2, p3); + } +} + +void PixbufLoader_Class::closed_callback(GdkPixbufLoader* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_closed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->closed) + (*base->closed)(self); + } +} + + +Glib::ObjectBase* PixbufLoader_Class::wrap_new(GObject* object) +{ + return new PixbufLoader((GdkPixbufLoader*)object); +} + + +/* The implementation: */ + +GdkPixbufLoader* PixbufLoader::gobj_copy() +{ + reference(); + return gobj(); +} + +PixbufLoader::PixbufLoader(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +PixbufLoader::PixbufLoader(GdkPixbufLoader* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +PixbufLoader::~PixbufLoader() +{} + + +PixbufLoader::CppClassType PixbufLoader::pixbufloader_class_; // initialize static member + +GType PixbufLoader::get_type() +{ + return pixbufloader_class_.init().get_type(); +} + +GType PixbufLoader::get_base_type() +{ + return gdk_pixbuf_loader_get_type(); +} + + +PixbufLoader::PixbufLoader() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(pixbufloader_class_.init())) +{ + } + +Glib::RefPtr PixbufLoader::create() +{ + return Glib::RefPtr( new PixbufLoader() ); +} +Glib::RefPtr PixbufLoader::create(const Glib::ustring& image_type, bool mime_type) +{ + return Glib::RefPtr( new PixbufLoader(image_type, mime_type) ); +} +void PixbufLoader::set_size(int width, int height) +{ + gdk_pixbuf_loader_set_size(gobj(), width, height); +} + +Glib::RefPtr PixbufLoader::get_pixbuf() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_pixbuf_loader_get_pixbuf(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr PixbufLoader::get_animation() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_pixbuf_loader_get_animation(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +PixbufFormat PixbufLoader::get_format() const +{ + return PixbufFormat(gdk_pixbuf_loader_get_format(const_cast(gobj()))); +} + + +Glib::SignalProxy0< void > PixbufLoader::signal_area_prepared() +{ + return Glib::SignalProxy0< void >(this, &PixbufLoader_signal_area_prepared_info); +} + +Glib::SignalProxy4< void,int,int,int,int > PixbufLoader::signal_area_updated() +{ + return Glib::SignalProxy4< void,int,int,int,int >(this, &PixbufLoader_signal_area_updated_info); +} + +Glib::SignalProxy0< void > PixbufLoader::signal_closed() +{ + return Glib::SignalProxy0< void >(this, &PixbufLoader_signal_closed_info); +} + +Glib::SignalProxy2< void,int,int > PixbufLoader::signal_size_prepared() +{ + return Glib::SignalProxy2< void,int,int >(this, &PixbufLoader_signal_size_prepared_info); +} + + +void Gdk::PixbufLoader::on_area_prepared() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->area_prepared) + (*base->area_prepared)(gobj()); +} + +void Gdk::PixbufLoader::on_area_updated(int x, int y, int width, int height) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->area_updated) + (*base->area_updated)(gobj(),x,y,width,height); +} + +void Gdk::PixbufLoader::on_closed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->closed) + (*base->closed)(gobj()); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixbufloader.h b/libs/gtkmm2/gdk/gdkmm/pixbufloader.h new file mode 100644 index 0000000000..c89288740f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixbufloader.h @@ -0,0 +1,269 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFLOADER_H +#define _GDKMM_PIXBUFLOADER_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkPixbufLoader GdkPixbufLoader; +typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class PixbufLoader_Class; } // namespace Gdk +namespace Gdk +{ + + +class PixbufLoader : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef PixbufLoader CppObjectType; + typedef PixbufLoader_Class CppClassType; + typedef GdkPixbufLoader BaseObjectType; + typedef GdkPixbufLoaderClass BaseClassType; + +private: friend class PixbufLoader_Class; + static CppClassType pixbufloader_class_; + +private: + // noncopyable + PixbufLoader(const PixbufLoader&); + PixbufLoader& operator=(const PixbufLoader&); + +protected: + explicit PixbufLoader(const Glib::ConstructParams& construct_params); + explicit PixbufLoader(GdkPixbufLoader* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~PixbufLoader(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixbufLoader* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixbufLoader* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixbufLoader* gobj_copy(); + +private: + +protected: + + /** Constructs a pixbuf loader object. + */ + PixbufLoader(); + + /** Constructs a pixbuf loader object for a specific image type. + * Constructs a new pixbuf loader object that always attempts to parse image + * data as if it were an image of type @a image_type, instead of identifying + * the type automatically. Useful if you want an error if the image isn't the + * expected type, for loading image formats that can't be reliably identified + * by looking at the data, or if the user manually forces a specific type. + * + * The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type. + * + * Common MIME Types are listed here + * http://www.iana.org/assignments/media-types/ + * and here: + * http://www.freedesktop.org/Software/shared-mime-info + * + * @param image_type Name of the image format to be loaded with the image. + * @param mime_type If this is true then the image_type is a MIME type. + * @throw Gdk::PixbufError + */ + explicit PixbufLoader(const Glib::ustring& image_type, bool mime_type = false); + //TODO: What non-mime-types names are possible? + +public: + + /** Creates a new pixbuf loader object. + * @return A newly-created pixbuf loader. + */ + + static Glib::RefPtr create(); + + + /** Constructs a pixbuf loader object for a specific image type. + * Constructs a new pixbuf loader object that always attempts to parse image + * data as if it were an image of type @a image_type, instead of identifying + * the type automatically. Useful if you want an error if the image isn't the + * expected type, for loading image formats that can't be reliably identified + * by looking at the data, or if the user manually forces a specific type. + * + * The image_type can be one of the types returned by Gdk::Pixbuf::get_formats(), or a MIME type. + * + * Common MIME Types are listed here + * http://www.iana.org/assignments/media-types/ + * and here: + * http://www.freedesktop.org/Software/shared-mime-info + * + * @param image_type Name of the image format to be loaded with the image. + * @param mime_type If this is true then the image_type is a MIME type. + * @throw Gdk::PixbufError + */ + + static Glib::RefPtr create(const Glib::ustring& image_type, bool mime_type = false); + + + /** Causes the image to be scaled while it is loaded. The desired + * image size can be determined relative to the original size of + * the image by calling set_size() from a + * signal handler for the ::size_prepared signal. + * + * Attempts to set the desired image size are ignored after the + * emission of the ::size_prepared signal. + * + * Since: 2.2 + * @param width The desired width of the image being loaded. + * @param height The desired height of the image being loaded. + */ + void set_size(int width, int height); + + /** Causes the pixbuf loader to parse the next @a count bytes of an image. + * It will return if the data was loaded successfully, and throw an exception + * if an error occurred. In the latter case, the loader will be closed, and + * will not accept further writes. + * @param buf Pointer to image data. + * @param count Length of the @a buf buffer in bytes. + * @throw Gdk::PixbufError + * @throw Glib::FileError + */ + void write(const guint8* buf, gsize count); + + + /** Informs a pixbuf loader that no further writes with PixbufLoader::write() + * will occur, so that it can free its internal loading structures. Also, + * tries to parse any data that hasn't yet been parsed; if the remaining data + * is partial or corrupt, an exception will be thrown. If you're just + * cancelling a load rather than expecting it to be finished, writing an + * empty catch() block to ignore errors is reasonable. + * @throw Gdk::PixbufError + * @throw Glib::FileError + */ + void close(); + + + /** Queries the Gdk::Pixbuf that a pixbuf loader is currently creating. + * In general it only makes sense to call this function after the + * "area_prepared" signal has been emitted by the loader; this means + * that enough data has been read to know the size of the image that + * will be allocated. If the loader has not received enough data via + * write(), then this function returns 0. The + * returned pixbuf will be the same in all future calls to the loader, + * so simply calling Glib::object_ref() should be sufficient to continue + * using it. Additionally, if the loader is an animation, it will + * return the "static image" of the animation + * (see Gdk::PixbufAnimation::get_static_image()). + * @return The Gdk::Pixbuf that the loader is creating, or 0 if not + * enough data has been read to determine how to create the image buffer. + */ + Glib::RefPtr get_pixbuf(); + + /** Queries the Gdk::PixbufAnimation that a pixbuf loader is currently creating. + * In general it only makes sense to call this function after the "area_prepared" + * signal has been emitted by the loader. If the loader doesn't have enough + * bytes yet (hasn't emitted the "area_prepared" signal) this function will + * return 0. + * @return The Gdk::PixbufAnimation that the loader is loading, or 0 if + * not enough data has been read to determine the information. + */ + Glib::RefPtr get_animation(); + + + /** Obtains the available information about the format of the + * currently loading image file. + * @return A Gdk::PixbufFormat or 0. The return value is owned + * by GdkPixbuf and should not be freed. + * + * Since: 2.2. + */ + PixbufFormat get_format() const; + + + Glib::SignalProxy0< void > signal_area_prepared(); + + + Glib::SignalProxy4< void,int,int,int,int > signal_area_updated(); + + + Glib::SignalProxy0< void > signal_closed(); + + + //We use no_default_handler for this, because we can not add a new vfunc to 2.5 without breaking ABI. + //TODO: Remove no_default_handler when we do an ABI-break-with-parallel-install. + + + Glib::SignalProxy2< void,int,int > signal_size_prepared(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_area_prepared(); + virtual void on_area_updated(int x, int y, int width, int height); + virtual void on_closed(); + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::PixbufLoader + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkPixbufLoader* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXBUFLOADER_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/pixmap.cc b/libs/gtkmm2/gdk/gdkmm/pixmap.cc new file mode 100644 index 0000000000..a64cfb6aed --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixmap.cc @@ -0,0 +1,320 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +namespace Gdk +{ + +Glib::ObjectBase* Pixmap_Class::wrap_new(GObject* object) +{ + GdkPixmapObject *const pixmap_object = GDK_PIXMAP_OBJECT(object); + + g_return_val_if_fail(pixmap_object != 0, 0); + + // GdkPixmap and GdkBitmap are actually both of type GdkPixmapObject. + // A Bitmap is is a Pixmap with a depth of 1. Since these are distinct + // types in gtkmm, we dynamically create either a Pixmap or a Bitmap, + // depending on the depth field. + + if(pixmap_object->depth != 1) + return new Gdk::Pixmap((GdkPixmap*) pixmap_object); + else + return new Gdk::Bitmap((GdkBitmap*) pixmap_object); +} + + +Pixmap::Pixmap(const Glib::RefPtr& drawable, int width, int height, int depth) +: + Drawable((GdkDrawable*) gdk_pixmap_new(Glib::unwrap(drawable), width, height, depth)) +{ + //gdk_pixmap_new() is implemented differently for x11, win32, etc, + //so we can't really derived a new GType for GdkPixmap. +} + +Pixmap::Pixmap(const Glib::RefPtr& drawable, const char* data, int width, int height, int depth, + const Color& fg, const Color& bg) +: + Drawable((GdkDrawable*) gdk_pixmap_create_from_data( + Glib::unwrap(drawable), data, width, height, depth, + const_cast(fg.gobj()), const_cast(bg.gobj()))) +{ + //gdk_pixmap_new() is implemented differently for x11, win32, etc, + //so we can't really derived a new GType for GdkPixmap. +} + +Pixmap::Pixmap(const Glib::RefPtr& display, NativeWindow anid) +: + Drawable( (GdkDrawable*) gdk_pixmap_foreign_new_for_display(display->gobj(), anid) ) +{ + //gdk_pixmap_new() is implemented differently for x11, win32, etc, + //so we can't really derived a new GType for GdkPixmap. +} + +Glib::RefPtr Pixmap::create_from_data(const Glib::RefPtr& drawable, + const char* data, int width, int height, int depth, + const Color& fg, const Color& bg) +{ + GdkPixmap *const pixmap = gdk_pixmap_create_from_data( + const_cast(Glib::unwrap(drawable)), + const_cast(data), width, height, depth, + const_cast(fg.gobj()), + const_cast(bg.gobj())); + + return Glib::wrap((GdkPixmapObject*) pixmap); +} + + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& drawable, + const Color& transparent_color, + const std::string& filename) +{ + GdkPixmap *const pixmap = gdk_pixmap_create_from_xpm( + const_cast(Glib::unwrap(drawable)), 0, + const_cast(transparent_color.gobj()), + const_cast(filename.c_str())); + + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& drawable, + Glib::RefPtr& mask, + const Color& transparent_color, + const std::string& filename) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_create_from_xpm( + const_cast(Glib::unwrap(drawable)), &bitmap, + const_cast(transparent_color.gobj()), + const_cast(filename.c_str())); + + mask = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& drawable, + const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const Color& transparent_color, + const std::string& filename) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm( + const_cast(Glib::unwrap(drawable)), + Glib::unwrap(colormap), &bitmap, + const_cast(transparent_color.gobj()), + const_cast(filename.c_str())); + + mask = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& drawable, + Glib::RefPtr& mask, + const Color& transparent_color, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_create_from_xpm_d( + const_cast(Glib::unwrap(drawable)), + &bitmap, + const_cast(transparent_color.gobj()), + const_cast(data)); + + mask = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& drawable, + const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const Color& transparent_color, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm_d( + const_cast(Glib::unwrap(drawable)), + Glib::unwrap(colormap), &bitmap, + const_cast(transparent_color.gobj()), + const_cast(data)); + + mask = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const Color& transparent_color, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm_d( + 0, // drawable + Glib::unwrap(colormap), &bitmap, + const_cast(transparent_color.gobj()), + const_cast(data)); + + mask = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +Glib::RefPtr Pixmap::create_from_xpm(const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const char* const* data) +{ + GdkBitmap* bitmap = 0; + + GdkPixmap *const pixmap = gdk_pixmap_colormap_create_from_xpm_d( + 0, // drawable + Glib::unwrap(colormap), &bitmap, + 0, // transparent_color + const_cast(data)); + + mask = Glib::RefPtr::cast_dynamic(Glib::wrap((GdkPixmapObject*) bitmap)); + return Glib::wrap((GdkPixmapObject*) pixmap); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkPixmapObject* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Pixmap_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Pixmap_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_pixmap_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Pixmap_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +/* The implementation: */ + +GdkPixmap* Pixmap::gobj_copy() +{ + reference(); + return gobj(); +} + +Pixmap::Pixmap(const Glib::ConstructParams& construct_params) +: + Gdk::Drawable(construct_params) +{} + +Pixmap::Pixmap(GdkPixmap* castitem) +: + Gdk::Drawable((GdkDrawable*)(castitem)) +{} + +Pixmap::~Pixmap() +{} + + +Pixmap::CppClassType Pixmap::pixmap_class_; // initialize static member + +GType Pixmap::get_type() +{ + return pixmap_class_.init().get_type(); +} + +GType Pixmap::get_base_type() +{ + return gdk_pixmap_get_type(); +} + + +Pixmap::Pixmap() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gdk::Drawable(Glib::ConstructParams(pixmap_class_.init())) +{ + } + +Glib::RefPtr Pixmap::create(const Glib::RefPtr& drawable, int width, int height, int depth) +{ + return Glib::RefPtr( new Pixmap(drawable, width, height, depth) ); +} +Glib::RefPtr Pixmap::create(const Glib::RefPtr& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg) +{ + return Glib::RefPtr( new Pixmap(drawable, data, width, height, depth, fg, bg) ); +} +Glib::RefPtr Pixmap::create(const Glib::RefPtr& display, NativeWindow anid) +{ + return Glib::RefPtr( new Pixmap(display, anid) ); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/pixmap.h b/libs/gtkmm2/gdk/gdkmm/pixmap.h new file mode 100644 index 0000000000..6a7a1d978d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/pixmap.h @@ -0,0 +1,202 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXMAP_H +#define _GDKMM_PIXMAP_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { +//Custom stuct prototypes, because they aren't what the code-generator expects: +typedef struct _GdkDrawable GdkPixmap; +typedef struct _GdkPixmapClass GdkPixmapClass; +} // extern "C" +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Pixmap_Class; } // namespace Gdk +namespace Gdk +{ + +class Window; + +/** Pixmaps are offscreen drawables. They can be drawn upon with the standard drawing primitives, then copied to another + * drawable (such as a Gdk::Window) with Gdk::Drawable::draw_drawable(). The depth of a pixmap is the number of bits per + * pixels. + * Bitmaps are simply pixmaps with a depth of 1. (That is, they are monochrome bitmaps - each pixel can be either on or off). + */ + +class Pixmap : public Gdk::Drawable +{ + // GdkPixmap is a typedef to GdkDrawable, but it's actually a GdkPixmapObject. + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Pixmap CppObjectType; + typedef Pixmap_Class CppClassType; + typedef GdkPixmap BaseObjectType; + typedef GdkPixmapObjectClass BaseClassType; + +private: friend class Pixmap_Class; + static CppClassType pixmap_class_; + +private: + // noncopyable + Pixmap(const Pixmap&); + Pixmap& operator=(const Pixmap&); + +protected: + explicit Pixmap(const Glib::ConstructParams& construct_params); + explicit Pixmap(GdkPixmap* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Pixmap(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkPixmap* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkPixmap* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkPixmap* gobj_copy(); + +private: + + // see wrap_new() implementation in pixmap.ccg + + +protected: + Pixmap(); + + Pixmap(const Glib::RefPtr& drawable, int width, int height, int depth = -1); + + /// Initialize a Pixmap from data. + Pixmap(const Glib::RefPtr& drawable, + const char* data, int width, int height, int depth, + const Color& fg, const Color& bg); + + Pixmap(const Glib::RefPtr& display, NativeWindow anid); + +public: + + + static Glib::RefPtr create(const Glib::RefPtr& drawable, int width, int height, int depth = -1); + + + static Glib::RefPtr create(const Glib::RefPtr& drawable, const char* data, int width, int height, int depth, const Color& fg, const Color& bg); + + + static Glib::RefPtr create(const Glib::RefPtr& display, NativeWindow anid); + + + static Glib::RefPtr create_from_data(const Glib::RefPtr& drawable, + const char* data, int width, int height, int depth, + const Color& fg, const Color& bg); + + /// Create a Pixmap from a xpm file. + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& drawable, + const Color& transparent_color, + const std::string& filename); + + // Create a Pixmap from a xpm file. + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& drawable, + Glib::RefPtr& mask, + const Color& transparent_color, + const std::string& filename); + + /// Create a Pixmap from a xpm file with colormap. + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& drawable, + const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const Color& transparent_color, + const std::string& filename); + + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& drawable, + Glib::RefPtr& mask, + const Color& transparent_color, + const char* const* data); + + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& drawable, + const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const Color& transparent_color, + const char* const* data); + + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const Color& transparent_color, + const char* const* data); + + static Glib::RefPtr create_from_xpm(const Glib::RefPtr& colormap, + Glib::RefPtr& mask, + const char* const* data); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Pixmap + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkPixmapObject* object, bool take_copy = false); +} + + +#endif /* _GDKMM_PIXMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h b/libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h new file mode 100644 index 0000000000..13a2e31932 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/bitmap_p.h @@ -0,0 +1,7 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_BITMAP_P_H +#define _GDKMM_BITMAP_P_H +#include +#endif /* _GDKMM_BITMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/color_p.h b/libs/gtkmm2/gdk/gdkmm/private/color_p.h new file mode 100644 index 0000000000..10e8370c05 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/color_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLOR_P_H +#define _GDKMM_COLOR_P_H +#endif /* _GDKMM_COLOR_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/colormap_p.h b/libs/gtkmm2/gdk/gdkmm/private/colormap_p.h new file mode 100644 index 0000000000..3ceb776d16 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/colormap_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_COLORMAP_P_H +#define _GDKMM_COLORMAP_P_H +#include + +#include + +namespace Gdk +{ + +class Colormap_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Colormap CppObjectType; + typedef GdkColormap BaseObjectType; + typedef GdkColormapClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Colormap; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_COLORMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/cursor_p.h b/libs/gtkmm2/gdk/gdkmm/private/cursor_p.h new file mode 100644 index 0000000000..5400e45e0a --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/cursor_p.h @@ -0,0 +1,7 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_CURSOR_P_H +#define _GDKMM_CURSOR_P_H +#include +#endif /* _GDKMM_CURSOR_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/device_p.h b/libs/gtkmm2/gdk/gdkmm/private/device_p.h new file mode 100644 index 0000000000..f19b9c8ccd --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/device_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DEVICE_P_H +#define _GDKMM_DEVICE_P_H +#include + +#include + +namespace Gdk +{ + +class Device_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Device CppObjectType; + typedef GdkDevice BaseObjectType; + typedef GdkDeviceClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Device; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DEVICE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/display_p.h b/libs/gtkmm2/gdk/gdkmm/private/display_p.h new file mode 100644 index 0000000000..0b5ba089e0 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/display_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAY_P_H +#define _GDKMM_DISPLAY_P_H +#include + +#include + +namespace Gdk +{ + +class Display_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Display CppObjectType; + typedef GdkDisplay BaseObjectType; + typedef GdkDisplayClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Display; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void closed_callback(GdkDisplay* self, gboolean p0); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DISPLAY_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h b/libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h new file mode 100644 index 0000000000..25ff018c44 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/displaymanager_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DISPLAYMANAGER_P_H +#define _GDKMM_DISPLAYMANAGER_P_H +#include + +#include + +namespace Gdk +{ + +class DisplayManager_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef DisplayManager CppObjectType; + typedef GdkDisplayManager BaseObjectType; + typedef GdkDisplayManagerClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class DisplayManager; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void display_opened_callback(GdkDisplayManager* self, GdkDisplay* p0); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DISPLAYMANAGER_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h b/libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h new file mode 100644 index 0000000000..13dfd57ccc --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/dragcontext_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAGCONTEXT_P_H +#define _GDKMM_DRAGCONTEXT_P_H +#include + +#include + +namespace Gdk +{ + +class DragContext_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef DragContext CppObjectType; + typedef GdkDragContext BaseObjectType; + typedef GdkDragContextClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class DragContext; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DRAGCONTEXT_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/drawable_p.h b/libs/gtkmm2/gdk/gdkmm/private/drawable_p.h new file mode 100644 index 0000000000..59e22d083e --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/drawable_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_DRAWABLE_P_H +#define _GDKMM_DRAWABLE_P_H +#include + +#include + +namespace Gdk +{ + +class Drawable_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Drawable CppObjectType; + typedef GdkDrawable BaseObjectType; + typedef GdkDrawableClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Drawable; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_DRAWABLE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/event_p.h b/libs/gtkmm2/gdk/gdkmm/private/event_p.h new file mode 100644 index 0000000000..999db9b7fc --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/event_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_EVENT_P_H +#define _GDKMM_EVENT_P_H +#endif /* _GDKMM_EVENT_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/gc_p.h b/libs/gtkmm2/gdk/gdkmm/private/gc_p.h new file mode 100644 index 0000000000..82725a3a1a --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/gc_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_GC_P_H +#define _GDKMM_GC_P_H +#include + +#include + +namespace Gdk +{ + +class GC_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef GC CppObjectType; + typedef GdkGC BaseObjectType; + typedef GdkGCClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class GC; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_GC_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/image_p.h b/libs/gtkmm2/gdk/gdkmm/private/image_p.h new file mode 100644 index 0000000000..2b6fe88d3d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/image_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_IMAGE_P_H +#define _GDKMM_IMAGE_P_H +#include + +#include + +namespace Gdk +{ + +class Image_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Image CppObjectType; + typedef GdkImage BaseObjectType; + typedef GdkImageClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Image; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_IMAGE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h new file mode 100644 index 0000000000..659bd0d8d7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbuf_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUF_P_H +#define _GDKMM_PIXBUF_P_H +#include + +#include + +namespace Gdk +{ + +class Pixbuf_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Pixbuf CppObjectType; + typedef GdkPixbuf BaseObjectType; + typedef GdkPixbufClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Pixbuf; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUF_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h new file mode 100644 index 0000000000..ca03e440c2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimation_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATION_P_H +#define _GDKMM_PIXBUFANIMATION_P_H +#include + +#include + +namespace Gdk +{ + +class PixbufAnimation_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufAnimation CppObjectType; + typedef GdkPixbufAnimation BaseObjectType; + typedef GdkPixbufAnimationClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class PixbufAnimation; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUFANIMATION_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h new file mode 100644 index 0000000000..f7de22ffd8 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufanimationiter_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFANIMATIONITER_P_H +#define _GDKMM_PIXBUFANIMATIONITER_P_H +#include + +#include + +namespace Gdk +{ + +class PixbufAnimationIter_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufAnimationIter CppObjectType; + typedef GdkPixbufAnimationIter BaseObjectType; + typedef GdkPixbufAnimationIterClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class PixbufAnimationIter; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUFANIMATIONITER_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h new file mode 100644 index 0000000000..6a0b196620 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufformat_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFFORMAT_P_H +#define _GDKMM_PIXBUFFORMAT_P_H +#endif /* _GDKMM_PIXBUFFORMAT_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h new file mode 100644 index 0000000000..7bceceef72 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixbufloader_p.h @@ -0,0 +1,47 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXBUFLOADER_P_H +#define _GDKMM_PIXBUFLOADER_P_H +#include + +#include + +namespace Gdk +{ + +class PixbufLoader_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef PixbufLoader CppObjectType; + typedef GdkPixbufLoader BaseObjectType; + typedef GdkPixbufLoaderClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class PixbufLoader; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void area_prepared_callback(GdkPixbufLoader* self); + static void area_updated_callback(GdkPixbufLoader* self, gint p0, gint p1, gint p2, gint p3); + static void closed_callback(GdkPixbufLoader* self); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXBUFLOADER_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h b/libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h new file mode 100644 index 0000000000..149ed76a07 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/pixmap_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_PIXMAP_P_H +#define _GDKMM_PIXMAP_P_H +#include + +#include + +namespace Gdk +{ + +class Pixmap_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Pixmap CppObjectType; + typedef GdkPixmapObject BaseObjectType; + typedef GdkPixmapObjectClass BaseClassType; + typedef Gdk::Drawable_Class CppClassParent; + typedef GdkDrawableClass BaseClassParent; + + friend class Pixmap; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_PIXMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h b/libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h new file mode 100644 index 0000000000..51088336bb --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/rectangle_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RECTANGLE_P_H +#define _GDKMM_RECTANGLE_P_H +#endif /* _GDKMM_RECTANGLE_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/region_p.h b/libs/gtkmm2/gdk/gdkmm/private/region_p.h new file mode 100644 index 0000000000..b0a7f8cdf2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/region_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_REGION_P_H +#define _GDKMM_REGION_P_H +#endif /* _GDKMM_REGION_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h b/libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h new file mode 100644 index 0000000000..d5845141c4 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/rgbcmap_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RGBCMAP_P_H +#define _GDKMM_RGBCMAP_P_H +#endif /* _GDKMM_RGBCMAP_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/screen_p.h b/libs/gtkmm2/gdk/gdkmm/private/screen_p.h new file mode 100644 index 0000000000..9888f6c9db --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/screen_p.h @@ -0,0 +1,45 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_SCREEN_P_H +#define _GDKMM_SCREEN_P_H +#include + +#include + +namespace Gdk +{ + +class Screen_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Screen CppObjectType; + typedef GdkScreen BaseObjectType; + typedef GdkScreenClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Screen; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + static void size_changed_callback(GdkScreen* self); + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_SCREEN_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/types_p.h b/libs/gtkmm2/gdk/gdkmm/private/types_p.h new file mode 100644 index 0000000000..474d473ad8 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/types_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_TYPES_P_H +#define _GDKMM_TYPES_P_H +#endif /* _GDKMM_TYPES_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/visual_p.h b/libs/gtkmm2/gdk/gdkmm/private/visual_p.h new file mode 100644 index 0000000000..b11005c9db --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/visual_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_VISUAL_P_H +#define _GDKMM_VISUAL_P_H +#include + +#include + +namespace Gdk +{ + +class Visual_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Visual CppObjectType; + typedef GdkVisual BaseObjectType; + typedef GdkVisualClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Visual; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_VISUAL_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/private/window_p.h b/libs/gtkmm2/gdk/gdkmm/private/window_p.h new file mode 100644 index 0000000000..c9fc8a9e85 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/private/window_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_WINDOW_P_H +#define _GDKMM_WINDOW_P_H +#include + +#include + +namespace Gdk +{ + +class Window_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Window CppObjectType; + typedef GdkWindowObject BaseObjectType; + typedef GdkWindowObjectClass BaseClassType; + typedef Gdk::Drawable_Class CppClassParent; + typedef GdkDrawableClass BaseClassParent; + + friend class Window; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Gdk + +#endif /* _GDKMM_WINDOW_P_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/rectangle.cc b/libs/gtkmm2/gdk/gdkmm/rectangle.cc new file mode 100644 index 0000000000..a59a22bd75 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rectangle.cc @@ -0,0 +1,160 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Gdk +{ + +Rectangle::Rectangle(int x, int y, int width, int height) +{ + gobject_.x = x; + gobject_.y = y; + gobject_.width = width; + gobject_.height = height; +} + +// gdk_rectangle_union() and gdk_rectangle_intersect() work fine even if +// the destination points to one of the input rectangles. The join() and +// intersect() implementations rely on this ability. + +Rectangle& Rectangle::join(const Rectangle& src2) +{ + gdk_rectangle_union( + &gobject_, const_cast(&src2.gobject_), &gobject_); + return *this; +} + +Rectangle& Rectangle::intersect(const Rectangle& src2) +{ + gdk_rectangle_intersect( + &gobject_, const_cast(&src2.gobject_), &gobject_); + return *this; +} + +Rectangle& Rectangle::intersect(const Rectangle& src2, bool& rectangles_intersect) +{ + rectangles_intersect = gdk_rectangle_intersect( + &gobject_, const_cast(&src2.gobject_), &gobject_); + return *this; +} + +bool Rectangle::has_zero_area() const +{ + return (gobject_.width == 0 || gobject_.height == 0); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gdk::Rectangle& wrap(GdkRectangle* object) +{ + return *reinterpret_cast(object); +} + +const Gdk::Rectangle& wrap(const GdkRectangle* object) +{ + return *reinterpret_cast(object); +} + +} // namespace Glib + + +namespace Gdk +{ + + +// static +GType Rectangle::get_type() +{ + return gdk_rectangle_get_type(); +} + +Rectangle::Rectangle() +{ + GLIBMM_INITIALIZE_STRUCT(gobject_, GdkRectangle); +} + +Rectangle::Rectangle(const GdkRectangle* gobject) +{ + if(gobject) + gobject_ = *gobject; + else + GLIBMM_INITIALIZE_STRUCT(gobject_, GdkRectangle); +} + + +int Rectangle::get_x() const +{ + return gobj()->x; +} + +void Rectangle::set_x(const int& value) +{ + gobj()->x = value; +} + +int Rectangle::get_y() const +{ + return gobj()->y; +} + +void Rectangle::set_y(const int& value) +{ + gobj()->y = value; +} + +int Rectangle::get_width() const +{ + return gobj()->width; +} + +void Rectangle::set_width(const int& value) +{ + gobj()->width = value; +} + +int Rectangle::get_height() const +{ + return gobj()->height; +} + +void Rectangle::set_height(const int& value) +{ + gobj()->height = value; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/rectangle.h b/libs/gtkmm2/gdk/gdkmm/rectangle.h new file mode 100644 index 0000000000..5a92e1b22d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rectangle.h @@ -0,0 +1,113 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RECTANGLE_H +#define _GDKMM_RECTANGLE_H + +#include + +/* $Id$ */ + +/* rectangle.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Gdk +{ + +/** Gdk::Rectangle is a structure holding the position and size of a rectangle. + * The intersection of two rectangles can be computed with intersect(). To find the union of two rectangles use union(). + */ +class Rectangle +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Rectangle CppObjectType; + typedef GdkRectangle BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Rectangle(); + + explicit Rectangle(const GdkRectangle* gobject); // always takes a copy + + ///Provides access to the underlying C instance. + GdkRectangle* gobj() { return &gobject_; } + + ///Provides access to the underlying C instance. + const GdkRectangle* gobj() const { return &gobject_; } + +protected: + GdkRectangle gobject_; + +private: + +public: +//_CUSTOM_DEFAULT_CTOR +//Rectangle(); + Rectangle(int x, int y, int width, int height); + + Rectangle& join(const Rectangle& src2); + Rectangle& intersect(const Rectangle& src2); + Rectangle& intersect(const Rectangle& src2, bool& rectangles_intersect); + + bool has_zero_area() const; + + int get_x() const; + void set_x(const int& value); + int get_y() const; + void set_y(const int& value); + int get_width() const; + void set_width(const int& value); + int get_height() const; + void set_height(const int& value); + + +}; + +} // namespace Gdk + + +namespace Glib +{ + +/** @relates Gdk::Rectangle + * @param object The C instance + * @result A C++ instance that wraps this C instance. + */ +Gdk::Rectangle& wrap(GdkRectangle* object); + +/** @relates Gdk::Rectangle + * @param object The C instance + * @result A C++ instance that wraps this C instance. + */ +const Gdk::Rectangle& wrap(const GdkRectangle* object); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value : public Glib::Value_Boxed +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GDKMM_RECTANGLE_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/region.cc b/libs/gtkmm2/gdk/gdkmm/region.cc new file mode 100644 index 0000000000..7206c1e239 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/region.cc @@ -0,0 +1,226 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + +Region::Region(const Glib::ArrayHandle& points, FillRule fill_rule) +: + // The dangerous-looking cast to GdkPoint* works, because Gdk::Point + // has only one member variable of type GdkPoint, and no vtable. Please + // don't copy this code, casts like that won't work with most other types. + + gobject_ (gdk_region_polygon( + reinterpret_cast(const_cast(points.data())), + points.size(), (GdkFillRule)(fill_rule))) +{} + +Region::Region(const Rectangle& rectangle) +: + gobject_ (gdk_region_rectangle(const_cast(rectangle.gobj()))) +{} + +Glib::ArrayHandle Region::get_rectangles() const +{ + GdkRectangle* rectangles = 0; + int n_rectangles = 0; + + gdk_region_get_rectangles(gobject_, &rectangles, &n_rectangles); + + // The dangerous-looking cast to Rectangle* works, because Gdk::Rectangle + // has only one member variable of type GdkRectangle, and no vtable. Please + // don't copy this code, casts like that won't work with most other types. + + return Glib::ArrayHandle( + reinterpret_cast(rectangles), n_rectangles, Glib::OWNERSHIP_SHALLOW); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_fill_rule_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_overlap_type_get_type(); +} + + +namespace Glib +{ + +Gdk::Region wrap(GdkRegion* object, bool take_copy /* = false */) +{ + return Gdk::Region(object, take_copy); +} + +} // namespace Glib + + +namespace Gdk +{ + + +Region::Region() +: + gobject_ (gdk_region_new()) +{} + +Region::Region(const Region& src) +: + gobject_ ((src.gobject_) ? gdk_region_copy(src.gobject_) : 0) +{} + +Region::Region(GdkRegion* castitem, bool make_a_copy /* = false */) +{ + if(!make_a_copy) + { + // It was given to us by a function which has already made a copy for us to keep. + gobject_ = castitem; + } + else + { + // We are probably getting it via direct access to a struct, + // so we can not just take it - we have to take a copy of it. + if(castitem) + gobject_ = gdk_region_copy(castitem); + else + gobject_ = 0; + } +} + +Region& Region::operator=(const Region& src) +{ + GdkRegion *const new_gobject = (src.gobject_) ? gdk_region_copy(src.gobject_) : 0; + + if(gobject_) + gdk_region_destroy(gobject_); + + gobject_ = new_gobject; + + return *this; +} + +Region::~Region() +{ + if(gobject_) + gdk_region_destroy(gobject_); +} + +GdkRegion* Region::gobj_copy() const +{ + return gdk_region_copy(gobject_); +} + + +void Region::get_clipbox(const Rectangle& rectangle) +{ + gdk_region_get_clipbox(gobj(), const_cast(rectangle.gobj())); +} + +bool Region::empty() +{ + return gdk_region_empty(gobj()); +} + +bool Region::point_in(int x, int y) +{ + return gdk_region_point_in(gobj(), x, y); +} + +OverlapType Region::rect_in(const Rectangle& rect) +{ + return ((OverlapType)(gdk_region_rect_in(gobj(), const_cast(rect.gobj())))); +} + +void Region::offset(int dx, int dy) +{ + gdk_region_offset(gobj(), dx, dy); +} + +void Region::shrink(int dx, int dy) +{ + gdk_region_shrink(gobj(), dx, dy); +} + +void Region::union_with_rect(const Rectangle& rect) +{ + gdk_region_union_with_rect(gobj(), const_cast(rect.gobj())); +} + +void Region::intersect(const Region& source2) +{ + gdk_region_intersect(gobj(), const_cast((source2).gobj())); +} + +void Region::union_(const Region& source2) +{ + gdk_region_union(gobj(), const_cast((source2).gobj())); +} + +void Region::subtract(const Region& source2) +{ + gdk_region_subtract(gobj(), const_cast((source2).gobj())); +} + +void Region::xor_(const Region& source2) +{ + gdk_region_xor(gobj(), const_cast((source2).gobj())); +} + +void Region::spans_intersect_foreach(GdkSpan* spans, int n_spans, bool sorted, GdkSpanFunc function, gpointer data) +{ + gdk_region_spans_intersect_foreach(gobj(), spans, n_spans, static_cast(sorted), function, data); +} + + +bool operator==(const Region& lhs, const Region& rhs) +{ + return (gdk_region_equal(const_cast(lhs.gobj()), const_cast(rhs.gobj())) != 0); +} + +bool operator!=(const Region& lhs, const Region& rhs) +{ + return (gdk_region_equal(const_cast(lhs.gobj()), const_cast(rhs.gobj())) == 0); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/region.h b/libs/gtkmm2/gdk/gdkmm/region.h new file mode 100644 index 0000000000..bcea009aa7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/region.h @@ -0,0 +1,234 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_REGION_H +#define _GDKMM_REGION_H + +#include + +/* $Id$ */ + +/* region.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +extern "C" { typedef struct _GdkRegion GdkRegion; } + +#include +#include +#include + + +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum FillRule +{ + EVEN_ODD_RULE, + WINDING_RULE +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum OverlapType +{ + OVERLAP_RECTANGLE_IN, + OVERLAP_RECTANGLE_OUT, + OVERLAP_RECTANGLE_PART +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** This is an opaque data type holding a set of arbitrary pixels, and is usually used for clipping graphical operations + * (see Gdk::GC::set_clip_region()). + */ +class Region +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Region CppObjectType; + typedef GdkRegion BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Region(); + + // Use make_a_copy=true when getting it directly from a struct. + explicit Region(GdkRegion* castitem, bool make_a_copy = false); + + Region(const Region& src); + Region& operator=(const Region& src); + + ~Region(); + + GdkRegion* gobj() { return gobject_; } + const GdkRegion* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GdkRegion* gobj_copy() const; + +protected: + GdkRegion* gobject_; + +private: + + +public: + + Region(const Glib::ArrayHandle& points, FillRule fill_rule); + explicit Region(const Rectangle& rectangle); + + + void get_clipbox(const Rectangle& rectangle); + Glib::ArrayHandle get_rectangles() const; + + + bool empty(); + + bool point_in(int x, int y); + + OverlapType rect_in(const Rectangle& rect); + + + void offset(int dx, int dy); + + void shrink(int dx, int dy); + + /** Sets the area of @a region to the union of the areas of @a region and + * @a rect . The resulting area is the set of pixels contained in + * either @a region or @a rect . + * @param rect A Gdk::Rectangle. + */ + void union_with_rect(const Rectangle& rect); + + /** Sets the area of @a source1 to the intersection of the areas of @a source1 + * and @a source2 . The resulting area is the set of pixels contained in + * both @a source1 and @a source2 . + * @param source2 Another Gdk::Region. + */ + void intersect(const Region& source2); + + /** Sets the area of @a source1 to the union of the areas of @a source1 and + * @a source2 . The resulting area is the set of pixels contained in + * either @a source1 or @a source2 . + * @param source2 A Gdk::Region. + */ + void union_(const Region& source2); //union is a keyword. + + /** Subtracts the area of @a source2 from the area @a source1 . The resulting + * area is the set of pixels contained in @a source1 but not in @a source2 . + * @param source2 Another Gdk::Region. + */ + void subtract(const Region& source2); + + /** Sets the area of @a source1 to the exclusive-OR of the areas of @a source1 + * and @a source2 . The resulting area is the set of pixels contained in one + * or the other of the two sources but not in both. + * @param source2 Another Gdk::Region. + */ + void xor_(const Region& source2); //xor is a keyword + + void spans_intersect_foreach(GdkSpan* spans, int n_spans, bool sorted, GdkSpanFunc function, gpointer data); + + +}; + +} //namespace Gdk + + +namespace Gdk +{ + +/** @relates Gdk::Region + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator==(const Region& lhs, const Region& rhs); + +/** @relates Gdk::Region + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator!=(const Region& lhs, const Region& rhs); + + +} // namespace Gdk + + +namespace Glib +{ + + /** @relates Gdk::Region + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gdk::Region wrap(GdkRegion* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GDKMM_REGION_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/rgb.cc b/libs/gtkmm2/gdk/gdkmm/rgb.cc new file mode 100644 index 0000000000..08c8cd58a2 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgb.cc @@ -0,0 +1,43 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gdk +{ + +Glib::RefPtr rgb_get_colormap() +{ + return Glib::wrap( gdk_rgb_get_colormap() ); +} + +Glib::RefPtr rgb_get_visual() +{ + return Glib::wrap( gdk_rgb_get_visual() ); +} + +bool rgb_ditherable() +{ + return gdk_rgb_ditherable(); +} + +} //namespace Gdk + diff --git a/libs/gtkmm2/gdk/gdkmm/rgb.h b/libs/gtkmm2/gdk/gdkmm/rgb.h new file mode 100644 index 0000000000..fa504ae68c --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgb.h @@ -0,0 +1,55 @@ +/* $Id$ */ + +/* Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GDKMM_RGB_H +#define _GDKMM_RGB_H + +#include +#include + +namespace Gdk +{ + +/** Get the preferred colormap for rendering image data. + * Not a very useful function; historically, GDK could only render RGB image data to one colormap and visual, + * but in the current version it can render to any colormap and visual. So there's no need to call this function. + * + * @result The preferred colormap + */ +Glib::RefPtr rgb_get_colormap(); + +/** Gets a "preferred visual" chosen by GdkRGB for rendering image data on the default screen. + * In previous versions of GDK, this was the only visual GdkRGB could use for rendering. In current versions, + * it's simply the visual GdkRGB would have chosen as the optimal one in those previous versions. + * GdkRGB can now render to drawables with any visual. + * @result The Gdk::Visual chosen by GdkRGB. + */ +Glib::RefPtr rgb_get_visual(); + +/** Determines whether the visual is ditherable. + * This function may be useful for presenting a user interface choice to the user about which dither mode is desired; + * if the display is not ditherable, it may make sense to gray out or hide the corresponding UI widget. + * result true if the visual is ditherable. + */ +bool rgb_ditherable(); + +} //namespace Gdk + +#endif //_GDKMM_RGB_H + diff --git a/libs/gtkmm2/gdk/gdkmm/rgbcmap.cc b/libs/gtkmm2/gdk/gdkmm/rgbcmap.cc new file mode 100644 index 0000000000..84a87d5439 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgbcmap.cc @@ -0,0 +1,72 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gdk +{ + +RgbCmap::RgbCmap(const Glib::ArrayHandle& colors) +: gobject_ (gdk_rgb_cmap_new(const_cast(colors.data()), colors.size())) +{} + +RgbCmap::~RgbCmap() +{ + if(gobject_) + gdk_rgb_cmap_free(gobject_); +} + +guint32& RgbCmap::operator[](unsigned long index) +{ + return gobject_->colors[index]; +} + +const guint32& RgbCmap::operator[](unsigned long index) const +{ + return gobject_->colors[index]; +} + + +unsigned long RgbCmap::size() const +{ + return gobject_->n_colors; +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + + +namespace Gdk +{ + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/rgbcmap.h b/libs/gtkmm2/gdk/gdkmm/rgbcmap.h new file mode 100644 index 0000000000..0f01f1e619 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/rgbcmap.h @@ -0,0 +1,82 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_RGBCMAP_H +#define _GDKMM_RGBCMAP_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GdkRgbCmap GdkRgbCmap; } +#endif + +namespace Gdk +{ + +class RgbCmap +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef RgbCmap CppObjectType; + typedef GdkRgbCmap BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + explicit RgbCmap(const Glib::ArrayHandle& colors); + virtual ~RgbCmap(); + + ///Number of colors. + unsigned long size() const; + + ///Access the colors. + guint32& operator[](unsigned long index); + + ///Access the colors. + const guint32& operator[](unsigned long index) const; + + /// Provides access to the underlying C GObject. + GdkRgbCmap* gobj() { return gobject_; } + /// Provides access to the underlying C GObject. + const GdkRgbCmap* gobj() const { return gobject_; } + +protected: + GdkRgbCmap* gobject_; + +private: + // noncopyable + RgbCmap(const RgbCmap&); + RgbCmap& operator=(const RgbCmap&); + + +}; + +} // namespace Gdk + + +#endif /* _GDKMM_RGBCMAP_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/screen.cc b/libs/gtkmm2/gdk/gdkmm/screen.cc new file mode 100644 index 0000000000..0b64a27a59 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/screen.cc @@ -0,0 +1,416 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +namespace Gdk +{ + +} //Gdk + + +namespace +{ + +const Glib::SignalProxyInfo Screen_signal_size_changed_info = +{ + "size-changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkScreen* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Screen_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Screen_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_screen_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Screen_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->size_changed = &size_changed_callback; +} + + +void Screen_Class::size_changed_callback(GdkScreen* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_size_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->size_changed) + (*base->size_changed)(self); + } +} + + +Glib::ObjectBase* Screen_Class::wrap_new(GObject* object) +{ + return new Screen((GdkScreen*)object); +} + + +/* The implementation: */ + +GdkScreen* Screen::gobj_copy() +{ + reference(); + return gobj(); +} + +Screen::Screen(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Screen::Screen(GdkScreen* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Screen::~Screen() +{} + + +Screen::CppClassType Screen::screen_class_; // initialize static member + +GType Screen::get_type() +{ + return screen_class_.init().get_type(); +} + +GType Screen::get_base_type() +{ + return gdk_screen_get_type(); +} + + +Glib::RefPtr Screen::get_default_colormap() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_default_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_default_colormap() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_default_colormap(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Screen::set_default_colormap(const Glib::RefPtr& colormap) +{ + gdk_screen_set_default_colormap(gobj(), const_cast(Glib::unwrap(colormap))); +} + +Glib::RefPtr Screen::get_system_colormap() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_system_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_system_colormap() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_system_colormap(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_system_visual() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_system_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_system_visual() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_system_visual(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_rgb_colormap() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_rgb_colormap(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_rgb_colormap() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_rgb_colormap(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_rgb_visual() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_rgb_visual(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_rgb_visual() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_rgb_visual(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_root_window() +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_screen_get_root_window(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_root_window() const +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_screen_get_root_window(const_cast(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_display() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Screen::get_display() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_display(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Screen::get_number() const +{ + return gdk_screen_get_number(const_cast(gobj())); +} + +int Screen::get_width() const +{ + return gdk_screen_get_width(const_cast(gobj())); +} + +int Screen::get_height() const +{ + return gdk_screen_get_height(const_cast(gobj())); +} + +int Screen::get_width_mm() const +{ + return gdk_screen_get_width_mm(const_cast(gobj())); +} + +int Screen::get_height_mm() const +{ + return gdk_screen_get_height_mm(const_cast(gobj())); +} + +Glib::ListHandle< Glib::RefPtr > Screen::list_visuals() +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_screen_list_visuals(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle< Glib::RefPtr > Screen::get_toplevel_windows() +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_screen_get_toplevel_windows(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ustring Screen::make_display_name() +{ + return Glib::convert_return_gchar_ptr_to_ustring(gdk_screen_make_display_name(gobj())); +} + +int Screen::get_n_monitors() const +{ + return gdk_screen_get_n_monitors(const_cast(gobj())); +} + +void Screen::get_monitor_geometry(int monitor_num, Rectangle& dest) const +{ + gdk_screen_get_monitor_geometry(const_cast(gobj()), monitor_num, (dest).gobj()); +} + +int Screen::get_monitor_at_point(int x, int y) const +{ + return gdk_screen_get_monitor_at_point(const_cast(gobj()), x, y); +} + +int Screen::get_monitor_at_window(const Glib::RefPtr& window) const +{ + return gdk_screen_get_monitor_at_window(const_cast(gobj()), Glib::unwrap(window)); +} + +void Screen::broadcast_client_message(GdkEvent* event) +{ + gdk_screen_broadcast_client_message(gobj(), event); +} + +Glib::RefPtr Screen::get_default() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_screen_get_default()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +Glib::SignalProxy0< void > Screen::signal_size_changed() +{ + return Glib::SignalProxy0< void >(this, &Screen_signal_size_changed_info); +} + + +void Gdk::Screen::on_size_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->size_changed) + (*base->size_changed)(gobj()); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/screen.h b/libs/gtkmm2/gdk/gdkmm/screen.h new file mode 100644 index 0000000000..29ae15d54f --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/screen.h @@ -0,0 +1,423 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_SCREEN_H +#define _GDKMM_SCREEN_H + +#include + +/* $Id$ */ + +/* screen.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +//#include +//#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkScreen GdkScreen; +typedef struct _GdkScreenClass GdkScreenClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Screen_Class; } // namespace Gdk +namespace Gdk +{ + +class Display; +class Colormap; +class Visual; +class Window; + +/** Object representing a physical screen + * Gdk::Screen objects are the GDK representation of a physical screen. It is used throughout GDK and GTK+ to specify + * which screen the top level windows are to be displayed on. It is also used to query the screen specification and + * default settings such as the default colormap (get_default_colormap()), the screen width (get_width()), etc. + * Note that a screen may consist of multiple monitors which are merged to form a large screen area. + */ + +class Screen : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Screen CppObjectType; + typedef Screen_Class CppClassType; + typedef GdkScreen BaseObjectType; + typedef GdkScreenClass BaseClassType; + +private: friend class Screen_Class; + static CppClassType screen_class_; + +private: + // noncopyable + Screen(const Screen&); + Screen& operator=(const Screen&); + +protected: + explicit Screen(const Glib::ConstructParams& construct_params); + explicit Screen(GdkScreen* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Screen(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkScreen* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkScreen* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkScreen* gobj_copy(); + +private: + +protected: + +public: + + /** Gets the default colormap for @a screen . + * @return The default Gdk::Colormap. + * + * Since: 2.2. + */ + Glib::RefPtr get_default_colormap(); + + /** Gets the default colormap for @a screen . + * @return The default Gdk::Colormap. + * + * Since: 2.2. + */ + Glib::RefPtr get_default_colormap() const; + + + /** Sets the default @a colormap for @a screen . + * + * Since: 2.2 + * @param colormap A Gdk::Colormap. + */ + void set_default_colormap(const Glib::RefPtr& colormap); + + /** Gets the system's default colormap for @a screen + * @return The default colormap for @a screen . + * + * Since: 2.2. + */ + Glib::RefPtr get_system_colormap(); + + /** Gets the system's default colormap for @a screen + * @return The default colormap for @a screen . + * + * Since: 2.2. + */ + Glib::RefPtr get_system_colormap() const; + + + /** Get the system's default visual for @a screen . + * This is the visual for the root window of the display. + * The return value should not be freed. + * @return The system visual + * + * Since: 2.2. + */ + Glib::RefPtr get_system_visual(); + + /** Get the system's default visual for @a screen . + * This is the visual for the root window of the display. + * The return value should not be freed. + * @return The system visual + * + * Since: 2.2. + */ + Glib::RefPtr get_system_visual() const; + + + /** Gets the preferred colormap for rendering image data on @a screen . + * Not a very useful function; historically, GDK could only render RGB + * image data to one colormap and visual, but in the current version + * it can render to any colormap and visual. So there's no need to + * call this function. + * @return The preferred colormap + * + * Since: 2.2. + */ + Glib::RefPtr get_rgb_colormap(); + + /** Gets the preferred colormap for rendering image data on @a screen . + * Not a very useful function; historically, GDK could only render RGB + * image data to one colormap and visual, but in the current version + * it can render to any colormap and visual. So there's no need to + * call this function. + * @return The preferred colormap + * + * Since: 2.2. + */ + Glib::RefPtr get_rgb_colormap() const; + + + /** Gets a "preferred visual" chosen by GdkRGB for rendering image data + * on @a screen . In previous versions of + * GDK, this was the only visual GdkRGB could use for rendering. In + * current versions, it's simply the visual GdkRGB would have chosen as + * the optimal one in those previous versions. GdkRGB can now render to + * drawables with any visual. + * @return The Gdk::Visual chosen by GdkRGB. + * + * Since: 2.2. + */ + Glib::RefPtr get_rgb_visual(); + + /** Gets a "preferred visual" chosen by GdkRGB for rendering image data + * on @a screen . In previous versions of + * GDK, this was the only visual GdkRGB could use for rendering. In + * current versions, it's simply the visual GdkRGB would have chosen as + * the optimal one in those previous versions. GdkRGB can now render to + * drawables with any visual. + * @return The Gdk::Visual chosen by GdkRGB. + * + * Since: 2.2. + */ + Glib::RefPtr get_rgb_visual() const; + + + /** Gets the root window of @a screen . + * @return The root window + * + * Since: 2.2. + */ + Glib::RefPtr get_root_window(); + + /** Gets the root window of @a screen . + * @return The root window + * + * Since: 2.2. + */ + Glib::RefPtr get_root_window() const; + + + /** Gets the display to which the @a screen belongs. + * @return The display to which @a screen belongs + * + * Since: 2.2. + */ + Glib::RefPtr get_display(); + + /** Gets the display to which the @a screen belongs. + * @return The display to which @a screen belongs + * + * Since: 2.2. + */ + Glib::RefPtr get_display() const; + + + /** Gets the index of @a screen among the screens in the display + * to which it belongs. (See get_display()) + * @return The index + * + * Since: 2.2. + */ + int get_number() const; + + /** Gets the width of @a screen in pixels + * @return The width of @a screen in pixels. + * + * Since: 2.2. + */ + int get_width() const; + + /** Gets the height of @a screen in pixels + * @return The height of @a screen in pixels. + * + * Since: 2.2. + */ + int get_height() const; + + /** Gets the width of @a screen in millimeters. + * Note that on some X servers this value will not be correct. + * @return The width of @a screen in pixels. + * + * Since: 2.2. + */ + int get_width_mm() const; + + /** Returns the height of @a screen in millimeters. + * Note that on some X servers this value will not be correct. + * @return The heigth of @a screen in pixels. + * + * Since: 2.2. + */ + int get_height_mm() const; + + + /** Lists the available visuals for the specified @a screen . + * A visual describes a hardware image data format. + * For example, a visual might support 24-bit color, or 8-bit color, + * and might expect pixels to be in a certain format. + * @return A list of visuals. + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr > list_visuals(); + + /** Obtains a list of all toplevel windows known to GDK on the screen @a screen . + * A toplevel window is a child of the root window (see + * gdk_get_default_root_window()). + * @return List of toplevel windows. + * + * Since: 2.2. + */ + Glib::ListHandle< Glib::RefPtr > get_toplevel_windows(); + + /** Determines the name to pass to Gdk::Display::open() to get + * a Gdk::Display with this screen as the default screen. + * @return The name. + * + * Since: 2.2. + */ + Glib::ustring make_display_name(); + + + /** Returns the number of monitors which @a screen consists of. + * @return Number of monitors which @a screen consists of. + * + * Since: 2.2. + */ + int get_n_monitors() const; + + /** Retrieves the Gdk::Rectangle representing the size and position of + * the individual monitor within the the entire screen area. + * + * Note that the size of the entire screen area can be retrieved via + * get_width() and get_height(). + * + * Since: 2.2 + * @param monitor_num The monitor number. + * @param dest A Gdk::Rectangle to be filled with the monitor geometry. + */ + void get_monitor_geometry(int monitor_num, Rectangle& dest) const; + + /** Returns the monitor number in which the point ( @a x , @a y ) is located. + * @param x The x coordinate in the virtual screen. + * @param y The y coordinate in the virtual screen. + * @return The monitor number in which the point ( @a x , @a y ) lies, or + * a monitor close to ( @a x , @a y ) if the point is not in any monitor. + * + * Since: 2.2. + */ + int get_monitor_at_point(int x, int y) const; + + /** + * @param window A Gdk::Window. + * @return The monitor number in which most of @a window is located, + * or if @a window does not intersect any monitors, a monitor, + * close to @a window . + * the number of the monitor in which the largest area of the + * bounding rectangle of @a window resides. + * + * Since: 2.2. + */ + int get_monitor_at_window(const Glib::RefPtr& window) const; + + + /** On X11, sends an X ClientMessage event to all toplevel windows on + * @a screen . + * + * Toplevel windows are determined by checking for the WM_STATE property, + * as described in the Inter-Client Communication Conventions Manual (ICCCM). + * If no windows are found with the WM_STATE property set, the message is + * sent to all children of the root window. + * + * On Windows, broadcasts a message registered with the name + * GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of + * data is limited to one long, i.e. four bytes. + * + * Since: 2.2 + * @param event The Gdk::Event. + */ + void broadcast_client_message(GdkEvent* event); + + + /** Gets the default screen for the default display. (See + * Gdk::Display::get_default()). + * @return A Gdk::Screen, or 0 if there is no default display. + * + * Since: 2.2. + */ + static Glib::RefPtr get_default(); + + template + bool get_setting(const Glib::ustring& name, ValueType& value) const; + + + Glib::SignalProxy0< void > signal_size_changed(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_size_changed(); + + +}; + +template +bool Screen::get_setting(const Glib::ustring& name, ValueType& value) const +{ + Glib::Value glibmmvalue; + glibmmvalue.init(Glib::Value::value_type()); + + gboolean result = gdk_screen_get_setting(const_cast(gobj()), name.c_str(), glibmmvalue.gobj()); + + value = glibmmvalue.get(); + return result; +} + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Screen + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkScreen* object, bool take_copy = false); +} + + +#endif /* _GDKMM_SCREEN_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/types.cc b/libs/gtkmm2/gdk/gdkmm/types.cc new file mode 100644 index 0000000000..e15170aadb --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/types.cc @@ -0,0 +1,116 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +namespace Gdk +{ + +Point::Point() +{ + gobject_.x = 0; + gobject_.y = 0; +} + +Point::Point(int x, int y) +{ + gobject_.x = x; + gobject_.y = y; +} + +bool Point::equal(const Gdk::Point& rhs) const +{ + return (gobject_.x == rhs.gobject_.x) && (gobject_.y == rhs.gobject_.y); +} + +// static +GdkAtom AtomStringTraits::to_c_type(const std::string& atom_name) +{ + return gdk_atom_intern(atom_name.c_str(), 0); +} + +// static +std::string AtomStringTraits::to_cpp_type(GdkAtom atom) +{ + if(char *const atom_name = gdk_atom_name(atom)) + return std::string(Glib::ScopedPtr(atom_name).get()); + else + return std::string(); +} + +} // namespace Gdk + + +namespace Glib +{ + +Gdk::Point& wrap(GdkPoint* object) +{ + return *reinterpret_cast(object); +} + +const Gdk::Point& wrap(const GdkPoint* object) +{ + return *reinterpret_cast(object); +} + +} // namespace Glib + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_byte_order_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_modifier_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_status_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_input_condition_get_type(); +} + + +namespace Gdk +{ + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/types.h b/libs/gtkmm2/gdk/gdkmm/types.h new file mode 100644 index 0000000000..1f0c0fafd4 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/types.h @@ -0,0 +1,370 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_TYPES_H +#define _GDKMM_TYPES_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + +/* Shadow ERROR macro (from wingdi.h). + */ +#if defined(ERROR) && !defined(GTKMM_MACRO_SHADOW_ERROR) +enum { GTKMM_MACRO_DEFINITION_ERROR = ERROR }; +#undef ERROR +enum { ERROR = GTKMM_MACRO_DEFINITION_ERROR }; +#define ERROR ERROR +#define GTKMM_MACRO_SHADOW_ERROR 1 +#endif + +/********************************************************************* +***** Version macros +*********************************************************************/ + +/* macro for controlling version numbers */ +#ifndef _GDK_VERSION + +#define GDK_VERSION_GT(major,minor) ((GTK_MAJOR_VERSION>major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>minor)) +#define GDK_VERSION_GE(major,minor) ((GTK_MAJOR_VERSION>major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>=minor)) +#define GDK_VERSION_EQ(major,minor) ((GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION==minor)) +#define GDK_VERSION_NE(major,minor) ((GTK_MAJOR_VERSION!=major)||(GTK_MINOR_VERSION!=minor)) +#define GDK_VERSION_LE(major,minor) ((GTK_MAJOR_VERSION +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %ModifierType operator|(ModifierType, ModifierType)
+ * %ModifierType operator&(ModifierType, ModifierType)
+ * %ModifierType operator^(ModifierType, ModifierType)
+ * %ModifierType operator~(ModifierType)
+ * %ModifierType& operator|=(ModifierType&, ModifierType)
+ * %ModifierType& operator&=(ModifierType&, ModifierType)
+ * %ModifierType& operator^=(ModifierType&, ModifierType)
+ */ +enum ModifierType +{ + SHIFT_MASK = 1 << 0, + LOCK_MASK = 1 << 1, + CONTROL_MASK = 1 << 2, + MOD1_MASK = 1 << 3, + MOD2_MASK = 1 << 4, + MOD3_MASK = 1 << 5, + MOD4_MASK = 1 << 6, + MOD5_MASK = 1 << 7, + BUTTON1_MASK = 1 << 8, + BUTTON2_MASK = 1 << 9, + BUTTON3_MASK = 1 << 10, + BUTTON4_MASK = 1 << 11, + BUTTON5_MASK = 1 << 12, + RELEASE_MASK = 1 << 30, + MODIFIER_MASK = 0x40001FFF +}; + +/** @ingroup gdkmmEnums */ +inline ModifierType operator|(ModifierType lhs, ModifierType rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType operator&(ModifierType lhs, ModifierType rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType operator^(ModifierType lhs, ModifierType rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType operator~(ModifierType flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline ModifierType& operator|=(ModifierType& lhs, ModifierType rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline ModifierType& operator&=(ModifierType& lhs, ModifierType rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline ModifierType& operator^=(ModifierType& lhs, ModifierType rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Status +{ + OK = 0, + ERROR = -1, + ERROR_PARAM = -2, + ERROR_FILE = -3, + ERROR_MEM = -4 +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %InputCondition operator|(InputCondition, InputCondition)
+ * %InputCondition operator&(InputCondition, InputCondition)
+ * %InputCondition operator^(InputCondition, InputCondition)
+ * %InputCondition operator~(InputCondition)
+ * %InputCondition& operator|=(InputCondition&, InputCondition)
+ * %InputCondition& operator&=(InputCondition&, InputCondition)
+ * %InputCondition& operator^=(InputCondition&, InputCondition)
+ */ +enum InputCondition +{ + INPUT_READ = 1 << 0, + INPUT_WRITE = 1 << 1, + INPUT_EXCEPTION = 1 << 2 +}; + +/** @ingroup gdkmmEnums */ +inline InputCondition operator|(InputCondition lhs, InputCondition rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition operator&(InputCondition lhs, InputCondition rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition operator^(InputCondition lhs, InputCondition rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition operator~(InputCondition flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline InputCondition& operator|=(InputCondition& lhs, InputCondition rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline InputCondition& operator&=(InputCondition& lhs, InputCondition rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline InputCondition& operator^=(InputCondition& lhs, InputCondition rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +typedef GdkGeometry Geometry; //It's not used enough to justify having a wrapper. +typedef GdkNativeWindow NativeWindow; + +/** This is a simple structure containing an x and y coordinate of a point. + */ +class Point +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Point CppObjectType; + typedef GdkPoint BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + Point(); + Point(int x, int y); + + void set_x(int x) { gobject_.x = x; } + void set_y(int y) { gobject_.y = y; } + + int get_x() const { return gobject_.x; } + int get_y() const { return gobject_.y; } + + bool equal(const Gdk::Point& rhs) const; + + /// Provides access to the underlying C GObject. + GdkPoint* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const GdkPoint* gobj() const { return &gobject_; } + +protected: + GdkPoint gobject_; + + +}; + +/** @relates Gdk::Point */ +inline bool operator==(const Point& lhs, const Point& rhs) + { return lhs.equal(rhs); } + +/** @relates Gdk::Point */ +inline bool operator!=(const Point& lhs, const Point& rhs) + { return !lhs.equal(rhs); } + + +struct AtomStringTraits +{ + typedef std::string CppType; + typedef GdkAtom CType; + typedef GdkAtom CTypeNonConst; + + static GdkAtom to_c_type(GdkAtom atom) { return atom; } + static void release_c_type(GdkAtom) {} + + // These aren't worth to be inlined since doing so + // would expose way too much of the implementation. + static GdkAtom to_c_type (const std::string& atom_name); + static std::string to_cpp_type(GdkAtom atom); +}; + +// I'm typedef'ing this because when we call to_c_type or to_c_type, +// we don't want it to look like we're calling a template trait, but +// a utility function. -Bryan +typedef AtomStringTraits AtomString; + +typedef Glib::ArrayHandle ArrayHandle_AtomString; + +} // namespace Gdk + + +namespace Glib +{ + +/** @relates Gdk::Point */ +Gdk::Point& wrap(GdkPoint* object); + +/** @relates Gdk::Point */ +const Gdk::Point& wrap(const GdkPoint* object); + +} // namespace Glib + + +#endif /* _GDKMM_TYPES_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/visual.cc b/libs/gtkmm2/gdk/gdkmm/visual.cc new file mode 100644 index 0000000000..4d4e84774c --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/visual.cc @@ -0,0 +1,226 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gdk +{ + + +} //namespace + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_visual_type_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkVisual* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Visual_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Visual_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_visual_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Visual_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Visual_Class::wrap_new(GObject* object) +{ + return new Visual((GdkVisual*)object); +} + + +/* The implementation: */ + +GdkVisual* Visual::gobj_copy() +{ + reference(); + return gobj(); +} + +Visual::Visual(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Visual::Visual(GdkVisual* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Visual::~Visual() +{} + + +Visual::CppClassType Visual::visual_class_; // initialize static member + +GType Visual::get_type() +{ + return visual_class_.init().get_type(); +} + +GType Visual::get_base_type() +{ + return gdk_visual_get_type(); +} + + +Visual::Visual() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(visual_class_.init())) +{ + } + +Glib::RefPtr Visual::get_system() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_system()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Visual::get_best() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_best()); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Visual::get_best(int depth) +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_best_with_depth(depth)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Visual::get_best(VisualType visual_type) +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_best_with_type(((GdkVisualType)(visual_type)))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Visual::get_best(int depth, VisualType visual_type) +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_best_with_both(depth, ((GdkVisualType)(visual_type)))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +int Visual::get_best_depth() +{ + return gdk_visual_get_best_depth(); +} + +VisualType Visual::get_best_type() +{ + return ((VisualType)(gdk_visual_get_best_type())); +} + +Glib::RefPtr Visual::get_screen() +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_screen(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Visual::get_screen() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gdk_visual_get_screen(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/visual.h b/libs/gtkmm2/gdk/gdkmm/visual.h new file mode 100644 index 0000000000..66f3cd5807 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/visual.h @@ -0,0 +1,253 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_VISUAL_H +#define _GDKMM_VISUAL_H + +#include + +/* $Id$ */ + +/* bitmap.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GdkVisual GdkVisual; +typedef struct _GdkVisualClass GdkVisualClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Visual_Class; } // namespace Gdk +namespace Gdk +{ + +class Screen; + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + */ +enum VisualType +{ + VISUAL_STATIC_GRAY, + VISUAL_GRAYSCALE, + VISUAL_STATIC_COLOR, + VISUAL_PSEUDO_COLOR, + VISUAL_TRUE_COLOR, + VISUAL_DIRECT_COLOR +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +/** A Gdk::Visual describes a particular video hardware display format. + * It includes information about the number of bits used for each color, the way the bits are translated into an RGB value + * for display, and the way the bits are stored in memory. For example, a piece of display hardware might support 24-bit + * color, 16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can be in different + * formats; for example the "red" element of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower 4 + * bits. + * + * Usually you can avoid thinking about visuals in GTK+. Visuals are useful to interpret the contents of a GdkImage, but + * you should avoid Gdk::Image precisely because its contents depend on the display hardware; use Gdk::Pixbuf instead, for + * all but the most low-level purposes. Also, anytime you provide a Gdk::Colormap, the visual is implied as part of the + * colormap (Gdk::Colormap::get_visual()), so you won't have to provide a visual in addition. + * + * There are several standard visuals. The visual returned by get_system() is the system's default visual. get_visual() + * returns the visual most suited to displaying full-color image data. If you use the calls in Gdk::RGB, you should create + * your windows using this visual (and the colormap returned by Gdk::Rgb::get_colormap()). + * + * A number of methods are provided for determining the "best" available visual. For the purposes of making this + * determination, higher bit depths are considered better, and for visuals of the same bit depth, GDK_VISUAL_PSEUDO_COLOR + * is preferred at 8bpp, otherwise, the visual types are ranked in the order of (highest to lowest) GDK_VISUAL_DIRECT_COLOR, + * GDK_VISUAL_TRUE_COLOR, GDK_VISUAL_PSEUDO_COLOR, GDK_VISUAL_STATIC_COLOR, GDK_VISUAL_GRAYSCALE, then + * GDK_VISUAL_STATIC_GRAY. + */ + +class Visual : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Visual CppObjectType; + typedef Visual_Class CppClassType; + typedef GdkVisual BaseObjectType; + typedef GdkVisualClass BaseClassType; + +private: friend class Visual_Class; + static CppClassType visual_class_; + +private: + // noncopyable + Visual(const Visual&); + Visual& operator=(const Visual&); + +protected: + explicit Visual(const Glib::ConstructParams& construct_params); + explicit Visual(GdkVisual* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Visual(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkVisual* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkVisual* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkVisual* gobj_copy(); + +private: + +protected: + + Visual(); + +public: + + /** Get the system'sdefault visual for the default GDK screen. + * This is the visual for the root window of the display. + * The return value should not be freed. + * @return System visual. + */ + static Glib::RefPtr get_system(); + + /** Get the visual with the most available colors for the default + * GDK screen. The return value should not be freed. + * @return Best visual. + */ + static Glib::RefPtr get_best(); + + /** Get the best visual with depth @a depth for the default GDK screen. + * Color visuals and visuals with mutable colormaps are preferred + * over grayscale or fixed-colormap visuals. The return value should not + * be freed. 0 may be returned if no visual supports @a depth . + * @param depth A bit depth. + * @return Best visual for the given depth. + */ + static Glib::RefPtr get_best(int depth); + + /** Get the best visual of the given @a visual_type for the default GDK screen. + * Visuals with higher color depths are considered better. The return value + * should not be freed. 0 may be returned if no visual has type + * @a visual_type . + * @param visual_type A visual type. + * @return Best visual of the given type. + */ + static Glib::RefPtr get_best(VisualType visual_type); + + /** Combines gdk_visual_get_best_with_depth() and gdk_visual_get_best_with_type(). + * @param depth A bit depth. + * @param visual_type A visual type. + * @return Best visual with both @a depth and @a visual_type , or 0 if none. + */ + static Glib::RefPtr get_best(int depth, VisualType visual_type); + + + /** Get the best available depth for the default GDK screen. "Best" + * means "largest," i.e. 32 preferred over 24 preferred over 8 bits + * per pixel. + * @return Best available depth. + */ + static int get_best_depth(); + + /** Return the best available visual type for the default GDK screen. + * @return Best visual type. + */ + static VisualType get_best_type(); + + + /** Gets the screen to which this visual belongs + * @return The screen to which this visual belongs. + * + * Since: 2.2. + */ + Glib::RefPtr get_screen(); + + /** Gets the screen to which this visual belongs + * @return The screen to which this visual belongs. + * + * Since: 2.2. + */ + Glib::RefPtr get_screen() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} //namespace Gdk + + +namespace Glib +{ + /** @relates Gdk::Visual + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkVisual* object, bool take_copy = false); +} + + +#endif /* _GDKMM_VISUAL_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/window.cc b/libs/gtkmm2/gdk/gdkmm/window.cc new file mode 100644 index 0000000000..9419c5b01b --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/window.cc @@ -0,0 +1,769 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Gdk +{ + +Window::Window(const Glib::RefPtr& parent, GdkWindowAttr* attributes, int attributes_mask) +: + Drawable((GdkDrawable*) gdk_window_new(parent->gobj(), attributes, attributes_mask)) +{ + //GdkWindow is X11/win32-specific, so we probably can't derived our own GType. +} + +void Window::set_cursor() +{ + gdk_window_set_cursor(gobj(), 0); +} + +GrabStatus Window::pointer_grab(bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 timestamp) +{ + return ((GrabStatus)(gdk_pointer_grab(gobj(), static_cast(owner_events), ((GdkEventMask)(event_mask)), 0, (cursor).gobj_copy(), timestamp))); +} + +GrabStatus Window::pointer_grab(bool owner_events, EventMask event_mask, guint32 timestamp) +{ + return ((GrabStatus)(gdk_pointer_grab(gobj(), static_cast(owner_events), ((GdkEventMask)(event_mask)), 0, 0, timestamp))); +} + +//static +void Window::unset_sm_client_id() +{ + gdk_set_sm_client_id(0 /* see GDK docs */); +} + +void Window::set_icon(const Glib::RefPtr& icon_window, const Glib::RefPtr& pixmap) +{ + gdk_window_set_icon(gobj(), icon_window->gobj(), pixmap->gobj(), 0); /* See GDK docs */ +} + +void Window::unset_icon() +{ + gdk_window_set_icon(gobj(), 0, 0, 0); /* See GDK docs */ +} + +void Window::unset_shape_combine_mask() +{ + gdk_window_shape_combine_mask(gobj(), 0, 0, 0); //See GDK docs. +} + +void Window::get_internal_paint_info(Glib::RefPtr& real_drawable, int& x_offset, int& y_offset) const +{ + GdkDrawable* temp_drawable = 0; + gdk_window_get_internal_paint_info(const_cast(gobj()), &temp_drawable, &x_offset, &y_offset); + real_drawable = Glib::wrap(temp_drawable); +} + +} // namespace Gdk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gdk_event_mask_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_window_state_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_window_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_window_attributes_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_window_hints_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_window_type_hint_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_wm_decoration_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_wm_function_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_window_edge_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_gravity_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gdk_grab_status_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GdkWindowObject* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gdk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Window_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Window_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gdk_window_object_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Window_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Window_Class::wrap_new(GObject* object) +{ + return new Window((GdkWindow*)object); +} + + +/* The implementation: */ + +GdkWindow* Window::gobj_copy() +{ + reference(); + return gobj(); +} + +Window::Window(const Glib::ConstructParams& construct_params) +: + Gdk::Drawable(construct_params) +{} + +Window::Window(GdkWindow* castitem) +: + Gdk::Drawable((GdkDrawable*)(castitem)) +{} + +Window::~Window() +{} + + +Window::CppClassType Window::window_class_; // initialize static member + +GType Window::get_type() +{ + return window_class_.init().get_type(); +} + +GType Window::get_base_type() +{ + return gdk_window_object_get_type(); +} + + +Glib::RefPtr Window::create(const Glib::RefPtr& parent, GdkWindowAttr* attributes, int attributes_mask) +{ + return Glib::RefPtr( new Window(parent, attributes, attributes_mask) ); +} +WindowType Window::get_window_type() const +{ + return ((WindowType)(gdk_window_get_window_type(const_cast(gobj())))); +} + +void Window::show() +{ + gdk_window_show(gobj()); +} + +void Window::hide() +{ + gdk_window_hide(gobj()); +} + +void Window::withdraw() +{ + gdk_window_withdraw(gobj()); +} + +void Window::show_unraised() +{ + gdk_window_show_unraised(gobj()); +} + +void Window::move(int x, int y) +{ + gdk_window_move(gobj(), x, y); +} + +void Window::resize(int width, int height) +{ + gdk_window_resize(gobj(), width, height); +} + +void Window::move_resize(int x, int y, int width, int height) +{ + gdk_window_move_resize(gobj(), x, y, width, height); +} + +void Window::reparent(const Glib::RefPtr& new_parent, int x, int y) +{ + gdk_window_reparent(gobj(), Glib::unwrap(new_parent), x, y); +} + +void Window::clear() +{ + gdk_window_clear(gobj()); +} + +void Window::clear_area(int x, int y, int width, int height) +{ + gdk_window_clear_area(gobj(), x, y, width, height); +} + +void Window::clear_area_e(int x, int y, int width, int height) +{ + gdk_window_clear_area_e(gobj(), x, y, width, height); +} + +void Window::raise() +{ + gdk_window_raise(gobj()); +} + +void Window::lower() +{ + gdk_window_lower(gobj()); +} + +void Window::focus(guint32 timestamp) +{ + gdk_window_focus(gobj(), timestamp); +} + +void Window::set_user_data(gpointer user_data) +{ + gdk_window_set_user_data(gobj(), user_data); +} + +void Window::set_override_redirect(bool override_redirect) +{ + gdk_window_set_override_redirect(gobj(), static_cast(override_redirect)); +} + +void Window::add_filter(GdkFilterFunc function, gpointer data) +{ + gdk_window_add_filter(gobj(), function, data); +} + +void Window::remove_filter(GdkFilterFunc function, gpointer data) +{ + gdk_window_remove_filter(gobj(), function, data); +} + +void Window::scroll(int dx, int dy) +{ + gdk_window_scroll(gobj(), dx, dy); +} + +void Window::shape_combine_mask(const Glib::RefPtr& mask, int x, int y) +{ + gdk_window_shape_combine_mask(gobj(), Glib::unwrap(mask), x, y); +} + +void Window::shape_combine_region(const Region& shape_region, int offset_x, int offset_y) +{ + gdk_window_shape_combine_region(gobj(), const_cast((shape_region).gobj()), offset_x, offset_y); +} + +void Window::set_child_shapes() +{ + gdk_window_set_child_shapes(gobj()); +} + +void Window::merge_child_shapes() +{ + gdk_window_merge_child_shapes(gobj()); +} + +bool Window::is_visible() const +{ + return gdk_window_is_visible(const_cast(gobj())); +} + +bool Window::is_viewable() const +{ + return gdk_window_is_viewable(const_cast(gobj())); +} + +WindowState Window::get_state() const +{ + return ((WindowState)(gdk_window_get_state(const_cast(gobj())))); +} + +bool Window::set_static_gravities(bool use_static) +{ + return gdk_window_set_static_gravities(gobj(), static_cast(use_static)); +} + +void Window::set_type_hint(WindowTypeHint hint) +{ + gdk_window_set_type_hint(gobj(), ((GdkWindowTypeHint)(hint))); +} + +void Window::set_modal_hint(bool modal) +{ + gdk_window_set_modal_hint(gobj(), static_cast(modal)); +} + +void Window::set_geometry_hints(const Geometry& geometry, WindowHints geom_mask) +{ + gdk_window_set_geometry_hints(gobj(), const_cast(&(geometry)), ((GdkWindowHints)(geom_mask))); +} + +void Window::set_sm_client_id(const Glib::ustring& sm_client_id) +{ + gdk_set_sm_client_id(sm_client_id.c_str()); +} + +void Window::begin_paint_rect(Rectangle& rectangle) +{ + gdk_window_begin_paint_rect(gobj(), (rectangle).gobj()); +} + +void Window::begin_paint_region(const Region& region) +{ + gdk_window_begin_paint_region(gobj(), const_cast((region).gobj())); +} + +void Window::end_paint() +{ + gdk_window_end_paint(gobj()); +} + +void Window::set_title(const Glib::ustring& title) +{ + gdk_window_set_title(gobj(), title.c_str()); +} + +void Window::set_role(const Glib::ustring& role) +{ + gdk_window_set_role(gobj(), role.c_str()); +} + +void Window::set_transient_for(const Glib::RefPtr& parent) +{ + gdk_window_set_transient_for(gobj(), Glib::unwrap(parent)); +} + +void Window::set_background(const Color& color) +{ + gdk_window_set_background(gobj(), (color).gobj()); +} + +void Window::set_back_pixmap(const Glib::RefPtr& pixmap, bool parent_relative) +{ + gdk_window_set_back_pixmap(gobj(), Glib::unwrap(pixmap), static_cast(parent_relative)); +} + +void Window::set_cursor(const Cursor& cursor) +{ + gdk_window_set_cursor(gobj(), (cursor).gobj_copy()); +} + +void Window::get_user_data(gpointer* data) +{ + gdk_window_get_user_data(gobj(), data); +} + +void Window::get_geometry(int& x, int& y, int& width, int& height, int& depth) const +{ + gdk_window_get_geometry(const_cast(gobj()), &x, &y, &width, &height, &depth); +} + +void Window::get_position(int& x, int& y) const +{ + gdk_window_get_position(const_cast(gobj()), &x, &y); +} + +int Window::get_origin(int& x, int& y) const +{ + return gdk_window_get_origin(const_cast(gobj()), &x, &y); +} + +void Window::get_root_origin(int& x, int& y) const +{ + gdk_window_get_root_origin(const_cast(gobj()), &x, &y); +} + +void Window::get_frame_extents(Rectangle& rect) +{ + gdk_window_get_frame_extents(gobj(), (rect).gobj()); +} + +Glib::RefPtr Window::get_pointer(int& x, int& y, ModifierType& mask) +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_pointer(gobj(), &x, &y, ((GdkModifierType*) &(mask))))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Window::get_parent() +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_parent(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Window::get_parent() const +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_parent(const_cast(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Window::get_toplevel() +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_toplevel(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Window::get_toplevel() const +{ + + Glib::RefPtr retvalue = Glib::wrap((GdkWindowObject*)(gdk_window_get_toplevel(const_cast(gobj())))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ListHandle< Glib::RefPtr > Window::get_children() +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_window_get_children(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle< Glib::RefPtr > Window::get_children() const +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_window_get_children(const_cast(gobj())), Glib::OWNERSHIP_SHALLOW); +} + +EventMask Window::get_events() const +{ + return ((EventMask)(gdk_window_get_events(const_cast(gobj())))); +} + +void Window::set_events(EventMask event_mask) +{ + gdk_window_set_events(gobj(), ((GdkEventMask)(event_mask))); +} + +void Window::set_icon_list(const Glib::ListHandle< Glib::RefPtr >& pixbufs) +{ + gdk_window_set_icon_list(gobj(), pixbufs.data()); +} + +void Window::set_icon(const Glib::RefPtr& icon_window, const Glib::RefPtr& pixmap, const Glib::RefPtr& mask) +{ + gdk_window_set_icon(gobj(), Glib::unwrap(icon_window), Glib::unwrap(pixmap), Glib::unwrap(mask)); +} + +void Window::set_icon_name(const Glib::ustring& name) +{ + gdk_window_set_icon_name(gobj(), name.c_str()); +} + +void Window::set_group(const Glib::RefPtr& leader) +{ + gdk_window_set_group(gobj(), Glib::unwrap(leader)); +} + +Glib::RefPtr Window::get_group() +{ + return Glib::wrap((GdkWindowObject*)(gdk_window_get_group(gobj()))); +} + +Glib::RefPtr Window::get_group() const +{ + return Glib::wrap((GdkWindowObject*)(gdk_window_get_group(const_cast(gobj())))); +} + +void Window::set_decorations(WMDecoration decorations) +{ + gdk_window_set_decorations(gobj(), ((GdkWMDecoration)(decorations))); +} + +bool Window::get_decorations(WMDecoration& decorations) const +{ + return gdk_window_get_decorations(const_cast(gobj()), ((GdkWMDecoration*) &(decorations))); +} + +void Window::set_functions(WMFunction functions) +{ + gdk_window_set_functions(gobj(), ((GdkWMFunction)(functions))); +} + +Glib::ListHandle< Glib::RefPtr > Window::get_toplevels() +{ + return Glib::ListHandle< Glib::RefPtr >(gdk_window_get_toplevels(), Glib::OWNERSHIP_SHALLOW); +} + +void Window::iconify() +{ + gdk_window_iconify(gobj()); +} + +void Window::deiconify() +{ + gdk_window_deiconify(gobj()); +} + +void Window::stick() +{ + gdk_window_stick(gobj()); +} + +void Window::unstick() +{ + gdk_window_unstick(gobj()); +} + +void Window::maximize() +{ + gdk_window_maximize(gobj()); +} + +void Window::unmaximize() +{ + gdk_window_unmaximize(gobj()); +} + +void Window::register_dnd() +{ + gdk_window_register_dnd(gobj()); +} + +void Window::begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp) +{ + gdk_window_begin_resize_drag(gobj(), ((GdkWindowEdge)(edge)), button, root_x, root_y, timestamp); +} + +void Window::begin_move_drag(int button, int root_x, int root_y, guint32 timestamp) +{ + gdk_window_begin_move_drag(gobj(), button, root_x, root_y, timestamp); +} + +void Window::invalidate_rect(const Rectangle& rect, bool invalidate_children) +{ + gdk_window_invalidate_rect(gobj(), const_cast(rect.gobj()), static_cast(invalidate_children)); +} + +void Window::invalidate_region(const Region& region, bool invalidate_children) +{ + gdk_window_invalidate_region(gobj(), const_cast((region).gobj()), static_cast(invalidate_children)); +} + +Region Window::get_update_area() +{ + return Region(gdk_window_get_update_area(gobj())); +} + +void Window::freeze_updates() +{ + gdk_window_freeze_updates(gobj()); +} + +void Window::thaw_updates() +{ + gdk_window_thaw_updates(gobj()); +} + +void Window::process_all_updates() +{ + gdk_window_process_all_updates(); +} + +void Window::process_updates(bool update_children) +{ + gdk_window_process_updates(gobj(), static_cast(update_children)); +} + +void Window::set_debug_updates(bool setting) +{ + gdk_window_set_debug_updates(static_cast(setting)); +} + +void Window::constrain_size(const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height) +{ + gdk_window_constrain_size(const_cast(&(geometry)), flags, width, height, &new_width, &new_height); +} + +void Window::enable_synchronized_configure() +{ + gdk_window_enable_synchronized_configure(gobj()); +} + +void Window::configure_finished() +{ + gdk_window_configure_finished(gobj()); +} + +void Window::set_skip_taskbar_hint(bool skips_taskbar) +{ + gdk_window_set_skip_taskbar_hint(gobj(), static_cast(skips_taskbar)); +} + +void Window::set_skip_pager_hint(bool skips_pager) +{ + gdk_window_set_skip_pager_hint(gobj(), static_cast(skips_pager)); +} + +void Window::fullscreen() +{ + gdk_window_fullscreen(gobj()); +} + +void Window::unfullscreen() +{ + gdk_window_unfullscreen(gobj()); +} + +GrabStatus Window::pointer_grab(bool owner_events, EventMask event_mask, const Glib::RefPtr& confine_to, const Cursor& cursor, guint32 time_) +{ + return ((GrabStatus)(gdk_pointer_grab(gobj(), static_cast(owner_events), ((GdkEventMask)(event_mask)), const_cast(Glib::unwrap(confine_to)), (cursor).gobj_copy(), time_))); +} + +void Window::pointer_ungrab(guint32 timestamp) +{ + gdk_pointer_ungrab(timestamp); +} + +GrabStatus Window::keyboard_grab(bool owner_events, guint32 timestamp) +{ + return ((GrabStatus)(gdk_keyboard_grab(gobj(), static_cast(owner_events), timestamp))); +} + +void Window::keyboard_ungrab(guint32 timestamp) +{ + gdk_keyboard_ungrab(timestamp); +} + +void Window::set_keep_above(bool setting) +{ + gdk_window_set_keep_above(gobj(), static_cast(setting)); +} + +void Window::set_keep_below(bool setting) +{ + gdk_window_set_keep_below(gobj(), static_cast(setting)); +} + +void Window::set_accept_focus(bool accept_focus) +{ + gdk_window_set_accept_focus(gobj(), static_cast(accept_focus)); +} + +void Window::set_focus_on_map(bool focus_on_map) +{ + gdk_window_set_focus_on_map(gobj(), static_cast(focus_on_map)); +} + + +} // namespace Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/window.h b/libs/gtkmm2/gdk/gdkmm/window.h new file mode 100644 index 0000000000..7b8d9c614d --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/window.h @@ -0,0 +1,1906 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GDKMM_WINDOW_H +#define _GDKMM_WINDOW_H + +#include + +/* $Id$ */ + +/* Copyright(C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License or(at your option) any later version. + * + * This library is distributed in the hope that it will be useful + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not write to the Free + * Software Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA. + */ + +#include +#include +//#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { +// Custom struct prototype, because this isn't what the code-generator expects: +typedef struct _GdkDrawable GdkWindow; +} // extern "C" +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ class Window_Class; } // namespace Gdk +namespace Gdk +{ + + +/** @addtogroup gdkmmEnums Enums and Flags */ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %EventMask operator|(EventMask, EventMask)
+ * %EventMask operator&(EventMask, EventMask)
+ * %EventMask operator^(EventMask, EventMask)
+ * %EventMask operator~(EventMask)
+ * %EventMask& operator|=(EventMask&, EventMask)
+ * %EventMask& operator&=(EventMask&, EventMask)
+ * %EventMask& operator^=(EventMask&, EventMask)
+ */ +enum EventMask +{ + EXPOSURE_MASK = 1 << 1, + POINTER_MOTION_MASK = 1 << 2, + POINTER_MOTION_HINT_MASK = 1 << 3, + BUTTON_MOTION_MASK = 1 << 4, + BUTTON1_MOTION_MASK = 1 << 5, + BUTTON2_MOTION_MASK = 1 << 6, + BUTTON3_MOTION_MASK = 1 << 7, + BUTTON_PRESS_MASK = 1 << 8, + BUTTON_RELEASE_MASK = 1 << 9, + KEY_PRESS_MASK = 1 << 10, + KEY_RELEASE_MASK = 1 << 11, + ENTER_NOTIFY_MASK = 1 << 12, + LEAVE_NOTIFY_MASK = 1 << 13, + FOCUS_CHANGE_MASK = 1 << 14, + STRUCTURE_MASK = 1 << 15, + PROPERTY_CHANGE_MASK = 1 << 16, + VISIBILITY_NOTIFY_MASK = 1 << 17, + PROXIMITY_IN_MASK = 1 << 18, + PROXIMITY_OUT_MASK = 1 << 19, + SUBSTRUCTURE_MASK = 1 << 20, + SCROLL_MASK = 1 << 21, + ALL_EVENTS_MASK = 0x3FFFFE +}; + +/** @ingroup gdkmmEnums */ +inline EventMask operator|(EventMask lhs, EventMask rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline EventMask operator&(EventMask lhs, EventMask rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline EventMask operator^(EventMask lhs, EventMask rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline EventMask operator~(EventMask flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline EventMask& operator|=(EventMask& lhs, EventMask rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline EventMask& operator&=(EventMask& lhs, EventMask rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline EventMask& operator^=(EventMask& lhs, EventMask rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %WindowState operator|(WindowState, WindowState)
+ * %WindowState operator&(WindowState, WindowState)
+ * %WindowState operator^(WindowState, WindowState)
+ * %WindowState operator~(WindowState)
+ * %WindowState& operator|=(WindowState&, WindowState)
+ * %WindowState& operator&=(WindowState&, WindowState)
+ * %WindowState& operator^=(WindowState&, WindowState)
+ */ +enum WindowState +{ + WINDOW_STATE_WITHDRAWN = 1 << 0, + WINDOW_STATE_ICONIFIED = 1 << 1, + WINDOW_STATE_MAXIMIZED = 1 << 2, + WINDOW_STATE_STICKY = 1 << 3, + WINDOW_STATE_FULLSCREEN = 1 << 4, + WINDOW_STATE_ABOVE = 1 << 5, + WINDOW_STATE_BELOW = 1 << 6 +}; + +/** @ingroup gdkmmEnums */ +inline WindowState operator|(WindowState lhs, WindowState rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowState operator&(WindowState lhs, WindowState rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowState operator^(WindowState lhs, WindowState rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowState operator~(WindowState flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline WindowState& operator|=(WindowState& lhs, WindowState rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowState& operator&=(WindowState& lhs, WindowState rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowState& operator^=(WindowState& lhs, WindowState rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum WindowType +{ + WINDOW_ROOT, + WINDOW_TOPLEVEL, + WINDOW_CHILD, + WINDOW_DIALOG, + WINDOW_TEMP, + WINDOW_FOREIGN +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %WindowAttributesType operator|(WindowAttributesType, WindowAttributesType)
+ * %WindowAttributesType operator&(WindowAttributesType, WindowAttributesType)
+ * %WindowAttributesType operator^(WindowAttributesType, WindowAttributesType)
+ * %WindowAttributesType operator~(WindowAttributesType)
+ * %WindowAttributesType& operator|=(WindowAttributesType&, WindowAttributesType)
+ * %WindowAttributesType& operator&=(WindowAttributesType&, WindowAttributesType)
+ * %WindowAttributesType& operator^=(WindowAttributesType&, WindowAttributesType)
+ */ +enum WindowAttributesType +{ + WA_TITLE = 1 << 1, + WA_X = 1 << 2, + WA_Y = 1 << 3, + WA_CURSOR = 1 << 4, + WA_COLORMAP = 1 << 5, + WA_VISUAL = 1 << 6, + WA_WMCLASS = 1 << 7, + WA_NOREDIR = 1 << 8 +}; + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator|(WindowAttributesType lhs, WindowAttributesType rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator&(WindowAttributesType lhs, WindowAttributesType rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator^(WindowAttributesType lhs, WindowAttributesType rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType operator~(WindowAttributesType flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType& operator|=(WindowAttributesType& lhs, WindowAttributesType rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType& operator&=(WindowAttributesType& lhs, WindowAttributesType rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowAttributesType& operator^=(WindowAttributesType& lhs, WindowAttributesType rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %WindowHints operator|(WindowHints, WindowHints)
+ * %WindowHints operator&(WindowHints, WindowHints)
+ * %WindowHints operator^(WindowHints, WindowHints)
+ * %WindowHints operator~(WindowHints)
+ * %WindowHints& operator|=(WindowHints&, WindowHints)
+ * %WindowHints& operator&=(WindowHints&, WindowHints)
+ * %WindowHints& operator^=(WindowHints&, WindowHints)
+ */ +enum WindowHints +{ + HINT_POS = 1 << 0, + HINT_MIN_SIZE = 1 << 1, + HINT_MAX_SIZE = 1 << 2, + HINT_BASE_SIZE = 1 << 3, + HINT_ASPECT = 1 << 4, + HINT_RESIZE_INC = 1 << 5, + HINT_WIN_GRAVITY = 1 << 6, + HINT_USER_POS = 1 << 7, + HINT_USER_SIZE = 1 << 8 +}; + +/** @ingroup gdkmmEnums */ +inline WindowHints operator|(WindowHints lhs, WindowHints rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints operator&(WindowHints lhs, WindowHints rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints operator^(WindowHints lhs, WindowHints rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints operator~(WindowHints flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline WindowHints& operator|=(WindowHints& lhs, WindowHints rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowHints& operator&=(WindowHints& lhs, WindowHints rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WindowHints& operator^=(WindowHints& lhs, WindowHints rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum WindowTypeHint +{ + WINDOW_TYPE_HINT_NORMAL, + WINDOW_TYPE_HINT_DIALOG, + WINDOW_TYPE_HINT_MENU, + WINDOW_TYPE_HINT_TOOLBAR, + WINDOW_TYPE_HINT_SPLASHSCREEN, + WINDOW_TYPE_HINT_UTILITY, + WINDOW_TYPE_HINT_DOCK, + WINDOW_TYPE_HINT_DESKTOP +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %WMDecoration operator|(WMDecoration, WMDecoration)
+ * %WMDecoration operator&(WMDecoration, WMDecoration)
+ * %WMDecoration operator^(WMDecoration, WMDecoration)
+ * %WMDecoration operator~(WMDecoration)
+ * %WMDecoration& operator|=(WMDecoration&, WMDecoration)
+ * %WMDecoration& operator&=(WMDecoration&, WMDecoration)
+ * %WMDecoration& operator^=(WMDecoration&, WMDecoration)
+ */ +enum WMDecoration +{ + DECOR_ALL = 1 << 0, + DECOR_BORDER = 1 << 1, + DECOR_RESIZEH = 1 << 2, + DECOR_TITLE = 1 << 3, + DECOR_MENU = 1 << 4, + DECOR_MINIMIZE = 1 << 5, + DECOR_MAXIMIZE = 1 << 6 +}; + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator|(WMDecoration lhs, WMDecoration rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator&(WMDecoration lhs, WMDecoration rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator^(WMDecoration lhs, WMDecoration rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration operator~(WMDecoration flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration& operator|=(WMDecoration& lhs, WMDecoration rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration& operator&=(WMDecoration& lhs, WMDecoration rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMDecoration& operator^=(WMDecoration& lhs, WMDecoration rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + * @par Bitwise operators: + * %WMFunction operator|(WMFunction, WMFunction)
+ * %WMFunction operator&(WMFunction, WMFunction)
+ * %WMFunction operator^(WMFunction, WMFunction)
+ * %WMFunction operator~(WMFunction)
+ * %WMFunction& operator|=(WMFunction&, WMFunction)
+ * %WMFunction& operator&=(WMFunction&, WMFunction)
+ * %WMFunction& operator^=(WMFunction&, WMFunction)
+ */ +enum WMFunction +{ + FUNC_ALL = 1 << 0, + FUNC_RESIZE = 1 << 1, + FUNC_MOVE = 1 << 2, + FUNC_MINIMIZE = 1 << 3, + FUNC_MAXIMIZE = 1 << 4, + FUNC_CLOSE = 1 << 5 +}; + +/** @ingroup gdkmmEnums */ +inline WMFunction operator|(WMFunction lhs, WMFunction rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction operator&(WMFunction lhs, WMFunction rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction operator^(WMFunction lhs, WMFunction rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction operator~(WMFunction flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gdkmmEnums */ +inline WMFunction& operator|=(WMFunction& lhs, WMFunction rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMFunction& operator&=(WMFunction& lhs, WMFunction rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gdkmmEnums */ +inline WMFunction& operator^=(WMFunction& lhs, WMFunction rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum WindowEdge +{ + WINDOW_EDGE_NORTH_WEST, + WINDOW_EDGE_NORTH, + WINDOW_EDGE_NORTH_EAST, + WINDOW_EDGE_WEST, + WINDOW_EDGE_EAST, + WINDOW_EDGE_SOUTH_WEST, + WINDOW_EDGE_SOUTH, + WINDOW_EDGE_SOUTH_EAST +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum Gravity +{ + GRAVITY_NORTH_WEST = 1, + GRAVITY_NORTH, + GRAVITY_NORTH_EAST, + GRAVITY_WEST, + GRAVITY_CENTER, + GRAVITY_EAST, + GRAVITY_SOUTH_WEST, + GRAVITY_SOUTH, + GRAVITY_SOUTH_EAST, + GRAVITY_STATIC +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + +/** + * @ingroup gdkmmEnums + */ +enum GrabStatus +{ + GRAB_SUCCESS, + GRAB_ALREADY_GRABBED, + GRAB_INVALID_TIME, + GRAB_NOT_VIEWABLE, + GRAB_FROZEN +}; + +} // namespace Gdk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gdk +{ + + +class Cursor; + +/** A Gdk::Window is a rectangular region on the screen. It's a low-level object, used to implement high-level objects such + * as Gtk::Widget and Gtk::Window on the GTK+ level. A Gtk::Window is a toplevel window, the thing a user might think of as + * a "window" with a titlebar and so on; a Gtk::Window may contain many Gdk::Windows. For example, each Gtk::Button has a + * Gdk::Window associated with it. + */ + +class Window : public Gdk::Drawable +{ + // GdkWindow is a typedef to GdkDrawable, but it's actually a GdkWindowObject. + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Window CppObjectType; + typedef Window_Class CppClassType; + typedef GdkWindow BaseObjectType; + typedef GdkWindowObjectClass BaseClassType; + +private: friend class Window_Class; + static CppClassType window_class_; + +private: + // noncopyable + Window(const Window&); + Window& operator=(const Window&); + +protected: + explicit Window(const Glib::ConstructParams& construct_params); + explicit Window(GdkWindow* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Window(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GdkWindow* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GdkWindow* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GdkWindow* gobj_copy(); + +private: + + +protected: + Window(const Glib::RefPtr& parent, GdkWindowAttr* attributes, int attributes_mask); + +public: + + static Glib::RefPtr create(const Glib::RefPtr& parent, GdkWindowAttr* attributes, int attributes_mask); + + + /** Gets the type of the window. See Gdk::WindowType. + * @return Type of window. + */ + WindowType get_window_type() const; + + /** Like gdk_window_show_unraised(), but also raises the window to the + * top of the window stack (moves the window to the front of the + * Z-order). + * + * This function maps a window so it's visible onscreen. Its opposite + * is gdk_window_hide(). + * + * When implementing a Gtk::Widget, you should call this function on the widget's + * Gdk::Window as part of the "map" method. + */ + void show(); + + /** For toplevel windows, withdraws them, so they will no longer be + * known to the window manager; for all windows, unmaps them, so + * they won't be displayed. Normally done automatically as + * part of gtk_widget_hide(). + */ + void hide(); + + /** Withdraws a window (unmaps it and asks the window manager to forget about it). + * This function is not really useful as gdk_window_hide() automatically + * withdraws toplevel windows before hiding them. + */ + void withdraw(); + + /** Shows a Gdk::Window onscreen, but does not modify its stacking + * order. In contrast, gdk_window_show() will raise the window + * to the top of the window stack. + * + * On the X11 platform, in Xlib terms, this function calls + * XMapWindow() (it also updates some internal GDK state, which means + * that you can't really use XMapWindow() directly on a GDK window). + */ + void show_unraised(); + + /** Repositions a window relative to its parent window. + * For toplevel windows, window managers may ignore or modify the move; + * you should probably use gtk_window_move() on a Gtk::Window widget + * anyway, instead of using GDK functions. For child windows, + * the move will reliably succeed. + * + * If you're also planning to resize the window, use gdk_window_move_resize() + * to both move and resize simultaneously, for a nicer visual effect. + * @param x X coordinate relative to window's parent. + * @param y Y coordinate relative to window's parent. + */ + void move(int x, int y); + + /** Resizes @a window ; for toplevel windows, asks the window manager to resize + * the window. The window manager may not allow the resize. When using GTK+, + * use gtk_window_resize() instead of this low-level GDK function. + * + * Windows may not be resized below 1x1. + * + * If you're also planning to move the window, use gdk_window_move_resize() + * to both move and resize simultaneously, for a nicer visual effect. + * @param width New width of the window. + * @param height New height of the window. + */ + void resize(int width, int height); + + /** Equivalent to calling gdk_window_move() and gdk_window_resize(), + * except that both operations are performed at once, avoiding strange + * visual effects. (i.e. the user may be able to see the window first + * move, then resize, if you don't use gdk_window_move_resize().) + * @param x New X position relative to window's parent. + * @param y New Y position relative to window's parent. + * @param width New width. + * @param height New height. + */ + void move_resize(int x, int y, int width, int height); + + /** Reparents @a window into the given @a new_parent . The window being + * reparented will be unmapped as a side effect. + * @param new_parent New parent to move @a window into. + * @param x X location inside the new parent. + * @param y Y location inside the new parent. + */ + void reparent(const Glib::RefPtr& new_parent, int x, int y); + + /** Clears an entire @a window to the background color or background pixmap. + */ + void clear(); + + /** Clears an area of @a window to the background color or background pixmap. + * @param x X coordinate of rectangle to clear. + * @param y Y coordinate of rectangle to clear. + * @param width Width of rectangle to clear. + * @param height Height of rectangle to clear. + */ + void clear_area(int x, int y, int width, int height); + + /** Like gdk_window_clear_area(), but also generates an expose event for + * the cleared area. + * + * This function has a stupid name because it dates back to the mists + * time, pre-GDK-1.0. + * @param x X coordinate of rectangle to clear. + * @param y Y coordinate of rectangle to clear. + * @param width Width of rectangle to clear. + * @param height Height of rectangle to clear. + */ + void clear_area_e(int x, int y, int width, int height); + + /** Raises @a window to the top of the Z-order (stacking order), so that + * other windows with the same parent window appear below @a window . + * This is true whether or not the windows are visible. + * + * If @a window is a toplevel, the window manager may choose to deny the + * request to move the window in the Z-order, gdk_window_raise() only + * requests the restack, does not guarantee it. + */ + void raise(); + + /** Lowers @a window to the bottom of the Z-order (stacking order), so that + * other windows with the same parent window appear above @a window . + * This is true whether or not the other windows are visible. + * + * If @a window is a toplevel, the window manager may choose to deny the + * request to move the window in the Z-order, gdk_window_lower() only + * requests the restack, does not guarantee it. + * + * Note that gdk_window_show() raises the window again, so don't call this + * function before gdk_window_show(). (Try gdk_window_show_unraised().) + */ + void lower(); + + /** Sets keyboard focus to @a window . If @a window is not onscreen this + * will not work. In most cases, gtk_window_present() should be used on + * a Gtk::Window, rather than calling this function. + * @param timestamp Timestamp of the event triggering the window focus. + */ + void focus(guint32 timestamp); + + /** For most purposes this function is deprecated in favor of + * Glib::object_set_data(). However, for historical reasons GTK+ stores + * the Gtk::Widget that owns a Gdk::Window as user data on the + * Gdk::Window. So, custom widget implementations should use + * this function for that. If GTK+ receives an event for a Gdk::Window, + * and the user data for the window is non-0, GTK+ will assume the + * user data is a Gtk::Widget, and forward the event to that widget. + * @param user_data User data. + */ + void set_user_data(gpointer user_data); + + /** An override redirect window is not under the control of the window manager. + * This means it won't have a titlebar, won't be minimizable, etc. - it will + * be entirely under the control of the application. The window manager + * can't see the override redirect window at all. + * + * Override redirect should only be used for short-lived temporary + * windows, such as popup menus. Gtk::Menu uses an override redirect + * window in its implementation, for example. + * @param override_redirect true if window should be override redirect. + */ + void set_override_redirect(bool override_redirect = true); + + //We could wrap these with a Slot instead of a C callback, but these methods are very low-level anyway. + + /** Adds an event filter to @a window , allowing you to intercept events + * before they reach GDK. This is a low-level operation and makes it + * easy to break GDK and/or GTK+, so you have to know what you're + * doing. Pass 0 for @a window to get all events for all windows, + * instead of events for a specific window. + * @param function Filter callback. + * @param data Data to pass to filter callback. + */ + void add_filter(GdkFilterFunc function, gpointer data); + + /** Remove a filter previously added with gdk_window_add_filter(). + * @param function Previously-added filter function. + * @param data User data for previously-added filter function. + */ + void remove_filter(GdkFilterFunc function, gpointer data); + + + /** Scroll the contents of @a window , both pixels and children, by the given + * amount. @a window itself does not move. Portions of the window that the scroll + * operation brings in from offscreen areas are invalidated. The invalidated + * region may be bigger than what would strictly be necessary. (For X11, a + * minimum area will be invalidated if the window has no subwindows, or if the + * edges of the window's parent do not extend beyond the edges of the window. In + * other cases, a multi-step process is used to scroll the window which may + * produce temporary visual artifacts and unnecessary invalidations.) + * @param dx Amount to scroll in the X direction. + * @param dy Amount to scroll in the Y direction. + */ + void scroll(int dx, int dy); + + /** Applies a shape mask to @a window . Pixels in @a window corresponding to + * set bits in the @a mask will be visible; pixels in @a window + * corresponding to unset bits in the @a mask will be transparent. This + * gives a non-rectangular window. + * + * If @a mask is 0, the shape mask will be unset, and the @a x / @a y + * parameters are not used. + * + * On the X11 platform, this uses an X server extension which is + * widely available on most common platforms, but not available on + * very old X servers, and occasionally the implementation will be + * buggy. On servers without the shape extension, this function + * will do nothing. + * + * This function works on both toplevel and child windows. + * @param mask Shape mask. + * @param x X position of shape mask with respect to @a window . + * @param y Y position of shape mask with respect to @a window . + */ + void shape_combine_mask(const Glib::RefPtr& mask, int x, int y); + void unset_shape_combine_mask(); + + + /** Makes pixels in @a window outside @a shape_region be transparent, + * so that the window may be nonrectangular. See also + * gdk_window_shape_combine_mask() to use a bitmap as the mask. + * + * If @a shape_region is 0, the shape will be unset, so the whole + * window will be opaque again. @a offset_x and @a offset_y are ignored + * if @a shape_region is 0. + * + * On the X11 platform, this uses an X server extension which is + * widely available on most common platforms, but not available on + * very old X servers, and occasionally the implementation will be + * buggy. On servers without the shape extension, this function + * will do nothing. + * + * This function works on both toplevel and child windows. + * @param shape_region Region of window to be non-transparent. + * @param offset_x X position of @a shape_region in @a window coordinates. + * @param offset_y Y position of @a shape_region in @a window coordinates. + */ + void shape_combine_region(const Region& shape_region, int offset_x, int offset_y); + + /** Sets the shape mask of @a window to the union of shape masks + * for all children of @a window , ignoring the shape mask of @a window + * itself. Contrast with gdk_window_merge_child_shapes() which includes + * the shape mask of @a window in the masks to be merged. + */ + void set_child_shapes(); + + /** Merges the shape masks for any child windows into the + * shape mask for @a window . i.e. the union of all masks + * for @a window and its children will become the new mask + * for @a window . See gdk_window_shape_combine_mask(). + * + * This function is distinct from gdk_window_set_child_shapes() + * because it includes @a window 's shape mask in the set of shapes to + * be merged. + */ + void merge_child_shapes(); + + /** Checks whether the window has been mapped (with gdk_window_show() or + * gdk_window_show_unraised()). + * @return true if the window is mapped. + */ + bool is_visible() const; + + /** Check if the window and all ancestors of the window are + * mapped. (This is not necessarily "viewable" in the X sense, since + * we only check as far as we have GDK window parents, not to the root + * window.) + * @return true if the window is viewable. + */ + bool is_viewable() const; + + /** Gets the bitwise OR of the currently active window state flags, + * from the Gdk::WindowState enumeration. + * @return Window state bitfield. + */ + WindowState get_state() const; + + /** Set the bit gravity of the given window to static, and flag it so + * all children get static subwindow gravity. This is used if you are + * implementing scary features that involve deep knowledge of the + * windowing system. Don't worry about it unless you have to. + * @param use_static true to turn on static gravity. + * @return true if the server supports static gravity. + */ + bool set_static_gravities(bool use_static = true); + + /** The application can use this call to provide a hint to the window + * manager about the functionality of a window. The window manager + * can use this information when determining the decoration and behaviour + * of the window. + * + * The hint must be set before the window is mapped. + * @param hint A hint of the function this window will have. + */ + void set_type_hint(WindowTypeHint hint); + + /** The application can use this hint to tell the window manager + * that a certain window has modal behaviour. The window manager + * can use this information to handle modal windows in a special + * way. + * + * You should only use this on windows for which you have + * previously called #gdk_window_set_transient_for() + * @param modal true if the window is modal, false otherwise. + */ + void set_modal_hint(bool modal = true); + + /** Sets the geometry hints for @a window . Hints flagged in @a geom_mask + * are set, hints not flagged in @a geom_mask are unset. + * To unset all hints, use a @a geom_mask of 0 and a @a geometry of 0. + * + * This function provides hints to the windowing system about + * acceptable sizes for a toplevel window. The purpose of + * this is to constrain user resizing, but the windowing system + * will typically (but is not required to) also constrain the + * current size of the window to the provided values and + * constrain programatic resizing via gdk_window_resize() or + * gdk_window_move_resize(). + * + * Note that on X11, this effect has no effect on windows + * of type GDK_WINDOW_TEMP or windows where override_redirect + * has been turned on via gdk_window_set_override_redirect() + * since these windows are not resizable by the user. + * + * Since you can't count on the windowing system doing the + * constraints for programmatic resizes, you should generally + * call gdk_window_constrain_size() yourself to determine + * appropriate sizes. + * @param geometry Geometry hints. + * @param geom_mask Bitmask indicating fields of @a geometry to pay attention to. + */ + void set_geometry_hints(const Geometry& geometry, WindowHints geom_mask); + + /** Sets the SM_CLIENT_ID property on the application's leader window so that + * the window manager can save the application's state using the X11R6 ICCCM + * session management protocol. + * + * See the X Session Management Library documentation for more information on + * session management and the Inter-Client Communication Conventions Manual + * (ICCCM) for information on the WM_CLIENT_LEADER property. + * (Both documents are part of the X %Window System distribution.) + * @param sm_client_id The client id assigned by the session manager when the + * connection was opened. + */ + static void set_sm_client_id(const Glib::ustring& sm_client_id); + static void unset_sm_client_id(); + + + /** A convenience wrapper around gdk_window_begin_paint_region() which + * creates a rectangular region for you. See + * gdk_window_begin_paint_region() for details. + * @param rectangle Rectangle you intend to draw to. + */ + void begin_paint_rect(Rectangle&rectangle); + + /** Indicates that you are beginning the process of redrawing @a region . + * A backing store (offscreen buffer) large enough to contain @a region + * will be created. The backing store will be initialized with the + * background color or background pixmap for @a window . Then, all + * drawing operations performed on @a window will be diverted to the + * backing store. When you call gdk_window_end_paint(), the backing + * store will be copied to @a window , making it visible onscreen. Only + * the part of @a window contained in @a region will be modified; that is, + * drawing operations are clipped to @a region . + * + * The net result of all this is to remove flicker, because the user + * sees the finished product appear all at once when you call + * gdk_window_end_paint(). If you draw to @a window directly without + * calling gdk_window_begin_paint_region(), the user may see flicker + * as individual drawing operations are performed in sequence. The + * clipping and background-initializing features of + * gdk_window_begin_paint_region() are conveniences for the + * programmer, so you can avoid doing that work yourself. + * + * When using GTK+, the widget system automatically places calls to + * gdk_window_begin_paint_region() and gdk_window_end_paint() around + * emissions of the expose_event signal. That is, if you're writing an + * expose event handler, you can assume that the exposed area in + * Gdk::EventExpose has already been cleared to the window background, + * is already set as the clip region, and already has a backing store. + * Therefore in most cases, application code need not call + * gdk_window_begin_paint_region(). (You can disable the automatic + * calls around expose events on a widget-by-widget basis by calling + * gtk_widget_set_double_buffered().) + * + * If you call this function multiple times before calling the + * matching gdk_window_end_paint(), the backing stores are pushed onto + * a stack. gdk_window_end_paint() copies the topmost backing store + * onscreen, subtracts the topmost region from all other regions in + * the stack, and pops the stack. All drawing operations affect only + * the topmost backing store in the stack. One matching call to + * gdk_window_end_paint() is required for each call to + * gdk_window_begin_paint_region(). + * @param region Region you intend to draw to. + */ + void begin_paint_region(const Region& region); + + /** Indicates that the backing store created by the most recent call to + * gdk_window_begin_paint_region() should be copied onscreen and + * deleted, leaving the next-most-recent backing store or no backing + * store at all as the active paint region. See + * gdk_window_begin_paint_region() for full details. It is an error to + * call this function without a matching + * gdk_window_begin_paint_region() first. + */ + void end_paint(); + + /** Sets the title of a toplevel window, to be displayed in the titlebar. + * If you haven't explicitly set the icon name for the window + * (using gdk_window_set_icon_name()), the icon name will be set to + * @a title as well. @a title must be in UTF-8 encoding (as with all + * user-readable strings in GDK/GTK+). @a title may not be 0. + * @param title Title of @a window . + */ + void set_title(const Glib::ustring& title); + + /** When using GTK+, typically you should use gtk_window_set_role() instead + * of this low-level function. + * + * The window manager and session manager use a window's role to + * distinguish it from other kinds of window in the same application. + * When an application is restarted after being saved in a previous + * session, all windows with the same title and role are treated as + * interchangeable. So if you have two windows with the same title + * that should be distinguished for session management purposes, you + * should set the role on those windows. It doesn't matter what string + * you use for the role, as long as you have a different role for each + * non-interchangeable kind of window. + * @param role A string indicating its role. + */ + void set_role(const Glib::ustring& role); + + /** Indicates to the window manager that @a window is a transient dialog + * associated with the application window @a parent . This allows the + * window manager to do things like center @a window on @a parent and + * keep @a window above @a parent . + * + * See gtk_window_set_transient_for() if you're using Gtk::Window or + * Gtk::Dialog. + * @param parent Another toplevel Gdk::Window. + */ + void set_transient_for(const Glib::RefPtr& parent); + + /** Sets the background color of @a window . (However, when using GTK+, + * set the background of a widget with gtk_widget_modify_bg() - if + * you're an application - or gtk_style_set_background() - if you're + * implementing a custom widget.) + * + * The @a color must be allocated; gdk_rgb_find_color() is the best way + * to allocate a color. + * + * See also gdk_window_set_back_pixmap(). + * @param color An allocated Gdk::Color. + */ + void set_background(const Color& color); + + /** Sets the background pixmap of @a window . May also be used to set a background of + * "None" on @a window , by setting a background pixmap of 0. + * A background pixmap will be tiled, positioning the first tile at the origin of + * @a window , or if @a parent_relative is true, the tiling will be done based on the + * origin of the parent window (useful to align tiles in a parent with tiles + * in a child). + * + * A background pixmap of 0 means that the window will have no + * background. A window with no background will never have its + * background filled by the windowing system, instead the window will + * contain whatever pixels were already in the corresponding area of + * the display. + * + * The windowing system will normally fill a window with its background + * when the window is obscured then exposed, and when you call + * gdk_window_clear(). + * @param pixmap A Gdk::Pixmap, or 0. + * @param parent_relative Whether the tiling origin is at the origin of @a window 's parent. + */ + void set_back_pixmap(const Glib::RefPtr&pixmap, bool parent_relative); + + /** Sets the mouse pointer for a Gdk::Window. + * To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create + * a cursor with no pixels in it. + * @param cursor A cursor. + */ + void set_cursor(const Cursor& cursor); + + /** Use the parent window's cursor. + * For top-level windows this means that it will use the default cursor for the ROOT window. + */ + void set_cursor(); + + + /** Retrieves the user data for @a window , which is normally the widget + * that @a window belongs to. See gdk_window_set_user_data(). + * @param data Return location for user data. + */ + void get_user_data(gpointer* data); + + /** Any of the return location arguments to this function may be 0, + * if you aren't interested in getting the value of that field. + * + * The X and Y coordinates returned are relative to the parent window + * of @a window , which for toplevels usually means relative to the + * window decorations (titlebar, etc.) rather than relative to the + * root window (screen-size background window). + * + * On the X11 platform, the geometry is obtained from the X server, + * so reflects the latest position of @a window ; this may be out-of-sync + * with the position of @a window delivered in the most-recently-processed + * Gdk::EventConfigure. gdk_window_get_position() in contrast gets the + * position from the most recent configure event. + * + * <note> + * If @a window is not a toplevel, it is much better + * to call gdk_window_get_position() and Gdk::Drawable::get_size() instead, + * because it avoids the roundtrip to the X server and because + * Gdk::Drawable::get_size() supports the full 32-bit coordinate space, + * whereas gdk_window_get_geometry() is restricted to the 16-bit + * coordinates of X11. + * </note> + * @param x Return location for X coordinate of window (relative to its parent). + * @param y Return location for Y coordinate of window (relative to its parent). + * @param width Return location for width of window. + * @param height Return location for height of window. + * @param depth Return location for bit depth of window. + */ + void get_geometry(int& x, int& y, int& width, int& height, int& depth) const; + + /** Obtains the position of the window as reported in the + * most-recently-processed Gdk::EventConfigure. Contrast with + * gdk_window_get_geometry() which queries the X server for the + * current window position, regardless of which events have been + * received or processed. + * + * The position coordinates are relative to the window's parent window. + * @param x X coordinate of window. + * @param y Y coordinate of window. + */ + void get_position(int& x, int& y) const; + + /** Obtains the position of a window in root window coordinates. + * (Compare with gdk_window_get_position() and + * gdk_window_get_geometry() which return the position of a window + * relative to its parent window.) + * @param x Return location for X coordinate. + * @param y Return location for Y coordinate. + * @return Not meaningful, ignore. + */ + int get_origin(int& x, int& y) const; + //_WRAP_METHOD(bool get_deskrelative_origin(int& x, int& y), gdk_window_get_deskrelative_origin) + + /** Obtains the top-left corner of the window manager frame in root + * window coordinates. + * @param x Return location for X position of window frame. + * @param y Return location for Y position of window frame. + */ + void get_root_origin(int& x, int& y) const; + + /** Obtains the bounding box of the window, including window manager + * titlebar/borders if any. The frame position is given in root window + * coordinates. To get the position of the window itself (rather than + * the frame) in root window coordinates, use gdk_window_get_origin(). + * @param rect Rectangle to fill with bounding box of the window frame. + */ + void get_frame_extents(Rectangle& rect); + + /** Obtains the current pointer position and modifier state. + * The position is given in coordinates relative to @a window . + * @param x Return location for X coordinate of pointer. + * @param y Return location for Y coordinate of pointer. + * @param mask Return location for modifier mask. + * @return The window containing the pointer (as with + * gdk_window_at_pointer()), or 0 if the window containing the + * pointer isn't known to GDK. + */ + Glib::RefPtr get_pointer(int& x, int& y, ModifierType& mask); + + /** Obtains the parent of @a window , as known to GDK. Does not query the + * X server; thus this returns the parent as passed to gdk_window_new(), + * not the actual parent. This should never matter unless you're using + * Xlib calls mixed with GDK calls on the X11 platform. It may also + * matter for toplevel windows, because the window manager may choose + * to reparent them. + * @return Parent of @a window . + */ + Glib::RefPtr get_parent(); + + /** Obtains the parent of @a window , as known to GDK. Does not query the + * X server; thus this returns the parent as passed to gdk_window_new(), + * not the actual parent. This should never matter unless you're using + * Xlib calls mixed with GDK calls on the X11 platform. It may also + * matter for toplevel windows, because the window manager may choose + * to reparent them. + * @return Parent of @a window . + */ + Glib::RefPtr get_parent() const; + + /** Gets the toplevel window that's an ancestor of @a window . + * @return The toplevel window containing @a window . + */ + Glib::RefPtr get_toplevel(); + + /** Gets the toplevel window that's an ancestor of @a window . + * @return The toplevel window containing @a window . + */ + Glib::RefPtr get_toplevel() const; + + + /** Gets the list of children of @a window known to GDK. + * This function only returns children created via GDK, + * so for example it's useless when used with the root window; + * it only returns windows an application created itself. + * + * The returned list must be freed, but the elements in the + * list need not be. + * @return List of child windows inside @a window . + */ + Glib::ListHandle< Glib::RefPtr > get_children(); + + /** Gets the list of children of @a window known to GDK. + * This function only returns children created via GDK, + * so for example it's useless when used with the root window; + * it only returns windows an application created itself. + * + * The returned list must be freed, but the elements in the + * list need not be. + * @return List of child windows inside @a window . + */ + Glib::ListHandle< Glib::RefPtr > get_children() const; + //gdk_window_peek_children() is the same as gdk_window_get_children() with different memory mangement of the list. + + + /** Gets the event mask for @a window . See gdk_window_set_events(). + * @return Event mask for @a window . + */ + EventMask get_events() const; + + /** The event mask for a window determines which events will be reported + * for that window. For example, an event mask including Gdk::BUTTON_PRESS_MASK + * means the window should report button press events. The event mask + * is the bitwise OR of values from the Gdk::EventMask enumeration. + * @param event_mask Event mask for @a window . + */ + void set_events(EventMask event_mask); + + + /** Sets a list of icons for the window. One of these will be used + * to represent the window when it has been iconified. The icon is + * usually shown in an icon box or some sort of task bar. Which icon + * size is shown depends on the window manager. The window manager + * can scale the icon but setting several size icons can give better + * image quality since the window manager may only need to scale the + * icon by a small amount or not at all. + * @param pixbufs A list of pixbufs, of different sizes. + */ + void set_icon_list(const Glib::ListHandle< Glib::RefPtr >& pixbufs); + + /** Sets the icon of @a window as a pixmap or window. If using GTK+, investigate + * gtk_window_set_default_icon_list() first, and then gtk_window_set_icon_list() + * and gtk_window_set_icon(). If those don't meet your needs, look at + * gdk_window_set_icon_list(). Only if all those are too high-level do you + * want to fall back to gdk_window_set_icon(). + * @param icon_window A Gdk::Window to use for the icon. + * @param pixmap A Gdk::Pixmap to use as the icon,. + * @param mask A 1-bit pixmap (Gdk::Bitmap) to use as mask for @a pixmap . + */ + void set_icon(const Glib::RefPtr& icon_window, const Glib::RefPtr& pixmap, const Glib::RefPtr& mask); + void set_icon(const Glib::RefPtr& icon_window, const Glib::RefPtr& pixmap); + void unset_icon(); + + /** Windows may have a name used while minimized, distinct from the + * name they display in their titlebar. Most of the time this is a bad + * idea from a user interface standpoint. But you can set such a name + * with this function, if you like. + * @param name Name of window while iconified (minimized). + */ + void set_icon_name(const Glib::ustring& name); + + + /** Sets the group leader window for @a window . By default, + * GDK sets the group leader for all toplevel windows + * to a global window implicitly created by GDK. With this function + * you can override this default. + * + * The group leader window allows the window manager to distinguish + * all windows that belong to a single application. It may for example + * allow users to minimize/unminimize all windows belonging to an + * application at once. You should only set a non-default group window + * if your application pretends to be multiple applications. + * @param leader Group leader window, or 0 to restore the default group leader window. + */ + void set_group(const Glib::RefPtr& leader); + + /** Returns the group leader window for @a window . See gdk_window_set_group(). + * @return The group leader window for @a window + * + * Since: 2.4. + */ + Glib::RefPtr get_group(); + + /** Returns the group leader window for @a window . See gdk_window_set_group(). + * @return The group leader window for @a window + * + * Since: 2.4. + */ + Glib::RefPtr get_group() const; + + + /** "Decorations" are the features the window manager adds to a toplevel Gdk::Window. + * This function sets the traditional Motif window manager hints that tell the + * window manager which decorations you would like your window to have. + * Usually you should use gtk_window_set_decorated() on a Gtk::Window instead of + * using the GDK function directly. + * + * The @a decorations argument is the logical OR of the fields in + * the Gdk::WMDecoration enumeration. If Gdk::DECOR_ALL is included in the + * mask, the other bits indicate which decorations should be turned off. + * If Gdk::DECOR_ALL is not included, then the other bits indicate + * which decorations should be turned on. + * + * Most window managers honor a decorations hint of 0 to disable all decorations, + * but very few honor all possible combinations of bits. + * @param decorations Decoration hint mask. + */ + void set_decorations(WMDecoration decorations); + + /** Returns the decorations set on the GdkWindow with #gdk_window_set_decorations + * @param decorations The window decorations will be written here. + * @return true if the window has decorations set, false otherwise. + */ + bool get_decorations(WMDecoration& decorations) const; + + /** This function isn't really good for much. It sets the traditional + * Motif window manager hint for which operations the window manager + * should allow on a toplevel window. However, few window managers do + * anything reliable or interesting with this hint. Many ignore it + * entirely. + * + * The @a functions argument is the logical OR of values from the + * Gdk::WMFunction enumeration. If the bitmask includes Gdk::FUNC_ALL, + * then the other bits indicate which functions to disable; if + * it doesn't include Gdk::FUNC_ALL, it indicates which functions to + * enable. + * @param functions Bitmask of operations to allow on @a window . + */ + void set_functions(WMFunction functions); + + + /** Obtains a list of all toplevel windows known to GDK on the default + * screen (see gdk_window_get_toplevels_for_screen()). + * A toplevel window is a child of the root window (see + * gdk_get_default_root_window()). + * @return List of toplevel windows. + */ + static Glib::ListHandle< Glib::RefPtr > get_toplevels(); + + + /** Asks to iconify (minimize) @a window . The window manager may choose + * to ignore the request, but normally will honor it. Using + * gtk_window_iconify() is preferred, if you have a Gtk::Window widget. + * + * This function only makes sense when @a window is a toplevel window. + */ + void iconify(); + + /** Attempt to deiconify (unminimize) @a window . On X11 the window manager may + * choose to ignore the request to deiconify. When using GTK+, + * use gtk_window_deiconify() instead of the Gdk::Window variant. Or better yet, + * you probably want to use gtk_window_present(), which raises the window, focuses it, + * unminimizes it, and puts it on the current desktop. + */ + void deiconify(); + + /** "Pins" a window such that it's on all workspaces and does not scroll + * with viewports, for window managers that have scrollable viewports. + * (When using Gtk::Window, gtk_window_stick() may be more useful.) + * + * On the X11 platform, this function depends on window manager + * support, so may have no effect with many window managers. However, + * GDK will do the best it can to convince the window manager to stick + * the window. For window managers that don't support this operation, + * there's nothing you can do to force it to happen. + */ + void stick(); + + /** Reverse operation for gdk_window_stick(); see gdk_window_stick(), + * and gtk_window_unstick(). + */ + void unstick(); + + /** Maximizes the window. If the window was already maximized, then + * this function does nothing. + * + * On X11, asks the window manager to maximize @a window , if the window + * manager supports this operation. Not all window managers support + * this, and some deliberately ignore it or don't have a concept of + * "maximized"; so you can't rely on the maximization actually + * happening. But it will happen with most standard window managers, + * and GDK makes a best effort to get it to happen. + * + * On Windows, reliably maximizes the window. + */ + void maximize(); + + /** Unmaximizes the window. If the window wasn't maximized, then this + * function does nothing. + * + * On X11, asks the window manager to unmaximize @a window , if the + * window manager supports this operation. Not all window managers + * support this, and some deliberately ignore it or don't have a + * concept of "maximized"; so you can't rely on the unmaximization + * actually happening. But it will happen with most standard window + * managers, and GDK makes a best effort to get it to happen. + * + * On Windows, reliably unmaximizes the window. + */ + void unmaximize(); + + void register_dnd(); + + /** Begins a window resize operation (for a toplevel window). + * You might use this function to implement a "window resize grip," for + * example; in fact Gtk::Statusbar uses it. The function works best + * with window managers that support the Extended Window Manager Hints spec + * (see http://www.freedesktop.org), but has a fallback implementation + * for other window managers. + * @param edge The edge or corner from which the drag is started. + * @param button The button being used to drag. + * @param root_x Root window X coordinate of mouse click that began the drag. + * @param root_y Root window Y coordinate of mouse click that began the drag. + * @param timestamp Timestamp of mouse click that began the drag (use gdk_event_get_time()). + */ + void begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp); + + /** Begins a window move operation (for a toplevel window). You might + * use this function to implement a "window move grip," for + * example. The function works best with window managers that support + * the Extended Window Manager Hints spec (see + * http://www.freedesktop.org), but has a fallback implementation for + * other window managers. + * @param button The button being used to drag. + * @param root_x Root window X coordinate of mouse click that began the drag. + * @param root_y Root window Y coordinate of mouse click that began the drag. + * @param timestamp Timestamp of mouse click that began the drag. + */ + void begin_move_drag(int button, int root_x, int root_y, guint32 timestamp); + + /** A convenience wrapper around gdk_window_invalidate_region() which + * invalidates a rectangular region. See + * gdk_window_invalidate_region() for details. + * @param rect Rectangle to invalidate. + * @param invalidate_children Whether to also invalidate child windows. + */ + void invalidate_rect(const Rectangle& rect, bool invalidate_children); + + + /** Adds @a region to the update area for @a window . The update area is the + * region that needs to be redrawn, or "dirty region." The call + * gdk_window_process_updates() sends one or more expose events to the + * window, which together cover the entire update area. An + * application would normally redraw the contents of @a window in + * response to those expose events. + * + * GDK will call gdk_window_process_all_updates() on your behalf + * whenever your program returns to the main loop and becomes idle, so + * normally there's no need to do that manually, you just need to + * invalidate regions that you know should be redrawn. + * + * The @a invalidate_children parameter controls whether the region of + * each child window that intersects @a region will also be invalidated. + * If false, then the update area for child windows will remain + * unaffected. See gdk_window_invalidate_maybe_recurse if you need + * fine grained control over which children are invalidated. + * @param region A Gdk::Region. + * @param invalidate_children true to also invalidate child windows. + */ + void invalidate_region(const Region& region, bool invalidate_children = true); + + //TODO: Rewrite the docs, to be more C++-like. + + /** Transfers ownership of the update area from @a window to the caller + * of the function. That is, after calling this function, @a window will + * no longer have an invalid/dirty region; the update area is removed + * from @a window and handed to you. If a window has no update area, + * gdk_window_get_update_area() returns 0. You are responsible for + * calling gdk_region_destroy() on the returned region if it's non-0. + * @return The update area for @a window . + */ + Region get_update_area(); + //This method should not have a const version - see the docs. + + + /** Temporarily freezes a window such that it won't receive expose + * events. The window will begin receiving expose events again when + * Gdk::Window::thaw_updates() is called. If Gdk::Window::freeze_updates() + * has been called more than once, Gdk::Window::thaw_updates() must be called + * an equal number of times to begin processing exposes. + */ + void freeze_updates(); + + /** Thaws a window frozen with Gdk::Window::freeze_updates(). + */ + void thaw_updates(); + + /** Calls gdk_window_process_updates() for all windows (see Gdk::Window) + * in the application. + */ + static void process_all_updates(); + + /** Sends one or more expose events to @a window . The areas in each + * expose event will cover the entire update area for the window (see + * gdk_window_invalidate_region() for details). Normally GDK calls + * gdk_window_process_all_updates() on your behalf, so there's no + * need to call this function unless you want to force expose events + * to be delivered immediately and synchronously (vs. the usual + * case, where GDK delivers them in an idle handler). Occasionally + * this is useful to produce nicer scrolling behavior, for example. + * @param update_children Whether to also process updates for child windows. + */ + void process_updates(bool update_children); + + /** With update debugging enabled, calls to + * gdk_window_invalidate_region() clear the invalidated region of the + * screen to a noticeable color, and GDK pauses for a short time + * before sending exposes to windows during + * gdk_window_process_updates(). The net effect is that you can see + * the invalid region for each window and watch redraws as they + * occur. This allows you to diagnose inefficiencies in your application. + * + * In essence, because the GDK rendering model prevents all flicker, + * if you are redrawing the same region 400 times you may never + * notice, aside from noticing a speed problem. Enabling update + * debugging causes GTK to flicker slowly and noticeably, so you can + * see exactly what's being redrawn when, in what order. + * + * The --gtk-debug=updates command line option passed to GTK+ programs + * enables this debug option at application startup time. That's + * usually more useful than calling gdk_window_set_debug_updates() + * yourself, though you might want to use this function to enable + * updates sometime after application startup time. + * @param setting true to turn on update debugging. + */ + static void set_debug_updates(bool setting = true); + + /** Constrains a desired width and height according to a + * set of geometry hints (such as minimum and maximum size). + * @param geometry A Gdk::Geometry structure. + * @param flags A mask indicating what portions of @a geometry are set. + * @param width Desired width of window. + * @param height Desired height of the window. + * @param new_width Location to store resulting width. + * @param new_height Location to store resulting height. + */ + static void constrain_size(const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height); + void get_internal_paint_info(Glib::RefPtr& real_drawable, int& x_offset, int& y_offset) const; + + + /** Indicates that the application will cooperate with the window + * system in synchronizing the window repaint with the window + * manager during resizing operations. After an application calls + * this function, it must call gdk_window_configure_finished() every + * time it has finished all processing associated with a set of + * Configure events. Toplevel GTK+ windows automatically use this + * protocol. + * + * On X, calling this function makes @a window participate in the + * _NET_WM_SYNC_REQUEST window manager protocol. + * + * Since: 2.6 + */ + void enable_synchronized_configure(); + + /** Signal to the window system that the application has finished + * handling Configure events it has received. Window Managers can + * use this to better synchronize the frame repaint with the + * application. GTK+ applications will automatically call this + * function when appropriate. + * + * This function can only be called if gdk_window_use_configure() + * was called previously. + * + * Since: 2.6 + */ + void configure_finished(); + + + /** Toggles whether a window should appear in a task list or window + * list. If a window's semantic type as specified with + * gdk_window_set_type_hint() already fully describes the window, this + * function should NOT be called in addition, instead you should allow + * the window to be treated according to standard policy for its + * semantic type. + * + * Since: 2.2 + * @param skips_taskbar true to skip the taskbar. + */ + void set_skip_taskbar_hint(bool skips_taskbar = true); + + /** Toggles whether a window should appear in a pager (workspace + * switcher, or other desktop utility program that displays a small + * thumbnail representation of the windows on the desktop). If a + * window's semantic type as specified with gdk_window_set_type_hint() + * already fully describes the window, this function should NOT be + * called in addition, instead you should allow the window to be + * treated according to standard policy for its semantic type. + * + * Since: 2.2 + * @param skips_pager true to skip the pager. + */ + void set_skip_pager_hint(bool skips_pager = true); + + + /** Moves the window into fullscreen mode. This means the + * window covers the entire screen and is above any panels + * or task bars. + * + * If the window was already fullscreen, then this function does nothing. + * + * On X11, asks the window manager to put @a window in a fullscreen + * state, if the window manager supports this operation. Not all + * window managers support this, and some deliberately ignore it or + * don't have a concept of "fullscreen"; so you can't rely on the + * fullscreenification actually happening. But it will happen with + * most standard window managers, and GDK makes a best effort to get + * it to happen. + * + * Since: 2.2 + */ + void fullscreen(); + + /** Moves the window out of fullscreen mode. If the window was not + * fullscreen, does nothing. + * + * On X11, asks the window manager to move @a window out of the fullscreen + * state, if the window manager supports this operation. Not all + * window managers support this, and some deliberately ignore it or + * don't have a concept of "fullscreen"; so you can't rely on the + * unfullscreenification actually happening. But it will happen with + * most standard window managers, and GDK makes a best effort to get + * it to happen. + * + * Since: 2.2 + */ + void unfullscreen(); + + + GrabStatus pointer_grab(bool owner_events, EventMask event_mask, const Glib::RefPtr& confine_to, const Cursor& cursor, guint32 time_); + + /** Grabs the pointer to a specific window. + * Requires a corresponding call to pointer_ungrab(). + * + * Arguments: + * @param owner_events Specifies whether events will be reported as is, or relative to the window. + * @param event_mask Masks only interesting events. + * @param cursor Changes the cursor for the duration of the grab. + * @param timestamp Specifies the time. + */ + GrabStatus pointer_grab(bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 timestamp); + + /** Grabs the pointer to a specific window. + * Requires a corresponding call to pointer_ungrab(). + * + * Arguments: + * @param owner_events Specifies whether events will be reported as is, or relative to the window. + * @param event_mask Masks only interesting events. + * @param timestamp Specifies the time. + */ + GrabStatus pointer_grab(bool owner_events, EventMask event_mask, guint32 timestamp); + + + /** Ungrabs the pointer, if it is grabbed by this application. + * @param timestamp A timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no + * timestamp is available. + */ + static void pointer_ungrab(guint32 timestamp); + + GrabStatus keyboard_grab(bool owner_events, guint32 timestamp); + + /** Ungrabs the keyboard, if it is grabbed by this application. + * @param timestamp A timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no + * timestamp is available. + */ + static void keyboard_ungrab(guint32 timestamp); + + + /** Set if @a window must be kept above other windows. If the + * window was already above, then this function does nothing. + * + * On X11, asks the window manager to keep @a window above, if the window + * manager supports this operation. Not all window managers support + * this, and some deliberately ignore it or don't have a concept of + * "keep above"; so you can't rely on the window being kept above. + * But it will happen with most standard window managers, + * and GDK makes a best effort to get it to happen. + * + * Since: 2.4 + * @param setting Whether to keep @a window above other windows. + */ + void set_keep_above(bool setting = true); + + /** Set if @a window must be kept below other windows. If the + * window was already below, then this function does nothing. + * + * On X11, asks the window manager to keep @a window below, if the window + * manager supports this operation. Not all window managers support + * this, and some deliberately ignore it or don't have a concept of + * "keep below"; so you can't rely on the window being kept below. + * But it will happen with most standard window managers, + * and GDK makes a best effort to get it to happen. + * + * Since: 2.4 + * @param setting Whether to keep @a window below other windows. + */ + void set_keep_below(bool setting = true); + + + /** Setting @a accept_focus to false hints the desktop environment that the + * window doesn't want to receive input focus. + * + * On X, it is the responsibility of the window manager to interpret this + * hint. ICCCM-compliant window manager usually respect it. + * + * Since: 2.4 + * @param accept_focus true if the window should receive input focus. + */ + void set_accept_focus(bool accept_focus = true); + + + /** Setting @a focus_on_map to false hints the desktop environment that the + * window doesn't want to receive input focus when it is mapped. + * focus_on_map should be turned off for windows that aren't triggered + * interactively (such as popups from network activity). + * + * On X, it is the responsibility of the window manager to interpret + * this hint. %Window managers following the freedesktop.org window + * manager extension specification should respect it. + * + * Since: 2.6 + * @param focus_on_map true if the window should receive input focus when mapped. + */ + void set_focus_on_map(bool focus_on_map); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gdk */ + + +namespace Glib +{ + /** @relates Gdk::Window + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GdkWindowObject* object, bool take_copy = false); +} + + +#endif /* _GDKMM_WINDOW_H */ + diff --git a/libs/gtkmm2/gdk/gdkmm/wrap_init.cc b/libs/gtkmm2/gdk/gdkmm/wrap_init.cc new file mode 100644 index 0000000000..e859fb7e76 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/wrap_init.cc @@ -0,0 +1,135 @@ + +#include + +// Disable the 'const' function attribute of the get_type() functions. +// GCC would optimize them out because we don't use the return value. +#undef G_GNUC_CONST +#define G_GNUC_CONST /* empty */ + +#include +#include +#include + +// #include the widget headers so that we can call the get_type() static methods: + +#include "bitmap.h" +#include "color.h" +#include "colormap.h" +#include "cursor.h" +#include "device.h" +#include "display.h" +#include "displaymanager.h" +#include "dragcontext.h" +#include "drawable.h" +#include "event.h" +#include "gc.h" +#include "image.h" +#include "pixbuf.h" +#include "pixbufanimation.h" +#include "pixbufanimationiter.h" +#include "pixmap.h" +#include "pixbufformat.h" +#include "pixbufloader.h" +#include "rectangle.h" +#include "region.h" +#include "rgbcmap.h" +#include "screen.h" +#include "types.h" +#include "visual.h" +#include "window.h" + +extern "C" +{ + +//Declarations of the *_get_type() functions: + +GType gdk_colormap_get_type(void); +GType gdk_device_get_type(void); +GType gdk_display_get_type(void); +GType gdk_display_manager_get_type(void); +GType gdk_drag_context_get_type(void); +GType gdk_drawable_get_type(void); +GType gdk_gc_get_type(void); +GType gdk_image_get_type(void); +GType gdk_pixbuf_get_type(void); +GType gdk_pixbuf_animation_get_type(void); +GType gdk_pixbuf_animation_iter_get_type(void); +GType gdk_pixbuf_loader_get_type(void); +GType gdk_pixmap_get_type(void); +GType gdk_screen_get_type(void); +GType gdk_visual_get_type(void); +GType gdk_window_object_get_type(void); + +//Declarations of the *_error_quark() functions: + +GQuark gdk_pixbuf_error_quark(void); +} // extern "C" + + +//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers: + +namespace Gdk { class Colormap_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Device_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Display_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class DisplayManager_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class DragContext_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Drawable_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class GC_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Image_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Pixbuf_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class PixbufAnimation_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class PixbufAnimationIter_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class PixbufLoader_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Pixmap_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Screen_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Visual_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Gdk { class Window_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } + +namespace Gdk { + +void wrap_init() +{ + // Register Error domains: + Glib::Error::register_domain(gdk_pixbuf_error_quark(), &Gdk::PixbufError::throw_func); + +// Map gtypes to gtkmm wrapper-creation functions: + Glib::wrap_register(gdk_colormap_get_type(), &Gdk::Colormap_Class::wrap_new); + Glib::wrap_register(gdk_device_get_type(), &Gdk::Device_Class::wrap_new); + Glib::wrap_register(gdk_display_get_type(), &Gdk::Display_Class::wrap_new); + Glib::wrap_register(gdk_display_manager_get_type(), &Gdk::DisplayManager_Class::wrap_new); + Glib::wrap_register(gdk_drag_context_get_type(), &Gdk::DragContext_Class::wrap_new); + Glib::wrap_register(gdk_drawable_get_type(), &Gdk::Drawable_Class::wrap_new); + Glib::wrap_register(gdk_gc_get_type(), &Gdk::GC_Class::wrap_new); + Glib::wrap_register(gdk_image_get_type(), &Gdk::Image_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_get_type(), &Gdk::Pixbuf_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_animation_get_type(), &Gdk::PixbufAnimation_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_animation_iter_get_type(), &Gdk::PixbufAnimationIter_Class::wrap_new); + Glib::wrap_register(gdk_pixbuf_loader_get_type(), &Gdk::PixbufLoader_Class::wrap_new); + Glib::wrap_register(gdk_pixmap_get_type(), &Gdk::Pixmap_Class::wrap_new); + Glib::wrap_register(gdk_screen_get_type(), &Gdk::Screen_Class::wrap_new); + Glib::wrap_register(gdk_visual_get_type(), &Gdk::Visual_Class::wrap_new); + Glib::wrap_register(gdk_window_object_get_type(), &Gdk::Window_Class::wrap_new); + + // Register the gtkmm gtypes: + Gdk::Colormap::get_type(); + Gdk::Device::get_type(); + Gdk::Display::get_type(); + Gdk::DisplayManager::get_type(); + Gdk::DragContext::get_type(); + Gdk::Drawable::get_type(); + Gdk::GC::get_type(); + Gdk::Image::get_type(); + Gdk::Pixbuf::get_type(); + Gdk::PixbufAnimation::get_type(); + Gdk::PixbufAnimationIter::get_type(); + Gdk::PixbufLoader::get_type(); + Gdk::Pixmap::get_type(); + Gdk::Screen::get_type(); + Gdk::Visual::get_type(); + Gdk::Window::get_type(); + +} // wrap_init() + +} //Gdk + + diff --git a/libs/gtkmm2/gdk/gdkmm/wrap_init.h b/libs/gtkmm2/gdk/gdkmm/wrap_init.h new file mode 100644 index 0000000000..e27d2122a7 --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmm/wrap_init.h @@ -0,0 +1,32 @@ +#ifndef _GDKMM_WRAP_INIT_H +#define _GDKMM_WRAP_INIT_H + +/* wrap_init.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// wrap_init.cc is generated by tools/generate_wrap_init.pl + +namespace Gdk +{ + +void wrap_init(); + +} /* namespace Gdk */ + +#endif // _GDKMM_WRAP_INIT_H diff --git a/libs/gtkmm2/gdk/gdkmmconfig.h b/libs/gtkmm2/gdk/gdkmmconfig.h new file mode 100644 index 0000000000..cbfb1a34da --- /dev/null +++ b/libs/gtkmm2/gdk/gdkmmconfig.h @@ -0,0 +1,8 @@ +/* gdk/gdkmmconfig.h. Generated by configure. */ +#ifndef _GDKMM_CONFIG_H +#define _GDKMM_CONFIG_H 1 + +#include + +#endif /* _GDKMM_CONFIG_H */ + diff --git a/libs/gtkmm2/gtk/SConscript b/libs/gtkmm2/gtk/SConscript new file mode 100644 index 0000000000..ecf8417230 --- /dev/null +++ b/libs/gtkmm2/gtk/SConscript @@ -0,0 +1,10 @@ +import glob + +gtkmm2_files = glob.glob('gtkmm/*.cc') + +Import('env libraries') +gtkmm2 = env.Copy() +gtkmm2.Merge([libraries['glibmm2'], libraries['gtk2'], libraries['sigc2'], libraries['pangomm'], libraries['atkmm'], libraries['gdkmm2'] ]) + +libgtkmm2 = gtkmm2.StaticLibrary('gtkmm2', gtkmm2_files) +Default(libgtkmm2) diff --git a/libs/gtkmm2/gtk/gtkmm.h b/libs/gtkmm2/gtk/gtkmm.h new file mode 100644 index 0000000000..cb8411a3e3 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm.h @@ -0,0 +1,156 @@ +/* $Id$ */ +/* gtkmm - a C++ wrapper for the Gtk toolkit + * + * Copyright 1999-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GTKMM_H +#define _GTKMM_H + +/* Gtkmm version. */ +extern const int gtkmm_major_version; +extern const int gtkmm_minor_version; +extern const int gtkmm_micro_version; + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //TODO: Deprecated. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //TODO: Deprecated. +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* #ifndef GTKMM_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/aboutdialog.cc b/libs/gtkmm2/gtk/gtkmm/aboutdialog.cc new file mode 100644 index 0000000000..24b97e3b39 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/aboutdialog.cc @@ -0,0 +1,477 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace //anonymous +{ + +// This Signal Proxy allows the C++ coder to specify +// a sigc::slot instead of a static function. +class SignalProxy_ActivateLink +{ +public: + typedef Gtk::AboutDialog::SlotActivateLink SlotType; + + SignalProxy_ActivateLink(const SlotType& slot) + : slot_(slot) {} + + ~SignalProxy_ActivateLink(); + + static void gtk_callback(GtkAboutDialog* about, const gchar* link, gpointer data); + static void gtk_callback_destroy(void* data); + +private: + SlotType slot_; +}; + +SignalProxy_ActivateLink::~SignalProxy_ActivateLink() +{} + +void SignalProxy_ActivateLink::gtk_callback(GtkAboutDialog* about, const gchar* link, gpointer data) +{ + SignalProxy_ActivateLink *const self = static_cast(data); + + try + { + Gtk::AboutDialog* pCppAbout = Glib::wrap(about); + (self->slot_)( *pCppAbout, Glib::convert_const_gchar_ptr_to_ustring(link) ); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + +} + +void SignalProxy_ActivateLink::gtk_callback_destroy(void* data) +{ + delete static_cast(data); +} + +} // anonymous namespace + + +namespace Gtk +{ + +//static: +void AboutDialog::set_email_hook(const SlotActivateLink& slot) +{ + // Create a signal proxy. A pointer to this will be passed + // through the callback's data parameter. It will be deleted + // when SignalProxy_ActivateLink::gtk_callback_destroy() is called. + SignalProxy_ActivateLink *const pSignalProxy = new SignalProxy_ActivateLink(slot); + + gtk_about_dialog_set_email_hook( + &SignalProxy_ActivateLink::gtk_callback, pSignalProxy, + &SignalProxy_ActivateLink::gtk_callback_destroy); +} + +//static: +void AboutDialog::set_url_hook(const SlotActivateLink& slot) +{ + // Create a signal proxy. A pointer to this will be passed + // through the callback's data parameter. It will be deleted + // when SignalProxy_ActivateLink::gtk_callback_destroy() is called. + SignalProxy_ActivateLink *const pSignalProxy = new SignalProxy_ActivateLink(slot); + + gtk_about_dialog_set_url_hook( + &SignalProxy_ActivateLink::gtk_callback, pSignalProxy, + &SignalProxy_ActivateLink::gtk_callback_destroy); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::AboutDialog* wrap(GtkAboutDialog* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& AboutDialog_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &AboutDialog_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_about_dialog_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void AboutDialog_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* AboutDialog_Class::wrap_new(GObject* o) +{ + return new AboutDialog((GtkAboutDialog*)(o)); //top-level windows can not be manage()ed. + +} + + +/* The implementation: */ + +AboutDialog::AboutDialog(const Glib::ConstructParams& construct_params) +: + Gtk::Dialog(construct_params) +{ + } + +AboutDialog::AboutDialog(GtkAboutDialog* castitem) +: + Gtk::Dialog((GtkDialog*)(castitem)) +{ + } + +AboutDialog::~AboutDialog() +{ + destroy_(); +} + +AboutDialog::CppClassType AboutDialog::aboutdialog_class_; // initialize static member + +GType AboutDialog::get_type() +{ + return aboutdialog_class_.init().get_type(); +} + +GType AboutDialog::get_base_type() +{ + return gtk_about_dialog_get_type(); +} + + +AboutDialog::AboutDialog() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(aboutdialog_class_.init())) +{ + } + +Glib::ustring AboutDialog::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_name(const_cast(gobj()))); +} + +void AboutDialog::set_name(const Glib::ustring& name) +{ + gtk_about_dialog_set_name(gobj(), name.c_str()); +} + +Glib::ustring AboutDialog::get_version() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_version(const_cast(gobj()))); +} + +void AboutDialog::set_version(const Glib::ustring& version) +{ + gtk_about_dialog_set_version(gobj(), version.c_str()); +} + +Glib::ustring AboutDialog::get_copyright() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_copyright(const_cast(gobj()))); +} + +void AboutDialog::set_copyright(const Glib::ustring& copyright) +{ + gtk_about_dialog_set_copyright(gobj(), copyright.c_str()); +} + +Glib::ustring AboutDialog::get_comments() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_comments(const_cast(gobj()))); +} + +void AboutDialog::set_comments(const Glib::ustring& comments) +{ + gtk_about_dialog_set_comments(gobj(), comments.c_str()); +} + +Glib::ustring AboutDialog::get_license() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_license(const_cast(gobj()))); +} + +void AboutDialog::set_license(const Glib::ustring& license) +{ + gtk_about_dialog_set_license(gobj(), license.c_str()); +} + +Glib::ustring AboutDialog::get_website() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_website(const_cast(gobj()))); +} + +void AboutDialog::set_website(const Glib::ustring& website) +{ + gtk_about_dialog_set_website(gobj(), website.c_str()); +} + +Glib::ustring AboutDialog::get_website_label() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_website_label(const_cast(gobj()))); +} + +void AboutDialog::set_website_label(const Glib::ustring& website_label) +{ + gtk_about_dialog_set_website_label(gobj(), website_label.c_str()); +} + +Glib::StringArrayHandle AboutDialog::get_authors() const +{ + return Glib::StringArrayHandle(gtk_about_dialog_get_authors(const_cast(gobj()))); +} + +void AboutDialog::set_authors(const Glib::StringArrayHandle& authors) const +{ + gtk_about_dialog_set_authors(const_cast(gobj()), const_cast((authors).data())); +} + +Glib::StringArrayHandle AboutDialog::get_documenters() const +{ + return Glib::StringArrayHandle(gtk_about_dialog_get_documenters(const_cast(gobj()))); +} + +void AboutDialog::set_documenters(const Glib::StringArrayHandle& documenters) +{ + gtk_about_dialog_set_documenters(gobj(), const_cast((documenters).data())); +} + +Glib::StringArrayHandle AboutDialog::get_artists() const +{ + return Glib::StringArrayHandle(gtk_about_dialog_get_artists(const_cast(gobj()))); +} + +void AboutDialog::set_artists(const Glib::StringArrayHandle& artists) +{ + gtk_about_dialog_set_artists(gobj(), const_cast((artists).data())); +} + +Glib::ustring AboutDialog::get_translator_credits() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_translator_credits(const_cast(gobj()))); +} + +void AboutDialog::set_translator_credits(const Glib::ustring& translator_credits) +{ + gtk_about_dialog_set_translator_credits(gobj(), translator_credits.c_str()); +} + +Glib::RefPtr AboutDialog::get_logo() +{ + return Glib::wrap(gtk_about_dialog_get_logo(gobj())); +} + +Glib::RefPtr AboutDialog::get_logo() const +{ + return Glib::wrap(gtk_about_dialog_get_logo(const_cast(gobj()))); +} + +void AboutDialog::set_logo(const Glib::RefPtr& logo) +{ + gtk_about_dialog_set_logo(gobj(), Glib::unwrap(logo)); +} + +Glib::ustring AboutDialog::get_logo_icon_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_about_dialog_get_logo_icon_name(const_cast(gobj()))); +} + +void AboutDialog::set_logo_icon_name(const Glib::ustring& icon_name) +{ + gtk_about_dialog_set_logo_icon_name(gobj(), icon_name.c_str()); +} + + +Glib::PropertyProxy AboutDialog::property_name() +{ + return Glib::PropertyProxy(this, "name"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_name() const +{ + return Glib::PropertyProxy_ReadOnly(this, "name"); +} + +Glib::PropertyProxy AboutDialog::property_version() +{ + return Glib::PropertyProxy(this, "version"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_version() const +{ + return Glib::PropertyProxy_ReadOnly(this, "version"); +} + +Glib::PropertyProxy AboutDialog::property_copyright() +{ + return Glib::PropertyProxy(this, "copyright"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_copyright() const +{ + return Glib::PropertyProxy_ReadOnly(this, "copyright"); +} + +Glib::PropertyProxy AboutDialog::property_comments() +{ + return Glib::PropertyProxy(this, "comments"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_comments() const +{ + return Glib::PropertyProxy_ReadOnly(this, "comments"); +} + +Glib::PropertyProxy AboutDialog::property_website() +{ + return Glib::PropertyProxy(this, "website"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_website() const +{ + return Glib::PropertyProxy_ReadOnly(this, "website"); +} + +Glib::PropertyProxy AboutDialog::property_website_label() +{ + return Glib::PropertyProxy(this, "website-label"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_website_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "website-label"); +} + +Glib::PropertyProxy AboutDialog::property_license() +{ + return Glib::PropertyProxy(this, "license"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_license() const +{ + return Glib::PropertyProxy_ReadOnly(this, "license"); +} + +Glib::PropertyProxy AboutDialog::property_authors() +{ + return Glib::PropertyProxy(this, "authors"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_authors() const +{ + return Glib::PropertyProxy_ReadOnly(this, "authors"); +} + +Glib::PropertyProxy AboutDialog::property_documenters() +{ + return Glib::PropertyProxy(this, "documenters"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_documenters() const +{ + return Glib::PropertyProxy_ReadOnly(this, "documenters"); +} + +Glib::PropertyProxy AboutDialog::property_translator_credits() +{ + return Glib::PropertyProxy(this, "translator-credits"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_translator_credits() const +{ + return Glib::PropertyProxy_ReadOnly(this, "translator-credits"); +} + +Glib::PropertyProxy AboutDialog::property_artists() +{ + return Glib::PropertyProxy(this, "artists"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_artists() const +{ + return Glib::PropertyProxy_ReadOnly(this, "artists"); +} + +Glib::PropertyProxy< Glib::RefPtr > AboutDialog::property_logo() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "logo"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > AboutDialog::property_logo() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "logo"); +} + +Glib::PropertyProxy AboutDialog::property_logo_icon_name() +{ + return Glib::PropertyProxy(this, "logo-icon-name"); +} + +Glib::PropertyProxy_ReadOnly AboutDialog::property_logo_icon_name() const +{ + return Glib::PropertyProxy_ReadOnly(this, "logo-icon-name"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/aboutdialog.h b/libs/gtkmm2/gtk/gtkmm/aboutdialog.h new file mode 100644 index 0000000000..d36c8b2326 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/aboutdialog.h @@ -0,0 +1,591 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ABOUTDIALOG_H +#define _GTKMM_ABOUTDIALOG_H + +#include + +/* $Id$ */ + +/* aboutdialog.h + * + * Copyright (C) 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +//#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAboutDialog GtkAboutDialog; +typedef struct _GtkAboutDialogClass GtkAboutDialogClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class AboutDialog_Class; } // namespace Gtk +namespace Gtk +{ + +/** TODO + * + * @ingroup Dialogs + */ + +class AboutDialog : public Dialog +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AboutDialog CppObjectType; + typedef AboutDialog_Class CppClassType; + typedef GtkAboutDialog BaseObjectType; + typedef GtkAboutDialogClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~AboutDialog(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class AboutDialog_Class; + static CppClassType aboutdialog_class_; + + // noncopyable + AboutDialog(const AboutDialog&); + AboutDialog& operator=(const AboutDialog&); + +protected: + explicit AboutDialog(const Glib::ConstructParams& construct_params); + explicit AboutDialog(GtkAboutDialog* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkAboutDialog* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkAboutDialog* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + AboutDialog(); + + + /** Returns the program name displayed in the about dialog. + * @return The program name. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_name() const; + + /** Sets the name to display in the about dialog. + * If this is not set, it defaults to Glib::get_application_name(). + * + * Since: 2.6 + * @param name The program name. + */ + void set_name(const Glib::ustring& name); + + /** Returns the version string. + * @return The version string. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_version() const; + + /** Sets the version string to display in the about dialog. + * + * Since: 2.6 + * @param version The version string. + */ + void set_version(const Glib::ustring& version); + + /** Returns the copyright string. + * @return The copyright string. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_copyright() const; + + /** Sets the copyright string to display in the about dialog. + * This should be a short string of one or two lines. + * + * Since: 2.6 + * @param copyright The copyright string. + */ + void set_copyright(const Glib::ustring& copyright); + + /** Returns the comments string. + * @return The comments. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_comments() const; + + /** Sets the comments string to display in the about + * dialog. This should be a short string of one or + * two lines. + * + * Since: 2.6 + * @param comments A comments string. + */ + void set_comments(const Glib::ustring& comments); + + /** Returns the license information. + * @return The license information. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_license() const; + + /** Sets the license information to be displayed in the secondary + * license dialog. If @a license is 0, the license button is + * hidden. + * + * Since: 2.6 + * @param license The license information or 0. + */ + void set_license(const Glib::ustring& license); + + /** Returns the website URL. + * @return The website URL. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_website() const; + + /** Sets the URL to use for the website link. + * + * Since: 2.6 + * @param website A URL string starting with "http://". + */ + void set_website(const Glib::ustring& website); + + /** Returns the label used for the website link. + * @return The label used for the website link. The string is owned by the about + * dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_website_label() const; + + /** Sets the label to be used for the website link. + * It defaults to the website URL. + * + * Since: 2.6 + * @param website_label The label used for the website link. + */ + void set_website_label(const Glib::ustring& website_label); + + + /** Returns the string which are displayed in the authors tab + * of the secondary credits dialog. + * @return A 0-terminated string array containing + * the authors. The array is owned by the about dialog + * and must not be modified. + * + * Since: 2.6. + */ + Glib::StringArrayHandle get_authors() const; + + + /** Sets the strings which are displayed in the authors tab + * of the secondary credits dialog. + * + * Since: 2.6 + * @param authors A 0-terminated array of strings. + */ + void set_authors(const Glib::StringArrayHandle& authors) const; + + + /** Returns the string which are displayed in the documenters + * tab of the secondary credits dialog. + * @return A 0-terminated string array containing + * the documenters. The array is owned by the about dialog + * and must not be modified. + * + * Since: 2.6. + */ + Glib::StringArrayHandle get_documenters() const; + + + /** Sets the strings which are displayed in the documenters tab + * of the secondary credits dialog. + * + * Since: 2.6 + * @param documenters A 0-terminated array of strings. + */ + void set_documenters(const Glib::StringArrayHandle& documenters); + + /** Returns the string which are displayed in the artists tab + * of the secondary credits dialog. + * @return A 0-terminated string array containing + * the artists. The array is owned by the about dialog + * and must not be modified. + * + * Since: 2.6. + */ + Glib::StringArrayHandle get_artists() const; + + /** Sets the strings which are displayed in the artists tab + * of the secondary credits dialog. + * + * Since: 2.6 + * @param artists A 0-terminated array of strings. + */ + void set_artists(const Glib::StringArrayHandle& artists); + + /** Returns the translator credits string which is displayed + * in the translators tab of the secondary credits dialog. + * @return The translator credits string. The string is + * owned by the about dialog and must not be modified. + * + * Since: 2.6. + */ + Glib::ustring get_translator_credits() const; + + /** Sets the translator credits string which is displayed in + * the translators tab of the secondary credits dialog. + * + * The intended use for this string is to display the translator + * of the language which is currently used in the user interface. + * Using gettext(), a simple way to achieve that is to mark the + * string for translation: + * @code + * gtk_about_dialog_set_translator_credits (about, _("translator-credits")); + * @endcode + * It is a good idea to use the customary msgid "translator-credits" for this + * purpose, since translators will already know the purpose of that msgid, and + * since Gtk::AboutDialog will detect if "translator-credits" is untranslated + * and hide the tab. + * + * Since: 2.6 + * @param translator_credits The translator credits. + */ + void set_translator_credits(const Glib::ustring& translator_credits); + + + /** Returns the pixbuf displayed as logo in the about dialog. + * @return The pixbuf displayed as logo. The pixbuf is + * owned by the about dialog. If you want to keep a reference + * to it, you have to call Glib::object_ref() on it. + * + * Since: 2.6. + */ + Glib::RefPtr get_logo(); + + /** Returns the pixbuf displayed as logo in the about dialog. + * @return The pixbuf displayed as logo. The pixbuf is + * owned by the about dialog. If you want to keep a reference + * to it, you have to call Glib::object_ref() on it. + * + * Since: 2.6. + */ + Glib::RefPtr get_logo() const; + + + /** Sets the pixbuf to be displayed as logo in + * the about dialog. If it is 0, the default + * window icon set with Gtk::Window::set_default_icon() + * will be used. + * + * Since: 2.6 + * @param logo A Gdk::Pixbuf, or 0. + */ + void set_logo(const Glib::RefPtr& logo); + + + /** Returns the icon name displayed as logo in the about dialog. + * @return The icon name displayed as logo. The string is + * owned by the about dialog. If you want to keep a reference + * to it, you have to call Glib::strdup() on it. + * + * Since: 2.6. + */ + Glib::ustring get_logo_icon_name() const; + + /** Sets the pixbuf to be displayed as logo in + * the about dialog. If it is 0, the default + * window icon set with Gtk::Window::set_default_icon() + * will be used. + * + * Since: 2.6 + * @param icon_name An icon name, or 0. + */ + void set_logo_icon_name(const Glib::ustring& icon_name); + + /** For instance, + * void on_activate_link_url(AboutDialog& about_dialog, const Glib::ustring& link); + */ + typedef sigc::slot SlotActivateLink; + + //TODO: Document these methods. + static void set_email_hook(const SlotActivateLink& slot); + + + static void set_url_hook(const SlotActivateLink& slot); + + + /** The name of the program. If this is not set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_name() ; + +/** The name of the program. If this is not set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_name() const; + + /** The version of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_version() ; + +/** The version of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_version() const; + + /** Copyright information for the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_copyright() ; + +/** Copyright information for the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_copyright() const; + + /** Comments about the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_comments() ; + +/** Comments about the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_comments() const; + + /** The URL for the link to the website of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_website() ; + +/** The URL for the link to the website of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_website() const; + + /** The label for the link to the website of the program. If this is not set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_website_label() ; + +/** The label for the link to the website of the program. If this is not set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_website_label() const; + + /** The license of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_license() ; + +/** The license of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_license() const; + + /** List of authors of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_authors() ; + +/** List of authors of the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_authors() const; + + /** List of people documenting the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_documenters() ; + +/** List of people documenting the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_documenters() const; + + /** Credits to the translators. This string should be marked as translatable. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_translator_credits() ; + +/** Credits to the translators. This string should be marked as translatable. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_translator_credits() const; + + /** List of people who have contributed artwork to the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_artists() ; + +/** List of people who have contributed artwork to the program. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_artists() const; + + /** A logo for the about box. If this is not set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_logo() ; + +/** A logo for the about box. If this is not set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_logo() const; + + /** A named icon to use as the logo for the about box. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_logo_icon_name() ; + +/** A named icon to use as the logo for the about box. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_logo_icon_name() const; + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::AboutDialog + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::AboutDialog* wrap(GtkAboutDialog* object, bool take_copy = false); +} +#endif /* _GTKMM_ABOUTDIALOG_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/accelgroup.cc b/libs/gtkmm2/gtk/gtkmm/accelgroup.cc new file mode 100644 index 0000000000..edb7170bf4 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accelgroup.cc @@ -0,0 +1,347 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Gtk +{ + +bool AccelGroup::valid(guint keyval, Gdk::ModifierType modifiers) +{ + return gtk_accelerator_valid(keyval, (GdkModifierType) modifiers); +} + +void AccelGroup::parse(const Glib::ustring& accelerator, + guint& accelerator_key, + Gdk::ModifierType& accelerator_mods) +{ + GdkModifierType mods = GdkModifierType(0); + gtk_accelerator_parse(accelerator.c_str(), &accelerator_key, &mods); + + accelerator_mods = (Gdk::ModifierType) mods; +} + +Glib::ustring AccelGroup::name(guint accelerator_key, Gdk::ModifierType accelerator_mods) +{ + return gtk_accelerator_name(accelerator_key, (GdkModifierType) accelerator_mods); +} + +void AccelGroup::set_default_mod_mask(Gdk::ModifierType default_mod_mask) +{ + gtk_accelerator_set_default_mod_mask((GdkModifierType) default_mod_mask); +} + +Gdk::ModifierType AccelGroup::get_default_mod_mask() +{ + return (Gdk::ModifierType) gtk_accelerator_get_default_mod_mask(); +} + +} // namespace Gtk + + +namespace +{ + +gboolean AccelGroup_signal_accel_activate_callback(GtkAccelGroup* self, GObject* p0,guint p1,GdkModifierType p2,void* data) +{ + using namespace Gtk; + typedef sigc::slot< bool,const Glib::RefPtr&,guint,Gdk::ModifierType > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + return static_cast((*static_cast(slot))(Glib::wrap(p0, true) +, p1, ((Gdk::ModifierType)(p2)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + + typedef gboolean RType; + return RType(); +} + +gboolean AccelGroup_signal_accel_activate_notify_callback(GtkAccelGroup* self, GObject* p0,guint p1,GdkModifierType p2, void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::RefPtr&,guint,Gdk::ModifierType > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0, true) +, p1, ((Gdk::ModifierType)(p2)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + + typedef gboolean RType; + return RType(); +} + +const Glib::SignalProxyInfo AccelGroup_signal_accel_activate_info = +{ + "accel_activate", + (GCallback) &AccelGroup_signal_accel_activate_callback, + (GCallback) &AccelGroup_signal_accel_activate_notify_callback +}; + + +void AccelGroup_signal_accel_changed_callback(GtkAccelGroup* self, guint p0,GdkModifierType p1,GClosure* p2,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,guint,Gdk::ModifierType,GClosure* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0, ((Gdk::ModifierType)(p1)) +, p2); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo AccelGroup_signal_accel_changed_info = +{ + "accel_changed", + (GCallback) &AccelGroup_signal_accel_changed_callback, + (GCallback) &AccelGroup_signal_accel_changed_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkAccelGroup* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& AccelGroup_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &AccelGroup_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_accel_group_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void AccelGroup_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->accel_changed = &accel_changed_callback; +} + + +void AccelGroup_Class::accel_changed_callback(GtkAccelGroup* self, guint p0, GdkModifierType p1, GClosure* p2) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_accel_changed(p0, ((Gdk::ModifierType)(p1)) +, p2); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->accel_changed) + (*base->accel_changed)(self, p0, p1, p2); + } +} + + +Glib::ObjectBase* AccelGroup_Class::wrap_new(GObject* object) +{ + return new AccelGroup((GtkAccelGroup*)object); +} + + +/* The implementation: */ + +GtkAccelGroup* AccelGroup::gobj_copy() +{ + reference(); + return gobj(); +} + +AccelGroup::AccelGroup(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +AccelGroup::AccelGroup(GtkAccelGroup* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +AccelGroup::~AccelGroup() +{} + + +AccelGroup::CppClassType AccelGroup::accelgroup_class_; // initialize static member + +GType AccelGroup::get_type() +{ + return accelgroup_class_.init().get_type(); +} + +GType AccelGroup::get_base_type() +{ + return gtk_accel_group_get_type(); +} + + +AccelGroup::AccelGroup() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(accelgroup_class_.init())) +{ + } + +Glib::RefPtr AccelGroup::create() +{ + return Glib::RefPtr( new AccelGroup() ); +} +void AccelGroup::lock() +{ + gtk_accel_group_lock(gobj()); +} + +void AccelGroup::unlock() +{ + gtk_accel_group_unlock(gobj()); +} + +bool AccelGroup::disconnect_key(guint accel_key, Gdk::ModifierType accel_mods) +{ + return gtk_accel_group_disconnect_key(gobj(), accel_key, ((GdkModifierType)(accel_mods))); +} + +Glib::ustring AccelGroup::get_label(guint accelerator_key, Gdk::ModifierType accelerator_mods) +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_accelerator_get_label(accelerator_key, ((GdkModifierType)(accelerator_mods)))); +} + +bool AccelGroup::activate(GQuark accel_quark, const Glib::RefPtr& acceleratable, guint accel_key, Gdk::ModifierType accel_mods) +{ + return gtk_accel_group_activate(gobj(), accel_quark, Glib::unwrap(acceleratable), accel_key, ((GdkModifierType)(accel_mods))); +} + +bool AccelGroup::activate(Gtk::Object& object, guint accel_key, Gdk::ModifierType accel_mods) +{ + return gtk_accel_groups_activate((object).Glib::Object::gobj(), accel_key, ((GdkModifierType)(accel_mods))); +} + + +Glib::SignalProxy3< bool,const Glib::RefPtr&,guint,Gdk::ModifierType > AccelGroup::signal_accel_activate() +{ + return Glib::SignalProxy3< bool,const Glib::RefPtr&,guint,Gdk::ModifierType >(this, &AccelGroup_signal_accel_activate_info); +} + +Glib::SignalProxy3< void,guint,Gdk::ModifierType,GClosure* > AccelGroup::signal_accel_changed() +{ + return Glib::SignalProxy3< void,guint,Gdk::ModifierType,GClosure* >(this, &AccelGroup_signal_accel_changed_info); +} + + +void Gtk::AccelGroup::on_accel_changed(guint keyval, Gdk::ModifierType modifier, GClosure* accel_closure) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->accel_changed) + (*base->accel_changed)(gobj(),keyval,((GdkModifierType)(modifier)),accel_closure); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/accelgroup.h b/libs/gtkmm2/gtk/gtkmm/accelgroup.h new file mode 100644 index 0000000000..1a6a8adc4d --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accelgroup.h @@ -0,0 +1,249 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ACCELGROUP_H +#define _GTKMM_ACCELGROUP_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAccelGroup GtkAccelGroup; +typedef struct _GtkAccelGroupClass GtkAccelGroupClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class AccelGroup_Class; } // namespace Gtk +namespace Gtk +{ + +/** A Gtk::AccelGroup represents a group of keyboard accelerators, typically + * attached to a toplevel Gtk::Window (with Gtk::Window::add_accel_group()). + * Usually you won't need to create a Gtk::AccelGroup directly; instead, gtkmm + * automatically sets up the accelerators for your menus. Note that + * accelerators are different from mnemonics. Accelerators are shortcuts for + * activating a menu item; they appear alongside the menu item for which + * they're a shortcut. For example "Ctrl+Q" might appear alongside the "Quit" + * menu item. Mnemonics are shortcuts for GUI elements such as text entries or + * buttons; they appear as underlined characters. See the Gtk::Label + * constructor. Menu items can have both accelerators and mnemonics, of course. + * + * You can use Gtk::Window::get_accel_group() to get an accel group for that window, + * then use it with other widgets too. + */ + +class AccelGroup : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef AccelGroup CppObjectType; + typedef AccelGroup_Class CppClassType; + typedef GtkAccelGroup BaseObjectType; + typedef GtkAccelGroupClass BaseClassType; + +private: friend class AccelGroup_Class; + static CppClassType accelgroup_class_; + +private: + // noncopyable + AccelGroup(const AccelGroup&); + AccelGroup& operator=(const AccelGroup&); + +protected: + explicit AccelGroup(const Glib::ConstructParams& construct_params); + explicit AccelGroup(GtkAccelGroup* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~AccelGroup(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkAccelGroup* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkAccelGroup* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GtkAccelGroup* gobj_copy(); + +private: + + +protected: + AccelGroup(); + +public: + /** Creates a new Gtk::AccelGroup object. + * @return A Glib::RefPtr<> to a newly created Gtk::AccelGroup object. + */ + + static Glib::RefPtr create(); + + + /** Locks the given accelerator group. + * + * Locking an acelerator group prevents the accelerators contained + * within it to be changed during runtime. Refer to + * gtk_accel_map_change_entry() about runtime accelerator changes. + * + * If called more than once, @a accel_group remains locked until + * unlock() has been called an equivalent number + * of times. + */ + void lock(); + + /** Undoes the last call to lock() on this @a accel_group . + */ + void unlock(); + + /** Removes an accelerator previously installed through + * connect(). + * @param accel_key Key value of the accelerator. + * @param accel_mods Modifier combination of the accelerator. + * @return true if there was an accelerator which could be + * removed, false otherwise. + */ + bool disconnect_key(guint accel_key, Gdk::ModifierType accel_mods); + + /** Determines whether a given keyval and modifier mask constitute + * a valid keyboard accelerator. For example, the 'a' keyval + * plus Gdk::CONTROL_MASK is valid - this is a "Ctrl+a" accelerator. + * But you can't, for instance, use the GDK_Control_L keyval + * as an accelerator. + */ + static bool valid(guint keyval, Gdk::ModifierType modifiers); + + /** Parse the accelerator string. + * @param accelerator See the Gtk::AccelKey constructor for the format. + * @param accelerator_key Output argument + * @param accelerator_mods Output argument + */ + static void parse(const Glib::ustring& accelerator, guint& accelerator_key, Gdk::ModifierType& accelerator_mods); + + /** Converts an accelerator keyval and modifier mask + * into a string parseable by parse(). + * For example, if you pass in 'q' and Gdk::CONTROL_MASK, it returns "<Control>q". + */ + static Glib::ustring name(guint accelerator_key, Gdk::ModifierType accelerator_mods); + + + /** Converts an accelerator keyval and modifier mask into a string + * which can be used to represent the accelerator to the user. + * @param accelerator_key Accelerator keyval. + * @param accelerator_mods Accelerator modifier mask. + * @return A newly-allocated string representing the accelerator. + * + * Since: 2.6. + */ + static Glib::ustring get_label(guint accelerator_key, Gdk::ModifierType accelerator_mods); + + /** Sets the modifiers that will be considered significant for keyboard + * accelerators. The default mod mask is Gdk::CONTROL_MASK | + * Gdk::SHIFT_MASK | Gdk::MOD1_MASK, that is, Control, Shift, and Alt. + * Other modifiers will ignored by default. + * You must include at least the three default modifiers in any + * value you pass to this function. + * + * The default mod mask should be changed on application startup, + * before using any accelerator groups. + */ + static void set_default_mod_mask(Gdk::ModifierType default_mod_mask); + + /// See set_default_mod_mask(). + static Gdk::ModifierType get_default_mod_mask(); + + //TODO: This is undocumented in GTK+ at the moment. When would it be used and where does the quark come from? murrayc. + + bool activate(GQuark accel_quark, const Glib::RefPtr& acceleratable, guint accel_key, Gdk::ModifierType accel_mods); + + + //Let's not wrap this, because the GtkAccelGroupFindFunc callback uses GClosures, and it's not clear that this is useful. + //AccelKey find(const SlotFind& slot); + //GtkAccelKey* gtk_accel_group_find(GtkAccelGroup* accel_group, GtkAccelGroupFindFunc find_func, gpointer data); + + + /** Finds the first accelerator in any Gtk::AccelGroup attached + * to @a object that matches @a accel_key and @a accel_mods , and + * activates that accelerator. + * If an accelerator was activated and handled this keypress, true + * is returned. + * @param object The G::Object, usually a Gtk::Window, on which + * to activate the accelerator. + * @param accel_key Accelerator keyval from a key event. + * @param accel_mods Keyboard state mask from a key event. + * @return true if the accelerator was handled, false otherwise. + */ + static bool activate(Gtk::Object& object, guint accel_key, Gdk::ModifierType accel_mods); + + //TODO: Discover real parameter names: + + + Glib::SignalProxy3< bool,const Glib::RefPtr&,guint,Gdk::ModifierType > signal_accel_activate(); + + //TODO: The C type is unpleasant: + + + Glib::SignalProxy3< void,guint,Gdk::ModifierType,GClosure* > signal_accel_changed(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_accel_changed(guint keyval, Gdk::ModifierType modifier, GClosure* accel_closure); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::AccelGroup + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkAccelGroup* object, bool take_copy = false); +} + + +#endif /* _GTKMM_ACCELGROUP_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/accelkey.cc b/libs/gtkmm2/gtk/gtkmm/accelkey.cc new file mode 100644 index 0000000000..ffd734c423 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accelkey.cc @@ -0,0 +1,93 @@ +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +AccelKey::AccelKey() +: key_(GDK_VoidSymbol), + mod_((Gdk::ModifierType)0) +{ +} + +AccelKey::AccelKey(guint accel_key, Gdk::ModifierType accel_mods, + const Glib::ustring& accel_path) +: key_(accel_key), + mod_(accel_mods), + path_(accel_path) +{ +} + +AccelKey::AccelKey(const Glib::ustring& accelerator, const Glib::ustring& accel_path) +: path_(accel_path) +{ + //Get the key and mod by parsing the accelerator string: + AccelGroup::parse (accelerator, key_, mod_); +} + +AccelKey::AccelKey(const AccelKey& src) +{ + key_ = src.key_; + mod_ = src.mod_; + path_ = src.path_; +} + +AccelKey& AccelKey::operator=(const AccelKey& src) +{ + key_ = src.key_; + mod_ = src.mod_; + path_ = src.path_; + + return *this; +} + +guint AccelKey::get_key() const +{ + return key_; +} + +Gdk::ModifierType AccelKey::get_mod() const +{ + return mod_; +} + +Glib::ustring AccelKey::get_path() const +{ + return path_; +} + +bool AccelKey::is_null() const +{ + return ( (key_ == GDK_VoidSymbol) || !(get_key() > 0) ); //both seem to be invalid. +} + +Glib::ustring AccelKey::get_abbrev() const +{ + return AccelGroup::name (key_, mod_); +} + + +} // namespace + diff --git a/libs/gtkmm2/gtk/gtkmm/accelkey.h b/libs/gtkmm2/gtk/gtkmm/accelkey.h new file mode 100644 index 0000000000..21841b1a8e --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accelkey.h @@ -0,0 +1,94 @@ +/* $Id$ */ +#ifndef _GTKMM_ACCELKEY_H +#define _GTKMM_ACCELKEY_H + +/* menu_elems.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Gtk +{ + +/** Defines accelerator key combinations. + * For instance, pressing Control-Q to activate the File|Quit menu item. + * Typedefed as Gtk::Menu::AccelKey + * + * By defining accelerator paths you can allow the user of your application + * to change accelerators himself. An example of an accelerator might be + * "/File/Open". Modified accelerators may be saved + * @see Gtk::AccelMap + * @ingroup Menus + */ +class AccelKey +{ +public: + AccelKey(); + + /** AccelKey constructor. + * @param accel_key For instance, 'q' + * @param accel_mods For instance, Gdk::CONTROL_MASK + * @param accel_path For instance, "/File/Open" + */ + AccelKey(guint accel_key, Gdk::ModifierType accel_mods, + const Glib::ustring& accel_path = ""); + + /** AccelKey constructor. + * @param accelerator For instance, "<control>q" - Use + * <control>, <shift>, <alt> and <release>. + * Use F1, F2, etc, for function keys. + * @param accel_path For instance, "/File/Open" + */ + AccelKey(const Glib::ustring& accelerator, + const Glib::ustring& accel_path = Glib::ustring()); + + AccelKey(const AccelKey& src); + + AccelKey& operator=(const AccelKey& src); + + bool is_null() const; + + /** + * Gets the accelerator key. + */ + guint get_key() const; + /** + * Gets the accelerator modifier. + */ + Gdk::ModifierType get_mod() const; + /** + * Gets the accelerator path. + */ + Glib::ustring get_path() const; + /** + * Gets the accelerator representation for labels. + */ + Glib::ustring get_abbrev() const; + +protected: + guint key_; + Gdk::ModifierType mod_; + Glib::ustring path_; +}; + +} /* namespace Gtk */ + +#endif //_GTKMM_ACCELKEY_H diff --git a/libs/gtkmm2/gtk/gtkmm/accellabel.cc b/libs/gtkmm2/gtk/gtkmm/accellabel.cc new file mode 100644 index 0000000000..d62bc75418 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accellabel.cc @@ -0,0 +1,188 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +AccelLabel::AccelLabel(const Glib::ustring& label, bool mnemonic) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Label(Glib::ConstructParams(accellabel_class_.init(), (char*) 0)) +{ + if(mnemonic) + set_text_with_mnemonic(label); + else + set_text(label); +} + +void AccelLabel::unset_accel_widget() +{ + //Not documented, at the moment, but this is what the source does: + gtk_accel_label_set_accel_widget(gobj(), 0); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::AccelLabel* wrap(GtkAccelLabel* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& AccelLabel_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &AccelLabel_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_accel_label_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void AccelLabel_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* AccelLabel_Class::wrap_new(GObject* o) +{ + return manage(new AccelLabel((GtkAccelLabel*)(o))); + +} + + +/* The implementation: */ + +AccelLabel::AccelLabel(const Glib::ConstructParams& construct_params) +: + Gtk::Label(construct_params) +{ + } + +AccelLabel::AccelLabel(GtkAccelLabel* castitem) +: + Gtk::Label((GtkLabel*)(castitem)) +{ + } + +AccelLabel::~AccelLabel() +{ + destroy_(); +} + +AccelLabel::CppClassType AccelLabel::accellabel_class_; // initialize static member + +GType AccelLabel::get_type() +{ + return accellabel_class_.init().get_type(); +} + +GType AccelLabel::get_base_type() +{ + return gtk_accel_label_get_type(); +} + + +AccelLabel::AccelLabel() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Label(Glib::ConstructParams(accellabel_class_.init())) +{ + } + +void AccelLabel::set_accel_widget(const Widget& accel_widget) +{ + gtk_accel_label_set_accel_widget(gobj(), const_cast((accel_widget).gobj())); +} + +Widget* AccelLabel::get_accel_widget() +{ + return Glib::wrap(gtk_accel_label_get_accel_widget(gobj())); +} + +const Widget* AccelLabel::get_accel_widget() const +{ + return Glib::wrap(gtk_accel_label_get_accel_widget(const_cast(gobj()))); +} + +guint AccelLabel::get_accel_width() const +{ + return gtk_accel_label_get_accel_width(const_cast(gobj())); +} + +bool AccelLabel::refetch() +{ + return gtk_accel_label_refetch(gobj()); +} + + +Glib::PropertyProxy AccelLabel::property_accel_widget() +{ + return Glib::PropertyProxy(this, "accel-widget"); +} + +Glib::PropertyProxy_ReadOnly AccelLabel::property_accel_widget() const +{ + return Glib::PropertyProxy_ReadOnly(this, "accel-widget"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/accellabel.h b/libs/gtkmm2/gtk/gtkmm/accellabel.h new file mode 100644 index 0000000000..a4d6a32645 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accellabel.h @@ -0,0 +1,182 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ACCELLABEL_H +#define _GTKMM_ACCELLABEL_H + +#include + +/* $Id$ */ + +/* accellabel.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAccelLabel GtkAccelLabel; +typedef struct _GtkAccelLabelClass GtkAccelLabelClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class AccelLabel_Class; } // namespace Gtk +namespace Gtk +{ + +/** A label which displays an accelerator key on the right of the text. + * Used for menu item labels, for instance. + * + * @ingroup Widgets + */ + +class AccelLabel : public Label +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AccelLabel CppObjectType; + typedef AccelLabel_Class CppClassType; + typedef GtkAccelLabel BaseObjectType; + typedef GtkAccelLabelClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~AccelLabel(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class AccelLabel_Class; + static CppClassType accellabel_class_; + + // noncopyable + AccelLabel(const AccelLabel&); + AccelLabel& operator=(const AccelLabel&); + +protected: + explicit AccelLabel(const Glib::ConstructParams& construct_params); + explicit AccelLabel(GtkAccelLabel* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkAccelLabel* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkAccelLabel* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + //The default ctor doesn't correspond to any _new function, but gtkmenuitem.cc does a simple g_object_new() with no properties. + /** Default constructor to create an AccelLabel object + */ + AccelLabel(); + + /** Constructor to create an AccelLabel object with a default label + * @param label The label string. + * @param mnemonic If true, characters preceded by an underscore (_) will be underlined and used as a keyboard accelerator. + */ + explicit AccelLabel(const Glib::ustring& label, bool mnemonic = false); + + + /** Sets the widget to be monitored by this accelerator label. + * @param accel_widget The widget to be monitored. + */ + void set_accel_widget(const Widget& accel_widget); + /// Forget the accel widget previously set by set_accel_widget(). + void unset_accel_widget(); + + + /** Fetches the widget monitored by this accelerator label. See + * set_accel_widget(). + * @return The object monitored by the accelerator label, + * or 0. + */ + Widget* get_accel_widget(); + + /** Fetches the widget monitored by this accelerator label. See + * set_accel_widget(). + * @return The object monitored by the accelerator label, + * or 0. + */ + const Widget* get_accel_widget() const; + + + /** Gets the width needed to display this accelerator label. This is used by menus to align all of the Gtk::MenuItem widgets, and shouldn't be needed by applications. + * @return Width of this accelerator label. + */ + guint get_accel_width() const; + + /** Recreates the string representing the accelerator keys. + * @return Always returns false. + */ + bool refetch(); + + //_WRAP_PROPERTY("accel-closure", Glib::Object) //GClosure + /** The widget to be monitored for accelerator changes. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_accel_widget() ; + +/** The widget to be monitored for accelerator changes. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_accel_widget() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::AccelLabel + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::AccelLabel* wrap(GtkAccelLabel* object, bool take_copy = false); +} +#endif /* _GTKMM_ACCELLABEL_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/accelmap.cc b/libs/gtkmm2/gtk/gtkmm/accelmap.cc new file mode 100644 index 0000000000..1d87a7cd64 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accelmap.cc @@ -0,0 +1,70 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +namespace AccelMap +{ + +void add_entry(const std::string& accel_path, + guint accel_key, + Gdk::ModifierType accel_mods) +{ + gtk_accel_map_add_entry(accel_path.c_str(), accel_key, + (GdkModifierType)accel_mods); +} + +bool change_entry(const std::string& accel_path, + guint accel_key, + Gdk::ModifierType accel_mods, + bool replace) +{ + return gtk_accel_map_change_entry(accel_path.c_str(), accel_key, + (GdkModifierType)accel_mods, replace); +} + +void load(const std::string& filename) +{ + gtk_accel_map_load(filename.c_str()); +} + +void save(const std::string& filename) +{ + gtk_accel_map_save(filename.c_str()); +} + +void lock_path(const std::string& accel_path) +{ + gtk_accel_map_lock_path(accel_path.c_str()); +} + +void unlock_path(const std::string& accel_path) +{ + gtk_accel_map_unlock_path(accel_path.c_str()); +} + +} // namespace AccelMap + +} // namespace Gtk + diff --git a/libs/gtkmm2/gtk/gtkmm/accelmap.h b/libs/gtkmm2/gtk/gtkmm/accelmap.h new file mode 100644 index 0000000000..00dd8b9a1f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/accelmap.h @@ -0,0 +1,129 @@ +// -*- c++ -*- +#ifndef _GTKMM_ACCELMAP_H +#define _GTKMM_ACCELMAP_H + +/* $Id$ */ + +/* accelmap.h + * + * Copyright (C) 2002 The Gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#include + +namespace Gtk +{ + +namespace AccelMap +{ + +//TODO: Why is the accel_path a std::string, instead of a Glib::ustring? murrayc. + +/** Registers a new accelerator with the global accelerator map. + * This function should only be called once per accel_path + * with the canonical accel_key and accel_mods for this path. + * To change the accelerator during runtime programatically, use + * change_entry(). + * The accelerator path must consist of "<WINDOWTYPE>/Category1/Category2/.../Action", + * where <WINDOWTYPE> should be a unique application-specific identifier, that + * corresponds to the kind of window the accelerator is being used in, e.g. "Gimp-Image", + * "Abiword-Document" or "Gnumeric-Settings". + * The Category1/.../Action portion is most appropriately chosen by the action the + * accelerator triggers, i.e. for accelerators on menu items, choose the item's menu path, + * e.g. "File/Save As", "Image/View/Zoom" or "Edit/Select All". + * So a full valid accelerator path may look like: + * "<Gimp-Toolbox>/File/Dialogs/Tool Options...". + * + * @param accel_path valid accelerator path + * @param accel_key the accelerator key + * @param accel_mods the accelerator modifiers + * + */ +void add_entry(const std::string& accel_path, + guint accel_key, + Gdk::ModifierType accel_mods); + +/** Changes the accel_key and accel_mods currently associated with accel_path. + * Due to conflicts with other accelerators, a change may not always be possible, + * replace indicates whether other accelerators may be deleted to resolve such + * conflicts. A change will only occur if all conflicts could be resolved (which + * might not be the case if conflicting accelerators are locked). Successful + * changes are indicated by a true return value. + * + * @param accel_path a valid accelerator path + * @param accel_key the new accelerator key + * @param accel_mods the new accelerator modifiers + * @param replace true if other accelerators may be deleted upon conflicts + * @result true if the accelerator could be changed, false otherwise + */ +bool change_entry(const std::string& accel_path, + guint accel_key, + Gdk::ModifierType accel_mods, + bool replace); + +/** Parses a file previously saved with save() for + * accelerator specifications, and propagates them accordingly. + * + * @param filename a file containing accelerator specifications + */ +void load(const std::string& filename); + +/** Saves current accelerator specifications (accelerator path, key + * and modifiers) to filename. + * The file is written in a format suitable to be read back in by + * load(). + * + * @param filename the file to contain accelerator specifications + */ +void save(const std::string& filename); + +/** Locks the given accelerator path. + * + * Locking an accelerator path prevents its accelerator from being changed + * during runtime. A locked accelerator path can be unlocked by + * unlock_path(). Refer to change_entry() + * about runtime accelerator changes. + * + * Note that locking of individual accelerator paths is independent from + * locking the #GtkAccelGroup containing them. For runtime accelerator + * changes to be possible both the accelerator path and its AccelGroup + * have to be unlocked. + * + * @param accel_path a valid accelerator path + * + * Since: 2.4 + **/ +void lock_path(const std::string& accel_path); + +/** Unlocks the given accelerator path. Refer to gtk_accel_map_lock_path() + * about accelerator path locking. + * + * @param accel_path a valid accelerator path + * + * Since: 2.4 + **/ +void unlock_path(const std::string& accel_path); + +} // namespace AccelMap + +} // namespace Gtk + + +#endif /* _GTKMM_ACCELMAP_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/action.cc b/libs/gtkmm2/gtk/gtkmm/action.cc new file mode 100644 index 0000000000..1504ee29c2 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/action.cc @@ -0,0 +1,639 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#include +#include +#include + +namespace Gtk +{ + +Action::Action(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(action_class_.init(), "name",name.c_str(),"stock_id",stock_id.get_c_str(),"label",(label.empty() ? 0 : label.c_str()),"tooltip",(tooltip.empty() ? 0 : tooltip.c_str()), (char*) 0)) +{} + +Glib::RefPtr Action::create(const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip) +{ + return Glib::RefPtr( new Action(name, Gtk::StockID(), label, tooltip) ); +} + +Glib::RefPtr Action::create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip) +{ + return Glib::RefPtr( new Action(name, stock_id, label, tooltip) ); +} + + +void Action::set_tooltip(const Glib::ustring& tooltip) +{ + property_tooltip() = tooltip; +} + + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo Action_signal_activate_info = +{ + "activate", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkAction* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Action_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Action_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_action_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Action_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->create_menu_item = &create_menu_item_vfunc_callback; + klass->create_tool_item = &create_tool_item_vfunc_callback; + klass->connect_proxy = &connect_proxy_vfunc_callback; + klass->disconnect_proxy = &disconnect_proxy_vfunc_callback; + klass->activate = &activate_callback; +} + +GtkWidget* Action_Class::create_menu_item_vfunc_callback(GtkAction* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return (GtkWidget*)Glib::unwrap(obj->create_menu_item_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->create_menu_item) + return (*base->create_menu_item)(self); + } + + typedef GtkWidget* RType; + return RType(); +} + +GtkWidget* Action_Class::create_tool_item_vfunc_callback(GtkAction* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return (GtkWidget*)Glib::unwrap(obj->create_tool_item_vfunc()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->create_tool_item) + return (*base->create_tool_item)(self); + } + + typedef GtkWidget* RType; + return RType(); +} + +void Action_Class::connect_proxy_vfunc_callback(GtkAction* self, GtkWidget* proxy) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->connect_proxy_vfunc(Glib::wrap(proxy) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->connect_proxy) + (*base->connect_proxy)(self, proxy); + } +} + +void Action_Class::disconnect_proxy_vfunc_callback(GtkAction* self, GtkWidget* proxy) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->disconnect_proxy_vfunc(Glib::wrap(proxy) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->disconnect_proxy) + (*base->disconnect_proxy)(self, proxy); + } +} + + +void Action_Class::activate_callback(GtkAction* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_activate(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->activate) + (*base->activate)(self); + } +} + + +Glib::ObjectBase* Action_Class::wrap_new(GObject* object) +{ + return new Action((GtkAction*)object); +} + + +/* The implementation: */ + +GtkAction* Action::gobj_copy() +{ + reference(); + return gobj(); +} + +Action::Action(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Action::Action(GtkAction* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Action::~Action() +{} + + +Action::CppClassType Action::action_class_; // initialize static member + +GType Action::get_type() +{ + return action_class_.init().get_type(); +} + +GType Action::get_base_type() +{ + return gtk_action_get_type(); +} + + +Action::Action() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(action_class_.init())) +{ + } + +Glib::RefPtr Action::create() +{ + return Glib::RefPtr( new Action() ); +} +Glib::ustring Action::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_name(const_cast(gobj()))); +} + +bool Action::is_sensitive() const +{ + return gtk_action_is_sensitive(const_cast(gobj())); +} + +bool Action::get_sensitive() const +{ + return gtk_action_get_sensitive(const_cast(gobj())); +} + +void Action::set_sensitive(bool sensitive) +{ + gtk_action_set_sensitive(gobj(), static_cast(sensitive)); +} + +bool Action::is_visible() const +{ + return gtk_action_is_visible(const_cast(gobj())); +} + +bool Action::get_visible() const +{ + return gtk_action_get_visible(const_cast(gobj())); +} + +void Action::set_visible(bool visible) +{ + gtk_action_set_visible(gobj(), static_cast(visible)); +} + +void Action::activate() +{ + gtk_action_activate(gobj()); +} + +Image* Action::create_icon(IconSize icon_size) +{ + return Glib::wrap((GtkImage*)(gtk_action_create_icon(gobj(), static_cast(int(icon_size))))); +} + +MenuItem* Action::create_menu_item() +{ + return Glib::wrap((GtkMenuItem*)(gtk_action_create_menu_item(gobj()))); +} + +ToolItem* Action::create_tool_item() +{ + return Glib::wrap((GtkToolItem*)(gtk_action_create_tool_item(gobj()))); +} + +void Action::connect_proxy(Widget& proxy) +{ + gtk_action_connect_proxy(gobj(), (proxy).gobj()); +} + +void Action::disconnect_proxy(Widget& proxy) +{ + gtk_action_disconnect_proxy(gobj(), (proxy).gobj()); +} + +Glib::SListHandle Action::get_proxies() +{ + return Glib::SListHandle(gtk_action_get_proxies(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::SListHandle Action::get_proxies() const +{ + return Glib::SListHandle(gtk_action_get_proxies(const_cast(gobj())), Glib::OWNERSHIP_SHALLOW); +} + +void Action::connect_accelerator() +{ + gtk_action_connect_accelerator(gobj()); +} + +void Action::disconnect_accelerator() +{ + gtk_action_disconnect_accelerator(gobj()); +} + +Glib::ustring Action::get_accel_path() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_accel_path(const_cast(gobj()))); +} + +void Action::set_accel_path(const Glib::ustring& accel_path) +{ + gtk_action_set_accel_path(gobj(), accel_path.c_str()); +} + +void Action::set_accel_group(const Glib::RefPtr& accel_group) +{ + gtk_action_set_accel_group(gobj(), Glib::unwrap(accel_group)); +} + +void Action::block_activate_from(Widget& proxy) +{ + gtk_action_block_activate_from(gobj(), (proxy).gobj()); +} + +void Action::unblock_activate_from(Widget& proxy) +{ + gtk_action_unblock_activate_from(gobj(), (proxy).gobj()); +} + + +Glib::SignalProxy0< void > Action::signal_activate() +{ + return Glib::SignalProxy0< void >(this, &Action_signal_activate_info); +} + + +Glib::PropertyProxy_ReadOnly Action::property_name() const +{ + return Glib::PropertyProxy_ReadOnly(this, "name"); +} + +Glib::PropertyProxy Action::property_label() +{ + return Glib::PropertyProxy(this, "label"); +} + +Glib::PropertyProxy_ReadOnly Action::property_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label"); +} + +Glib::PropertyProxy Action::property_short_label() +{ + return Glib::PropertyProxy(this, "short-label"); +} + +Glib::PropertyProxy_ReadOnly Action::property_short_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "short-label"); +} + +Glib::PropertyProxy Action::property_tooltip() +{ + return Glib::PropertyProxy(this, "tooltip"); +} + +Glib::PropertyProxy_ReadOnly Action::property_tooltip() const +{ + return Glib::PropertyProxy_ReadOnly(this, "tooltip"); +} + +Glib::PropertyProxy Action::property_stock_id() +{ + return Glib::PropertyProxy(this, "stock-id"); +} + +Glib::PropertyProxy_ReadOnly Action::property_stock_id() const +{ + return Glib::PropertyProxy_ReadOnly(this, "stock-id"); +} + +Glib::PropertyProxy Action::property_visible_horizontal() +{ + return Glib::PropertyProxy(this, "visible-horizontal"); +} + +Glib::PropertyProxy_ReadOnly Action::property_visible_horizontal() const +{ + return Glib::PropertyProxy_ReadOnly(this, "visible-horizontal"); +} + +Glib::PropertyProxy Action::property_visible_vertical() +{ + return Glib::PropertyProxy(this, "visible-vertical"); +} + +Glib::PropertyProxy_ReadOnly Action::property_visible_vertical() const +{ + return Glib::PropertyProxy_ReadOnly(this, "visible-vertical"); +} + +Glib::PropertyProxy Action::property_is_important() +{ + return Glib::PropertyProxy(this, "is-important"); +} + +Glib::PropertyProxy_ReadOnly Action::property_is_important() const +{ + return Glib::PropertyProxy_ReadOnly(this, "is-important"); +} + +Glib::PropertyProxy Action::property_hide_if_empty() +{ + return Glib::PropertyProxy(this, "hide-if-empty"); +} + +Glib::PropertyProxy_ReadOnly Action::property_hide_if_empty() const +{ + return Glib::PropertyProxy_ReadOnly(this, "hide-if-empty"); +} + +Glib::PropertyProxy Action::property_sensitive() +{ + return Glib::PropertyProxy(this, "sensitive"); +} + +Glib::PropertyProxy_ReadOnly Action::property_sensitive() const +{ + return Glib::PropertyProxy_ReadOnly(this, "sensitive"); +} + +Glib::PropertyProxy Action::property_visible() +{ + return Glib::PropertyProxy(this, "visible"); +} + +Glib::PropertyProxy_ReadOnly Action::property_visible() const +{ + return Glib::PropertyProxy_ReadOnly(this, "visible"); +} + + +void Gtk::Action::on_activate() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->activate) + (*base->activate)(gobj()); +} + + +Widget* Gtk::Action::create_menu_item_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->create_menu_item) + return Glib::wrap((*base->create_menu_item)(gobj())); + + typedef Widget* RType; + return RType(); +} + +Widget* Gtk::Action::create_tool_item_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->create_tool_item) + return Glib::wrap((*base->create_tool_item)(gobj())); + + typedef Widget* RType; + return RType(); +} + +void Gtk::Action::connect_proxy_vfunc(Widget* proxy) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->connect_proxy) + (*base->connect_proxy)(gobj(),(GtkWidget*)Glib::unwrap(proxy)); +} + +void Gtk::Action::disconnect_proxy_vfunc(Widget* proxy) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->disconnect_proxy) + (*base->disconnect_proxy)(gobj(),(GtkWidget*)Glib::unwrap(proxy)); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/action.h b/libs/gtkmm2/gtk/gtkmm/action.h new file mode 100644 index 0000000000..6c319c769a --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/action.h @@ -0,0 +1,532 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ACTION_H +#define _GTKMM_ACTION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAction GtkAction; +typedef struct _GtkActionClass GtkActionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Action_Class; } // namespace Gtk +namespace Gtk +{ + +class MenuItem; +class ToolItem; +class Image; + + +class Action : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Action CppObjectType; + typedef Action_Class CppClassType; + typedef GtkAction BaseObjectType; + typedef GtkActionClass BaseClassType; + +private: friend class Action_Class; + static CppClassType action_class_; + +private: + // noncopyable + Action(const Action&); + Action& operator=(const Action&); + +protected: + explicit Action(const Glib::ConstructParams& construct_params); + explicit Action(GtkAction* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Action(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkAction* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkAction* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GtkAction* gobj_copy(); + +private: + + +protected: + Action(); + explicit Action(const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring()); + +public: + + static Glib::RefPtr create(); + + static Glib::RefPtr create(const Glib::ustring& name, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring()); + static Glib::RefPtr create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring()); + + + /** Returns the name of the action. + * @return The name of the action. The string belongs to GTK+ and should not + * be freed. + * + * Since: 2.4. + */ + Glib::ustring get_name() const; + + + /** Returns whether the action is effectively sensitive. + * @return true if the action and its associated action group + * are both sensitive. + * + * Since: 2.4. + */ + bool is_sensitive() const; + + /** Returns whether the action itself is sensitive. Note that this doesn't + * necessarily mean effective sensitivity. See is_sensitive() + * for that. + * @return true if the action itself is sensitive. + * + * Since: 2.4. + */ + bool get_sensitive() const; + + //TODO: Just wrap gtk_action_set_sensitive() when they put it in GTK+. + void set_tooltip(const Glib::ustring& tooltip); + + + /** Sets the ::sensitive property of the action to @a sensitive . Note that + * this doesn't necessarily mean effective sensitivity. See + * is_sensitive() + * for that. + * + * Since: 2.6 + * @param sensitive true to make the action sensitive. + */ + void set_sensitive(bool sensitive = true); + + + /** Returns whether the action is effectively visible. + * @return true if the action and its associated action group + * are both visible. + * + * Since: 2.4. + */ + bool is_visible() const; + + /** Returns whether the action itself is visible. Note that this doesn't + * necessarily mean effective visibility. See is_sensitive() + * for that. + * @return true if the action itself is visible. + * + * Since: 2.4. + */ + bool get_visible() const; + + /** Sets the ::visible property of the action to @a visible . Note that + * this doesn't necessarily mean effective visibility. See + * is_visible() + * for that. + * + * Since: 2.6 + * @param visible true to make the action visible. + */ + void set_visible(bool visible = true); + + + /** Emits the "activate" signal on the specified action, if it isn't + * insensitive. This gets called by the proxy widgets when they get + * activated. + * + * It can also be used to manually activate an action. + * + * Since: 2.4 + */ + void activate(); + + /** This function is intended for use by action implementations to + * create icons displayed in the proxy widgets. + * @param icon_size The size of the icon that should be created. + * @return A widget that displays the icon for this action. + * + * Since: 2.4. + */ + Image* create_icon(IconSize icon_size); + + /** Creates a menu item widget that proxies for the given action. + * @return A menu item connected to the action. + * + * Since: 2.4. + */ + MenuItem* create_menu_item(); + + /** Creates a toolbar item widget that proxies for the given action. + * @return A toolbar item connected to the action. + * + * Since: 2.4. + */ + ToolItem* create_tool_item(); + + /** Connects a widget to an action object as a proxy. Synchronises + * various properties of the action with the widget (such as label + * text, icon, tooltip, etc), and attaches a callback so that the + * action gets activated when the proxy widget does. + * + * If the widget is already connected to an action, it is disconnected + * first. + * + * Since: 2.4 + * @param proxy The proxy widget. + */ + void connect_proxy(Widget& proxy); + + /** Disconnects a proxy widget from an action. + * Does not destroy the widget, however. + * + * Since: 2.4 + * @param proxy The proxy widget. + */ + void disconnect_proxy(Widget& proxy); + + /** Returns the proxy widgets for an action. + * @return A G::SList of proxy widgets. The list is owned by the action and + * must not be modified. + * + * Since: 2.4. + */ + Glib::SListHandle get_proxies(); + + /** Returns the proxy widgets for an action. + * @return A G::SList of proxy widgets. The list is owned by the action and + * must not be modified. + * + * Since: 2.4. + */ + Glib::SListHandle get_proxies() const; + + /** Installs the accelerator for @a action if @a action has an + * accel path and group. See set_accel_path() and + * set_accel_group() + * + * Since multiple proxies may independently trigger the installation + * of the accelerator, the @a action counts the number of times this + * function has been called and doesn't remove the accelerator until + * disconnect_accelerator() has been called as many times. + * + * Since: 2.4 + */ + void connect_accelerator(); + + /** Undoes the effect of one call to connect_accelerator(). + * + * Since: 2.4 + */ + void disconnect_accelerator(); + + + /** Returns the accel path for this action. + * + * Since: 2.6 + * @return The accel path for this action, or 0 + * if none is set. The returned string is owned by GTK+ + * and must not be freed or modified. + */ + Glib::ustring get_accel_path() const; + + /// For instance, void on_activate(); + typedef sigc::slot SlotActivate; + + + Glib::SignalProxy0< void > signal_activate(); + + + //Used by AccelGroup: + + /** Sets the accel path for this action. All proxy widgets associated + * with the action will have this accel path, so that their + * accelerators are consistent. + * + * Since: 2.4 + * @param accel_path The accelerator path. + */ + void set_accel_path(const Glib::ustring& accel_path); + + /** Sets the Gtk::AccelGroup in which the accelerator for this action + * will be installed. + * + * Since: 2.4 + * @param accel_group A Gtk::AccelGroup or 0. + */ + void set_accel_group(const Glib::RefPtr& accel_group); + + /** A unique name for the action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_name() const; + + + /** The label used for menu items and buttons that activate this action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label() ; + +/** The label used for menu items and buttons that activate this action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label() const; + + /** A shorter label that may be used on toolbar buttons. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_short_label() ; + +/** A shorter label that may be used on toolbar buttons. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_short_label() const; + + /** A tooltip for this action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_tooltip() ; + +/** A tooltip for this action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_tooltip() const; + + /** The stock icon displayed in widgets representing this action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_stock_id() ; + +/** The stock icon displayed in widgets representing this action. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_stock_id() const; + + /** Whether the toolbar item is visible when the toolbar is in a horizontal orientation. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_visible_horizontal() ; + +/** Whether the toolbar item is visible when the toolbar is in a horizontal orientation. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_visible_horizontal() const; + + /** Whether the toolbar item is visible when the toolbar is in a vertical orientation. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_visible_vertical() ; + +/** Whether the toolbar item is visible when the toolbar is in a vertical orientation. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_visible_vertical() const; + + /** Whether the action is considered important. When TRUE + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_is_important() ; + +/** Whether the action is considered important. When TRUE + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_is_important() const; + + /** When TRUE + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_hide_if_empty() ; + +/** When TRUE + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_hide_if_empty() const; + + /** Whether the action is enabled. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_sensitive() ; + +/** Whether the action is enabled. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_sensitive() const; + + /** Whether the action is visible. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_visible() ; + +/** Whether the action is visible. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_visible() const; + + +protected: + //For use by child actions: + + /** Disables calls to the activate() + * function by signals on the given proxy widget. This is used to + * break notification loops for things like check or radio actions. + * + * This function is intended for use by action implementations. + * + * Since: 2.4 + * @param proxy A proxy widget. + */ + void block_activate_from(Widget& proxy); + + /** Re-enables calls to the activate() + * function by signals on the given proxy widget. This undoes the + * blocking done by block_activate_from(). + * + * This function is intended for use by action implementations. + * + * Since: 2.4 + * @param proxy A proxy widget. + */ + void unblock_activate_from(Widget& proxy); + + +protected: + //Widget-creation routines: + virtual Widget* create_menu_item_vfunc(); + virtual Widget* create_tool_item_vfunc(); + virtual void connect_proxy_vfunc(Widget* proxy); + virtual void disconnect_proxy_vfunc(Widget* proxy); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_activate(); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Action + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkAction* object, bool take_copy = false); +} + + +#endif /* _GTKMM_ACTION_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/actiongroup.cc b/libs/gtkmm2/gtk/gtkmm/actiongroup.cc new file mode 100644 index 0000000000..d539b9ab5e --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/actiongroup.cc @@ -0,0 +1,419 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace Gtk +{ + +void ActionGroup::add(const Glib::RefPtr& action) +{ + gtk_action_group_add_action_with_accel(gobj(), Glib::unwrap(action), + 0 /* accelerator=0 means use the stock accelerator if this is a stock item */ ); +} + +void ActionGroup::add(const Glib::RefPtr& action, const AccelKey& accel_key) +{ + // We need to half-duplicate the gtk_action_group_add_action_with_accel() implementation, because we want to + // use AccelKey, not just the accelerator string format that is _one_ of the ways to create an AccelKey. murrayc. + + //The AccelKey might have been constructed from key+mod or from an accelerator string, + //but it the end that just produces a key+mod. + guint key = accel_key.get_key(); + Gdk::ModifierType mod = accel_key.get_mod(); + if(key) + { + // The AccelKey constructor can take an accel path, so I suppose we should not ignore it, + // but I can't imagine how it would be useful with the UIManager. murrayc. + Glib::ustring accel_path = accel_key.get_path(); + if(accel_path.empty()) + { + //Copied from the gtk_action_group_add_action_with_accel() implementation: + accel_path = "/" + get_name() + "/" + action->property_name(); + } + + AccelMap::add_entry(accel_path, key, mod); + + action->set_accel_path(accel_path); + } + + gtk_action_group_add_action(gobj(), action->gobj()); +} + + +void ActionGroup::add(const Glib::RefPtr& action, const Action::SlotActivate& slot) +{ + //This is meant to be similar to the gtk_action_group_add_actions() convenience method that is used from C. + //This also does the work of gtk_action_group_add_toggle_actions() and gtk_action_group_add_radio_actions_full(), + //because the extra stuff there is already done when the Action (or a derived type, such as ToggleAction) is create()ed. + + action->signal_activate().connect(slot); + + //We probably don't need to use translate_string(), because the label and tooltip will be regular translated strings in our C++ application code. + //But C needs it because gtk_action_group_add_actions() takes a static array of GtkActionEntrys whose fields + //can not be translated with gettext macros. + //But we should soon know if menus and toolbars are not translated in non-english locales. murrayc. + + add(action); +} + +void ActionGroup::add(const Glib::RefPtr& action, const AccelKey& accel_key, const Action::SlotActivate& slot) +{ + //This is meant to be similar to the gtk_action_group_add_actions() convenience method that is used from C. + //This also does the work of gtk_action_group_add_toggle_actions() and gtk_action_group_add_radio_actions_full(), + //because the extra stuff there is already done when the Action (or a derived type, such as ToggleAction) is create()ed. + + action->signal_activate().connect(slot); + add(action, accel_key); + + /* + //Create the accel path (a kind of unique key): + Glib::ustring accel_path = "/" + get_name() + "/" + action->get_name(); + + //Register the accel path: + Gtk::AccelMap::add_entry(accel_path, accel_key.get_key(), accel_key.get_mod()); + + //USe the accel path: + action->set_accel_path(accel_path); + */ +} + + +} // namespace Gtk + + +namespace +{ + +void ActionGroup_signal_connect_proxy_callback(GtkActionGroup* self, GtkAction* p0,GtkWidget* p1,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::RefPtr&,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0, true) +, Glib::wrap(p1) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ActionGroup_signal_connect_proxy_info = +{ + "connect_proxy", + (GCallback) &ActionGroup_signal_connect_proxy_callback, + (GCallback) &ActionGroup_signal_connect_proxy_callback +}; + + +void ActionGroup_signal_disconnect_proxy_callback(GtkActionGroup* self, GtkAction* p0,GtkWidget* p1,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::RefPtr&,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0, true) +, Glib::wrap(p1) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ActionGroup_signal_disconnect_proxy_info = +{ + "disconnect_proxy", + (GCallback) &ActionGroup_signal_disconnect_proxy_callback, + (GCallback) &ActionGroup_signal_disconnect_proxy_callback +}; + + +void ActionGroup_signal_pre_activate_callback(GtkActionGroup* self, GtkAction* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::RefPtr& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ActionGroup_signal_pre_activate_info = +{ + "pre_activate", + (GCallback) &ActionGroup_signal_pre_activate_callback, + (GCallback) &ActionGroup_signal_pre_activate_callback +}; + + +void ActionGroup_signal_post_activate_callback(GtkActionGroup* self, GtkAction* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::RefPtr& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0, true) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ActionGroup_signal_post_activate_info = +{ + "post_activate", + (GCallback) &ActionGroup_signal_post_activate_callback, + (GCallback) &ActionGroup_signal_post_activate_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkActionGroup* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ActionGroup_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ActionGroup_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_action_group_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ActionGroup_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* ActionGroup_Class::wrap_new(GObject* object) +{ + return new ActionGroup((GtkActionGroup*)object); +} + + +/* The implementation: */ + +GtkActionGroup* ActionGroup::gobj_copy() +{ + reference(); + return gobj(); +} + +ActionGroup::ActionGroup(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +ActionGroup::ActionGroup(GtkActionGroup* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +ActionGroup::~ActionGroup() +{} + + +ActionGroup::CppClassType ActionGroup::actiongroup_class_; // initialize static member + +GType ActionGroup::get_type() +{ + return actiongroup_class_.init().get_type(); +} + +GType ActionGroup::get_base_type() +{ + return gtk_action_group_get_type(); +} + + +ActionGroup::ActionGroup(const Glib::ustring& name) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(actiongroup_class_.init(), "name", name.c_str(), (char*) 0)) +{ + } + +Glib::RefPtr ActionGroup::create(const Glib::ustring& name) +{ + return Glib::RefPtr( new ActionGroup(name) ); +} +Glib::ustring ActionGroup::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_group_get_name(const_cast(gobj()))); +} + +bool ActionGroup::get_sensitive() const +{ + return gtk_action_group_get_sensitive(const_cast(gobj())); +} + +void ActionGroup::set_sensitive(bool sensitive) +{ + gtk_action_group_set_sensitive(gobj(), static_cast(sensitive)); +} + +bool ActionGroup::get_visible() const +{ + return gtk_action_group_get_visible(const_cast(gobj())); +} + +void ActionGroup::set_visible(bool visible) +{ + gtk_action_group_set_visible(gobj(), static_cast(visible)); +} + +Glib::RefPtr ActionGroup::get_action(const Glib::ustring& action_name) +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_action_group_get_action(gobj(), action_name.c_str())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr ActionGroup::get_action(const Glib::ustring& action_name) const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_action_group_get_action(const_cast(gobj()), action_name.c_str())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::ListHandle< Glib::RefPtr > ActionGroup::get_actions() +{ + return Glib::ListHandle< Glib::RefPtr >(gtk_action_group_list_actions(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle< Glib::RefPtr > ActionGroup::get_actions() const +{ + return Glib::ListHandle< Glib::RefPtr >(gtk_action_group_list_actions(const_cast(gobj())), Glib::OWNERSHIP_SHALLOW); +} + +void ActionGroup::remove(const Glib::RefPtr& action) +{ + gtk_action_group_remove_action(gobj(), Glib::unwrap(action)); +} + +Glib::ustring ActionGroup::translate_string(const Glib::ustring& str) const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_group_translate_string(const_cast(gobj()), str.c_str())); +} + + +Glib::SignalProxy2< void,const Glib::RefPtr&,Widget* > ActionGroup::signal_connect_proxy() +{ + return Glib::SignalProxy2< void,const Glib::RefPtr&,Widget* >(this, &ActionGroup_signal_connect_proxy_info); +} + +Glib::SignalProxy2< void,const Glib::RefPtr&,Widget* > ActionGroup::signal_disconnect_proxy() +{ + return Glib::SignalProxy2< void,const Glib::RefPtr&,Widget* >(this, &ActionGroup_signal_disconnect_proxy_info); +} + +Glib::SignalProxy1< void,const Glib::RefPtr& > ActionGroup::signal_pre_activate() +{ + return Glib::SignalProxy1< void,const Glib::RefPtr& >(this, &ActionGroup_signal_pre_activate_info); +} + +Glib::SignalProxy1< void,const Glib::RefPtr& > ActionGroup::signal_post_activate() +{ + return Glib::SignalProxy1< void,const Glib::RefPtr& >(this, &ActionGroup_signal_post_activate_info); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/actiongroup.h b/libs/gtkmm2/gtk/gtkmm/actiongroup.h new file mode 100644 index 0000000000..8db2b42e80 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/actiongroup.h @@ -0,0 +1,250 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ACTIONGROUP_H +#define _GTKMM_ACTIONGROUP_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkActionGroup GtkActionGroup; +typedef struct _GtkActionGroupClass GtkActionGroupClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ActionGroup_Class; } // namespace Gtk +namespace Gtk +{ + + +class ActionGroup : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef ActionGroup CppObjectType; + typedef ActionGroup_Class CppClassType; + typedef GtkActionGroup BaseObjectType; + typedef GtkActionGroupClass BaseClassType; + +private: friend class ActionGroup_Class; + static CppClassType actiongroup_class_; + +private: + // noncopyable + ActionGroup(const ActionGroup&); + ActionGroup& operator=(const ActionGroup&); + +protected: + explicit ActionGroup(const Glib::ConstructParams& construct_params); + explicit ActionGroup(GtkActionGroup* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~ActionGroup(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkActionGroup* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkActionGroup* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GtkActionGroup* gobj_copy(); + +private: + + +protected: + explicit ActionGroup(const Glib::ustring& name = Glib::ustring()); + +public: + + static Glib::RefPtr create(const Glib::ustring& name = Glib::ustring()); + + + /** Gets the name of the action group. + * @return The name of the action group. + * + * Since: 2.4. + */ + Glib::ustring get_name() const; + + + /** Returns true if the group is sensitive. The constituent actions + * can only be logically sensitive (see is_sensitive()) if + * they are sensitive (see get_sensitive()) and their group + * is sensitive. + * @return true if the group is sensitive. + * + * Since: 2.4. + */ + bool get_sensitive() const; + + /** Changes the sensitivity of @a action_group + * + * Since: 2.4 + * @param sensitive New sensitivity. + */ + void set_sensitive(bool sensitive = true); + + /** Returns true if the group is visible. The constituent actions + * can only be logically visible (see is_visible()) if + * they are visible (see get_visible()) and their group + * is visible. + * @return true if the group is visible. + * + * Since: 2.4. + */ + bool get_visible() const; + + /** Changes the visible of @a action_group . + * + * Since: 2.4 + * @param visible New visiblity. + */ + void set_visible(bool visible = true); + + + /** Looks up an action in the action group by name. + * @param action_name The name of the action. + * @return The action, or 0 if no action by that name exists + * + * Since: 2.4. + */ + Glib::RefPtr get_action(const Glib::ustring& action_name); + + /** Looks up an action in the action group by name. + * @param action_name The name of the action. + * @return The action, or 0 if no action by that name exists + * + * Since: 2.4. + */ + Glib::RefPtr get_action(const Glib::ustring& action_name) const; + + + /** Lists the actions in the action group. + * @return An allocated list of the action objects in the action group + * + * Since: 2.4. + */ + Glib::ListHandle< Glib::RefPtr > get_actions(); + + /** Lists the actions in the action group. + * @return An allocated list of the action objects in the action group + * + * Since: 2.4. + */ + Glib::ListHandle< Glib::RefPtr > get_actions() const; + + void add(const Glib::RefPtr& action); + + //We want it to always try to use the stock accelerator, + //so we use gtk_action_group_add_action_with_accel(), instead of gtk_action_group_add_action(), + //passing null for the accelerator. + + void add(const Glib::RefPtr& action, const AccelKey& accel_key); + + //We need to duplicate the gtk_action_group_add_action_with_accel() implementation, because we want to + //use AccelKey, not just the accelerator string format that is _one_ of the ways to create an AccelKey. + + //TODO: Could this whole class have an STL-style interface? + void add(const Glib::RefPtr& action, const Action::SlotActivate& slot); + void add(const Glib::RefPtr& action, const AccelKey& accel_key, const Action::SlotActivate& slot); + + /** Removes an action object from the action group. + * + * Since: 2.4 + * @param action An action. + */ + void remove(const Glib::RefPtr& action); + + //TODO: We probably need to use this in our add_actions() implementation: + + /** Translates a string using the specified translate_func(). This + * is mainly intended for language bindings. + * @param string A string. + * @return The translation of @a string + * + * Since: 2.6. + */ + Glib::ustring translate_string(const Glib::ustring& str) const; + + + //These are just C convenience methods: + + //These are also just C convenience methods that are useless unless you are using the other convenience methods: + + + Glib::SignalProxy2< void,const Glib::RefPtr&,Widget* > signal_connect_proxy(); + + + Glib::SignalProxy2< void,const Glib::RefPtr&,Widget* > signal_disconnect_proxy(); + + + Glib::SignalProxy1< void,const Glib::RefPtr& > signal_pre_activate(); + + + Glib::SignalProxy1< void,const Glib::RefPtr& > signal_post_activate(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::ActionGroup + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkActionGroup* object, bool take_copy = false); +} + + +#endif /* _GTKMM_ACTIONGROUP_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/adjustment.cc b/libs/gtkmm2/gtk/gtkmm/adjustment.cc new file mode 100644 index 0000000000..10b2e8815f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/adjustment.cc @@ -0,0 +1,343 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include + +namespace Gtk +{ + +Adjustment::Adjustment(double value, + double lower, double upper, + double step_increment, double page_increment, + double page_size) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Object(Glib::ConstructParams(adjustment_class_.init(), (char*) 0)) +{ + gobj()->lower = lower; + gobj()->upper = upper; + gobj()->step_increment = step_increment; + gobj()->page_increment = page_increment; + gobj()->page_size = page_size; + changed(); + + set_value(value); +} + +void Adjustment::set_lower(double lower) +{ + gobj()->lower = lower; + changed(); +} + +void Adjustment::set_upper(double upper) +{ + gobj()->upper = upper; + changed(); +} + +void Adjustment::set_step_increment(double incr) +{ + gobj()->step_increment = incr; + changed(); +} + +void Adjustment::set_page_increment(double incr) +{ + gobj()->page_increment = incr; + changed(); +} + +void Adjustment::set_page_size(double size) +{ + gobj()->page_size = size; + changed(); +} + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo Adjustment_signal_changed_info = +{ + "changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Adjustment_signal_value_changed_info = +{ + "value_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Adjustment* wrap(GtkAdjustment* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Adjustment_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Adjustment_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_adjustment_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Adjustment_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->changed = &changed_callback; + klass->value_changed = &value_changed_callback; +} + + +void Adjustment_Class::changed_callback(GtkAdjustment* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->changed) + (*base->changed)(self); + } +} + +void Adjustment_Class::value_changed_callback(GtkAdjustment* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_value_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->value_changed) + (*base->value_changed)(self); + } +} + + +Glib::ObjectBase* Adjustment_Class::wrap_new(GObject* o) +{ + return manage(new Adjustment((GtkAdjustment*)(o))); + +} + + +/* The implementation: */ + +Adjustment::Adjustment(const Glib::ConstructParams& construct_params) +: + Gtk::Object(construct_params) +{ + } + +Adjustment::Adjustment(GtkAdjustment* castitem) +: + Gtk::Object((GtkObject*)(castitem)) +{ + } + +Adjustment::~Adjustment() +{ + destroy_(); +} + +Adjustment::CppClassType Adjustment::adjustment_class_; // initialize static member + +GType Adjustment::get_type() +{ + return adjustment_class_.init().get_type(); +} + +GType Adjustment::get_base_type() +{ + return gtk_adjustment_get_type(); +} + + +void Adjustment::changed() +{ + gtk_adjustment_changed(gobj()); +} + +void Adjustment::value_changed() +{ + gtk_adjustment_value_changed(gobj()); +} + +void Adjustment::clamp_page(double lower, double upper) +{ + gtk_adjustment_clamp_page(gobj(), lower, upper); +} + +void Adjustment::set_value(double value) +{ + gtk_adjustment_set_value(gobj(), value); +} + +double Adjustment::get_value() const +{ + return gtk_adjustment_get_value(const_cast(gobj())); +} + +double Adjustment::get_lower() const +{ + return gobj()->lower; +} + +double Adjustment::get_upper() const +{ + return gobj()->upper; +} + +double Adjustment::get_step_increment() const +{ + return gobj()->step_increment; +} + +double Adjustment::get_page_increment() const +{ + return gobj()->page_increment; +} + +double Adjustment::get_page_size() const +{ + return gobj()->page_size; +} + + +Glib::SignalProxy0< void > Adjustment::signal_changed() +{ + return Glib::SignalProxy0< void >(this, &Adjustment_signal_changed_info); +} + +Glib::SignalProxy0< void > Adjustment::signal_value_changed() +{ + return Glib::SignalProxy0< void >(this, &Adjustment_signal_value_changed_info); +} + + +void Gtk::Adjustment::on_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->changed) + (*base->changed)(gobj()); +} + +void Gtk::Adjustment::on_value_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->value_changed) + (*base->value_changed)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/adjustment.h b/libs/gtkmm2/gtk/gtkmm/adjustment.h new file mode 100644 index 0000000000..2c45297cb4 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/adjustment.h @@ -0,0 +1,236 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ADJUSTMENT_H +#define _GTKMM_ADJUSTMENT_H + +#include + +/* $Id$ */ + +/* adjustment.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAdjustment GtkAdjustment; +typedef struct _GtkAdjustmentClass GtkAdjustmentClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Adjustment_Class; } // namespace Gtk +namespace Gtk +{ + +/** A class representing an adjustable bounded value. + * + * The Gtk::Adjustment object represents a value which has an associated + * lower and upper bound, together with step and page increments, and a page + * size. It is used within several gtkmm widgets, including + * Gtk::SpinButton, Gtk::Viewport, and Gtk::Range (which is a base class for + * Gtk::HScrollbar, Gtk::VScrollbar, Gtk::HScale, and Gtk::VScale). + * + * The Gtk::Adjustment object does not update the value itself. Instead it + * is left up to the owner of the Gtk::Adjustment to control the value. + * + * The owner of the Gtk::Adjustment typically calls the value_changed() and + * changed() functions after changing the value and its bounds. This results + * in the emission of the "value_changed" or "changed" signal respectively. + * + */ + +class Adjustment : public Object +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Adjustment CppObjectType; + typedef Adjustment_Class CppClassType; + typedef GtkAdjustment BaseObjectType; + typedef GtkAdjustmentClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Adjustment(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Adjustment_Class; + static CppClassType adjustment_class_; + + // noncopyable + Adjustment(const Adjustment&); + Adjustment& operator=(const Adjustment&); + +protected: + explicit Adjustment(const Glib::ConstructParams& construct_params); + explicit Adjustment(GtkAdjustment* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkAdjustment* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkAdjustment* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_changed(); + virtual void on_value_changed(); + + +private: + +public: + + friend class Range; + friend class HScrollbar; + friend class VScrollbar; + + /** Constructor to create an Adjustment object. + * @param value The initial value + * @param lower The minimum value + * @param upper The maximum value + * @param step_increment The step increment + * @param page_increment The page increment + * @param page_size The page size + */ + Adjustment(double value, + double lower, double upper, + double step_increment = 1, double page_increment = 10, + double page_size = 0); + + + /** Emits a "changed" signal from the Adjustment. This is typically called by the owner of the Adjustment after it has changed any of the Adjustment fields other than the value. + */ + void changed(); + + /** Emits a "value_changed" signal from the Adjustment. This is typically called by the owner of the Adjustment after it has changed the Adjustment value field. + */ + void value_changed(); + + + /** Updates the Adjustment value to ensure that the range between the parameters @a lower and @a upper is in the current page (i.e.\ between @a value and @a value + @a page_size ). If this range is larger than the page size, then only the start of it will be in the current page. A "changed" signal will be emitted if the value is changed. + * @param upper The upper value. + * @param lower The lower value. + */ + void clamp_page(double lower, double upper); + + + /** Sets the current value of the Adjustment + * @param value The new value of the Adjustment. + */ + void set_value(double value); + + /** Gets the current value of the adjustment. See + * set_value(). + * @return The current value of the adjustment. + */ + double get_value() const; + + // Other internal fields accessors + /** Retrieve the @a lower member variable. + * @return The current value of @a lower. + */ + double get_lower() const; + + /** Retrieve the @a upper member variable. + * @return The current value of @a upper. + */ + double get_upper() const; + + /** Retrieve the @a step_increment variable. + * @return The current value of @a step_increment. + */ + double get_step_increment() const; + + /** Retrieve the @a page_increment variable. + * @return The current value of @a page_increment. + */ + double get_page_increment() const; + + /** Retrieve the @a page_size variable. + * @return The current value of @a page_size. + */ + double get_page_size() const; + + // TODO: This section needs changing. We must be able to set more at a time, + // emitting "changed" signal only once. + /** Sets the @a lower member variable + * @param lower The value to set the @a lower member variable to. + */ + void set_lower(double lower); + + /** Sets the @a upper member variable + * @param upper The value to set the @a upper member variable to. + */ + void set_upper(double upper); + + /** Sets the @a step_increment member variable + * @param incr The value to set the @a step_incrememnt member variable to. + */ + void set_step_increment(double incr); + + /** Sets the @a page_increment member variable + * @param incr The value to set the @a page_increment member variable to. + */ + void set_page_increment(double incr); + + /** Sets the @a page_size member variable + * @param size The value to set the @ page_size member varialbe to. + */ + void set_page_size(double size); + + + Glib::SignalProxy0< void > signal_changed(); + + + Glib::SignalProxy0< void > signal_value_changed(); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Adjustment + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Adjustment* wrap(GtkAdjustment* object, bool take_copy = false); +} +#endif /* _GTKMM_ADJUSTMENT_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/alignment.cc b/libs/gtkmm2/gtk/gtkmm/alignment.cc new file mode 100644 index 0000000000..56f5c58726 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/alignment.cc @@ -0,0 +1,243 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Alignment* wrap(GtkAlignment* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Alignment_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Alignment_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_alignment_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Alignment_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Alignment_Class::wrap_new(GObject* o) +{ + return manage(new Alignment((GtkAlignment*)(o))); + +} + + +/* The implementation: */ + +Alignment::Alignment(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +Alignment::Alignment(GtkAlignment* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +Alignment::~Alignment() +{ + destroy_(); +} + +Alignment::CppClassType Alignment::alignment_class_; // initialize static member + +GType Alignment::get_type() +{ + return alignment_class_.init().get_type(); +} + +GType Alignment::get_base_type() +{ + return gtk_alignment_get_type(); +} + + +Alignment::Alignment(float xalign, float yalign, float xscale, float yscale) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(alignment_class_.init(), "xalign", xalign, "yalign", yalign, "xscale", xscale, "yscale", yscale, (char*) 0)) +{ + } + +Alignment::Alignment(AlignmentEnum xalign, AlignmentEnum yalign, float xscale, float yscale) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(alignment_class_.init(), "xalign", _gtkmm_align_float_from_enum(xalign), "yalign", _gtkmm_align_float_from_enum(yalign), "xscale", xscale, "yscale", yscale, (char*) 0)) +{ + } + +void Alignment::set(float xalign, float yalign, float xscale, float yscale) +{ + gtk_alignment_set(gobj(), xalign, yalign, xscale, yscale); +} + +void Alignment::set(AlignmentEnum xalign, AlignmentEnum yalign, float xscale, float yscale) +{ + gtk_alignment_set(gobj(), _gtkmm_align_float_from_enum(xalign), _gtkmm_align_float_from_enum(yalign), xscale, yscale); +} + +void Alignment::set_padding(guint padding_top, guint padding_bottom, guint padding_left, guint padding_right) +{ + gtk_alignment_set_padding(gobj(), padding_top, padding_bottom, padding_left, padding_right); +} + +void Alignment::get_padding(guint& padding_top, guint& padding_bottom, guint& padding_left, guint& padding_right) +{ + gtk_alignment_get_padding(gobj(), &(padding_top), &(padding_bottom), &(padding_left), &(padding_right)); +} + + +Glib::PropertyProxy Alignment::property_xalign() +{ + return Glib::PropertyProxy(this, "xalign"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_xalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "xalign"); +} + +Glib::PropertyProxy Alignment::property_yalign() +{ + return Glib::PropertyProxy(this, "yalign"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_yalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "yalign"); +} + +Glib::PropertyProxy Alignment::property_xscale() +{ + return Glib::PropertyProxy(this, "xscale"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_xscale() const +{ + return Glib::PropertyProxy_ReadOnly(this, "xscale"); +} + +Glib::PropertyProxy Alignment::property_yscale() +{ + return Glib::PropertyProxy(this, "yscale"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_yscale() const +{ + return Glib::PropertyProxy_ReadOnly(this, "yscale"); +} + +Glib::PropertyProxy Alignment::property_top_padding() +{ + return Glib::PropertyProxy(this, "top-padding"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_top_padding() const +{ + return Glib::PropertyProxy_ReadOnly(this, "top-padding"); +} + +Glib::PropertyProxy Alignment::property_bottom_padding() +{ + return Glib::PropertyProxy(this, "bottom-padding"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_bottom_padding() const +{ + return Glib::PropertyProxy_ReadOnly(this, "bottom-padding"); +} + +Glib::PropertyProxy Alignment::property_left_padding() +{ + return Glib::PropertyProxy(this, "left-padding"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_left_padding() const +{ + return Glib::PropertyProxy_ReadOnly(this, "left-padding"); +} + +Glib::PropertyProxy Alignment::property_right_padding() +{ + return Glib::PropertyProxy(this, "right-padding"); +} + +Glib::PropertyProxy_ReadOnly Alignment::property_right_padding() const +{ + return Glib::PropertyProxy_ReadOnly(this, "right-padding"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/alignment.h b/libs/gtkmm2/gtk/gtkmm/alignment.h new file mode 100644 index 0000000000..98130b9e2d --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/alignment.h @@ -0,0 +1,318 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ALIGNMENT_H +#define _GTKMM_ALIGNMENT_H + +#include + +/* $Id$ */ + +/* alignment.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAlignment GtkAlignment; +typedef struct _GtkAlignmentClass GtkAlignmentClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Alignment_Class; } // namespace Gtk +namespace Gtk +{ + +/** A widget which controls the alignment and size of its child. + * + * Normally, a widget is allocated at least as much size as it requests, and, + * most widgets expand to fill any extra allocated space, but sometimes + * this behavior is not desired. The alignment widget allows the + * programmer to specify how a widget should expand and position itself + * to fill the area it is allocated. + * + * It has four settings: xscale, yscale, xalign, and yalign: + * The scale settings specify how much the child widget should expand to fill the space allocated to the Gtk::Alignment. The values can range from 0 (meaning the child doesn't expand at all) to 1 (meaning the child expands to fill all of the available space). + * The align settings place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class Alignment : public Bin +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Alignment CppObjectType; + typedef Alignment_Class CppClassType; + typedef GtkAlignment BaseObjectType; + typedef GtkAlignmentClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Alignment(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Alignment_Class; + static CppClassType alignment_class_; + + // noncopyable + Alignment(const Alignment&); + Alignment& operator=(const Alignment&); + +protected: + explicit Alignment(const Glib::ConstructParams& construct_params); + explicit Alignment(GtkAlignment* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkAlignment* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkAlignment* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + /** Constructor to create an Alignment object. + * @param xalign The initial horizontal alignment of the child. + * @param yalign The initial vertical alignment of the child. + * @param xscale The initial amount that the child expands horizontally to fill up unused space. + * @param yscale The initial amount that the child expands vertically to fill up unused space. + */ + explicit Alignment(float xalign = 0.5, float yalign = 0.5, float xscale = 1.0, float yscale = 1.0); + + /** Constructor to create an Alignment object. + * @param xalign A Gtk::AlignmentEnum describing the initial horizontal alignment of the child. + * @param yalign A Gtk::AlignmentEnum describing the initial vertical alignment of the child. + * @param xscale The initial amount that the child expands horizontally to fill up unused space. + * @param yscale The initial amount that the child expands vertically to fill up unused space. + */ + explicit Alignment(AlignmentEnum xalign, AlignmentEnum yalign = Gtk::ALIGN_CENTER, float xscale = 1.0, float yscale = 1.0); + + + /** Sets the Alignment values. + * @param xalign The horizontal alignment of the child of this Alignment, from 0 (left) to 1 (right). + * @param yalign The vertical alignment of the child of this Alignment, from 0 (top) to 1 (bottom). + * @param xscale The amount that the child expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all the space allocated for the Alignment. + * @param yscale The amount that the child widget expands vertically to fill up unused space from 0 to 1. The values are similar to @a xscale . + */ + void set(float xalign = 0.5, float yalign = 0.5, float xscale = 1.0, float yscale= 1.0); + + /** Sets the Alignment values. + * @param xalign The horizontal alignment of the child of this Alignment, from 0 (left) to 1 (right). + * @param yalign The vertical alignment of the child of this Alignment, from 0 (top) to 1 (bottom). + * @param xscale The amount that the child expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all the space allocated for the Alignment. + * @param yscale The amount that the child widget expands vertically to fill up unused space from 0 to 1. The values are similar to @a xscale . + */ + void set(AlignmentEnum xalign, AlignmentEnum yalign = Gtk::ALIGN_CENTER, float xscale = 1.0, float yscale= 1.0); + + //New in GTK+ 2.4 + + /** Sets the padding on the different sides of the widget. + * The padding adds blank space to the sides of the widget. For instance, + * this can be used to indent the child widget towards the right by adding + * padding on the left. + * + * Since: 2.4 + * @param padding_top The padding at the top of the widget. + * @param padding_bottom The padding at the bottom of the widget. + * @param padding_left The padding at the left of the widget. + * @param padding_right The padding at the right of the widget. + */ + void set_padding(guint padding_top, guint padding_bottom, guint padding_left, guint padding_right); + + /** Gets the padding on the different sides of the widget. + * See set_padding(). + * + * Since: 2.4 + * @param padding_top Location to store the padding for the top of the widget, or 0. + * @param padding_bottom Location to store the padding for the bottom of the widget, or 0. + * @param padding_left Location to store the padding for the left of the widget, or 0. + * @param padding_right Location to store the padding for the right of the widget, or 0. + */ + void get_padding(guint& padding_top, guint& padding_bottom, guint& padding_left, guint& padding_right); + + /** Horizontal position of child in available space. 0.0 is left aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_xalign() ; + +/** Horizontal position of child in available space. 0.0 is left aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_xalign() const; + + /** Vertical position of child in available space. 0.0 is top aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_yalign() ; + +/** Vertical position of child in available space. 0.0 is top aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_yalign() const; + + /** If available horizontal space is bigger than needed for the child + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_xscale() ; + +/** If available horizontal space is bigger than needed for the child + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_xscale() const; + + /** If available vertical space is bigger than needed for the child + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_yscale() ; + +/** If available vertical space is bigger than needed for the child + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_yscale() const; + + + //New in GTK+ 2.4 + /** The padding to insert at the top of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_top_padding() ; + +/** The padding to insert at the top of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_top_padding() const; + + /** The padding to insert at the bottom of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_bottom_padding() ; + +/** The padding to insert at the bottom of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_bottom_padding() const; + + /** The padding to insert at the left of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_left_padding() ; + +/** The padding to insert at the left of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_left_padding() const; + + /** The padding to insert at the right of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_right_padding() ; + +/** The padding to insert at the right of the widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_right_padding() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Alignment + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Alignment* wrap(GtkAlignment* object, bool take_copy = false); +} +#endif /* _GTKMM_ALIGNMENT_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/arrow.cc b/libs/gtkmm2/gtk/gtkmm/arrow.cc new file mode 100644 index 0000000000..681847cc02 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/arrow.cc @@ -0,0 +1,177 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include + +namespace Gtk +{ + +/* +#define MIN_ARROW_SIZE 11 + +Arrow::Arrow(ArrowType arrow_type, ShadowType shadow_type) + _CONSTRUCT() +{ + + GtkArrow *arrow=gobj(); + + GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2; + GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2; + + arrow->arrow_type = arrow_type; + arrow->shadow_type = shadow_type; +} + +*/ + +} /* namespace Gtk */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Arrow* wrap(GtkArrow* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Arrow_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Arrow_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_arrow_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Arrow_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Arrow_Class::wrap_new(GObject* o) +{ + return manage(new Arrow((GtkArrow*)(o))); + +} + + +/* The implementation: */ + +Arrow::Arrow(const Glib::ConstructParams& construct_params) +: + Gtk::Misc(construct_params) +{ + } + +Arrow::Arrow(GtkArrow* castitem) +: + Gtk::Misc((GtkMisc*)(castitem)) +{ + } + +Arrow::~Arrow() +{ + destroy_(); +} + +Arrow::CppClassType Arrow::arrow_class_; // initialize static member + +GType Arrow::get_type() +{ + return arrow_class_.init().get_type(); +} + +GType Arrow::get_base_type() +{ + return gtk_arrow_get_type(); +} + + +Arrow::Arrow(ArrowType arrow_type, ShadowType shadow_type) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Misc(Glib::ConstructParams(arrow_class_.init(), "arrow_type", ((GtkArrowType)(arrow_type)), "shadow_type", ((GtkShadowType)(shadow_type)), (char*) 0)) +{ + } + +void Arrow::set(ArrowType arrow_type, ShadowType shadow_type) +{ + gtk_arrow_set(gobj(), ((GtkArrowType)(arrow_type)), ((GtkShadowType)(shadow_type))); +} + + +Glib::PropertyProxy Arrow::property_arrow_type() +{ + return Glib::PropertyProxy(this, "arrow-type"); +} + +Glib::PropertyProxy_ReadOnly Arrow::property_arrow_type() const +{ + return Glib::PropertyProxy_ReadOnly(this, "arrow-type"); +} + +Glib::PropertyProxy Arrow::property_shadow_type() +{ + return Glib::PropertyProxy(this, "shadow-type"); +} + +Glib::PropertyProxy_ReadOnly Arrow::property_shadow_type() const +{ + return Glib::PropertyProxy_ReadOnly(this, "shadow-type"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/arrow.h b/libs/gtkmm2/gtk/gtkmm/arrow.h new file mode 100644 index 0000000000..f34a744d3e --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/arrow.h @@ -0,0 +1,177 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ARROW_H +#define _GTKMM_ARROW_H + +#include + +/* $Id$ */ + +/* arrow.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkArrow GtkArrow; +typedef struct _GtkArrowClass GtkArrowClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Arrow_Class; } // namespace Gtk +namespace Gtk +{ + +/** Produces an arrow pointing in one of the four cardinal directions. + * + * This is intended for use where a directional arrow (in one of the four + * cardinal directions) is desired. As such, it has very limited + * functionality and basically only draws itself in a particular direction + * and with a particular shadow type. + * + * Gtk::Arrow will fill any space alloted to it, but since it is inherited + * from Gtk::Misc, it can be padded and/or aligned, to fill exactly the + * space the programmer desires. + * + * @ingroup Widgets + */ + +class Arrow : public Misc { + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Arrow CppObjectType; + typedef Arrow_Class CppClassType; + typedef GtkArrow BaseObjectType; + typedef GtkArrowClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Arrow(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Arrow_Class; + static CppClassType arrow_class_; + + // noncopyable + Arrow(const Arrow&); + Arrow& operator=(const Arrow&); + +protected: + explicit Arrow(const Glib::ConstructParams& construct_params); + explicit Arrow(GtkArrow* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkArrow* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkArrow* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + + /** Creates an arrow. + * + * @param arrow_type A Gtk::ArrowType enum describing the arrow direction. + * @param shadow_type A Gtk::ShadowType enum describing the shadow type of + * the arrow. + */ + explicit Arrow(ArrowType arrow_type, ShadowType shadow_type); + + + // Changes the direction and shadow of an arrow. + + /** Sets the direction and shadow of this Arrow. + * @param arrow_type A Gtk::ArrowType enum describing what arrow type to set this Arrow to. + * @param shadow_type A Gtk::ShadowType enum describing what shadow type to set this Arrow to. + */ + void set(ArrowType arrow_type, ShadowType shadow_type); + + /** The direction the arrow should point. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_arrow_type() ; + +/** The direction the arrow should point. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_arrow_type() const; + + /** Appearance of the shadow surrounding the arrow. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_shadow_type() ; + +/** Appearance of the shadow surrounding the arrow. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_shadow_type() const; + + +}; + + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Arrow + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Arrow* wrap(GtkArrow* object, bool take_copy = false); +} +#endif /* _GTKMM_ARROW_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/aspectframe.cc b/libs/gtkmm2/gtk/gtkmm/aspectframe.cc new file mode 100644 index 0000000000..faf6a94286 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/aspectframe.cc @@ -0,0 +1,187 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::AspectFrame* wrap(GtkAspectFrame* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& AspectFrame_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &AspectFrame_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_aspect_frame_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void AspectFrame_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* AspectFrame_Class::wrap_new(GObject* o) +{ + return manage(new AspectFrame((GtkAspectFrame*)(o))); + +} + + +/* The implementation: */ + +AspectFrame::AspectFrame(const Glib::ConstructParams& construct_params) +: + Gtk::Frame(construct_params) +{ + } + +AspectFrame::AspectFrame(GtkAspectFrame* castitem) +: + Gtk::Frame((GtkFrame*)(castitem)) +{ + } + +AspectFrame::~AspectFrame() +{ + destroy_(); +} + +AspectFrame::CppClassType AspectFrame::aspectframe_class_; // initialize static member + +GType AspectFrame::get_type() +{ + return aspectframe_class_.init().get_type(); +} + +GType AspectFrame::get_base_type() +{ + return gtk_aspect_frame_get_type(); +} + + +AspectFrame::AspectFrame(const Glib::ustring& label, AlignmentEnum xalign, AlignmentEnum yalign, float ratio, bool obey_child) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Frame(Glib::ConstructParams(aspectframe_class_.init(), "label", label.c_str(), "xalign", _gtkmm_align_float_from_enum(xalign), "yalign", _gtkmm_align_float_from_enum(yalign), "ratio", ratio, "obey_child", static_cast(obey_child), (char*) 0)) +{ + } + +AspectFrame::AspectFrame(const Glib::ustring& label, float xalign, float yalign, float ratio, bool obey_child) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Frame(Glib::ConstructParams(aspectframe_class_.init(), "label", label.c_str(), "xalign", xalign, "yalign", yalign, "ratio", ratio, "obey_child", static_cast(obey_child), (char*) 0)) +{ + } + +void AspectFrame::set(float xalign, float yalign, float ratio, bool obey_child) +{ + gtk_aspect_frame_set(gobj(), xalign, yalign, ratio, static_cast(obey_child)); +} + +void AspectFrame::set(AlignmentEnum xalign, AlignmentEnum yalign, float ratio, bool obey_child) +{ + gtk_aspect_frame_set(gobj(), _gtkmm_align_float_from_enum(xalign), _gtkmm_align_float_from_enum(yalign), ratio, static_cast(obey_child)); +} + + +Glib::PropertyProxy AspectFrame::property_xalign() +{ + return Glib::PropertyProxy(this, "xalign"); +} + +Glib::PropertyProxy_ReadOnly AspectFrame::property_xalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "xalign"); +} + +Glib::PropertyProxy AspectFrame::property_yalign() +{ + return Glib::PropertyProxy(this, "yalign"); +} + +Glib::PropertyProxy_ReadOnly AspectFrame::property_yalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "yalign"); +} + +Glib::PropertyProxy AspectFrame::property_ratio() +{ + return Glib::PropertyProxy(this, "ratio"); +} + +Glib::PropertyProxy_ReadOnly AspectFrame::property_ratio() const +{ + return Glib::PropertyProxy_ReadOnly(this, "ratio"); +} + +Glib::PropertyProxy AspectFrame::property_obey_child() +{ + return Glib::PropertyProxy(this, "obey-child"); +} + +Glib::PropertyProxy_ReadOnly AspectFrame::property_obey_child() const +{ + return Glib::PropertyProxy_ReadOnly(this, "obey-child"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/aspectframe.h b/libs/gtkmm2/gtk/gtkmm/aspectframe.h new file mode 100644 index 0000000000..4687417211 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/aspectframe.h @@ -0,0 +1,242 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ASPECTFRAME_H +#define _GTKMM_ASPECTFRAME_H + +#include + +/* $Id$ */ + +/* aspectframe.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkAspectFrame GtkAspectFrame; +typedef struct _GtkAspectFrameClass GtkAspectFrameClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class AspectFrame_Class; } // namespace Gtk +namespace Gtk +{ + +/** A frame that constrains its child to a particular aspect ratio. + * + * The Gtk::AspectFrame is useful when you want pack a widget so that it can + * resize but always retains the same aspect ratio. For instance, one might + * be drawing a small preview of a larger image. Because it derives from + * Gtk::Frame, it can draw a label and a frame around the child. The frame + * will be "shrink-wrapped" to the size of the child. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class AspectFrame : public Frame +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AspectFrame CppObjectType; + typedef AspectFrame_Class CppClassType; + typedef GtkAspectFrame BaseObjectType; + typedef GtkAspectFrameClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~AspectFrame(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class AspectFrame_Class; + static CppClassType aspectframe_class_; + + // noncopyable + AspectFrame(const AspectFrame&); + AspectFrame& operator=(const AspectFrame&); + +protected: + explicit AspectFrame(const Glib::ConstructParams& construct_params); + explicit AspectFrame(GtkAspectFrame* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkAspectFrame* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkAspectFrame* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + /** Constructor to create a new AspectFrame object. + * @param label Label text. + * @param xalign Horizontal alignment of the child within the allocation of this + * AspectFrame. For possible values, see Gtk::AlignmentEnum. + * @param yalign Vertical alignment of the child within the allocation of this + * AspectFrame. For possible values, see Gtk::AlignmentEnum. + * @param ratio The desired aspect ratio. + * @param obey_child If true, @a ratio is ignored and the aspect ratio + * is taken from the requisition of the child. + */ + explicit AspectFrame(const Glib::ustring& label = Glib::ustring(), + AlignmentEnum xalign = Gtk::ALIGN_CENTER, AlignmentEnum yalign = Gtk::ALIGN_CENTER, + float ratio = 1.0, bool obey_child = false); + + /** Constructor to create a new AspectFrame object. + * @param label Label text. + * @param xalign Horizontal alignment of the child within the allocation of this + * AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned). + * @param yalign Vertical alignment of the child within the allocation of this + * AspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned). + * @param ratio The desired aspect ratio. + * @param obey_child If true, @a ratio is ignored and the aspect ratio + * is taken from the requisition of the child. + */ + explicit AspectFrame(const Glib::ustring& label, + float xalign, float yalign, + float ratio = 1.0, bool obey_child = false); + + //TODO: Is "obey_child = true" a good default? + /** Set the properties of this AspectFrame. + * @param xalign Horizontal alignment of the child within the allocation of this + * AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned). + * @param yalign Vertical alignment of the child within the allocation of this + * AspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned). + * @param ratio The desired aspect ratio. + * @param obey_child If true, @a ratio is ignored and the aspect ratio + * is taken from the requisition of the child. + */ + + void set(float xalign, float yalign, float ratio, bool obey_child = true); + /** Set the properties of this AspectFrame. + * @param xalign Horizontal alignment of the child within the allocation of this + * AspectFrame. For possible values, see Gtk::AlignmentEnum. + * @param yalign Vertical alignment of the child within the allocation of this + * AspectFrame. For possible values, see Gtk::AlignmentEnum. + * @param ratio The desired aspect ratio. + * @param obey_child If true, @a ratio is ignored and the aspect ratio + * is taken from the requisition of the child. + */ + + void set(AlignmentEnum xalign, AlignmentEnum yalign, float ratio, bool obey_child = true); + + /** X alignment of the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_xalign() ; + +/** X alignment of the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_xalign() const; + + /** Y alignment of the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_yalign() ; + +/** Y alignment of the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_yalign() const; + + /** Aspect ratio if obey_child is FALSE. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_ratio() ; + +/** Aspect ratio if obey_child is FALSE. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_ratio() const; + + /** Force aspect ratio to match that of the frame's child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_obey_child() ; + +/** Force aspect ratio to match that of the frame's child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_obey_child() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::AspectFrame + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::AspectFrame* wrap(GtkAspectFrame* object, bool take_copy = false); +} +#endif /* _GTKMM_ASPECTFRAME_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/base.h b/libs/gtkmm2/gtk/gtkmm/base.h new file mode 100644 index 0000000000..82bcdb2ab5 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/base.h @@ -0,0 +1,53 @@ +// -*- c++ -*- +#ifndef _GTKMM_BASE_H +#define _GTKMM_BASE_H + +/* $Id$ */ + +/* base.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + using Glib::unconst; + +} + +/* This aint pretty, but I don't know a better way to make + sure things work when the stl classes are defined in a namespace */ + +// Gtk-- Base and other utility classes +#define GTK_VERSION_GT(major,minor) ((GTK_MAJOR_VERSION>major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>minor)) +#define GTK_VERSION_GE(major,minor) ((GTK_MAJOR_VERSION>major)||(GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>=minor)) +#define GTK_VERSION_EQ(major,minor) ((GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION==minor)) +#define GTK_VERSION_NE(major,minor) ((GTK_MAJOR_VERSION!=major)||(GTK_MINOR_VERSION!=minor)) +#define GTK_VERSION_LE(major,minor) ((GTK_MAJOR_VERSIONmajor)|| \ + (GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION>minor)||\ + (GTK_MAJOR_VERSION==major)&&(GTK_MINOR_VERSION==minor)&&(GTK_MICRO_VERSION>minor)) + + +#endif /* _GTKMM_BASE_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/bin.cc b/libs/gtkmm2/gtk/gtkmm/bin.cc new file mode 100644 index 0000000000..2b58d2954c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/bin.cc @@ -0,0 +1,242 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + +namespace Gtk +{ + + +void +Bin::remove() +{ + if(gobj()->child) + { + Gtk::Widget* cppChild = Glib::wrap(gobj()->child); + + //If this is a managed widget, + //then do an extra ref so that it will + //not be destroyed when adding to another container + //This should leave it in much the same state as when it was instantiated, + //before being added to the first container. + if(cppChild->is_managed_()) + cppChild->reference(); + + gtk_container_remove(Container::gobj(), cppChild->gobj()); + } +} + +void +Bin::add_label(const Glib::ustring& str, bool mnemonic /* = false */, + double x_align /* = 0.5 */, double y_align /* = 0.5 */) +{ + Label* label = manage(new Label(str, mnemonic, x_align, y_align)); + add(*label); + + //This might not always be appropriate: + //because maybe the mnemonic widget should be another child widget. + //if(mnemonic) + //label->set_mnemonic_widget(*this); + + label->show(); +} + +void +Bin::add_label(const Glib::ustring& str, bool mnemonic, + AlignmentEnum x_align, AlignmentEnum y_align /* = ALIGN_CENTER */) +{ + add_label(str, mnemonic, + _gtkmm_align_float_from_enum(x_align), + _gtkmm_align_float_from_enum(y_align)); +} + +void +Bin::add_pixmap(const Glib::RefPtr& pixmap, const Glib::RefPtr& mask) +{ + Image* p = manage(new Image(pixmap, mask)); + add(*p); + p->show(); +} + +void +Bin::add_pixlabel (const Glib::RefPtr& pixmap, + const Glib::RefPtr& mask, + const Glib::ustring& str, + double x_align /* = 0.5 */, double y_align /* = 0.5 */) +{ + //Create Pixmap and Label widgets: + Image* pmap = manage(new Image(pixmap, mask)); + Label* label = manage(new Label(str)); + label->set_alignment (x_align, y_align); + + //Put them in a VBox: + Box* box = manage(new HBox(false,5)); + box->pack_start(*pmap, PACK_SHRINK); + box->pack_start(*label); + box->show_all(); + + //And put that VBox in this: + add(*box); +} + +void +Bin::add_pixlabel(const Glib::ustring& pixfile, + const Glib::ustring& str, + double x_align /* = 0.5 */, double y_align /* = 0.5 */) +{ + //Create Pixmap and Label widgets: + Image* pmap = manage(new Image(pixfile)); + Label* label = manage(new Label(str)); + label->set_alignment (x_align, y_align); + + //Put them in a VBox: + Box* vbox = manage(new HBox(false, 5)); + vbox->pack_start(*pmap, PACK_SHRINK); + vbox->pack_start(*label); + vbox->show_all(); + + //And put that VBox in this: + add(*vbox); +} + + +} /* namespace Gtk */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Bin* wrap(GtkBin* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Bin_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Bin_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_bin_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Bin_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Bin_Class::wrap_new(GObject* o) +{ + return manage(new Bin((GtkBin*)(o))); + +} + + +/* The implementation: */ + +Bin::Bin(const Glib::ConstructParams& construct_params) +: + Gtk::Container(construct_params) +{ + } + +Bin::Bin(GtkBin* castitem) +: + Gtk::Container((GtkContainer*)(castitem)) +{ + } + +Bin::~Bin() +{ + destroy_(); +} + +Bin::CppClassType Bin::bin_class_; // initialize static member + +GType Bin::get_type() +{ + return bin_class_.init().get_type(); +} + +GType Bin::get_base_type() +{ + return gtk_bin_get_type(); +} + + +Bin::Bin() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Container(Glib::ConstructParams(bin_class_.init())) +{ + } + +Widget* Bin::get_child() +{ + return Glib::wrap(gobj()->child); +} + +const Widget* Bin::get_child() const +{ + return Glib::wrap(gobj()->child); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/bin.h b/libs/gtkmm2/gtk/gtkmm/bin.h new file mode 100644 index 0000000000..2100110f69 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/bin.h @@ -0,0 +1,211 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_BIN_H +#define _GTKMM_BIN_H + +#include + +/* $Id$ */ + +/* bin.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkBin GtkBin; +typedef struct _GtkBinClass GtkBinClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Bin_Class; } // namespace Gtk +namespace Gtk +{ + +/** A container with just one child. + * + * This is an abstract base class from which all classes holding + * up to 1 widget inside of them derive. It provides access to methods + * relevent to a single object, such as add_label, add_pixmap, etc. + * + * @ingroup Widgets + */ + +class Bin : public Container +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Bin CppObjectType; + typedef Bin_Class CppClassType; + typedef GtkBin BaseObjectType; + typedef GtkBinClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Bin(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Bin_Class; + static CppClassType bin_class_; + + // noncopyable + Bin(const Bin&); + Bin& operator=(const Bin&); + +protected: + explicit Bin(const Glib::ConstructParams& construct_params); + explicit Bin(GtkBin* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkBin* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkBin* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +protected: + Bin(); +public: + + + // get_child() is a convenience function to get a c++ wrapper of + // the contained widget. It may return NULL if such an item is not + // available. + Widget* get_child(); + const Widget* get_child() const; + + /** Remove the contained object + * Since this can only hold one object it is not necessary to + * specify which object to remove like other containers. + * + * When calling remove() on a Gtk::ScrolledWindow this might not remove the + * expected child directly, because Gtk::ScrolledWindow::add() sometimes creates a + * Gtk::ViewPort child and places the widget in that. + */ + void remove(); + + //Convenience methods that don't correspond to GTK+ functions: + + /** Add a Label object. + * This does not correspond to any GTK+ function and is provided purely for + * convenience. + * @param label The text for the label. + * @param mnemonic If true, characters preceded by an underscore + * (_) will be underlined and used as a keyboard accelerator (shortcut). + * @param x_align The horizontal alignment of the text. This ranges from + * 0.0 (left aligned) to 1.0 (right aligned). + * @param y_align The vertical alignment of the text. This ranges from + * 0.0 (top aligned) to 1.0 (bottom aligned). + */ + void add_label(const Glib::ustring& label, bool mnemonic = false, + double x_align = 0.5, double y_align = 0.5); + + /** Add a Label object. + * This does not correspond to any GTK+ function and is provided purely for + * convenience. + * @param label The label text. + * @param mnemonic If true, characters preceded by an underscore + * (_) will be underlined and used as a keyboard accelerator (shortcut). + * @param x_align The horizontal alignment of the text. For possible + * values, see Gtk::AlignmentEnum. + * @param y_align The vertical alignment of the text. For possible + * values, see Gtk::AlignmentEnum. + */ + void add_label(const Glib::ustring& label, bool mnemonic, + AlignmentEnum x_align, AlignmentEnum y_align = ALIGN_CENTER); + + /** Add an Image object. + * This does not correspond to any GTK+ function and is provided purely for + * convenience. + * This will create, manage, add, and show a new Image to this Bin. + * @param pixmap A Glib::RefPtr to a Gdk::Pixmap. + * @param mask A Glib::RefPtr to a Gdk::Bitmap. + */ + void add_pixmap(const Glib::RefPtr& pixmap, + const Glib::RefPtr& mask); + + /** Add Image and Label objects. + * This does not correspond to any GTK+ function and is provided purely for + * convenience. + * This will create, manage, add, and show a new Image and Label (within an + * HBox) to this Bin. + * @param pixmap A Glib::RefPtr to a Gdk::Pixmap. + * @param mask A Glib::RefPtr to a Gdk::Bitmap. + * @param label The text for the label. + * @param x_align The horizontal alignment of the text in the label. + * @param y_align The vertical alignment of the text in the label. + */ + void add_pixlabel(const Glib::RefPtr& pixmap, + const Glib::RefPtr& mask, + const Glib::ustring& label, + double x_align = 0.5, double y_align = 0.5); + + /** Add Image and Label objects. + * This does not correspond to any GTK+ function and is provided purely for + * convenience. + * This will create, manage, add, and show a new Image and Label (within an + * HBox) to this Bin. + * @param pixfile The path to a file to be displayed. + * @param label The text for the label. + * @param x_align The horizontal alignment of the text in the label. + * @param y_align The vertical alignment of the text in the label. + */ + void add_pixlabel(const Glib::ustring& pixfile, + const Glib::ustring& label, + double x_align = 0.5, double y_align = 0.5); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Bin + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Bin* wrap(GtkBin* object, bool take_copy = false); +} +#endif /* _GTKMM_BIN_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/box.cc b/libs/gtkmm2/gtk/gtkmm/box.cc new file mode 100644 index 0000000000..a67411b47b --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/box.cc @@ -0,0 +1,572 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +namespace Gtk +{ + +namespace Box_Helpers +{ + +Widget* Child::get_widget() const +{ + return Glib::wrap(gobj()->widget); +} + +void Child::set_options(PackOptions options, guint padding) +{ + const bool expand = (options == PACK_EXPAND_PADDING || options == PACK_EXPAND_WIDGET); + const bool fill = (options == PACK_EXPAND_WIDGET); + + set_options(expand, fill, padding); +} + +void Child::set_options(bool expand, bool fill, guint padding) +{ + gobj()->expand = expand; + gobj()->fill = fill; + gobj()->padding = padding; +} + +void Child::set_pack(PackType pack) +{ + gobj()->pack = pack; +} + + +/**************************************************************************/ + + +typedef Box_Helpers::BoxList::iterator box_iterator; + +box_iterator BoxList::insert(box_iterator position, const Element& e) +{ + iterator i; + bool expand = (e.options_ == PACK_EXPAND_PADDING) || (e.options_ == PACK_EXPAND_WIDGET); + bool fill = (e.options_ == PACK_EXPAND_WIDGET); + + if (e.pack_ == PACK_START) + gtk_box_pack_start(gparent(), (e.widget_? e.widget_->gobj() : 0), + (gboolean)expand, (gboolean)fill, e.padding_); + else + gtk_box_pack_end(gparent(), (e.widget_ ? e.widget_->gobj() : 0), + (gboolean)expand, (gboolean)fill, e.padding_); + + i = --end(); + + if (position!=end()) + reorder(i, position); + + return i; +} + +// Non-standard +void BoxList::reorder(box_iterator loc, box_iterator pos) +{ + int position = g_list_position(glist(), pos.node_); + gtk_box_reorder_child(gparent(), loc->gobj()->widget, position); +} + +} /* namespace Box_Helpers */ + +Box::BoxList& Box::children() +{ + children_proxy_ = BoxList(gobj()); + return children_proxy_; +} + +const Box::BoxList& Box::children() const +{ + children_proxy_ = BoxList(const_cast(gobj())); + return children_proxy_; +} + +void Box::pack_start(Widget& child, PackOptions options, guint padding) +{ + bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET); + bool fill = (options == PACK_EXPAND_WIDGET); + + gtk_box_pack_start(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding); +} + +void Box::pack_end(Widget& child, PackOptions options, guint padding) +{ + bool expand = (options == PACK_EXPAND_PADDING) || (options == PACK_EXPAND_WIDGET); + bool fill = (options == PACK_EXPAND_WIDGET); + + gtk_box_pack_end(gobj(), child.gobj(), (gboolean)expand, (gboolean)fill, padding); +} + + +} /* namespace Gtk */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Box* wrap(GtkBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Box_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Box_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Box_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Box_Class::wrap_new(GObject* o) +{ + return manage(new Box((GtkBox*)(o))); + +} + + +/* The implementation: */ + +Box::Box(const Glib::ConstructParams& construct_params) +: + Gtk::Container(construct_params) +{ + } + +Box::Box(GtkBox* castitem) +: + Gtk::Container((GtkContainer*)(castitem)) +{ + } + +Box::~Box() +{ + destroy_(); +} + +Box::CppClassType Box::box_class_; // initialize static member + +GType Box::get_type() +{ + return box_class_.init().get_type(); +} + +GType Box::get_base_type() +{ + return gtk_box_get_type(); +} + + +namespace Box_Helpers +{ + +BoxList::iterator BoxList::find(const_reference w) +{ + iterator i = begin(); + for(i = begin(); i != end() && (i->get_widget()->gobj() != w.get_widget()->gobj()); i++); + return i; +} + +BoxList::iterator BoxList::find(Widget& w) +{ + iterator i; + for(i = begin(); i != end() && ((GtkWidget*)i->get_widget()->gobj() != w.gobj()); i++); + return i; +} + +} /* namespace Box_Helpers */ + + +namespace Box_Helpers +{ + +void BoxList::remove(const_reference child) +{ + gtk_container_remove(GTK_CONTAINER(gparent_), + (GtkWidget*)(child.get_widget()->gobj())); +} + +void BoxList::remove(Widget& widget) +{ + gtk_container_remove(GTK_CONTAINER(gparent_), (GtkWidget*)(widget.gobj())); +} + +BoxList::iterator BoxList::erase(iterator position) +{ + //Check that it is a valid iterator, to a real item: + if ( !position.node_|| (position == end()) ) + return end(); + + //Get an iterator the the next item, to return: + iterator next = position; + next++; + + //Use GTK+ C function to remove it, by providing the GtkWidget*: + gtk_container_remove( GTK_CONTAINER(gparent_), (GtkWidget*)(position->get_widget()->gobj()) ); + return next; +} + +} /* namespace Box_Helpers */ + + +namespace Box_Helpers +{ + +BoxList::BoxList() +{} + +BoxList::BoxList(GtkBox* gparent) +: type_base((GObject*)gparent) +{} + +BoxList::BoxList(const BoxList& src) +: + type_base(src) +{} + +BoxList& BoxList::operator=(const BoxList& src) +{ + type_base::operator=(src); + return *this; +} + +GList*& BoxList::glist() const +{ + return ((GtkBox*)gparent_)->children; +} + +void BoxList::erase(iterator start, iterator stop) +{ + type_base::erase(start, stop); +} + +GtkBox* BoxList::gparent() +{ + return (GtkBox*)type_base::gparent(); +} + +const GtkBox* BoxList::gparent() const +{ + return (GtkBox*)type_base::gparent(); +} + +BoxList::reference BoxList::operator[](size_type l) const +{ + return type_base::operator[](l); +} + +} /* namespace Box_Helpers */ + +Box::Box() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Container(Glib::ConstructParams(box_class_.init())) +{ + } + +void Box::pack_start(Widget& child, bool expand, bool fill, guint padding) +{ + gtk_box_pack_start(gobj(), (child).gobj(), static_cast(expand), static_cast(fill), padding); +} + +void Box::pack_end(Widget& child, bool expand, bool fill, guint padding) +{ + gtk_box_pack_end(gobj(), (child).gobj(), static_cast(expand), static_cast(fill), padding); +} + +void Box::set_homogeneous(bool homogeneous) +{ + gtk_box_set_homogeneous(gobj(), static_cast(homogeneous)); +} + +bool Box::get_homogeneous() const +{ + return gtk_box_get_homogeneous(const_cast(gobj())); +} + +void Box::set_spacing(int spacing) +{ + gtk_box_set_spacing(gobj(), spacing); +} + +int Box::get_spacing() const +{ + return gtk_box_get_spacing(const_cast(gobj())); +} + +void Box::reorder_child(Widget& child, int pos) +{ + gtk_box_reorder_child(gobj(), (child).gobj(), pos); +} + + +Glib::PropertyProxy Box::property_spacing() +{ + return Glib::PropertyProxy(this, "spacing"); +} + +Glib::PropertyProxy_ReadOnly Box::property_spacing() const +{ + return Glib::PropertyProxy_ReadOnly(this, "spacing"); +} + +Glib::PropertyProxy Box::property_homogeneous() +{ + return Glib::PropertyProxy(this, "homogeneous"); +} + +Glib::PropertyProxy_ReadOnly Box::property_homogeneous() const +{ + return Glib::PropertyProxy_ReadOnly(this, "homogeneous"); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::VBox* wrap(GtkVBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& VBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &VBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_vbox_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void VBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* VBox_Class::wrap_new(GObject* o) +{ + return manage(new VBox((GtkVBox*)(o))); + +} + + +/* The implementation: */ + +VBox::VBox(const Glib::ConstructParams& construct_params) +: + Gtk::Box(construct_params) +{ + } + +VBox::VBox(GtkVBox* castitem) +: + Gtk::Box((GtkBox*)(castitem)) +{ + } + +VBox::~VBox() +{ + destroy_(); +} + +VBox::CppClassType VBox::vbox_class_; // initialize static member + +GType VBox::get_type() +{ + return vbox_class_.init().get_type(); +} + +GType VBox::get_base_type() +{ + return gtk_vbox_get_type(); +} + +VBox::VBox(bool homogeneous, int spacing) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Box(Glib::ConstructParams(vbox_class_.init(), "homogeneous", static_cast(homogeneous), "spacing", spacing, (char*) 0)) +{ + } + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::HBox* wrap(GtkHBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& HBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &HBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_hbox_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void HBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* HBox_Class::wrap_new(GObject* o) +{ + return manage(new HBox((GtkHBox*)(o))); + +} + + +/* The implementation: */ + +HBox::HBox(const Glib::ConstructParams& construct_params) +: + Gtk::Box(construct_params) +{ + } + +HBox::HBox(GtkHBox* castitem) +: + Gtk::Box((GtkBox*)(castitem)) +{ + } + +HBox::~HBox() +{ + destroy_(); +} + +HBox::CppClassType HBox::hbox_class_; // initialize static member + +GType HBox::get_type() +{ + return hbox_class_.init().get_type(); +} + +GType HBox::get_base_type() +{ + return gtk_hbox_get_type(); +} + +HBox::HBox(bool homogeneous, int spacing) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Box(Glib::ConstructParams(hbox_class_.init(), "homogeneous", static_cast(homogeneous), "spacing", spacing, (char*) 0)) +{ + } + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/box.h b/libs/gtkmm2/gtk/gtkmm/box.h new file mode 100644 index 0000000000..3955273760 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/box.h @@ -0,0 +1,587 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_BOX_H +#define _GTKMM_BOX_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include /* For _GtkBoxChild */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkBox GtkBox; +typedef struct _GtkBoxClass GtkBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Box_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkVBox GtkVBox; +typedef struct _GtkVBoxClass GtkVBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class VBox_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkHBox GtkHBox; +typedef struct _GtkHBoxClass GtkHBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class HBox_Class; } // namespace Gtk +namespace Gtk +{ + +/** Packing options for adding child widgets to a Box with pack_start() and pack_end(). + * @ingroup gtkmmEnums + */ +enum PackOptions +{ + PACK_SHRINK, /**< Space is contracted to the child widget size. */ + PACK_EXPAND_PADDING, /**< Space is expanded, with extra space filled with padding. */ + PACK_EXPAND_WIDGET /**< Space is expanded, with extra space filled by increasing the child widget size. */ +}; + +class Box; + +namespace Box_Helpers +{ + +//This may not have any data or virtual functions. See below. +class Child : protected _GtkBoxChild +{ +private: + Child& operator=(const Child&); //Not implemented. + Child(const Child&); //Not implemented. + +public: + /// Provides access to the underlying C GObject. + inline _GtkBoxChild* gobj() { return this; } + /// Provides access to the underlying C GObject. + inline const _GtkBoxChild* gobj() const { return this; } + + Widget* get_widget() const; + + inline guint16 get_padding() const { return (gobj()->padding); } + inline bool get_expand() const { return (gobj()->expand); } + inline bool get_fill() const { return (gobj()->fill); } + inline bool get_pack() const { return (gobj()->pack); } + + void set_options(PackOptions options, guint padding = 0); + void set_options(bool expand, bool fill, guint padding = 0); + + void set_pack(PackType pack); + +protected: + inline GtkBox* parent() + { return (GtkBox*) (gobj()->widget->parent); } + + void redraw(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + friend class Dummy_; // silence the compiler (Child has only private ctors) +#endif +}; + +class Element +{ +public: + Element(Widget& widget, + PackOptions options = PACK_EXPAND_WIDGET, + guint padding = 0, + PackType pack = PACK_START) + : widget_(&widget), options_(options), + padding_(padding), pack_(pack) + {} + + Widget* widget_; + PackOptions options_; + guint padding_; + PackType pack_; +}; + +typedef Element StartElem; + +struct EndElem : public Element +{ + EndElem(Widget& widget, + PackOptions options = PACK_EXPAND_WIDGET, + guint padding = 0) + : Element (widget, options, padding, PACK_END) + {} +}; + + +class BoxList : public Glib::HelperList< Child, const Element, Glib::List_Iterator< Child > > +{ +public: + BoxList(); + explicit BoxList(GtkBox* gparent); + BoxList(const BoxList& src); + virtual ~BoxList() {} + + BoxList& operator=(const BoxList& src); + + typedef Glib::HelperList< Child, const Element, Glib::List_Iterator< Child > > type_base; + + GtkBox* gparent(); + const GtkBox* gparent() const; + + virtual GList*& glist() const; // front of list + + virtual void erase(iterator start, iterator stop); + virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE + virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE + + /// This is order n. (use at own risk) + reference operator[](size_type l) const; + +public: + iterator insert(iterator position, element_type& e); //custom-implemented. + + template + inline void insert(iterator position, InputIterator first, InputIterator last) + { + for(;first != last; ++first) + position = insert(position, *first); + } + + inline void push_front(element_type& e) + { insert(begin(), e); } + inline void push_back(element_type& e) + { insert(end(), e); } + + + //The standard iterator, instead of List_Cpp_Iterator, + //only works because Child is derived from _GtkBoxChild. + + + iterator find(const_reference c); + iterator find(Widget&); + + +virtual void remove(Widget& w); //Implented as custom or by LIST_CONTAINER_REMOVE + + // Non-standard + void reorder(iterator loc,iterator pos); + }; + + +} /* namespace Box_Helpers */ + + +/** A base class for box containers + * + * Abstract base class for horizontal and vertical boxes, which organize a + * variable number of widgets into a rectangular area. This is an abstract + * class and it defers choice of which way the widgets are packed to the screen + * to the derived classes. It provides a common interface for inserting + * widgets to a box indepenently of how it is shown in the screen. + * + * Gtk::Box uses a notion of packing. Packing refers to adding widgets with + * reference to a particular position in a Gtk::Container. There are two + * reference positions: the start and the end of the box. For a VBox, the start + * is defined as the top of the box and the end is defined as the bottom. For + * a HBox the start is defined as the left side and the end is defined as the + * right side. Use repeated calls to pack_start() to pack widgets into a + * Gtk::Box from start to end. Use pack_end() to add widgets from end to start. + * You may intersperse these calls and add widgets from both ends of the same + * Gtk::Box. + * + * Because Gtk::Box is a Gtk::Container, you may also use Gtk::Container::add() + * to insert widgets, and they will be packed as if with pack_start(). Use + * Gtk::Container::remove() to remove widgets. + * + * Use set_homogeneous() to specify whether or not all children of the Gtk::Box + * occupy the same amount of space. Use set_spacing() to determine the minimum + * space placed between all children in the Gtk::Box. Use reorder_child() to + * move a child widget to a different place in the box. Use + * set_child_packing() to reset the pack options and padding attributes of any + * Gtk::Box child. Use query_child_packing() to query these fields. + */ + +class Box : public Container +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Box CppObjectType; + typedef Box_Class CppClassType; + typedef GtkBox BaseObjectType; + typedef GtkBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Box(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Box_Class; + static CppClassType box_class_; + + // noncopyable + Box(const Box&); + Box& operator=(const Box&); + +protected: + explicit Box(const Glib::ConstructParams& construct_params); + explicit Box(GtkBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + typedef Box_Helpers::BoxList BoxList; + +protected: + Box(); +public: + + + /** Left side insert a widget to a box. + * The expand argument to pack_start() or pack_end() + * controls whether the widgets are laid out in the box to fill in all + * the extra space in the box so the box is expanded to fill the area + * allocated to it (true). Or the box is shrunk to just fit the widgets + * (false). Setting @a expand to false will allow you to do right and left + * justifying of your widgets. Otherwise, they will all expand to fit in + * the box, and the same effect could be achieved by using only one of + * pack_start() or pack_end() functions. + * + * The @a fill argument to the pack_start()/pack_end() functions control whether the + * extra space is allocated to the objects themselves (true), or as extra + * padding in the box around these objects (false). It only has an effect + * if the @a expand argument is also true. + * + * The difference between spacing (set when the box is created) + * and padding (set when elements are packed) is, that spacing is added between + * objects, and padding is added on either side of an object. + */ + void pack_start(Widget& child, bool expand, bool fill, guint padding = 0); + + /** Left side insert a widget to a box. + * @param child A Widget to be added to box. + * @param options Controls how the widget expands to fill space, and how the space around them is used. + * @param padding Padding that is added on either side of the widget. This is different to spacing set when the box is created (or with set_spacing()) - spacing is added between objects, and padding is added on either side of an object. + */ + void pack_start(Widget& child, PackOptions options = PACK_EXPAND_WIDGET, guint padding = 0); + + + void pack_end(Widget& child, bool expand, bool fill, guint padding = 0); + + /** Right side insert a widget to a box. + * @param child A Widget to be added to box. + * @param options Controls how the widget expands to fill space, and how the space around them is used. + * @param padding Padding that is added on either side of the widget. This is different to spacing set when the box is created (or with set_spacing()) - spacing is added between objects, and padding is added on either side of an object. + */ + void pack_end(Widget& child, PackOptions options = PACK_EXPAND_WIDGET, guint padding = 0); + + + void set_homogeneous(bool homogeneous = true); + + /** Returns whether the box is homogeneous (all children are the + * same size). See set_homogeneous(). + * @return true if the box is homogeneous. + */ + bool get_homogeneous() const; + + + void set_spacing(int spacing); + + /** Gets the value set by set_spacing(). + * @return Spacing between children. + */ + int get_spacing() const; + + + void reorder_child(Widget& child, int pos); + + /* Get the child widgets. + * @result An STL-style container of pointers to the box's child widgets. + */ + BoxList& children(); + + /* Get the child widgets. + * @result An STL-style container of pointers to the box's child widgets. + */ + const BoxList& children() const; + + /** The amount of space between children. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_spacing() ; + +/** The amount of space between children. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_spacing() const; + + /** Whether the children should all be the same size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_homogeneous() ; + +/** Whether the children should all be the same size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_homogeneous() const; + + +protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + mutable BoxList children_proxy_; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +}; + + +/** Vertical Box for laying widgets in a vertical row. + * + * You should create these objects, but it is more confortable to pass + * around pointers of Gtk::Box. All the methods that do anything are in + * class Gtk::Box and this allows you to later change the direction of the + * box, when there's no dependencies to HBox and VBox classes. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class VBox : public Box +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef VBox CppObjectType; + typedef VBox_Class CppClassType; + typedef GtkVBox BaseObjectType; + typedef GtkVBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~VBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class VBox_Class; + static CppClassType vbox_class_; + + // noncopyable + VBox(const VBox&); + VBox& operator=(const VBox&); + +protected: + explicit VBox(const Glib::ConstructParams& construct_params); + explicit VBox(GtkVBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkVBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkVBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + /** Creates a new vertical box. + * @param homogeneous Whether each widget in the VBox should have the same + * height. If set, a PACK_SHRINK argument to pack_start() or pack_end() is + * ignored. + * @param spacing Determines the space in pixels between child widgets. + */ + explicit VBox(bool homogeneous = false, int spacing = 0); + + +}; + +/** Horizontal Box for laying widgets in a horizontal row. + * + * You should create these objects, but it is more confortable to pass + * around pointers of Gtk::Box. All the methods that do anything are in + * class Gtk::Box and this allows you to later change the direction of the + * box, when there's no dependencies to HBox and VBox classes. + * + * Use the Gtk::Box packing interface to determine the arrangement, spacing, + * width, and alignment of Gtk::HBox children. + * + * All children are allocated the same height. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class HBox : public Box +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef HBox CppObjectType; + typedef HBox_Class CppClassType; + typedef GtkHBox BaseObjectType; + typedef GtkHBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~HBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class HBox_Class; + static CppClassType hbox_class_; + + // noncopyable + HBox(const HBox&); + HBox& operator=(const HBox&); + +protected: + explicit HBox(const Glib::ConstructParams& construct_params); + explicit HBox(GtkHBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkHBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkHBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + /** Creates a new horizontal box. + * @param homogeneous Whether each widget in the HBox should have the same + * width. If set, a PACK_SHRINK argument to pack_start() or pack_end() is + * ignored. + * @param spacing Determines the space in pixels between child widgets. + */ + explicit HBox(bool homogeneous = false, int spacing = 0); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Box + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Box* wrap(GtkBox* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::VBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::VBox* wrap(GtkVBox* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::HBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::HBox* wrap(GtkHBox* object, bool take_copy = false); +} +#endif /* _GTKMM_BOX_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/button.cc b/libs/gtkmm2/gtk/gtkmm/button.cc new file mode 100644 index 0000000000..01a3265d8c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/button.cc @@ -0,0 +1,682 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace Gtk +{ + +Button::Button(const Glib::ustring& label, bool mnemonic) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(button_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0)) +{} + +Button::Button(const StockID& stock_id) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(button_class_.init(), "use_stock",1,"label",stock_id.get_c_str(), (char*) 0)) +{} + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo Button_signal_pressed_info = +{ + "pressed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Button_signal_released_info = +{ + "released", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Button_signal_clicked_info = +{ + "clicked", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Button_signal_enter_info = +{ + "enter", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Button_signal_leave_info = +{ + "leave", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Button_signal_activate_info = +{ + "activate", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Button* wrap(GtkButton* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Button_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Button_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_button_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Button_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->pressed = &pressed_callback; + klass->released = &released_callback; + klass->clicked = &clicked_callback; + klass->enter = &enter_callback; + klass->leave = &leave_callback; + klass->activate = &activate_callback; +} + + +void Button_Class::pressed_callback(GtkButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_pressed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->pressed) + (*base->pressed)(self); + } +} + +void Button_Class::released_callback(GtkButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_released(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->released) + (*base->released)(self); + } +} + +void Button_Class::clicked_callback(GtkButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_clicked(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->clicked) + (*base->clicked)(self); + } +} + +void Button_Class::enter_callback(GtkButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_enter(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->enter) + (*base->enter)(self); + } +} + +void Button_Class::leave_callback(GtkButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_leave(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->leave) + (*base->leave)(self); + } +} + +void Button_Class::activate_callback(GtkButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_activate(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->activate) + (*base->activate)(self); + } +} + + +Glib::ObjectBase* Button_Class::wrap_new(GObject* o) +{ + return manage(new Button((GtkButton*)(o))); + +} + + +/* The implementation: */ + +Button::Button(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +Button::Button(GtkButton* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +Button::~Button() +{ + destroy_(); +} + +Button::CppClassType Button::button_class_; // initialize static member + +GType Button::get_type() +{ + return button_class_.init().get_type(); +} + +GType Button::get_base_type() +{ + return gtk_button_get_type(); +} + + +Button::Button() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(button_class_.init())) +{ + } + +void Button::pressed() +{ + gtk_button_pressed(gobj()); +} + +void Button::released() +{ + gtk_button_released(gobj()); +} + +void Button::clicked() +{ + gtk_button_clicked(gobj()); +} + +void Button::enter() +{ + gtk_button_enter(gobj()); +} + +void Button::leave() +{ + gtk_button_leave(gobj()); +} + +void Button::set_relief(ReliefStyle newstyle) +{ + gtk_button_set_relief(gobj(), ((GtkReliefStyle)(newstyle))); +} + +ReliefStyle Button::get_relief() const +{ + return ((ReliefStyle)(gtk_button_get_relief(const_cast(gobj())))); +} + +void Button::set_label(const Glib::ustring& label) +{ + gtk_button_set_label(gobj(), label.c_str()); +} + +Glib::ustring Button::get_label() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_button_get_label(const_cast(gobj()))); +} + +void Button::set_use_underline(bool use_underline) +{ + gtk_button_set_use_underline(gobj(), static_cast(use_underline)); +} + +bool Button::get_use_underline() const +{ + return gtk_button_get_use_underline(const_cast(gobj())); +} + +void Button::set_use_stock(bool use_stock) +{ + gtk_button_set_use_stock(gobj(), static_cast(use_stock)); +} + +bool Button::get_use_stock() const +{ + return gtk_button_get_use_stock(const_cast(gobj())); +} + +void Button::set_focus_on_click(bool focus_on_click) +{ + gtk_button_set_focus_on_click(gobj(), static_cast(focus_on_click)); +} + +bool Button::get_focus_on_click() const +{ + return gtk_button_get_focus_on_click(const_cast(gobj())); +} + +void Button::set_alignment(float xalign, float yalign) +{ + gtk_button_set_alignment(gobj(), xalign, yalign); +} + +void Button::get_alignment(float& xalign, float& yalign) +{ + gtk_button_get_alignment(gobj(), &(xalign), &(yalign)); +} + +void Button::set_image(Widget& image) +{ + gtk_button_set_image(gobj(), (image).gobj()); +} + +Widget* Button::get_image() +{ + return Glib::wrap(gtk_button_get_image(gobj())); +} + +const Widget* Button::get_image() const +{ + return Glib::wrap(gtk_button_get_image(const_cast(gobj()))); +} + + +Glib::SignalProxy0< void > Button::signal_pressed() +{ + return Glib::SignalProxy0< void >(this, &Button_signal_pressed_info); +} + +Glib::SignalProxy0< void > Button::signal_released() +{ + return Glib::SignalProxy0< void >(this, &Button_signal_released_info); +} + +Glib::SignalProxy0< void > Button::signal_clicked() +{ + return Glib::SignalProxy0< void >(this, &Button_signal_clicked_info); +} + +Glib::SignalProxy0< void > Button::signal_enter() +{ + return Glib::SignalProxy0< void >(this, &Button_signal_enter_info); +} + +Glib::SignalProxy0< void > Button::signal_leave() +{ + return Glib::SignalProxy0< void >(this, &Button_signal_leave_info); +} + +Glib::SignalProxy0< void > Button::signal_activate() +{ + return Glib::SignalProxy0< void >(this, &Button_signal_activate_info); +} + + +Glib::PropertyProxy Button::property_label() +{ + return Glib::PropertyProxy(this, "label"); +} + +Glib::PropertyProxy_ReadOnly Button::property_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label"); +} + +Glib::PropertyProxy Button::property_relief() +{ + return Glib::PropertyProxy(this, "relief"); +} + +Glib::PropertyProxy_ReadOnly Button::property_relief() const +{ + return Glib::PropertyProxy_ReadOnly(this, "relief"); +} + +Glib::PropertyProxy Button::property_use_underline() +{ + return Glib::PropertyProxy(this, "use-underline"); +} + +Glib::PropertyProxy_ReadOnly Button::property_use_underline() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-underline"); +} + +Glib::PropertyProxy Button::property_use_stock() +{ + return Glib::PropertyProxy(this, "use-stock"); +} + +Glib::PropertyProxy_ReadOnly Button::property_use_stock() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-stock"); +} + +Glib::PropertyProxy Button::property_focus_on_click() +{ + return Glib::PropertyProxy(this, "focus-on-click"); +} + +Glib::PropertyProxy_ReadOnly Button::property_focus_on_click() const +{ + return Glib::PropertyProxy_ReadOnly(this, "focus-on-click"); +} + +Glib::PropertyProxy Button::property_xalign() +{ + return Glib::PropertyProxy(this, "xalign"); +} + +Glib::PropertyProxy_ReadOnly Button::property_xalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "xalign"); +} + +Glib::PropertyProxy Button::property_yalign() +{ + return Glib::PropertyProxy(this, "yalign"); +} + +Glib::PropertyProxy_ReadOnly Button::property_yalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "yalign"); +} + +Glib::PropertyProxy Button::property_image() +{ + return Glib::PropertyProxy(this, "image"); +} + +Glib::PropertyProxy_ReadOnly Button::property_image() const +{ + return Glib::PropertyProxy_ReadOnly(this, "image"); +} + + +void Gtk::Button::on_pressed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->pressed) + (*base->pressed)(gobj()); +} + +void Gtk::Button::on_released() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->released) + (*base->released)(gobj()); +} + +void Gtk::Button::on_clicked() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->clicked) + (*base->clicked)(gobj()); +} + +void Gtk::Button::on_enter() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->enter) + (*base->enter)(gobj()); +} + +void Gtk::Button::on_leave() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->leave) + (*base->leave)(gobj()); +} + +void Gtk::Button::on_activate() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->activate) + (*base->activate)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/button.h b/libs/gtkmm2/gtk/gtkmm/button.h new file mode 100644 index 0000000000..1ba9920a0f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/button.h @@ -0,0 +1,432 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_BUTTON_H +#define _GTKMM_BUTTON_H + +#include + +/* $Id$ */ + +/* box.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkButton GtkButton; +typedef struct _GtkButtonClass GtkButtonClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Button_Class; } // namespace Gtk +namespace Gtk +{ + +namespace Stock { struct BuiltinStockID; } + + +/** A widget that creates a signal when clicked on. + * + * This widget is generally used with a signal handler that is called when the button is pressed. + * It can hold any valid child widget. The most commonly used child is the Gtk::Label. + * + * @ingroup Widgets + */ + +class Button : public Bin +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Button CppObjectType; + typedef Button_Class CppClassType; + typedef GtkButton BaseObjectType; + typedef GtkButtonClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Button(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Button_Class; + static CppClassType button_class_; + + // noncopyable + Button(const Button&); + Button& operator=(const Button&); + +protected: + explicit Button(const Glib::ConstructParams& construct_params); + explicit Button(GtkButton* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkButton* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkButton* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_pressed(); + virtual void on_released(); + virtual void on_clicked(); + virtual void on_enter(); + virtual void on_leave(); + virtual void on_activate(); + + +private: + +public: + + /** Create an empty button. + * With an empty button, you can Gtk::Button::add() a widget + * such as a Gtk::Pixmap or Gtk::Box. + * + * If you just wish to add a Gtk::Label, + * you may want to + * use the Gtk::Button(const Glib::ustring& label) ctor + * directly instead. + */ + Button(); + + + /** Simple Push Button with label. + * Create a button with the given label inside. You won't be able + * to add a widget in this button since it already has a Gtk::Label + * in it + */ + explicit Button(const Glib::ustring& label, bool mnemonic = false); + explicit Button(const StockID& stock_id); + + + void pressed(); + + void released(); + + void clicked(); + + void enter(); + + void leave(); + + + void set_relief(ReliefStyle newstyle); + + ReliefStyle get_relief() const; + + + /** Sets the text of the label of the button to @a str . This text is + * also used to select the stock item if set_use_stock() + * is used. + * + * This will also clear any previously set labels. + * @param label A string. + */ + void set_label(const Glib::ustring& label); + + /** Fetches the text from the label of the button, as set by + * set_label(). If the label text has not + * been set the return value will be 0. This will be the + * case if you create an empty button with new() to + * use as a container. + * @return The text of the label widget. This string is owned + * by the widget and must not be modified or freed. + */ + Glib::ustring get_label() const; + + /** If true, an underline in the text of the button label indicates + * the next character should be used for the mnemonic accelerator key. + * @param use_underline true if underlines in the text indicate mnemonics. + */ + void set_use_underline(bool use_underline = true); + + /** Returns whether an embedded underline in the button label indicates a + * mnemonic. See set_use_underline(). + * @return true if an embedded underline in the button label + * indicates the mnemonic accelerator keys. + */ + bool get_use_underline() const; + + /** If true, the label set on the button is used as a + * stock id to select the stock item for the button. + * @param use_stock true if the button should use a stock item. + */ + void set_use_stock(bool use_stock = true); + + /** Returns whether the button label is a stock item. + * @return true if the button label is used to + * select a stock item instead of being + * used directly as the label text. + */ + bool get_use_stock() const; + + + /** Sets whether the button will grab focus when it is clicked with the mouse. + * Making mouse clicks not grab focus is useful in places like toolbars where + * you don't want the keyboard focus removed from the main area of the + * application. + * + * Since: 2.4 + * @param focus_on_click Whether the button grabs focus when clicked with the mouse. + */ + void set_focus_on_click(bool focus_on_click = true); + + /** Returns whether the button grabs focus when it is clicked with the mouse. + * See set_focus_on_click(). + * @return true if the button grabs focus when it is clicked with + * the mouse. + * + * Since: 2.4. + */ + bool get_focus_on_click() const; + + + /** Sets the alignment of the child. This property has no effect unless + * the child is a Gtk::Misc or a Gtk::Aligment. + * + * Since: 2.4 + * @param xalign The horizontal position of the child, 0.0 is left aligned, + * 1.0 is right aligned. + * @param yalign The vertical position of the child, 0.0 is top aligned, + * 1.0 is bottom aligned. + */ + void set_alignment(float xalign, float yalign); + + /** Gets the alignment of the child in the button. + * + * Since: 2.4 + * @param xalign Return location for horizontal alignment. + * @param yalign Return location for vertical alignment. + */ + void get_alignment(float& xalign, float& yalign); + + + /** Set the image of @a button to the given widget. Note that + * it depends on the show-button-images setting whether the + * image will be displayed or not. + * + * Since: 2.6 + * @param image A widget to set as the image for the button. + */ + void set_image(Widget& image); + + /** Gets the widget that is currenty set as the image of @a button . + * This may have been explicitly set by set_image() + * or constructed by new_from_stock(). + * + * Since: 2.6 + */ + Widget* get_image(); + + /** Gets the widget that is currenty set as the image of @a button . + * This may have been explicitly set by set_image() + * or constructed by new_from_stock(). + * + * Since: 2.6 + */ + const Widget* get_image() const; + + + Glib::SignalProxy0< void > signal_pressed(); + + + Glib::SignalProxy0< void > signal_released(); + + + Glib::SignalProxy0< void > signal_clicked(); + + + Glib::SignalProxy0< void > signal_enter(); + + + Glib::SignalProxy0< void > signal_leave(); + + + Glib::SignalProxy0< void > signal_activate(); + + + /** Text of the label widget inside the button + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label() ; + +/** Text of the label widget inside the button + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label() const; + + /** The border relief style. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_relief() ; + +/** The border relief style. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_relief() const; + + /** If set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_underline() ; + +/** If set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_underline() const; + + /** If set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_stock() ; + +/** If set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_stock() const; + + /** Whether the button grabs focus when it is clicked with the mouse. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_focus_on_click() ; + +/** Whether the button grabs focus when it is clicked with the mouse. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_focus_on_click() const; + + /** Horizontal position of child in available space. 0.0 is left aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_xalign() ; + +/** Horizontal position of child in available space. 0.0 is left aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_xalign() const; + + /** Vertical position of child in available space. 0.0 is top aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_yalign() ; + +/** Vertical position of child in available space. 0.0 is top aligned + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_yalign() const; + + /** Child widget to appear next to the button text. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_image() ; + +/** Child widget to appear next to the button text. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_image() const; + + +}; + +/*! A Gtk::Button example. + * Example 1: @link book/buttons/button/buttons.h @endlink + * Example 2: @link book/buttons/button/buttons.cc @endlink + * Example 3: @link book/buttons/button/main.cc @endlink + */ + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Button + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Button* wrap(GtkButton* object, bool take_copy = false); +} +#endif /* _GTKMM_BUTTON_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/buttonbox.cc b/libs/gtkmm2/gtk/gtkmm/buttonbox.cc new file mode 100644 index 0000000000..7fe9bd53f6 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/buttonbox.cc @@ -0,0 +1,389 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +VButtonBox::VButtonBox(ButtonBoxStyle layout, int spacing) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + ButtonBox(Glib::ConstructParams(vbuttonbox_class_.init(), (char*) 0)) +{ + set_layout(layout); + set_spacing(spacing); +} + +HButtonBox::HButtonBox(ButtonBoxStyle layout, int spacing) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + ButtonBox(Glib::ConstructParams(hbuttonbox_class_.init(), (char*) 0)) +{ + set_layout(layout); + set_spacing(spacing); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::ButtonBox* wrap(GtkButtonBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ButtonBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ButtonBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_button_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ButtonBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* ButtonBox_Class::wrap_new(GObject* o) +{ + return manage(new ButtonBox((GtkButtonBox*)(o))); + +} + + +/* The implementation: */ + +ButtonBox::ButtonBox(const Glib::ConstructParams& construct_params) +: + Gtk::Box(construct_params) +{ + } + +ButtonBox::ButtonBox(GtkButtonBox* castitem) +: + Gtk::Box((GtkBox*)(castitem)) +{ + } + +ButtonBox::~ButtonBox() +{ + destroy_(); +} + +ButtonBox::CppClassType ButtonBox::buttonbox_class_; // initialize static member + +GType ButtonBox::get_type() +{ + return buttonbox_class_.init().get_type(); +} + +GType ButtonBox::get_base_type() +{ + return gtk_button_box_get_type(); +} + + +ButtonBoxStyle ButtonBox::get_layout() const +{ + return ((ButtonBoxStyle)(gtk_button_box_get_layout(const_cast(gobj())))); +} + +void ButtonBox::set_layout(ButtonBoxStyle layout_style) +{ + gtk_button_box_set_layout(gobj(), ((GtkButtonBoxStyle)(layout_style))); +} + +void ButtonBox::set_child_secondary(Widget& child, bool is_secondary) +{ + gtk_button_box_set_child_secondary(gobj(), (child).gobj(), static_cast(is_secondary)); +} + +bool ButtonBox::get_child_secondary(const Gtk::Widget& child) const +{ + return gtk_button_box_get_child_secondary(const_cast(gobj()), const_cast(child.gobj())); +} + +int ButtonBox::get_child_min_width() const +{ + return gobj()->child_min_width; +} + +void ButtonBox::set_child_min_width(const int& value) +{ + gobj()->child_min_width = value; +} + +int ButtonBox::get_child_min_height() const +{ + return gobj()->child_min_height; +} + +void ButtonBox::set_child_min_height(const int& value) +{ + gobj()->child_min_height = value; +} + +int ButtonBox::get_child_ipadding_x() const +{ + return gobj()->child_ipad_x; +} + +void ButtonBox::set_child_ipadding_x(const int& value) +{ + gobj()->child_ipad_x = value; +} + +int ButtonBox::get_child_ipadding_y() const +{ + return gobj()->child_ipad_y; +} + +void ButtonBox::set_child_ipadding_y(const int& value) +{ + gobj()->child_ipad_y = value; +} + + +Glib::PropertyProxy ButtonBox::property_layout_style() +{ + return Glib::PropertyProxy(this, "layout-style"); +} + +Glib::PropertyProxy_ReadOnly ButtonBox::property_layout_style() const +{ + return Glib::PropertyProxy_ReadOnly(this, "layout-style"); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::VButtonBox* wrap(GtkVButtonBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& VButtonBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &VButtonBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_vbutton_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void VButtonBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* VButtonBox_Class::wrap_new(GObject* o) +{ + return manage(new VButtonBox((GtkVButtonBox*)(o))); + +} + + +/* The implementation: */ + +VButtonBox::VButtonBox(const Glib::ConstructParams& construct_params) +: + Gtk::ButtonBox(construct_params) +{ + } + +VButtonBox::VButtonBox(GtkVButtonBox* castitem) +: + Gtk::ButtonBox((GtkButtonBox*)(castitem)) +{ + } + +VButtonBox::~VButtonBox() +{ + destroy_(); +} + +VButtonBox::CppClassType VButtonBox::vbuttonbox_class_; // initialize static member + +GType VButtonBox::get_type() +{ + return vbuttonbox_class_.init().get_type(); +} + +GType VButtonBox::get_base_type() +{ + return gtk_vbutton_box_get_type(); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::HButtonBox* wrap(GtkHButtonBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& HButtonBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &HButtonBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_hbutton_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void HButtonBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* HButtonBox_Class::wrap_new(GObject* o) +{ + return manage(new HButtonBox((GtkHButtonBox*)(o))); + +} + + +/* The implementation: */ + +HButtonBox::HButtonBox(const Glib::ConstructParams& construct_params) +: + Gtk::ButtonBox(construct_params) +{ + } + +HButtonBox::HButtonBox(GtkHButtonBox* castitem) +: + Gtk::ButtonBox((GtkButtonBox*)(castitem)) +{ + } + +HButtonBox::~HButtonBox() +{ + destroy_(); +} + +HButtonBox::CppClassType HButtonBox::hbuttonbox_class_; // initialize static member + +GType HButtonBox::get_type() +{ + return hbuttonbox_class_.init().get_type(); +} + +GType HButtonBox::get_base_type() +{ + return gtk_hbutton_box_get_type(); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/buttonbox.h b/libs/gtkmm2/gtk/gtkmm/buttonbox.h new file mode 100644 index 0000000000..6f39c6aed9 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/buttonbox.h @@ -0,0 +1,361 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_BUTTONBOX_H +#define _GTKMM_BUTTONBOX_H + +#include + +/* $Id$ */ + +/* buttonbox.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkButtonBox GtkButtonBox; +typedef struct _GtkButtonBoxClass GtkButtonBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ButtonBox_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkVButtonBox GtkVButtonBox; +typedef struct _GtkVButtonBoxClass GtkVButtonBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class VButtonBox_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkHButtonBox GtkHButtonBox; +typedef struct _GtkHButtonBoxClass GtkHButtonBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class HButtonBox_Class; } // namespace Gtk +namespace Gtk +{ + +// This is a #define in GTK+, and unrelated to the GtkButtonBoxStyle enum. +/** @ingroup gtkmmEnums */ +enum { BUTTONBOX_DEFAULT = -1 }; + + +/** Base class for Gtk::HButtonBox and Gtk::VButtonBox + * + * A button box should be used to provide a consistent layout of buttons + * throughout your application. There is one default layout and a default + * spacing value that are persistant across all ButtonBox widgets. + */ + +class ButtonBox : public Box +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ButtonBox CppObjectType; + typedef ButtonBox_Class CppClassType; + typedef GtkButtonBox BaseObjectType; + typedef GtkButtonBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ButtonBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ButtonBox_Class; + static CppClassType buttonbox_class_; + + // noncopyable + ButtonBox(const ButtonBox&); + ButtonBox& operator=(const ButtonBox&); + +protected: + explicit ButtonBox(const Glib::ConstructParams& construct_params); + explicit ButtonBox(GtkButtonBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkButtonBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkButtonBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + ButtonBoxStyle get_layout() const; + + void set_layout(ButtonBoxStyle layout_style); + + + /** Sets whether @a child should appear in a secondary group of children. + * A typical use of a secondary child is the help button in a dialog. + * + * This group appears after the other children if the style + * is Gtk::BUTTONBOX_START, Gtk::BUTTONBOX_SPREAD or + * Gtk::BUTTONBOX_EDGE, and before the the other children if the style + * is Gtk::BUTTONBOX_END. For horizontal button boxes, the definition + * of before/after depends on direction of the widget (see + * Gtk::Widget::set_direction()). If the style is Gtk::BUTTONBOX_START + * or Gtk::BUTTONBOX_END, then the secondary children are aligned at + * the other end of the button box from the main children. For the + * other styles, they appear immediately next to the main children. + * @param child A child of @a widget . + * @param is_secondary If true, the @a child appears in a secondary group of the + * button box. + */ + void set_child_secondary(Widget& child, bool is_secondary = true); + + /** Returns whether @a child should appear in a secondary group of children. + * @param child A child of @a widget . + * @return Whether @a child should appear in a secondary group of children. + * + * Since: 2.4. + */ + bool get_child_secondary(const Gtk::Widget& child) const; + + int get_child_min_width() const; + void set_child_min_width(const int& value); + + int get_child_min_height() const; + void set_child_min_height(const int& value); + + int get_child_ipadding_x() const; + void set_child_ipadding_x(const int& value); + + int get_child_ipadding_y() const; + void set_child_ipadding_y(const int& value); + + /** How to layout the buttons in the box. Possible values are default + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_layout_style() ; + +/** How to layout the buttons in the box. Possible values are default + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_layout_style() const; + + +}; + +/** A container for arranging buttons vertically. + * + * A button box should be used to provide a consistent layout of buttons + * throughout your application. There is one default layout and a default spacing + * value that are persistant across all Gtk::VButtonBox widgets. + * + * The layout/spacing can then be altered by the programmer, or if desired, + * by the user to alter the 'feel' of a program to a small degree. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class VButtonBox : public ButtonBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef VButtonBox CppObjectType; + typedef VButtonBox_Class CppClassType; + typedef GtkVButtonBox BaseObjectType; + typedef GtkVButtonBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~VButtonBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class VButtonBox_Class; + static CppClassType vbuttonbox_class_; + + // noncopyable + VButtonBox(const VButtonBox&); + VButtonBox& operator=(const VButtonBox&); + +protected: + explicit VButtonBox(const Glib::ConstructParams& construct_params); + explicit VButtonBox(GtkVButtonBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkVButtonBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkVButtonBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + explicit VButtonBox(ButtonBoxStyle layout = BUTTONBOX_DEFAULT_STYLE, int spacing = BUTTONBOX_DEFAULT); + + +}; + +/** A container for arranging buttons horizontally. + * + * A button box should be used to provide a consistent layout of buttons + * throughout your application. There is one default layout and a default spacing + * value that are persistant across all Gtk::HButtonBox widgets. + * + * The layout/spacing can then be altered by the programmer, or if desired, + * by the user to alter the 'feel' of a program to a small degree. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class HButtonBox : public ButtonBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef HButtonBox CppObjectType; + typedef HButtonBox_Class CppClassType; + typedef GtkHButtonBox BaseObjectType; + typedef GtkHButtonBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~HButtonBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class HButtonBox_Class; + static CppClassType hbuttonbox_class_; + + // noncopyable + HButtonBox(const HButtonBox&); + HButtonBox& operator=(const HButtonBox&); + +protected: + explicit HButtonBox(const Glib::ConstructParams& construct_params); + explicit HButtonBox(GtkHButtonBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkHButtonBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkHButtonBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + explicit HButtonBox(ButtonBoxStyle layout = BUTTONBOX_DEFAULT_STYLE, int spacing = BUTTONBOX_DEFAULT); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::ButtonBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ButtonBox* wrap(GtkButtonBox* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::VButtonBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::VButtonBox* wrap(GtkVButtonBox* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::HButtonBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::HButtonBox* wrap(GtkHButtonBox* object, bool take_copy = false); +} +#endif /* _GTKMM_BUTTONBOX_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/calendar.cc b/libs/gtkmm2/gtk/gtkmm/calendar.cc new file mode 100644 index 0000000000..66add813c7 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/calendar.cc @@ -0,0 +1,605 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +} + + +namespace +{ + +const Glib::SignalProxyInfo Calendar_signal_month_changed_info = +{ + "month_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Calendar_signal_day_selected_info = +{ + "day_selected", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Calendar_signal_day_selected_double_click_info = +{ + "day_selected_double_click", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Calendar_signal_prev_month_info = +{ + "prev_month", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Calendar_signal_next_month_info = +{ + "next_month", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Calendar_signal_prev_year_info = +{ + "prev_year", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo Calendar_signal_next_year_info = +{ + "next_year", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gtk_calendar_display_options_get_type(); +} + + +namespace Glib +{ + +Gtk::Calendar* wrap(GtkCalendar* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Calendar_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Calendar_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_calendar_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Calendar_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->month_changed = &month_changed_callback; + klass->day_selected = &day_selected_callback; + klass->day_selected_double_click = &day_selected_double_click_callback; + klass->prev_month = &prev_month_callback; + klass->next_month = &next_month_callback; + klass->prev_year = &prev_year_callback; + klass->next_year = &next_year_callback; +} + + +void Calendar_Class::month_changed_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_month_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->month_changed) + (*base->month_changed)(self); + } +} + +void Calendar_Class::day_selected_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_day_selected(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->day_selected) + (*base->day_selected)(self); + } +} + +void Calendar_Class::day_selected_double_click_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_day_selected_double_click(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->day_selected_double_click) + (*base->day_selected_double_click)(self); + } +} + +void Calendar_Class::prev_month_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_prev_month(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->prev_month) + (*base->prev_month)(self); + } +} + +void Calendar_Class::next_month_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_next_month(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->next_month) + (*base->next_month)(self); + } +} + +void Calendar_Class::prev_year_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_prev_year(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->prev_year) + (*base->prev_year)(self); + } +} + +void Calendar_Class::next_year_callback(GtkCalendar* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_next_year(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->next_year) + (*base->next_year)(self); + } +} + + +Glib::ObjectBase* Calendar_Class::wrap_new(GObject* o) +{ + return manage(new Calendar((GtkCalendar*)(o))); + +} + + +/* The implementation: */ + +Calendar::Calendar(const Glib::ConstructParams& construct_params) +: + Gtk::Widget(construct_params) +{ + } + +Calendar::Calendar(GtkCalendar* castitem) +: + Gtk::Widget((GtkWidget*)(castitem)) +{ + } + +Calendar::~Calendar() +{ + destroy_(); +} + +Calendar::CppClassType Calendar::calendar_class_; // initialize static member + +GType Calendar::get_type() +{ + return calendar_class_.init().get_type(); +} + +GType Calendar::get_base_type() +{ + return gtk_calendar_get_type(); +} + + +Calendar::Calendar() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(calendar_class_.init())) +{ + } + +int Calendar::select_month(guint month, guint year) +{ + return gtk_calendar_select_month(gobj(), month, year); +} + +void Calendar::select_day(guint day) +{ + gtk_calendar_select_day(gobj(), day); +} + +int Calendar::mark_day(guint day) +{ + return gtk_calendar_mark_day(gobj(), day); +} + +int Calendar::unmark_day(guint day) +{ + return gtk_calendar_unmark_day(gobj(), day); +} + +void Calendar::clear_marks() +{ + gtk_calendar_clear_marks(gobj()); +} + +void Calendar::display_options(CalendarDisplayOptions flags) +{ + gtk_calendar_display_options(gobj(), ((GtkCalendarDisplayOptions)(flags))); +} + +void Calendar::set_display_options(CalendarDisplayOptions flags) +{ + gtk_calendar_set_display_options(gobj(), ((GtkCalendarDisplayOptions)(flags))); +} + +CalendarDisplayOptions Calendar::get_display_options() const +{ + return ((CalendarDisplayOptions)(gtk_calendar_get_display_options(const_cast(gobj())))); +} + +void Calendar::get_date(guint& year, guint& month, guint& day) const +{ + gtk_calendar_get_date(const_cast(gobj()), &(year), &(month), &(day)); +} + +void Calendar::freeze() +{ + gtk_calendar_freeze(gobj()); +} + +void Calendar::thaw() +{ + gtk_calendar_thaw(gobj()); +} + + +Glib::SignalProxy0< void > Calendar::signal_month_changed() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_month_changed_info); +} + +Glib::SignalProxy0< void > Calendar::signal_day_selected() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_day_selected_info); +} + +Glib::SignalProxy0< void > Calendar::signal_day_selected_double_click() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_day_selected_double_click_info); +} + +Glib::SignalProxy0< void > Calendar::signal_prev_month() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_prev_month_info); +} + +Glib::SignalProxy0< void > Calendar::signal_next_month() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_next_month_info); +} + +Glib::SignalProxy0< void > Calendar::signal_prev_year() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_prev_year_info); +} + +Glib::SignalProxy0< void > Calendar::signal_next_year() +{ + return Glib::SignalProxy0< void >(this, &Calendar_signal_next_year_info); +} + + +void Gtk::Calendar::on_month_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->month_changed) + (*base->month_changed)(gobj()); +} + +void Gtk::Calendar::on_day_selected() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->day_selected) + (*base->day_selected)(gobj()); +} + +void Gtk::Calendar::on_day_selected_double_click() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->day_selected_double_click) + (*base->day_selected_double_click)(gobj()); +} + +void Gtk::Calendar::on_prev_month() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->prev_month) + (*base->prev_month)(gobj()); +} + +void Gtk::Calendar::on_next_month() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->next_month) + (*base->next_month)(gobj()); +} + +void Gtk::Calendar::on_prev_year() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->prev_year) + (*base->prev_year)(gobj()); +} + +void Gtk::Calendar::on_next_year() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->next_year) + (*base->next_year)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/calendar.h b/libs/gtkmm2/gtk/gtkmm/calendar.h new file mode 100644 index 0000000000..a026c941e6 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/calendar.h @@ -0,0 +1,273 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CALENDAR_H +#define _GTKMM_CALENDAR_H + +#include + +/* $Id$ */ + +/* calendar.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCalendar GtkCalendar; +typedef struct _GtkCalendarClass GtkCalendarClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Calendar_Class; } // namespace Gtk +namespace Gtk +{ + + +/** @addtogroup gtkmmEnums Enums and Flags */ + +/** + * @ingroup gtkmmEnums + * @par Bitwise operators: + * %CalendarDisplayOptions operator|(CalendarDisplayOptions, CalendarDisplayOptions)
+ * %CalendarDisplayOptions operator&(CalendarDisplayOptions, CalendarDisplayOptions)
+ * %CalendarDisplayOptions operator^(CalendarDisplayOptions, CalendarDisplayOptions)
+ * %CalendarDisplayOptions operator~(CalendarDisplayOptions)
+ * %CalendarDisplayOptions& operator|=(CalendarDisplayOptions&, CalendarDisplayOptions)
+ * %CalendarDisplayOptions& operator&=(CalendarDisplayOptions&, CalendarDisplayOptions)
+ * %CalendarDisplayOptions& operator^=(CalendarDisplayOptions&, CalendarDisplayOptions)
+ */ +enum CalendarDisplayOptions +{ + CALENDAR_SHOW_HEADING = 1 << 0, + CALENDAR_SHOW_DAY_NAMES = 1 << 1, + CALENDAR_NO_MONTH_CHANGE = 1 << 2, + CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3, + CALENDAR_WEEK_START_MONDAY = 1 << 4 +}; + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions operator|(CalendarDisplayOptions lhs, CalendarDisplayOptions rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions operator&(CalendarDisplayOptions lhs, CalendarDisplayOptions rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions operator^(CalendarDisplayOptions lhs, CalendarDisplayOptions rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions operator~(CalendarDisplayOptions flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions& operator|=(CalendarDisplayOptions& lhs, CalendarDisplayOptions rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions& operator&=(CalendarDisplayOptions& lhs, CalendarDisplayOptions rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline CalendarDisplayOptions& operator^=(CalendarDisplayOptions& lhs, CalendarDisplayOptions rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/** Display a calendar and/or allow the user to select a date. + * + * This is a widget that displays a calendar, one month at a time. + * + * The month and year currently displayed can be altered with + * select_month(). The exact day can be selected from the displayed month + * using select_day(). + * + * The way in which the calendar itself is displayed can be altered using + * set_display_options(). + * + * The selected date can be retrieved from a GtkCalendar using get_date(). + * + * If performing many 'mark' operations, the calendar can be frozen to + * prevent flicker, using freeze(), and 'thawed' again using thaw(). + * + * @ingroup Widgets + */ + +class Calendar : public Widget +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Calendar CppObjectType; + typedef Calendar_Class CppClassType; + typedef GtkCalendar BaseObjectType; + typedef GtkCalendarClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Calendar(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Calendar_Class; + static CppClassType calendar_class_; + + // noncopyable + Calendar(const Calendar&); + Calendar& operator=(const Calendar&); + +protected: + explicit Calendar(const Glib::ConstructParams& construct_params); + explicit Calendar(GtkCalendar* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCalendar* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCalendar* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_month_changed(); + virtual void on_day_selected(); + virtual void on_day_selected_double_click(); + virtual void on_prev_month(); + virtual void on_next_month(); + virtual void on_prev_year(); + virtual void on_next_year(); + + +private: + +public: + Calendar(); + + + int select_month(guint month, guint year); + + void select_day(guint day); + + int mark_day(guint day); + + int unmark_day(guint day); + + void clear_marks(); + + #ifndef GTKMM_DISABLE_DEPRECATED + + void display_options(CalendarDisplayOptions flags); + #endif //GTKMM_DISABLE_DEPRECATED + + + /** Sets display options (whether to display the heading and the month + * headings). + * + * Since: 2.4 + * @param flags The display options to set. + */ + void set_display_options(CalendarDisplayOptions flags); + + /** Returns the current display options of @a calendar . + * @return The display options. + * + * Since: 2.4. + */ + CalendarDisplayOptions get_display_options() const; + + + void get_date(guint& year, guint& month, guint& day) const; + + void freeze(); + + void thaw(); + + + Glib::SignalProxy0< void > signal_month_changed(); + + + Glib::SignalProxy0< void > signal_day_selected(); + + + Glib::SignalProxy0< void > signal_day_selected_double_click(); + + + Glib::SignalProxy0< void > signal_prev_month(); + + + Glib::SignalProxy0< void > signal_next_month(); + + + Glib::SignalProxy0< void > signal_prev_year(); + + + Glib::SignalProxy0< void > signal_next_year(); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Calendar + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Calendar* wrap(GtkCalendar* object, bool take_copy = false); +} +#endif /* _GTKMM_CALENDAR_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/celleditable.cc b/libs/gtkmm2/gtk/gtkmm/celleditable.cc new file mode 100644 index 0000000000..2f0d2a5b1b --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/celleditable.cc @@ -0,0 +1,307 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ + +const Glib::SignalProxyInfo CellEditable_signal_editing_done_info = +{ + "editing_done", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo CellEditable_signal_remove_widget_info = +{ + "remove_widget", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkCellEditable* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& CellEditable_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &CellEditable_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = gtk_cell_editable_get_type(); + } + + return *this; +} + +void CellEditable_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->start_editing = &start_editing_vfunc_callback; + klass->editing_done = &editing_done_callback; + klass->remove_widget = &remove_widget_callback; +} + +void CellEditable_Class::start_editing_vfunc_callback(GtkCellEditable* self, GdkEvent* event) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->start_editing_vfunc(event); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->start_editing) + (*base->start_editing)(self, event); + } +} + + +void CellEditable_Class::editing_done_callback(GtkCellEditable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_editing_done(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->editing_done) + (*base->editing_done)(self); + } +} + +void CellEditable_Class::remove_widget_callback(GtkCellEditable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_remove_widget(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_widget) + (*base->remove_widget)(self); + } +} + + +Glib::ObjectBase* CellEditable_Class::wrap_new(GObject* object) +{ + return new CellEditable((GtkCellEditable*)(object)); +} + + +/* The implementation: */ + +CellEditable::CellEditable() +: + Glib::Interface(celleditable_class_.init()) +{} + +CellEditable::CellEditable(GtkCellEditable* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +CellEditable::~CellEditable() +{} + +// static +void CellEditable::add_interface(GType gtype_implementer) +{ + celleditable_class_.init().add_interface(gtype_implementer); +} + +CellEditable::CppClassType CellEditable::celleditable_class_; // initialize static member + +GType CellEditable::get_type() +{ + return celleditable_class_.init().get_type(); +} + +GType CellEditable::get_base_type() +{ + return gtk_cell_editable_get_type(); +} + + +void CellEditable::start_editing(GdkEvent* event) +{ + gtk_cell_editable_start_editing(gobj(), event); +} + +void CellEditable::editing_done() +{ + gtk_cell_editable_editing_done(gobj()); +} + +void CellEditable::remove_widget() +{ + gtk_cell_editable_remove_widget(gobj()); +} + + +Glib::SignalProxy0< void > CellEditable::signal_editing_done() +{ + return Glib::SignalProxy0< void >(this, &CellEditable_signal_editing_done_info); +} + +Glib::SignalProxy0< void > CellEditable::signal_remove_widget() +{ + return Glib::SignalProxy0< void >(this, &CellEditable_signal_remove_widget_info); +} + + +void Gtk::CellEditable::on_editing_done() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->editing_done) + (*base->editing_done)(gobj()); +} + +void Gtk::CellEditable::on_remove_widget() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_widget) + (*base->remove_widget)(gobj()); +} + + +void Gtk::CellEditable::start_editing_vfunc(GdkEvent* event) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->start_editing) + (*base->start_editing)(gobj(),event); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/celleditable.h b/libs/gtkmm2/gtk/gtkmm/celleditable.h new file mode 100644 index 0000000000..8d2bfdd6c5 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/celleditable.h @@ -0,0 +1,158 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLEDITABLE_H +#define _GTKMM_CELLEDITABLE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ +typedef struct _GtkCellEditableIface GtkCellEditableIface; +typedef union _GdkEvent GdkEvent; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellEditable GtkCellEditable; +typedef struct _GtkCellEditableClass GtkCellEditableClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellEditable_Class; } // namespace Gtk +namespace Gtk +{ + +/** Interface for widgets which are used for editing cells. + * The CellEditable interface must be implemented for widgets to be usable when editing the contents of a TreeView cell. + */ + +class CellEditable : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef CellEditable CppObjectType; + typedef CellEditable_Class CppClassType; + typedef GtkCellEditable BaseObjectType; + typedef GtkCellEditableIface BaseClassType; + +private: + friend class CellEditable_Class; + static CppClassType celleditable_class_; + + // noncopyable + CellEditable(const CellEditable&); + CellEditable& operator=(const CellEditable&); + +protected: + CellEditable(); // you must derive from this class + explicit CellEditable(GtkCellEditable* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~CellEditable(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkCellEditable* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkCellEditable* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + /** Begins editing on a @a cell_editable . @a event is the Gdk::Event that began the + * editing process. It may be 0, in the instance that editing was initiated + * through programatic means. + * @param event A Gdk::Event, or 0. + */ + void start_editing(GdkEvent* event); + + /** Emits the "editing_done" signal. This signal is a sign for the cell renderer + * to update its value from the cell. + */ + void editing_done(); + + /** Emits the "remove_widget" signal. This signal is meant to indicate that the + * cell is finished editing, and the widget may now be destroyed. + */ + void remove_widget(); + + + Glib::SignalProxy0< void > signal_editing_done(); + + + Glib::SignalProxy0< void > signal_remove_widget(); + + +protected: + virtual void start_editing_vfunc(GdkEvent* event); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_editing_done(); + virtual void on_remove_widget(); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::CellEditable + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkCellEditable* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GTKMM_CELLEDITABLE_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/celllayout.cc b/libs/gtkmm2/gtk/gtkmm/celllayout.cc new file mode 100644 index 0000000000..474dea3e5b --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/celllayout.cc @@ -0,0 +1,519 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace //anonymous +{ + +// This Signal Proxy allows the C++ coder to specify +// a sigc::slot instead of a static function. +class SignalProxy_CellData +{ +public: + typedef Gtk::CellLayout::SlotCellData SlotType; + + SignalProxy_CellData(const SlotType& slot) + : slot_(slot) {} + + ~SignalProxy_CellData(); + + static void gtk_callback(GtkCellLayout* cell_layout, GtkCellRenderer* cell, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer data); + static void gtk_callback_destroy(void* data); + +private: + SlotType slot_; +}; + +SignalProxy_CellData::~SignalProxy_CellData() +{} + +void SignalProxy_CellData::gtk_callback(GtkCellLayout* /* cell_layout */, GtkCellRenderer* /* cell */, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer data) +{ + SignalProxy_CellData *const self = static_cast(data); + + try + { + //We ignore the cell, because that was given as an argument to the connecting method, so the caller should know which one it is already. + //And we ignore the tree_model because that can be obtained from the iter or from the CellLayout itself. + (self->slot_)(Gtk::TreeModel::const_iterator(tree_model, iter)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + +} + +void SignalProxy_CellData::gtk_callback_destroy(void* data) +{ + delete static_cast(data); +} + +} // anonymous namespace + + +namespace Gtk +{ + +void CellLayout::add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column) +{ + gtk_cell_layout_add_attribute(gobj(), + (GtkCellRenderer*) property.get_object()->gobj(), property.get_name(), column.index()); +} + +void CellLayout::set_cell_data_func(CellRenderer& cell, const SlotCellData& slot) +{ + // Create a signal proxy. A pointer to this will be passed + // through the callback's data parameter. It will be deleted + // when SignalProxy_CellData::gtk_callback_destroy() is called. + SignalProxy_CellData *const pSignalProxy = new SignalProxy_CellData(slot); + + gtk_cell_layout_set_cell_data_func(gobj(), cell.gobj(), + &SignalProxy_CellData::gtk_callback, pSignalProxy, + &SignalProxy_CellData::gtk_callback_destroy); +} + + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkCellLayout* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& CellLayout_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &CellLayout_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = gtk_cell_layout_get_type(); + } + + return *this; +} + +void CellLayout_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->pack_start = &pack_start_vfunc_callback; + klass->pack_end = &pack_end_vfunc_callback; + klass->clear = &clear_vfunc_callback; + klass->add_attribute = &add_attribute_vfunc_callback; + klass->clear_attributes = &clear_attributes_vfunc_callback; + klass->reorder = &reorder_vfunc_callback; +} + +void CellLayout_Class::pack_start_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->pack_start_vfunc(Glib::wrap(cell) +, expand +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->pack_start) + (*base->pack_start)(self, cell, expand); + } +} + +void CellLayout_Class::pack_end_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gboolean expand) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->pack_end_vfunc(Glib::wrap(cell) +, expand +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->pack_end) + (*base->pack_end)(self, cell, expand); + } +} + +void CellLayout_Class::clear_vfunc_callback(GtkCellLayout* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->clear_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->clear) + (*base->clear)(self); + } +} + +void CellLayout_Class::add_attribute_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, const gchar* attribute, gint column) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->add_attribute_vfunc(Glib::wrap(cell) +, Glib::convert_const_gchar_ptr_to_ustring(attribute) +, column +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->add_attribute) + (*base->add_attribute)(self, cell, attribute, column); + } +} + +void CellLayout_Class::clear_attributes_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->clear_attributes_vfunc(Glib::wrap(cell) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->clear_attributes) + (*base->clear_attributes)(self, cell); + } +} + +void CellLayout_Class::reorder_vfunc_callback(GtkCellLayout* self, GtkCellRenderer* cell, gint position) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->reorder_vfunc(Glib::wrap(cell) +, position +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->reorder) + (*base->reorder)(self, cell, position); + } +} + + +Glib::ObjectBase* CellLayout_Class::wrap_new(GObject* object) +{ + return new CellLayout((GtkCellLayout*)(object)); +} + + +/* The implementation: */ + +CellLayout::CellLayout() +: + Glib::Interface(celllayout_class_.init()) +{} + +CellLayout::CellLayout(GtkCellLayout* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +CellLayout::~CellLayout() +{} + +// static +void CellLayout::add_interface(GType gtype_implementer) +{ + celllayout_class_.init().add_interface(gtype_implementer); +} + +CellLayout::CppClassType CellLayout::celllayout_class_; // initialize static member + +GType CellLayout::get_type() +{ + return celllayout_class_.init().get_type(); +} + +GType CellLayout::get_base_type() +{ + return gtk_cell_layout_get_type(); +} + + +void CellLayout::pack_start(CellRenderer& cell, bool expand) +{ + gtk_cell_layout_pack_start(gobj(), (cell).gobj(), static_cast(expand)); +} + +void CellLayout::pack_end(CellRenderer& cell, bool expand) +{ + gtk_cell_layout_pack_end(gobj(), (cell).gobj(), static_cast(expand)); +} + +void CellLayout::clear() +{ + gtk_cell_layout_clear(gobj()); +} + +void CellLayout::add_attribute(CellRenderer& cell, const Glib::ustring& attribute, int column) +{ + gtk_cell_layout_add_attribute(gobj(), (cell).gobj(), attribute.c_str(), column); +} + +void CellLayout::clear_attributes(CellRenderer& cell) +{ + gtk_cell_layout_clear_attributes(gobj(), (cell).gobj()); +} + +void CellLayout::reorder(CellRenderer& cell, int position) +{ + gtk_cell_layout_reorder(gobj(), (cell).gobj(), position); +} + + +void Gtk::CellLayout::pack_start_vfunc(CellRenderer* cell, bool expand) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->pack_start) + (*base->pack_start)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast(expand)); +} + +void Gtk::CellLayout::pack_end_vfunc(CellRenderer* cell, bool expand) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->pack_end) + (*base->pack_end)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),static_cast(expand)); +} + +void Gtk::CellLayout::clear_vfunc() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->clear) + (*base->clear)(gobj()); +} + +void Gtk::CellLayout::add_attribute_vfunc(CellRenderer* cell, const Glib::ustring& attribute, int column) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->add_attribute) + (*base->add_attribute)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),attribute.c_str(),column); +} + +void Gtk::CellLayout::clear_attributes_vfunc(CellRenderer* cell) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->clear_attributes) + (*base->clear_attributes)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell)); +} + +void Gtk::CellLayout::reorder_vfunc(CellRenderer* cell, int position) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->reorder) + (*base->reorder)(gobj(),(GtkCellRenderer*)Glib::unwrap(cell),position); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/celllayout.h b/libs/gtkmm2/gtk/gtkmm/celllayout.h new file mode 100644 index 0000000000..1fc7c8f6eb --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/celllayout.h @@ -0,0 +1,226 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLLAYOUT_H +#define _GTKMM_CELLLAYOUT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" +{ +typedef struct _GtkCellLayoutIface GtkCellLayoutIface; +} +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellLayout GtkCellLayout; +typedef struct _GtkCellLayoutClass GtkCellLayoutClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellLayout_Class; } // namespace Gtk +namespace Gtk +{ + +/** An interface for packing cells. + * CellLayout is an interface to be implemented by all objects which want to provide a TreeView::Column-like API + * for packing cells, setting attributes and data funcs. + */ + +class CellLayout : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef CellLayout CppObjectType; + typedef CellLayout_Class CppClassType; + typedef GtkCellLayout BaseObjectType; + typedef GtkCellLayoutIface BaseClassType; + +private: + friend class CellLayout_Class; + static CppClassType celllayout_class_; + + // noncopyable + CellLayout(const CellLayout&); + CellLayout& operator=(const CellLayout&); + +protected: + CellLayout(); // you must derive from this class + explicit CellLayout(GtkCellLayout* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~CellLayout(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkCellLayout* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkCellLayout* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + template inline + void pack_start(const TreeModelColumn& model_column, bool expand = true); + + + /** Packs the @a cell into the beginning of @a cell_layout . If @a expand is false, + * then the @a cell is allocated no more space than it needs. Any unused space + * is divided evenly between cells for which @a expand is true. + * + * Since: 2.4 + * @param cell A Gtk::CellRenderer. + * @param expand true if @a cell is to be given extra space allocated to @a cell_layout . + */ + void pack_start(CellRenderer& cell, bool expand = true); + + /** Adds the @a cell to the end of @a cell_layout . If @a expand is false, then the + * @a cell is allocated no more space than it needs. Any unused space is + * divided evenly between cells for which @a expand is true. + * + * Since: 2.4 + * @param cell A Gtk::CellRenderer. + * @param expand true if @a cell is to be given extra space allocated to @a cell_layout . + */ + void pack_end(CellRenderer& cell, bool expand = true); + + /** Unsets all the mappings on all renderers on @a cell_layout and + * removes all renderers from @a cell_layout . + * + * Since: 2.4 + */ + void clear(); + + //I think this is just a convenience method, equivalent to clear() and multiple add_attribute()s. murrayc. + + + /** Adds an attribute mapping to the list in @a cell_layout . The @a column is the + * column of the model to get a value from, and the @a attribute is the + * parameter on @a cell to be set from the value. So for example if column 2 + * of the model contains strings, you could have the "text" attribute of a + * Gtk::CellRendererText get its values from column 2. + * + * Since: 2.4 + * @param cell A Gtk::CellRenderer. + * @param attribute An attribute on the renderer. + * @param column The column position on the model to get the attribute from. + */ + void add_attribute(CellRenderer& cell, const Glib::ustring& attribute, int column); + void add_attribute(const Glib::PropertyProxy_Base& property, const TreeModelColumnBase& column); + + //For instance, void on_cell_data(const TreeModel::const_iterator& iter) + typedef sigc::slot SlotCellData; + + void set_cell_data_func(CellRenderer& cell, const SlotCellData& slot); + + + /** Clears all existing attributes previously set with + * set_attributes(). + * + * Since: 2.4 + * @param cell A Gtk::CellRenderer to clear the attribute mapping on. + */ + void clear_attributes(CellRenderer& cell); + + + /** Re-inserts @a cell at @a position . Note that @a cell has already to be packed + * into @a cell_layout for this to function properly. + * + * Since: 2.4 + * @param cell A Gtk::CellRenderer to reorder. + * @param position New position to insert @a cell at. + */ + void reorder(CellRenderer& cell, int position); + +protected: + virtual void pack_start_vfunc(CellRenderer* cell, bool expand); + virtual void pack_end_vfunc(CellRenderer* cell, bool expand); + virtual void clear_vfunc(); + virtual void add_attribute_vfunc(CellRenderer* cell, const Glib::ustring& attribute, int column); +//TODO: _WRAP_VFUNC(void set_cell_data_func(CellRenderer* cell, GtkCellLayoutDataFunc func, gpointer func_data, GDestroyNotify destroy), set_cell_data_func) + virtual void clear_attributes_vfunc(CellRenderer* cell); + virtual void reorder_vfunc(CellRenderer* cell, int position); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +template +void CellLayout::pack_start(const TreeModelColumn& column, bool expand) +{ + //Generate appropriate Renderer for the column: + CellRenderer* pCellRenderer = manage( CellRenderer_Generation::generate_cellrenderer() ); + + //Use the renderer: + pack_start(*pCellRenderer, expand); + + //Make the renderer render the column: + add_attribute(pCellRenderer->_property_renderable(), column); +} + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::CellLayout + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkCellLayout* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GTKMM_CELLLAYOUT_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderer.cc b/libs/gtkmm2/gtk/gtkmm/cellrenderer.cc new file mode 100644 index 0000000000..8cec8dc46f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderer.cc @@ -0,0 +1,638 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +void CellRenderer::get_size(Widget& widget, int& x_offset, int& y_offset, int& width, int& height) const +{ + gtk_cell_renderer_get_size(const_cast(gobj()), widget.gobj(), 0, &x_offset, &y_offset, &width, &height); +} + +Glib::PropertyProxy_Base CellRenderer::_property_renderable() +{ + g_assert_not_reached(); + return Glib::PropertyProxy(0, 0); // shut up warnings +} + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo CellRenderer_signal_editing_canceled_info = +{ + "editing_canceled", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void CellRenderer_signal_editing_started_callback(GtkCellRenderer* self, GtkCellEditable* p0,const gchar* p1,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,CellEditable*,const Glib::ustring& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(dynamic_cast(Glib::wrap_auto((GObject*)(p0), false)) +, Glib::convert_const_gchar_ptr_to_ustring(p1) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo CellRenderer_signal_editing_started_info = +{ + "editing_started", + (GCallback) &CellRenderer_signal_editing_started_callback, + (GCallback) &CellRenderer_signal_editing_started_callback +}; + +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gtk_cell_renderer_state_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_cell_renderer_mode_get_type(); +} + + +namespace Glib +{ + +Gtk::CellRenderer* wrap(GtkCellRenderer* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellRenderer_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellRenderer_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_renderer_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CellRenderer_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->get_size = &get_size_vfunc_callback; + klass->render = &render_vfunc_callback; + klass->activate = &activate_vfunc_callback; + klass->start_editing = &start_editing_vfunc_callback; + klass->editing_canceled = &editing_canceled_callback; +} + +void CellRenderer_Class::get_size_vfunc_callback(GtkCellRenderer* self, GtkWidget* widget, GdkRectangle* cell_area, gint* x_offset, gint* y_offset, gint* width, gint* height) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_size_vfunc(*Glib::wrap(widget) +, &Glib::wrap(cell_area) +, x_offset +, y_offset +, width +, height +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_size) + (*base->get_size)(self, widget, cell_area, x_offset, y_offset, width, height); + } +} + +void CellRenderer_Class::render_vfunc_callback(GtkCellRenderer* self, GdkDrawable* window, GtkWidget* widget, GdkRectangle* background_area, GdkRectangle* cell_area, GdkRectangle* expose_area, GtkCellRendererState flags) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->render_vfunc(Glib::wrap(window, true) +, *Glib::wrap(widget) +, Glib::wrap(background_area) +, Glib::wrap(cell_area) +, Glib::wrap(expose_area) +, ((CellRendererState)(flags)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->render) + (*base->render)(self, window, widget, background_area, cell_area, expose_area, flags); + } +} + +gboolean CellRenderer_Class::activate_vfunc_callback(GtkCellRenderer* self, GdkEvent* event, GtkWidget* widget, const gchar* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->activate_vfunc(event, *Glib::wrap(widget) +, Glib::convert_const_gchar_ptr_to_ustring(path) +, Glib::wrap(background_area) +, Glib::wrap(cell_area) +, ((CellRendererState)(flags)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->activate) + return (*base->activate)(self, event, widget, path, background_area, cell_area, flags); + } + + typedef gboolean RType; + return RType(); +} + +GtkCellEditable* CellRenderer_Class::start_editing_vfunc_callback(GtkCellRenderer* self, GdkEvent* event, GtkWidget* widget, const gchar* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(false) //obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return Glib::unwrap(obj->start_editing_vfunc(event, *Glib::wrap(widget) +, Glib::convert_const_gchar_ptr_to_ustring(path) +, Glib::wrap(background_area) +, Glib::wrap(cell_area) +, ((CellRendererState)(flags)) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->start_editing) + return (*base->start_editing)(self, event, widget, path, background_area, cell_area, flags); + } + + typedef GtkCellEditable* RType; + return RType(); +} + + +void CellRenderer_Class::editing_canceled_callback(GtkCellRenderer* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_editing_canceled(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->editing_canceled) + (*base->editing_canceled)(self); + } +} + + +Glib::ObjectBase* CellRenderer_Class::wrap_new(GObject* o) +{ + return manage(new CellRenderer((GtkCellRenderer*)(o))); + +} + + +/* The implementation: */ + +CellRenderer::CellRenderer(const Glib::ConstructParams& construct_params) +: + Gtk::Object(construct_params) +{ + } + +CellRenderer::CellRenderer(GtkCellRenderer* castitem) +: + Gtk::Object((GtkObject*)(castitem)) +{ + } + +CellRenderer::~CellRenderer() +{ + destroy_(); +} + +CellRenderer::CppClassType CellRenderer::cellrenderer_class_; // initialize static member + +GType CellRenderer::get_type() +{ + return cellrenderer_class_.init().get_type(); +} + +GType CellRenderer::get_base_type() +{ + return gtk_cell_renderer_get_type(); +} + + +void CellRenderer::get_size(Widget& widget, const Gdk::Rectangle& cell_area, int& x_offset, int& y_offset, int& width, int& height) const +{ + gtk_cell_renderer_get_size(const_cast(gobj()), (widget).gobj(), const_cast(cell_area.gobj()), &x_offset, &y_offset, &width, &height); +} + +void CellRenderer::render(const Glib::RefPtr& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, CellRendererState flags) +{ + gtk_cell_renderer_render(gobj(), Glib::unwrap(window), (widget).gobj(), const_cast(background_area.gobj()), const_cast(cell_area.gobj()), const_cast(expose_area.gobj()), ((GtkCellRendererState)(flags))); +} + +bool CellRenderer::activate(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags) +{ + return gtk_cell_renderer_activate(gobj(), event, (widget).gobj(), path.c_str(), const_cast(background_area.gobj()), const_cast(cell_area.gobj()), ((GtkCellRendererState)(flags))); +} + +CellEditable* CellRenderer::start_editing(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags) +{ + return dynamic_cast(Glib::wrap_auto((GObject*)(gtk_cell_renderer_start_editing(gobj(), event, (widget).gobj(), path.c_str(), const_cast(background_area.gobj()), const_cast(cell_area.gobj()), ((GtkCellRendererState)(flags)))), false)); +} + +void CellRenderer::set_fixed_size(int width, int height) +{ + gtk_cell_renderer_set_fixed_size(gobj(), width, height); +} + +void CellRenderer::get_fixed_size(int& width, int& height) const +{ + gtk_cell_renderer_get_fixed_size(const_cast(gobj()), &width, &height); +} + +void CellRenderer::editing_canceled() +{ + gtk_cell_renderer_editing_canceled(gobj()); +} + +void CellRenderer::stop_editing(bool canceled) +{ + gtk_cell_renderer_stop_editing(gobj(), static_cast(canceled)); +} + +CellRenderer::CellRenderer() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Object(Glib::ConstructParams(cellrenderer_class_.init())) +{ + } + + +Glib::SignalProxy0< void > CellRenderer::signal_editing_canceled() +{ + return Glib::SignalProxy0< void >(this, &CellRenderer_signal_editing_canceled_info); +} + +Glib::SignalProxy2< void,CellEditable*,const Glib::ustring& > CellRenderer::signal_editing_started() +{ + return Glib::SignalProxy2< void,CellEditable*,const Glib::ustring& >(this, &CellRenderer_signal_editing_started_info); +} + + +Glib::PropertyProxy CellRenderer::property_mode() +{ + return Glib::PropertyProxy(this, "mode"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_mode() const +{ + return Glib::PropertyProxy_ReadOnly(this, "mode"); +} + +Glib::PropertyProxy CellRenderer::property_visible() +{ + return Glib::PropertyProxy(this, "visible"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_visible() const +{ + return Glib::PropertyProxy_ReadOnly(this, "visible"); +} + +Glib::PropertyProxy CellRenderer::property_xalign() +{ + return Glib::PropertyProxy(this, "xalign"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_xalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "xalign"); +} + +Glib::PropertyProxy CellRenderer::property_yalign() +{ + return Glib::PropertyProxy(this, "yalign"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_yalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "yalign"); +} + +Glib::PropertyProxy CellRenderer::property_xpad() +{ + return Glib::PropertyProxy(this, "xpad"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_xpad() const +{ + return Glib::PropertyProxy_ReadOnly(this, "xpad"); +} + +Glib::PropertyProxy CellRenderer::property_ypad() +{ + return Glib::PropertyProxy(this, "ypad"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_ypad() const +{ + return Glib::PropertyProxy_ReadOnly(this, "ypad"); +} + +Glib::PropertyProxy CellRenderer::property_width() +{ + return Glib::PropertyProxy(this, "width"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_width() const +{ + return Glib::PropertyProxy_ReadOnly(this, "width"); +} + +Glib::PropertyProxy CellRenderer::property_height() +{ + return Glib::PropertyProxy(this, "height"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_height() const +{ + return Glib::PropertyProxy_ReadOnly(this, "height"); +} + +Glib::PropertyProxy CellRenderer::property_is_expander() +{ + return Glib::PropertyProxy(this, "is-expander"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_is_expander() const +{ + return Glib::PropertyProxy_ReadOnly(this, "is-expander"); +} + +Glib::PropertyProxy CellRenderer::property_is_expanded() +{ + return Glib::PropertyProxy(this, "is-expanded"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_is_expanded() const +{ + return Glib::PropertyProxy_ReadOnly(this, "is-expanded"); +} + +Glib::PropertyProxy_WriteOnly CellRenderer::property_cell_background() +{ + return Glib::PropertyProxy_WriteOnly(this, "cell-background"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_cell_background() const +{ + return Glib::PropertyProxy_ReadOnly(this, "cell-background"); +} + +Glib::PropertyProxy CellRenderer::property_cell_background_gdk() +{ + return Glib::PropertyProxy(this, "cell-background-gdk"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_cell_background_gdk() const +{ + return Glib::PropertyProxy_ReadOnly(this, "cell-background-gdk"); +} + +Glib::PropertyProxy CellRenderer::property_cell_background_set() +{ + return Glib::PropertyProxy(this, "cell-background-set"); +} + +Glib::PropertyProxy_ReadOnly CellRenderer::property_cell_background_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "cell-background-set"); +} + + +void Gtk::CellRenderer::on_editing_canceled() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->editing_canceled) + (*base->editing_canceled)(gobj()); +} + + +void Gtk::CellRenderer::get_size_vfunc(Widget& widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_size) + (*base->get_size)(const_cast(gobj()),(widget).gobj(),Glib::unwrap(const_cast(cell_area)),x_offset,y_offset,width,height); +} + +void Gtk::CellRenderer::render_vfunc(const Glib::RefPtr& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, CellRendererState flags) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->render) + (*base->render)(gobj(),Glib::unwrap(window),(widget).gobj(),const_cast(background_area.gobj()),const_cast(cell_area.gobj()),const_cast(expose_area.gobj()),((GtkCellRendererState)(flags))); +} + +bool Gtk::CellRenderer::activate_vfunc(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->activate) + return (*base->activate)(gobj(),event,(widget).gobj(),path.c_str(),const_cast(background_area.gobj()),const_cast(cell_area.gobj()),((GtkCellRendererState)(flags))); + + typedef bool RType; + return RType(); +} + +CellEditable* Gtk::CellRenderer::start_editing_vfunc(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->start_editing) + return dynamic_cast(Glib::wrap_auto((GObject*)((*base->start_editing)(gobj(),event,(widget).gobj(),path.c_str(),const_cast(background_area.gobj()),const_cast(cell_area.gobj()),((GtkCellRendererState)(flags)))), false)); + + typedef CellEditable* RType; + return RType(); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderer.h b/libs/gtkmm2/gtk/gtkmm/cellrenderer.h new file mode 100644 index 0000000000..7c382c44c5 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderer.h @@ -0,0 +1,610 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLRENDERER_H +#define _GTKMM_CELLRENDERER_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellRenderer GtkCellRenderer; +typedef struct _GtkCellRendererClass GtkCellRendererClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellRenderer_Class; } // namespace Gtk +namespace Gtk +{ + + +/** @addtogroup gtkmmEnums Enums and Flags */ + +/** + * @ingroup gtkmmEnums + * @par Bitwise operators: + * %CellRendererState operator|(CellRendererState, CellRendererState)
+ * %CellRendererState operator&(CellRendererState, CellRendererState)
+ * %CellRendererState operator^(CellRendererState, CellRendererState)
+ * %CellRendererState operator~(CellRendererState)
+ * %CellRendererState& operator|=(CellRendererState&, CellRendererState)
+ * %CellRendererState& operator&=(CellRendererState&, CellRendererState)
+ * %CellRendererState& operator^=(CellRendererState&, CellRendererState)
+ */ +enum CellRendererState +{ + CELL_RENDERER_SELECTED = 1 << 0, + CELL_RENDERER_PRELIT = 1 << 1, + CELL_RENDERER_INSENSITIVE = 1 << 2, + CELL_RENDERER_SORTED = 1 << 3, + CELL_RENDERER_FOCUSED = 1 << 4 +}; + +/** @ingroup gtkmmEnums */ +inline CellRendererState operator|(CellRendererState lhs, CellRendererState rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline CellRendererState operator&(CellRendererState lhs, CellRendererState rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline CellRendererState operator^(CellRendererState lhs, CellRendererState rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline CellRendererState operator~(CellRendererState flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gtkmmEnums */ +inline CellRendererState& operator|=(CellRendererState& lhs, CellRendererState rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline CellRendererState& operator&=(CellRendererState& lhs, CellRendererState rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline CellRendererState& operator^=(CellRendererState& lhs, CellRendererState rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum CellRendererMode +{ + CELL_RENDERER_MODE_INERT, + CELL_RENDERER_MODE_ACTIVATABLE, + CELL_RENDERER_MODE_EDITABLE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/** CellRenderers are used by Gtk::TreeView columns to render the Gtk::TreeModel column data appropriately. + * They display, and allow editing of, the values of their properties. + * In most cases, Gtk::TreeView::append_column() will automatically choose the appropriate renderer for the mode column's data type, + * so you will rarely need to worry about these classes. + * + * @ingroup TreeView + */ + +class CellRenderer : public Gtk::Object +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellRenderer CppObjectType; + typedef CellRenderer_Class CppClassType; + typedef GtkCellRenderer BaseObjectType; + typedef GtkCellRendererClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellRenderer(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellRenderer_Class; + static CppClassType cellrenderer_class_; + + // noncopyable + CellRenderer(const CellRenderer&); + CellRenderer& operator=(const CellRenderer&); + +protected: + explicit CellRenderer(const Glib::ConstructParams& construct_params); + explicit CellRenderer(GtkCellRenderer* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellRenderer* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellRenderer* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_editing_canceled(); + + +private: + +public: + + + /** Obtains the width and height needed to render the cell. Used by view widgets + * to determine the appropriate size for the cell_area passed to + * render(). Fills in the x and y + * offsets of the cell relative to this location. Please note that the + * values set in @a width and @a height , as well as those in @a x_offset and @a y_offset + * are inclusive of the xpad and ypad properties. + * @param widget The widget the renderer is rendering to. + * @param cell_area The area a cell will be allocated. + * @param x_offset Location to return x offset of cell relative to @a cell_area . + * @param y_offset Location to return y offset of cell relative to @a cell_area . + * @param width Location to return width needed to render a cell. + * @param height Location to return height needed to render a cell. + */ + void get_size( + Widget& widget, + const Gdk::Rectangle& cell_area, + int& x_offset, int& y_offset, + int& width, int& height) const; + + /** Obtains the width and height needed to render the cell. Used by view widgets + * to determine the appropriate size for the cell_area passed to + * render(). Fills in the x and y + * offsets of the cell relative to this location. Please note that the + * values set in @a width and @a height , as well as those in @a x_offset and @a y_offset + * are inclusive of the xpad and ypad properties. + * @param widget The widget the renderer is rendering to. + * @param x_offset Location to return x offset of cell relative to @a cell_area. + * @param y_offset Location to return y offset of cell relative to @a cell_area. + * @param width Location to return width needed to render a cell. + * @param height Location to return height needed to render a cell. + */ + void get_size(Widget& widget, int& x_offset, int& y_offset, int& width, int& height) const; + + + /** Invokes the virtual render function of the Gtk::CellRenderer. The three + * passed-in rectangles are areas of @a window . Most renderers will draw within + * @a cell_area ; the xalign, yalign, xpad, and ypad fields of the Gtk::CellRenderer + * should be honored with respect to @a cell_area . @a background_area includes the + * blank space around the cell, and also the area containing the tree expander; + * so the @a background_area rectangles for all cells tile to cover the entire + * @a window . @a expose_area is a clip rectangle. + * @param window A Gdk::Drawable to draw to. + * @param widget The widget owning @a window . + * @param background_area Entire cell area (including tree expanders and maybe padding on the sides). + * @param cell_area Area normally rendered by a cell renderer. + * @param expose_area Area that actually needs updating. + * @param flags Flags that affect rendering. + */ + void render( + const Glib::RefPtr& window, + Widget& widget, + const Gdk::Rectangle& background_area, + const Gdk::Rectangle& cell_area, + const Gdk::Rectangle& expose_area, + CellRendererState flags); + + + /** Passes an activate event to the cell renderer for possible processing. Some + * cell renderers may use events; for example, Gtk::CellRendererToggle toggles + * when it gets a mouse click. + * @param event A Gdk::Event. + * @param widget Widget that received the event. + * @param path Widget-dependent string representation of the event location; e.g. for Gtk::TreeView, a string representation of Gtk::TreePath. + * @param background_area Background area as passed to @a gtk_cell_renderer_render . + * @param cell_area Cell area as passed to @a gtk_cell_renderer_render . + * @param flags Render flags. + * @return true if the event was consumed/handled. + */ + bool activate( + GdkEvent* event, + Widget& widget, + const Glib::ustring& path, + const Gdk::Rectangle& background_area, + const Gdk::Rectangle& cell_area, + CellRendererState flags); + + + /** Passes an activate event to the cell renderer for possible processing. + * @param event A Gdk::Event. + * @param widget Widget that received the event. + * @param path Widget-dependent string representation of the event location; e.g. for Gtk::TreeView, a string representation of Gtk::TreePath. + * @param background_area Background area as passed to @a gtk_cell_renderer_render . + * @param cell_area Cell area as passed to @a gtk_cell_renderer_render . + * @param flags Render flags. + * @return A new Gtk::CellEditable, or 0. + */ + CellEditable* start_editing( + GdkEvent* event, Widget& widget, + const Glib::ustring& path, + const Gdk::Rectangle& background_area, + const Gdk::Rectangle& cell_area, + CellRendererState flags = CellRendererState(0)); + + + /** Sets the renderer size to be explicit, independent of the properties set. + * @param width The width of the cell renderer, or -1. + * @param height The height of the cell renderer, or -1. + */ + void set_fixed_size(int width, int height); + + /** Fills in @a width and @a height with the appropriate size of @a cell . + * @param width Location to fill in with the fixed width of the widget. + * @param height Location to fill in with the fixed height of the widget. + */ + void get_fixed_size(int& width, int& height) const; + + //TODO: Mark as @deprecated: See stop_editing(). + + /** Causes the cell renderer to emit the "editing-canceled" signal. This + * function is for use only by implementations of cell renderers that need to + * notify the client program that an editing process was canceled and the + * changes were not committed. + * + * Since: 2.4 + * Deprecated: Use stop_editing() instead + */ + void editing_canceled(); + + + /** Informs the cell renderer that the editing is stopped. + * If @a canceled is true, the cell renderer will emit the "editing-canceled" + * signal. This function should be called by cell renderer implementations + * in response to the "editing-done" signal of Gtk::CellEditable. + * + * Since: 2.6 + * @param canceled true if the editing has been canceled. + */ + void stop_editing(bool canceled = false); + + /** Returns the property that this CellRenderer renders. + * For instance, property_text for CellRendererText, and property_active for CellRendererToggle + * Needs to be overridden in derived classes. + */ + virtual Glib::PropertyProxy_Base _property_renderable(); + + + Glib::SignalProxy0< void > signal_editing_canceled(); + + + //We use no_default_handler for this, because we can not add a new vfunc to 2.5 without breaking ABI. + //TODO: Remove no_default_handler when we do an ABI-break-with-parallel-install. + + + Glib::SignalProxy2< void,CellEditable*,const Glib::ustring& > signal_editing_started(); + + + /** Editable mode of the CellRenderer. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_mode() ; + +/** Editable mode of the CellRenderer. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_mode() const; + + /** Display the cell. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_visible() ; + +/** Display the cell. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_visible() const; + + /** The x-align. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_xalign() ; + +/** The x-align. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_xalign() const; + + /** The y-align. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_yalign() ; + +/** The y-align. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_yalign() const; + + /** The xpad. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_xpad() ; + +/** The xpad. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_xpad() const; + + /** The ypad. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_ypad() ; + +/** The ypad. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_ypad() const; + + /** The fixed width. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_width() ; + +/** The fixed width. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_width() const; + + /** The fixed height. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_height() ; + +/** The fixed height. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_height() const; + + /** Row has children. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_is_expander() ; + +/** Row has children. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_is_expander() const; + + /** Row is an expander row + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_is_expanded() ; + +/** Row is an expander row + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_is_expanded() const; + + /** Cell background color as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_WriteOnly property_cell_background() ; + +/** Cell background color as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_cell_background() const; + + /** Cell background color as a GdkColor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_cell_background_gdk() ; + +/** Cell background color as a GdkColor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_cell_background_gdk() const; + + /** Whether this tag affects the cell background color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_cell_background_set() ; + +/** Whether this tag affects the cell background color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_cell_background_set() const; + + +protected: + CellRenderer(); + + /** Override this in derived CellRenderers. + * + * Obtains the width and height needed to render the cell. Used by view widgets + * to determine the appropriate size for the cell_area passed to + * render(). If @a cell_area is not 0, fills in the x and y + * offsets (if set) of the cell relative to this location. Please note that the + * values set in @a width and @a height, as well as those in @a x_offset and @a y_offset + * are inclusive of the xpad and ypad properties. + * + * @param widget The widget the renderer is rendering to. + * @param cell_area The area a cell will be allocated, or 0. + * @param x_offset x offset of cell relative to @a cell_area. + * @param y_offset y offset of cell relative to @a cell_area. + * @param width Width needed to render a cell. + * @param height Height needed to render a cell. + **/ + virtual void get_size_vfunc(Widget& widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) const; + + + virtual void render_vfunc(const Glib::RefPtr& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, CellRendererState flags); + + virtual bool activate_vfunc(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags); + + virtual CellEditable* start_editing_vfunc(GdkEvent* event, Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, CellRendererState flags); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::CellRenderer + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellRenderer* wrap(GtkCellRenderer* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLRENDERER_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.cc b/libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.cc new file mode 100644 index 0000000000..fc5a69c6bd --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.cc @@ -0,0 +1,52 @@ +/* $Id$ */ + +/* Copyright(C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or(at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +//template specializations: + +namespace Gtk +{ + +namespace CellRenderer_Generation +{ + +template<> +CellRenderer* generate_cellrenderer< Glib::RefPtr >(bool /*editable*/) +{ + //Ignore editable because there is no way for the user to edit a Pixbuf. + return new CellRendererPixbuf(); +} + +template<> +CellRenderer* generate_cellrenderer(bool editable) +{ + CellRendererToggle* pCellRenderer = new CellRendererToggle(); + + //GTK+'s "activatable" really means "editable": + pCellRenderer->property_activatable() = editable; + + return pCellRenderer; +} + +} //CellRenderer_Generation + + +} //namespace Gtk diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.h b/libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.h new file mode 100644 index 0000000000..309fba4b07 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderer_generation.h @@ -0,0 +1,62 @@ +#ifndef _GTKMM_CELLRENDERER_GENERATION_H +#define _GTKMM_CELLRENDERER_GENERATION_H +/* $Id$ */ + +/* cellrenderer_generation.h + * + * Copyright(C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or(at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace Gtk +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace CellRenderer_Generation +{ + +template //e.g. bool or Glib::ustring. +CellRenderer* generate_cellrenderer(bool editable = false) +{ + CellRendererText* pCellRenderer = new CellRendererText(); //the default - template specializations will use other renderers. + //CellRendererText can render both strings and numerical values. + + pCellRenderer->property_editable() = editable; + return pCellRenderer; +} + +#if !defined(__GNUC__) || __GNUC__ > 2 +// gcc 2.95.x fails in TreeView::append_column_editable if the +// following specializations are declared in the header. +template<> +CellRenderer* generate_cellrenderer(bool editable); + +template<> +CellRenderer* generate_cellrenderer< Glib::RefPtr >(bool editable); + +#endif + +} //CellRenderer_Generation +#endif //DOXYGEN_SHOULD_SKIP_THIS + +} // namespace Gtk + + +#endif /* _GTKMM_CELLRENDERER_GENERATION_H */ diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderercombo.cc b/libs/gtkmm2/gtk/gtkmm/cellrenderercombo.cc new file mode 100644 index 0000000000..7570da7fa1 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderercombo.cc @@ -0,0 +1,170 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +Glib::PropertyProxy_Base CellRendererCombo::_property_renderable() +{ + return CellRendererText::_property_renderable(); +} + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CellRendererCombo* wrap(GtkCellRendererCombo* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellRendererCombo_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellRendererCombo_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_renderer_combo_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CellRendererCombo_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* CellRendererCombo_Class::wrap_new(GObject* o) +{ + return manage(new CellRendererCombo((GtkCellRendererCombo*)(o))); + +} + + +/* The implementation: */ + +CellRendererCombo::CellRendererCombo(const Glib::ConstructParams& construct_params) +: + Gtk::CellRendererText(construct_params) +{ + } + +CellRendererCombo::CellRendererCombo(GtkCellRendererCombo* castitem) +: + Gtk::CellRendererText((GtkCellRendererText*)(castitem)) +{ + } + +CellRendererCombo::~CellRendererCombo() +{ + destroy_(); +} + +CellRendererCombo::CppClassType CellRendererCombo::cellrenderercombo_class_; // initialize static member + +GType CellRendererCombo::get_type() +{ + return cellrenderercombo_class_.init().get_type(); +} + +GType CellRendererCombo::get_base_type() +{ + return gtk_cell_renderer_combo_get_type(); +} + + +CellRendererCombo::CellRendererCombo() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::CellRendererText(Glib::ConstructParams(cellrenderercombo_class_.init())) +{ + } + + +Glib::PropertyProxy< Glib::RefPtr > CellRendererCombo::property_model() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "model"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > CellRendererCombo::property_model() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "model"); +} + +Glib::PropertyProxy CellRendererCombo::property_text_column() +{ + return Glib::PropertyProxy(this, "text-column"); +} + +Glib::PropertyProxy_ReadOnly CellRendererCombo::property_text_column() const +{ + return Glib::PropertyProxy_ReadOnly(this, "text-column"); +} + +Glib::PropertyProxy CellRendererCombo::property_has_entry() +{ + return Glib::PropertyProxy(this, "has-entry"); +} + +Glib::PropertyProxy_ReadOnly CellRendererCombo::property_has_entry() const +{ + return Glib::PropertyProxy_ReadOnly(this, "has-entry"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderercombo.h b/libs/gtkmm2/gtk/gtkmm/cellrenderercombo.h new file mode 100644 index 0000000000..7e158bd106 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderercombo.h @@ -0,0 +1,180 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLRENDERERCOMBO_H +#define _GTKMM_CELLRENDERERCOMBO_H + +#include + +/* $Id$ */ + +/* cellrenderercombo.h + * + * Copyright (C) 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellRendererCombo GtkCellRendererCombo; +typedef struct _GtkCellRendererComboClass GtkCellRendererComboClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellRendererCombo_Class; } // namespace Gtk +namespace Gtk +{ + +/** Renders a combobox in a cell. + * CellRendererCombo renders text in a cell like CellRendererText, from which it is derived. But while + * CellRendererText offers a simple entry to edit the text, CellRendererCombo offers a ComboBox or + * ComboBoxEntry widget to edit the text. The values to display in the combo box are taken from the + * tree model specified in the model property. + * + * The combo cell renderer takes care of adding a text cell renderer to the combo box and sets it to + * display the column specified by its text_column property. Further cell renderers can be added in a + * handler for the editing_started signal. + * + * @ingroup TreeView + */ + +class CellRendererCombo : public CellRendererText +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellRendererCombo CppObjectType; + typedef CellRendererCombo_Class CppClassType; + typedef GtkCellRendererCombo BaseObjectType; + typedef GtkCellRendererComboClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellRendererCombo(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellRendererCombo_Class; + static CppClassType cellrenderercombo_class_; + + // noncopyable + CellRendererCombo(const CellRendererCombo&); + CellRendererCombo& operator=(const CellRendererCombo&); + +protected: + explicit CellRendererCombo(const Glib::ConstructParams& construct_params); + explicit CellRendererCombo(GtkCellRendererCombo* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellRendererCombo* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellRendererCombo* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + CellRendererCombo(); + + /** The model containing the possible values for the combo box. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_model() ; + +/** The model containing the possible values for the combo box. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_model() const; + + /** A column in the data source model to get the strings from. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_text_column() ; + +/** A column in the data source model to get the strings from. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_text_column() const; + + /** If FALSE + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_has_entry() ; + +/** If FALSE + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_has_entry() const; + + + virtual Glib::PropertyProxy_Base _property_renderable(); //override + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::CellRendererCombo + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellRendererCombo* wrap(GtkCellRendererCombo* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLRENDERERCOMBO_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.cc b/libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.cc new file mode 100644 index 0000000000..bbf363d011 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.cc @@ -0,0 +1,199 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include + +namespace Gtk +{ + +Glib::PropertyProxy_Base CellRendererPixbuf::_property_renderable() +{ + return property_pixbuf(); +} + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CellRendererPixbuf* wrap(GtkCellRendererPixbuf* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellRendererPixbuf_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellRendererPixbuf_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_renderer_pixbuf_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CellRendererPixbuf_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* CellRendererPixbuf_Class::wrap_new(GObject* o) +{ + return manage(new CellRendererPixbuf((GtkCellRendererPixbuf*)(o))); + +} + + +/* The implementation: */ + +CellRendererPixbuf::CellRendererPixbuf(const Glib::ConstructParams& construct_params) +: + Gtk::CellRenderer(construct_params) +{ + } + +CellRendererPixbuf::CellRendererPixbuf(GtkCellRendererPixbuf* castitem) +: + Gtk::CellRenderer((GtkCellRenderer*)(castitem)) +{ + } + +CellRendererPixbuf::~CellRendererPixbuf() +{ + destroy_(); +} + +CellRendererPixbuf::CppClassType CellRendererPixbuf::cellrendererpixbuf_class_; // initialize static member + +GType CellRendererPixbuf::get_type() +{ + return cellrendererpixbuf_class_.init().get_type(); +} + +GType CellRendererPixbuf::get_base_type() +{ + return gtk_cell_renderer_pixbuf_get_type(); +} + + +CellRendererPixbuf::CellRendererPixbuf() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::CellRenderer(Glib::ConstructParams(cellrendererpixbuf_class_.init())) +{ + } + + +Glib::PropertyProxy< Glib::RefPtr > CellRendererPixbuf::property_pixbuf() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "pixbuf"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > CellRendererPixbuf::property_pixbuf() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "pixbuf"); +} + +Glib::PropertyProxy< Glib::RefPtr > CellRendererPixbuf::property_pixbuf_expander_open() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "pixbuf-expander-open"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > CellRendererPixbuf::property_pixbuf_expander_open() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "pixbuf-expander-open"); +} + +Glib::PropertyProxy< Glib::RefPtr > CellRendererPixbuf::property_pixbuf_expander_closed() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "pixbuf-expander-closed"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > CellRendererPixbuf::property_pixbuf_expander_closed() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "pixbuf-expander-closed"); +} + +Glib::PropertyProxy CellRendererPixbuf::property_stock_id() +{ + return Glib::PropertyProxy(this, "stock-id"); +} + +Glib::PropertyProxy_ReadOnly CellRendererPixbuf::property_stock_id() const +{ + return Glib::PropertyProxy_ReadOnly(this, "stock-id"); +} + +Glib::PropertyProxy CellRendererPixbuf::property_stock_size() +{ + return Glib::PropertyProxy(this, "stock-size"); +} + +Glib::PropertyProxy_ReadOnly CellRendererPixbuf::property_stock_size() const +{ + return Glib::PropertyProxy_ReadOnly(this, "stock-size"); +} + +Glib::PropertyProxy CellRendererPixbuf::property_stock_detail() +{ + return Glib::PropertyProxy(this, "stock-detail"); +} + +Glib::PropertyProxy_ReadOnly CellRendererPixbuf::property_stock_detail() const +{ + return Glib::PropertyProxy_ReadOnly(this, "stock-detail"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.h b/libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.h new file mode 100644 index 0000000000..8380c76492 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrendererpixbuf.h @@ -0,0 +1,226 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLRENDERERPIXBUF_H +#define _GTKMM_CELLRENDERERPIXBUF_H + +#include + +/* $Id$ */ + +/* cellrenderertext.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellRendererPixbuf GtkCellRendererPixbuf; +typedef struct _GtkCellRendererPixbufClass GtkCellRendererPixbufClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellRendererPixbuf_Class; } // namespace Gtk +namespace Gtk +{ + +/** Renders a pixbuf in a cell. + * A CellRendererPixbuf can be used to render an image in a cell. It allows you to render either a + * given Pixbuf (set via the pixbuf property) or a stock icon (set via the stock_id property). + * + * To support the tree view, CellRendererPixbuf also supports rendering two alternative pixbufs, when + * the is_expanded property is true. If the is_expanded property is true and the pixbuf_expander_open + * property is set to a pixbuf, it renders that pixbuf. If the is_expanded property is false and the * + * pixbuf_expander_closed property is set to a pixbuf, it renders that one. + * + * @ingroup TreeView + */ + +class CellRendererPixbuf : public CellRenderer +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellRendererPixbuf CppObjectType; + typedef CellRendererPixbuf_Class CppClassType; + typedef GtkCellRendererPixbuf BaseObjectType; + typedef GtkCellRendererPixbufClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellRendererPixbuf(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellRendererPixbuf_Class; + static CppClassType cellrendererpixbuf_class_; + + // noncopyable + CellRendererPixbuf(const CellRendererPixbuf&); + CellRendererPixbuf& operator=(const CellRendererPixbuf&); + +protected: + explicit CellRendererPixbuf(const Glib::ConstructParams& construct_params); + explicit CellRendererPixbuf(GtkCellRendererPixbuf* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellRendererPixbuf* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellRendererPixbuf* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + CellRendererPixbuf(); + + /** The pixbuf to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_pixbuf() ; + +/** The pixbuf to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_pixbuf() const; + + /** Pixbuf for open expander. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_pixbuf_expander_open() ; + +/** Pixbuf for open expander. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_pixbuf_expander_open() const; + + /** Pixbuf for closed expander. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_pixbuf_expander_closed() ; + +/** Pixbuf for closed expander. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_pixbuf_expander_closed() const; + + /** The stock ID of the stock icon to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_stock_id() ; + +/** The stock ID of the stock icon to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_stock_id() const; + + /** The GtkIconSize value that specifies the size of the rendered icon. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_stock_size() ; + +/** The GtkIconSize value that specifies the size of the rendered icon. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_stock_size() const; + + /** Render detail to pass to the theme engine. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_stock_detail() ; + +/** Render detail to pass to the theme engine. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_stock_detail() const; + + + virtual Glib::PropertyProxy_Base _property_renderable(); //override + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::CellRendererPixbuf + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellRendererPixbuf* wrap(GtkCellRendererPixbuf* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLRENDERERPIXBUF_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrendererprogress.cc b/libs/gtkmm2/gtk/gtkmm/cellrendererprogress.cc new file mode 100644 index 0000000000..e3f3b0ed4f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrendererprogress.cc @@ -0,0 +1,161 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +Glib::PropertyProxy_Base CellRendererProgress::_property_renderable() +{ + return _property_renderable(); +} + + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CellRendererProgress* wrap(GtkCellRendererProgress* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellRendererProgress_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellRendererProgress_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_renderer_progress_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CellRendererProgress_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* CellRendererProgress_Class::wrap_new(GObject* o) +{ + return manage(new CellRendererProgress((GtkCellRendererProgress*)(o))); + +} + + +/* The implementation: */ + +CellRendererProgress::CellRendererProgress(const Glib::ConstructParams& construct_params) +: + Gtk::CellRenderer(construct_params) +{ + } + +CellRendererProgress::CellRendererProgress(GtkCellRendererProgress* castitem) +: + Gtk::CellRenderer((GtkCellRenderer*)(castitem)) +{ + } + +CellRendererProgress::~CellRendererProgress() +{ + destroy_(); +} + +CellRendererProgress::CppClassType CellRendererProgress::cellrendererprogress_class_; // initialize static member + +GType CellRendererProgress::get_type() +{ + return cellrendererprogress_class_.init().get_type(); +} + +GType CellRendererProgress::get_base_type() +{ + return gtk_cell_renderer_progress_get_type(); +} + + +CellRendererProgress::CellRendererProgress() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::CellRenderer(Glib::ConstructParams(cellrendererprogress_class_.init())) +{ + } + + +Glib::PropertyProxy CellRendererProgress::property_value() +{ + return Glib::PropertyProxy(this, "value"); +} + +Glib::PropertyProxy_ReadOnly CellRendererProgress::property_value() const +{ + return Glib::PropertyProxy_ReadOnly(this, "value"); +} + +Glib::PropertyProxy CellRendererProgress::property_text() +{ + return Glib::PropertyProxy(this, "text"); +} + +Glib::PropertyProxy_ReadOnly CellRendererProgress::property_text() const +{ + return Glib::PropertyProxy_ReadOnly(this, "text"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrendererprogress.h b/libs/gtkmm2/gtk/gtkmm/cellrendererprogress.h new file mode 100644 index 0000000000..7ad6132715 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrendererprogress.h @@ -0,0 +1,152 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLRENDERERPROGRESS_H +#define _GTKMM_CELLRENDERERPROGRESS_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellRendererProgress GtkCellRendererProgress; +typedef struct _GtkCellRendererProgressClass GtkCellRendererProgressClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellRendererProgress_Class; } // namespace Gtk +namespace Gtk +{ + +/** Renders numbers as progress bars. + * + * @ingroup TreeView + */ + +class CellRendererProgress : public CellRenderer +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellRendererProgress CppObjectType; + typedef CellRendererProgress_Class CppClassType; + typedef GtkCellRendererProgress BaseObjectType; + typedef GtkCellRendererProgressClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellRendererProgress(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellRendererProgress_Class; + static CppClassType cellrendererprogress_class_; + + // noncopyable + CellRendererProgress(const CellRendererProgress&); + CellRendererProgress& operator=(const CellRendererProgress&); + +protected: + explicit CellRendererProgress(const Glib::ConstructParams& construct_params); + explicit CellRendererProgress(GtkCellRendererProgress* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellRendererProgress* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellRendererProgress* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + CellRendererProgress(); + + /** Value of the progress bar. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_value() ; + +/** Value of the progress bar. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_value() const; + + /** Text on the progress bar. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_text() ; + +/** Text on the progress bar. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_text() const; + + + virtual Glib::PropertyProxy_Base _property_renderable(); //override + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::CellRendererProgress + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellRendererProgress* wrap(GtkCellRendererProgress* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLRENDERERPROGRESS_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderertext.cc b/libs/gtkmm2/gtk/gtkmm/cellrenderertext.cc new file mode 100644 index 0000000000..3ffd88a287 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderertext.cc @@ -0,0 +1,624 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include + +namespace Gtk +{ + +Glib::PropertyProxy_Base CellRendererText::_property_renderable() +{ + return property_text(); +} + +void CellRendererText::edited(const Glib::ustring& path, const Glib::ustring& new_text) +{ + g_signal_emit_by_name(gobj(), "edited", path.c_str(), new_text.c_str()); +} + +} // namespace Gtk + + +namespace +{ + +void CellRendererText_signal_edited_callback(GtkCellRendererText* self, const gchar* p0,const gchar* p1,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::ustring&,const Glib::ustring& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0) +, Glib::convert_const_gchar_ptr_to_ustring(p1) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo CellRendererText_signal_edited_info = +{ + "edited", + (GCallback) &CellRendererText_signal_edited_callback, + (GCallback) &CellRendererText_signal_edited_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CellRendererText* wrap(GtkCellRendererText* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellRendererText_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellRendererText_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_renderer_text_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CellRendererText_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->edited = &edited_callback; +} + + +void CellRendererText_Class::edited_callback(GtkCellRendererText* self, const gchar* p0, const gchar* p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_edited(Glib::convert_const_gchar_ptr_to_ustring(p0) +, Glib::convert_const_gchar_ptr_to_ustring(p1) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->edited) + (*base->edited)(self, p0, p1); + } +} + + +Glib::ObjectBase* CellRendererText_Class::wrap_new(GObject* o) +{ + return manage(new CellRendererText((GtkCellRendererText*)(o))); + +} + + +/* The implementation: */ + +CellRendererText::CellRendererText(const Glib::ConstructParams& construct_params) +: + Gtk::CellRenderer(construct_params) +{ + } + +CellRendererText::CellRendererText(GtkCellRendererText* castitem) +: + Gtk::CellRenderer((GtkCellRenderer*)(castitem)) +{ + } + +CellRendererText::~CellRendererText() +{ + destroy_(); +} + +CellRendererText::CppClassType CellRendererText::cellrenderertext_class_; // initialize static member + +GType CellRendererText::get_type() +{ + return cellrenderertext_class_.init().get_type(); +} + +GType CellRendererText::get_base_type() +{ + return gtk_cell_renderer_text_get_type(); +} + + +CellRendererText::CellRendererText() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::CellRenderer(Glib::ConstructParams(cellrenderertext_class_.init())) +{ + } + +void CellRendererText::set_fixed_height_from_font(int number_of_rows) +{ + gtk_cell_renderer_text_set_fixed_height_from_font(gobj(), number_of_rows); +} + + +Glib::SignalProxy2< void,const Glib::ustring&,const Glib::ustring& > CellRendererText::signal_edited() +{ + return Glib::SignalProxy2< void,const Glib::ustring&,const Glib::ustring& >(this, &CellRendererText_signal_edited_info); +} + + +Glib::PropertyProxy CellRendererText::property_text() +{ + return Glib::PropertyProxy(this, "text"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_text() const +{ + return Glib::PropertyProxy_ReadOnly(this, "text"); +} + +Glib::PropertyProxy_WriteOnly CellRendererText::property_markup() +{ + return Glib::PropertyProxy_WriteOnly(this, "markup"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_markup() const +{ + return Glib::PropertyProxy_ReadOnly(this, "markup"); +} + +Glib::PropertyProxy CellRendererText::property_attributes() +{ + return Glib::PropertyProxy(this, "attributes"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_attributes() const +{ + return Glib::PropertyProxy_ReadOnly(this, "attributes"); +} + +Glib::PropertyProxy_WriteOnly CellRendererText::property_background() +{ + return Glib::PropertyProxy_WriteOnly(this, "background"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_background() const +{ + return Glib::PropertyProxy_ReadOnly(this, "background"); +} + +Glib::PropertyProxy_WriteOnly CellRendererText::property_foreground() +{ + return Glib::PropertyProxy_WriteOnly(this, "foreground"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_foreground() const +{ + return Glib::PropertyProxy_ReadOnly(this, "foreground"); +} + +Glib::PropertyProxy CellRendererText::property_background_gdk() +{ + return Glib::PropertyProxy(this, "background-gdk"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_background_gdk() const +{ + return Glib::PropertyProxy_ReadOnly(this, "background-gdk"); +} + +Glib::PropertyProxy CellRendererText::property_foreground_gdk() +{ + return Glib::PropertyProxy(this, "foreground-gdk"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_foreground_gdk() const +{ + return Glib::PropertyProxy_ReadOnly(this, "foreground-gdk"); +} + +Glib::PropertyProxy CellRendererText::property_font() +{ + return Glib::PropertyProxy(this, "font"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_font() const +{ + return Glib::PropertyProxy_ReadOnly(this, "font"); +} + +Glib::PropertyProxy CellRendererText::property_font_desc() +{ + return Glib::PropertyProxy(this, "font-desc"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_font_desc() const +{ + return Glib::PropertyProxy_ReadOnly(this, "font-desc"); +} + +Glib::PropertyProxy CellRendererText::property_family() +{ + return Glib::PropertyProxy(this, "family"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_family() const +{ + return Glib::PropertyProxy_ReadOnly(this, "family"); +} + +Glib::PropertyProxy CellRendererText::property_style() +{ + return Glib::PropertyProxy(this, "style"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_style() const +{ + return Glib::PropertyProxy_ReadOnly(this, "style"); +} + +Glib::PropertyProxy CellRendererText::property_variant() +{ + return Glib::PropertyProxy(this, "variant"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_variant() const +{ + return Glib::PropertyProxy_ReadOnly(this, "variant"); +} + +Glib::PropertyProxy CellRendererText::property_weight() +{ + return Glib::PropertyProxy(this, "weight"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_weight() const +{ + return Glib::PropertyProxy_ReadOnly(this, "weight"); +} + +Glib::PropertyProxy CellRendererText::property_stretch() +{ + return Glib::PropertyProxy(this, "stretch"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_stretch() const +{ + return Glib::PropertyProxy_ReadOnly(this, "stretch"); +} + +Glib::PropertyProxy CellRendererText::property_size() +{ + return Glib::PropertyProxy(this, "size"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_size() const +{ + return Glib::PropertyProxy_ReadOnly(this, "size"); +} + +Glib::PropertyProxy CellRendererText::property_size_points() +{ + return Glib::PropertyProxy(this, "size-points"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_size_points() const +{ + return Glib::PropertyProxy_ReadOnly(this, "size-points"); +} + +Glib::PropertyProxy CellRendererText::property_scale() +{ + return Glib::PropertyProxy(this, "scale"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_scale() const +{ + return Glib::PropertyProxy_ReadOnly(this, "scale"); +} + +Glib::PropertyProxy CellRendererText::property_editable() +{ + return Glib::PropertyProxy(this, "editable"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_editable() const +{ + return Glib::PropertyProxy_ReadOnly(this, "editable"); +} + +Glib::PropertyProxy CellRendererText::property_strikethrough() +{ + return Glib::PropertyProxy(this, "strikethrough"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_strikethrough() const +{ + return Glib::PropertyProxy_ReadOnly(this, "strikethrough"); +} + +Glib::PropertyProxy CellRendererText::property_underline() +{ + return Glib::PropertyProxy(this, "underline"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_underline() const +{ + return Glib::PropertyProxy_ReadOnly(this, "underline"); +} + +Glib::PropertyProxy CellRendererText::property_rise() +{ + return Glib::PropertyProxy(this, "rise"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_rise() const +{ + return Glib::PropertyProxy_ReadOnly(this, "rise"); +} + +Glib::PropertyProxy CellRendererText::property_language() +{ + return Glib::PropertyProxy(this, "language"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_language() const +{ + return Glib::PropertyProxy_ReadOnly(this, "language"); +} + +Glib::PropertyProxy CellRendererText::property_ellipsize() +{ + return Glib::PropertyProxy(this, "ellipsize"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_ellipsize() const +{ + return Glib::PropertyProxy_ReadOnly(this, "ellipsize"); +} + +Glib::PropertyProxy CellRendererText::property_background_set() +{ + return Glib::PropertyProxy(this, "background-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_background_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "background-set"); +} + +Glib::PropertyProxy CellRendererText::property_foreground_set() +{ + return Glib::PropertyProxy(this, "foreground-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_foreground_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "foreground-set"); +} + +Glib::PropertyProxy CellRendererText::property_family_set() +{ + return Glib::PropertyProxy(this, "family-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_family_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "family-set"); +} + +Glib::PropertyProxy CellRendererText::property_style_set() +{ + return Glib::PropertyProxy(this, "style-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_style_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "style-set"); +} + +Glib::PropertyProxy CellRendererText::property_variant_set() +{ + return Glib::PropertyProxy(this, "variant-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_variant_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "variant-set"); +} + +Glib::PropertyProxy CellRendererText::property_weight_set() +{ + return Glib::PropertyProxy(this, "weight-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_weight_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "weight-set"); +} + +Glib::PropertyProxy CellRendererText::property_stretch_set() +{ + return Glib::PropertyProxy(this, "stretch-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_stretch_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "stretch-set"); +} + +Glib::PropertyProxy CellRendererText::property_size_set() +{ + return Glib::PropertyProxy(this, "size-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_size_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "size-set"); +} + +Glib::PropertyProxy CellRendererText::property_scale_set() +{ + return Glib::PropertyProxy(this, "scale-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_scale_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "scale-set"); +} + +Glib::PropertyProxy CellRendererText::property_editable_set() +{ + return Glib::PropertyProxy(this, "editable-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_editable_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "editable-set"); +} + +Glib::PropertyProxy CellRendererText::property_strikethrough_set() +{ + return Glib::PropertyProxy(this, "strikethrough-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_strikethrough_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "strikethrough-set"); +} + +Glib::PropertyProxy CellRendererText::property_underline_set() +{ + return Glib::PropertyProxy(this, "underline-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_underline_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "underline-set"); +} + +Glib::PropertyProxy CellRendererText::property_rise_set() +{ + return Glib::PropertyProxy(this, "rise-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_rise_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "rise-set"); +} + +Glib::PropertyProxy CellRendererText::property_language_set() +{ + return Glib::PropertyProxy(this, "language-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_language_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "language-set"); +} + +Glib::PropertyProxy CellRendererText::property_ellipsize_set() +{ + return Glib::PropertyProxy(this, "ellipsize-set"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_ellipsize_set() const +{ + return Glib::PropertyProxy_ReadOnly(this, "ellipsize-set"); +} + +Glib::PropertyProxy CellRendererText::property_single_paragraph_mode() +{ + return Glib::PropertyProxy(this, "single-paragraph-mode"); +} + +Glib::PropertyProxy_ReadOnly CellRendererText::property_single_paragraph_mode() const +{ + return Glib::PropertyProxy_ReadOnly(this, "single-paragraph-mode"); +} + + +void Gtk::CellRendererText::on_edited(const Glib::ustring& path, const Glib::ustring& new_text) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->edited) + (*base->edited)(gobj(),path.c_str(),new_text.c_str()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderertext.h b/libs/gtkmm2/gtk/gtkmm/cellrenderertext.h new file mode 100644 index 0000000000..9135cdf83a --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderertext.h @@ -0,0 +1,769 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLRENDERERTEXT_H +#define _GTKMM_CELLRENDERERTEXT_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellRendererText GtkCellRendererText; +typedef struct _GtkCellRendererTextClass GtkCellRendererTextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellRendererText_Class; } // namespace Gtk +namespace Gtk +{ + +/** Renders text in a cell. + * + * @ingroup TreeView + */ + +class CellRendererText : public CellRenderer +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellRendererText CppObjectType; + typedef CellRendererText_Class CppClassType; + typedef GtkCellRendererText BaseObjectType; + typedef GtkCellRendererTextClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellRendererText(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellRendererText_Class; + static CppClassType cellrenderertext_class_; + + // noncopyable + CellRendererText(const CellRendererText&); + CellRendererText& operator=(const CellRendererText&); + +protected: + explicit CellRendererText(const Glib::ConstructParams& construct_params); + explicit CellRendererText(GtkCellRendererText* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellRendererText* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellRendererText* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_edited(const Glib::ustring& path, const Glib::ustring& new_text); + + +private: + +public: + CellRendererText(); + + + /** Sets the height of a renderer to explicitly be determined by the "font" and + * "y_pad" property set on it. Further changes in these properties do not + * affect the height, so they must be accompanied by a subsequent call to this + * function. Using this function is unflexible, and should really only be used + * if calculating the size of a cell is too slow (ie, a massive number of cells + * displayed). If @a number_of_rows is -1, then the fixed height is unset, and + * the height is determined by the properties again. + * @param number_of_rows Number of rows of text each cell renderer is allocated, or -1. + */ + void set_fixed_height_from_font(int number_of_rows); + + + Glib::SignalProxy2< void,const Glib::ustring&,const Glib::ustring& > signal_edited(); + + + /** Text to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_text() ; + +/** Text to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_text() const; + + /** Marked up text to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_WriteOnly property_markup() ; + +/** Marked up text to render. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_markup() const; + + /** A list of style attributes to apply to the text of the renderer. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_attributes() ; + +/** A list of style attributes to apply to the text of the renderer. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_attributes() const; + + /** Background color as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_WriteOnly property_background() ; + +/** Background color as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_background() const; + + /** Foreground color as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_WriteOnly property_foreground() ; + +/** Foreground color as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_foreground() const; + + /** Background color as a GdkColor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_background_gdk() ; + +/** Background color as a GdkColor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_background_gdk() const; + + /** Foreground color as a GdkColor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_foreground_gdk() ; + +/** Foreground color as a GdkColor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_foreground_gdk() const; + + /** Font description as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_font() ; + +/** Font description as a string. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_font() const; + + /** Font description as a PangoFontDescription struct. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_font_desc() ; + +/** Font description as a PangoFontDescription struct. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_font_desc() const; + + /** Name of the font family + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_family() ; + +/** Name of the font family + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_family() const; + + /** Font style. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_style() ; + +/** Font style. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_style() const; + + /** Font variant. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_variant() ; + +/** Font variant. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_variant() const; + + /** Font weight. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_weight() ; + +/** Font weight. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_weight() const; + + /** Font stretch. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_stretch() ; + +/** Font stretch. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_stretch() const; + + /** Font size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_size() ; + +/** Font size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_size() const; + + /** Font size in points. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_size_points() ; + +/** Font size in points. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_size_points() const; + + /** Font scaling factor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_scale() ; + +/** Font scaling factor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_scale() const; + + /** Whether the text can be modified by the user. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_editable() ; + +/** Whether the text can be modified by the user. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_editable() const; + + /** Whether to strike through the text. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_strikethrough() ; + +/** Whether to strike through the text. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_strikethrough() const; + + /** Style of underline for this text. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_underline() ; + +/** Style of underline for this text. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_underline() const; + + /** Offset of text above the baseline (below the baseline if rise is negative). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_rise() ; + +/** Offset of text above the baseline (below the baseline if rise is negative). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_rise() const; + + /** The language this text is in + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_language() ; + +/** The language this text is in + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_language() const; + + /** The preferred place to ellipsize the string + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_ellipsize() ; + +/** The preferred place to ellipsize the string + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_ellipsize() const; + + /** Whether this tag affects the background color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_background_set() ; + +/** Whether this tag affects the background color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_background_set() const; + + /** Whether this tag affects the foreground color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_foreground_set() ; + +/** Whether this tag affects the foreground color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_foreground_set() const; + + /** Whether this tag affects the font family. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_family_set() ; + +/** Whether this tag affects the font family. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_family_set() const; + + /** Whether this tag affects the font style. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_style_set() ; + +/** Whether this tag affects the font style. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_style_set() const; + + /** Whether this tag affects the font variant. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_variant_set() ; + +/** Whether this tag affects the font variant. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_variant_set() const; + + /** Whether this tag affects the font weight. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_weight_set() ; + +/** Whether this tag affects the font weight. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_weight_set() const; + + /** Whether this tag affects the font stretch. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_stretch_set() ; + +/** Whether this tag affects the font stretch. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_stretch_set() const; + + /** Whether this tag affects the font size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_size_set() ; + +/** Whether this tag affects the font size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_size_set() const; + + /** Whether this tag scales the font size by a factor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_scale_set() ; + +/** Whether this tag scales the font size by a factor. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_scale_set() const; + + /** Whether this tag affects text editability. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_editable_set() ; + +/** Whether this tag affects text editability. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_editable_set() const; + + /** Whether this tag affects strikethrough. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_strikethrough_set() ; + +/** Whether this tag affects strikethrough. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_strikethrough_set() const; + + /** Whether this tag affects underlining. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_underline_set() ; + +/** Whether this tag affects underlining. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_underline_set() const; + + /** Whether this tag affects the rise. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_rise_set() ; + +/** Whether this tag affects the rise. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_rise_set() const; + + /** Whether this tag affects the language the text is rendered as. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_language_set() ; + +/** Whether this tag affects the language the text is rendered as. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_language_set() const; + + /** Whether this tag affects the ellipsize mode. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_ellipsize_set() ; + +/** Whether this tag affects the ellipsize mode. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_ellipsize_set() const; + + /** Whether or not to keep all text in a single paragraph. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_single_paragraph_mode() ; + +/** Whether or not to keep all text in a single paragraph. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_single_paragraph_mode() const; + + + virtual Glib::PropertyProxy_Base _property_renderable(); //override + +protected: + /** Emits the "edited" signal. + * This is useful when implementing custom CellRenderers. + */ + void edited(const Glib::ustring& path, const Glib::ustring& new_text); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::CellRendererText + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellRendererText* wrap(GtkCellRendererText* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLRENDERERTEXT_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.cc b/libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.cc new file mode 100644 index 0000000000..023c5382dd --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.cc @@ -0,0 +1,273 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +Glib::PropertyProxy_Base CellRendererToggle::_property_renderable() +{ + return property_active(); +} + +} //namespace Gtk + + +namespace +{ + +void CellRendererToggle_signal_toggled_callback(GtkCellRendererToggle* self, const gchar* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::ustring& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo CellRendererToggle_signal_toggled_info = +{ + "toggled", + (GCallback) &CellRendererToggle_signal_toggled_callback, + (GCallback) &CellRendererToggle_signal_toggled_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CellRendererToggle* wrap(GtkCellRendererToggle* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellRendererToggle_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellRendererToggle_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_renderer_toggle_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CellRendererToggle_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->toggled = &toggled_callback; +} + + +void CellRendererToggle_Class::toggled_callback(GtkCellRendererToggle* self, const gchar* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_toggled(Glib::convert_const_gchar_ptr_to_ustring(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->toggled) + (*base->toggled)(self, p0); + } +} + + +Glib::ObjectBase* CellRendererToggle_Class::wrap_new(GObject* o) +{ + return manage(new CellRendererToggle((GtkCellRendererToggle*)(o))); + +} + + +/* The implementation: */ + +CellRendererToggle::CellRendererToggle(const Glib::ConstructParams& construct_params) +: + Gtk::CellRenderer(construct_params) +{ + } + +CellRendererToggle::CellRendererToggle(GtkCellRendererToggle* castitem) +: + Gtk::CellRenderer((GtkCellRenderer*)(castitem)) +{ + } + +CellRendererToggle::~CellRendererToggle() +{ + destroy_(); +} + +CellRendererToggle::CppClassType CellRendererToggle::cellrenderertoggle_class_; // initialize static member + +GType CellRendererToggle::get_type() +{ + return cellrenderertoggle_class_.init().get_type(); +} + +GType CellRendererToggle::get_base_type() +{ + return gtk_cell_renderer_toggle_get_type(); +} + + +CellRendererToggle::CellRendererToggle() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::CellRenderer(Glib::ConstructParams(cellrenderertoggle_class_.init())) +{ + } + +bool CellRendererToggle::get_radio() const +{ + return gtk_cell_renderer_toggle_get_radio(const_cast(gobj())); +} + +void CellRendererToggle::set_radio(bool radio) +{ + gtk_cell_renderer_toggle_set_radio(gobj(), static_cast(radio)); +} + +bool CellRendererToggle::get_active() const +{ + return gtk_cell_renderer_toggle_get_active(const_cast(gobj())); +} + +void CellRendererToggle::set_active(bool setting) +{ + gtk_cell_renderer_toggle_set_active(gobj(), static_cast(setting)); +} + + +Glib::SignalProxy1< void,const Glib::ustring& > CellRendererToggle::signal_toggled() +{ + return Glib::SignalProxy1< void,const Glib::ustring& >(this, &CellRendererToggle_signal_toggled_info); +} + + +Glib::PropertyProxy CellRendererToggle::property_activatable() +{ + return Glib::PropertyProxy(this, "activatable"); +} + +Glib::PropertyProxy_ReadOnly CellRendererToggle::property_activatable() const +{ + return Glib::PropertyProxy_ReadOnly(this, "activatable"); +} + +Glib::PropertyProxy CellRendererToggle::property_active() +{ + return Glib::PropertyProxy(this, "active"); +} + +Glib::PropertyProxy_ReadOnly CellRendererToggle::property_active() const +{ + return Glib::PropertyProxy_ReadOnly(this, "active"); +} + +Glib::PropertyProxy CellRendererToggle::property_radio() +{ + return Glib::PropertyProxy(this, "radio"); +} + +Glib::PropertyProxy_ReadOnly CellRendererToggle::property_radio() const +{ + return Glib::PropertyProxy_ReadOnly(this, "radio"); +} + + +void Gtk::CellRendererToggle::on_toggled(const Glib::ustring& path) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->toggled) + (*base->toggled)(gobj(),path.c_str()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.h b/libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.h new file mode 100644 index 0000000000..293f4e7750 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellrenderertoggle.h @@ -0,0 +1,206 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLRENDERERTOGGLE_H +#define _GTKMM_CELLRENDERERTOGGLE_H + +#include + +/* $Id$ */ + +/* cellrenderertoggle.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellRendererToggle GtkCellRendererToggle; +typedef struct _GtkCellRendererToggleClass GtkCellRendererToggleClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellRendererToggle_Class; } // namespace Gtk +namespace Gtk +{ + +/** Renders a toggle button in a cell. + * The button is drawn as a radio- or checkbutton, depending on the radio property. When activated, it + * emits the toggled signal. + * + * @ingroup TreeView + */ + +class CellRendererToggle : public CellRenderer +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellRendererToggle CppObjectType; + typedef CellRendererToggle_Class CppClassType; + typedef GtkCellRendererToggle BaseObjectType; + typedef GtkCellRendererToggleClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellRendererToggle(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellRendererToggle_Class; + static CppClassType cellrenderertoggle_class_; + + // noncopyable + CellRendererToggle(const CellRendererToggle&); + CellRendererToggle& operator=(const CellRendererToggle&); + +protected: + explicit CellRendererToggle(const Glib::ConstructParams& construct_params); + explicit CellRendererToggle(GtkCellRendererToggle* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellRendererToggle* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellRendererToggle* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_toggled(const Glib::ustring& path); + + +private: + +public: + + CellRendererToggle(); + + + /** Returns wether we're rendering radio toggles rather than checkboxes. + * @return true if we're rendering radio toggles rather than checkboxes. + */ + bool get_radio() const; + + /** If @a radio is true, the cell renderer renders a radio toggle + * (i.e.\ a toggle in a group of mutually-exclusive toggles). + * If false, it renders a check toggle (a standalone boolean option). + * This can be set globally for the cell renderer, or changed just + * before rendering each cell in the model (for Gtk::TreeView, you set + * up a per-row setting using Gtk::TreeViewColumn to associate model + * columns with cell renderer properties). + * @param radio true to make the toggle look like a radio button. + */ + void set_radio(bool radio = true); + + /** Returns whether the cell renderer is active. See + * set_active(). + * @return true if the cell renderer is active. + */ + bool get_active() const; + + /** Activates or deactivates a cell renderer. + * @param setting The value to set. + */ + void set_active(bool setting = true); + + + Glib::SignalProxy1< void,const Glib::ustring& > signal_toggled(); + + + /** The toggle button can be activated. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_activatable() ; + +/** The toggle button can be activated. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_activatable() const; + + /** The toggle state of the button. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_active() ; + +/** The toggle state of the button. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_active() const; + + /** Draw the toggle button as a radio button. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_radio() ; + +/** Draw the toggle button as a radio button. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_radio() const; + + + virtual Glib::PropertyProxy_Base _property_renderable(); //override + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::CellRendererToggle + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellRendererToggle* wrap(GtkCellRendererToggle* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLRENDERERTOGGLE_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/cellview.cc b/libs/gtkmm2/gtk/gtkmm/cellview.cc new file mode 100644 index 0000000000..5b57ccf3a0 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellview.cc @@ -0,0 +1,199 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace Gtk +{ + +CellView::CellView(const Glib::ustring& text, bool use_markup) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(cellview_class_.init(), (char*) 0)) +{ + Gtk::CellRendererText* cell = Gtk::manage(new Gtk::CellRendererText()); + + if(use_markup) + cell->property_markup() = text; + else + cell->property_text() = text; + + pack_start(*cell); +} + +CellView::CellView(const Glib::RefPtr& pixbuf) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(cellview_class_.init(), (char*) 0)) +{ + Gtk::CellRendererPixbuf* cell = Gtk::manage(new Gtk::CellRendererPixbuf()); + cell->property_pixbuf() = pixbuf; + + pack_start(*cell); +} + + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CellView* wrap(GtkCellView* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CellView_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CellView_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_cell_view_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + CellLayout::add_interface(get_type()); + } + + return *this; +} + +void CellView_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* CellView_Class::wrap_new(GObject* o) +{ + return manage(new CellView((GtkCellView*)(o))); + +} + + +/* The implementation: */ + +CellView::CellView(const Glib::ConstructParams& construct_params) +: + Gtk::Widget(construct_params) +{ + } + +CellView::CellView(GtkCellView* castitem) +: + Gtk::Widget((GtkWidget*)(castitem)) +{ + } + +CellView::~CellView() +{ + destroy_(); +} + +CellView::CppClassType CellView::cellview_class_; // initialize static member + +GType CellView::get_type() +{ + return cellview_class_.init().get_type(); +} + +GType CellView::get_base_type() +{ + return gtk_cell_view_get_type(); +} + + +CellView::CellView() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(cellview_class_.init())) +{ + } + +void CellView::set_model(const Glib::RefPtr& model) +{ + gtk_cell_view_set_model(gobj(), Glib::unwrap(model)); +} + +void CellView::set_displayed_row(const TreeModel::Path& path) +{ + gtk_cell_view_set_displayed_row(gobj(), const_cast((path).gobj())); +} + +TreeModel::Path CellView::get_displayed_row() const +{ + return Gtk::TreePath(gtk_cell_view_get_displayed_row(const_cast(gobj())), false); +} + +bool CellView::get_size_of_row(const TreeModel::Path& path, Requisition& requisition) const +{ + return gtk_cell_view_get_size_of_row(const_cast(gobj()), const_cast((path).gobj()), (GtkRequisition*)(&requisition)); +} + +void CellView::set_background_color(const Gdk::Color& color) +{ + gtk_cell_view_set_background_color(gobj(), (color).gobj()); +} + +Glib::ListHandle CellView::get_cell_renderers() +{ + return Glib::ListHandle(gtk_cell_view_get_cell_renderers(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle CellView::get_cell_renderers() const +{ + return Glib::ListHandle(gtk_cell_view_get_cell_renderers(const_cast(gobj())), Glib::OWNERSHIP_SHALLOW); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/cellview.h b/libs/gtkmm2/gtk/gtkmm/cellview.h new file mode 100644 index 0000000000..6e798c5f56 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/cellview.h @@ -0,0 +1,210 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CELLVIEW_H +#define _GTKMM_CELLVIEW_H + +#include + +/* $Id$ */ + +/* cellview.h + * + * Copyright (C) 2004 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCellView GtkCellView; +typedef struct _GtkCellViewClass GtkCellViewClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CellView_Class; } // namespace Gtk +namespace Gtk +{ + +/** A widget displaying a single row of a TreeModel. + * A CellView displays a single row of a TreeModel, using cell renderers just like TreeView. CellView doesn't support some of the more + * complex features of GtkTreeView, like cell editing and drag and drop. + * + * @ingroup Widgets + */ + +class CellView : + public Widget, + public CellLayout +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CellView CppObjectType; + typedef CellView_Class CppClassType; + typedef GtkCellView BaseObjectType; + typedef GtkCellViewClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CellView(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CellView_Class; + static CppClassType cellview_class_; + + // noncopyable + CellView(const CellView&); + CellView& operator=(const CellView&); + +protected: + explicit CellView(const Glib::ConstructParams& construct_params); + explicit CellView(GtkCellView* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCellView* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCellView* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + CellView(); + + /** Creates a new CellView widget, adds a CellRendererText to it, and makes it show the text. + * Optionally, the text can be marked up with the Pango text markup language. + * + * @param text The text to display in the cell view + * @param markup Whether the @a text uses Pango text markup language. + */ + explicit CellView(const Glib::ustring& text, bool use_markup = false); + + + /** Creates a new CellView widget, adds a CellRendererPixbuf to it, and makes it show the pixbuf. + * + * @param pixbuf The image to display in the cell view + * @param markup Whether the @a text uses Pango text markup language. + */ + explicit CellView(const Glib::RefPtr& pixbuf); + + + //_WRAP_METHOD(void set_value(CellRenderer& renderer, const Glib::ustring& property, const Glib::ValueBase& value), gtk_cell_view_set_value) + + + /** Sets the model for @a cell_view . If @a cell_view already has a model + * set, it will remove it before setting the new model. If @a model is + * 0, then it will unset the old model. + * + * Since: 2.6 + * @param model A Gtk::TreeModel. + */ + void set_model(const Glib::RefPtr& model); + + /** Sets the row of the model that is currently displayed + * by the Gtk::CellView. If the path is unset, then the + * contents of the cellview "stick" at their last value; + * this is not normally a desired result, but may be + * a needed intermediate state if say, the model for + * the Gtk::CellView becomes temporarily empty. + * + * Since: 2.6 + * @param path A Gtk::TreePath or 0 to unset. + */ + void set_displayed_row(const TreeModel::Path& path); + + TreeModel::Path get_displayed_row() const; + + /** Sets @a requisition to the size needed by @a cell_view to display + * the model row pointed to by @a path . + * @param path A Gtk::TreePath. + * @param requisition Return location for the size. + * @return true + * + * Since: 2.6. + */ + bool get_size_of_row(const TreeModel::Path& path, Requisition& requisition) const; + + + /** Sets the background color of @a view . + * + * Since: 2.6 + * @param color The new background color. + */ + void set_background_color(const Gdk::Color& color); + + + /** Returns the cell renderers which have been added to @a cell_view . + * @return A list of cell renderers. The list, but not the + * renderers has been newly allocated and should be freed with + * Glib::list_free() when no longer needed. + * + * Since: 2.6. + */ + Glib::ListHandle get_cell_renderers(); + + /** Returns the cell renderers which have been added to @a cell_view . + * @return A list of cell renderers. The list, but not the + * renderers has been newly allocated and should be freed with + * Glib::list_free() when no longer needed. + * + * Since: 2.6. + */ + Glib::ListHandle get_cell_renderers() const; + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::CellView + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CellView* wrap(GtkCellView* object, bool take_copy = false); +} +#endif /* _GTKMM_CELLVIEW_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/checkbutton.cc b/libs/gtkmm2/gtk/gtkmm/checkbutton.cc new file mode 100644 index 0000000000..110d0c5edc --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/checkbutton.cc @@ -0,0 +1,186 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +CheckButton::CheckButton(const Glib::ustring& label, bool mnemonic) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::ToggleButton(Glib::ConstructParams(checkbutton_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0)) +{} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CheckButton* wrap(GtkCheckButton* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CheckButton_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CheckButton_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_check_button_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CheckButton_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->draw_indicator = &draw_indicator_vfunc_callback; +} + +void CheckButton_Class::draw_indicator_vfunc_callback(GtkCheckButton* self, GdkRectangle* area) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->draw_indicator_vfunc(area); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->draw_indicator) + (*base->draw_indicator)(self, area); + } +} + + +Glib::ObjectBase* CheckButton_Class::wrap_new(GObject* o) +{ + return manage(new CheckButton((GtkCheckButton*)(o))); + +} + + +/* The implementation: */ + +CheckButton::CheckButton(const Glib::ConstructParams& construct_params) +: + Gtk::ToggleButton(construct_params) +{ + } + +CheckButton::CheckButton(GtkCheckButton* castitem) +: + Gtk::ToggleButton((GtkToggleButton*)(castitem)) +{ + } + +CheckButton::~CheckButton() +{ + destroy_(); +} + +CheckButton::CppClassType CheckButton::checkbutton_class_; // initialize static member + +GType CheckButton::get_type() +{ + return checkbutton_class_.init().get_type(); +} + +GType CheckButton::get_base_type() +{ + return gtk_check_button_get_type(); +} + + +CheckButton::CheckButton() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::ToggleButton(Glib::ConstructParams(checkbutton_class_.init())) +{ + } + + +void Gtk::CheckButton::draw_indicator_vfunc(GdkRectangle* area) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->draw_indicator) + (*base->draw_indicator)(gobj(),area); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/checkbutton.h b/libs/gtkmm2/gtk/gtkmm/checkbutton.h new file mode 100644 index 0000000000..bff262d400 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/checkbutton.h @@ -0,0 +1,151 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CHECKBUTTON_H +#define _GTKMM_CHECKBUTTON_H + +#include + +/* $Id$ */ + +/* checkbutton.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCheckButton GtkCheckButton; +typedef struct _GtkCheckButtonClass GtkCheckButtonClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CheckButton_Class; } // namespace Gtk +namespace Gtk +{ + +/** Create widgets with a discrete toggle button. + * + * A Gtk::CheckButton places a discrete Gtk::ToggleButton next to a widget, + * (usually a Gtk::Label). See Gtk::ToggleButton widgets for more + * information about toggle/check buttons. The important signal, + * signal_toggled() is also inherited from Gtk::ToggleButton. + * + * @ingroup Widgets + */ + +class CheckButton : public ToggleButton +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CheckButton CppObjectType; + typedef CheckButton_Class CppClassType; + typedef GtkCheckButton BaseObjectType; + typedef GtkCheckButtonClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CheckButton(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CheckButton_Class; + static CppClassType checkbutton_class_; + + // noncopyable + CheckButton(const CheckButton&); + CheckButton& operator=(const CheckButton&); + +protected: + explicit CheckButton(const Glib::ConstructParams& construct_params); + explicit CheckButton(GtkCheckButton* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCheckButton* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCheckButton* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + /** Create an empty check button. + * With an empty button, you can Gtk::Button::add() a widget such as a + * Gtk::Pixmap or Gtk::Box. + * + * If you just wish to add a Gtk::Label, you may want to use the + * Gtk::CheckButton(const Glib::ustring &label) constructor directly + * instead. + */ + CheckButton(); + + /** Create a check button with a label. + * You won't be able to add a widget to this button since it already + * contains a Gtk::Label + */ + explicit CheckButton(const Glib::ustring& label, bool mnemonic = false); + + +protected: + /** Emited on button redraw to update indicator. + * Triggered when the button is redrawn (e.g.after being toggled) + * Overload this signal if you want to implement your own check button + * look. Otherwise, you most likely don't care about it. + * The GdkRectangle specifies the area of the widget which will get + * redrawn. + */ + virtual void draw_indicator_vfunc(GdkRectangle* area); + + +}; + + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::CheckButton + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CheckButton* wrap(GtkCheckButton* object, bool take_copy = false); +} +#endif /* _GTKMM_CHECKBUTTON_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/checkmenuitem.cc b/libs/gtkmm2/gtk/gtkmm/checkmenuitem.cc new file mode 100644 index 0000000000..2a1a6b4ac2 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/checkmenuitem.cc @@ -0,0 +1,317 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace Gtk +{ + +CheckMenuItem::CheckMenuItem(const Glib::ustring& label, bool mnemonic) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::MenuItem(Glib::ConstructParams(checkmenuitem_class_.init(), (char*) 0)) +{ + add_accel_label(label, mnemonic); /* Left-aligned label */ +} + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo CheckMenuItem_signal_toggled_info = +{ + "toggled", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::CheckMenuItem* wrap(GtkCheckMenuItem* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& CheckMenuItem_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &CheckMenuItem_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_check_menu_item_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void CheckMenuItem_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->draw_indicator = &draw_indicator_vfunc_callback; + klass->toggled = &toggled_callback; +} + +void CheckMenuItem_Class::draw_indicator_vfunc_callback(GtkCheckMenuItem* self, GdkRectangle* area) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->draw_indicator_vfunc(area); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->draw_indicator) + (*base->draw_indicator)(self, area); + } +} + + +void CheckMenuItem_Class::toggled_callback(GtkCheckMenuItem* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_toggled(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->toggled) + (*base->toggled)(self); + } +} + + +Glib::ObjectBase* CheckMenuItem_Class::wrap_new(GObject* o) +{ + return manage(new CheckMenuItem((GtkCheckMenuItem*)(o))); + +} + + +/* The implementation: */ + +CheckMenuItem::CheckMenuItem(const Glib::ConstructParams& construct_params) +: + Gtk::MenuItem(construct_params) +{ + } + +CheckMenuItem::CheckMenuItem(GtkCheckMenuItem* castitem) +: + Gtk::MenuItem((GtkMenuItem*)(castitem)) +{ + } + +CheckMenuItem::~CheckMenuItem() +{ + destroy_(); +} + +CheckMenuItem::CppClassType CheckMenuItem::checkmenuitem_class_; // initialize static member + +GType CheckMenuItem::get_type() +{ + return checkmenuitem_class_.init().get_type(); +} + +GType CheckMenuItem::get_base_type() +{ + return gtk_check_menu_item_get_type(); +} + + +CheckMenuItem::CheckMenuItem() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::MenuItem(Glib::ConstructParams(checkmenuitem_class_.init())) +{ + } + +void CheckMenuItem::set_active(bool state) +{ + gtk_check_menu_item_set_active(gobj(), static_cast(state)); +} + +bool CheckMenuItem::get_active() const +{ + return gtk_check_menu_item_get_active(const_cast(gobj())); +} + +void CheckMenuItem::toggled() +{ + gtk_check_menu_item_toggled(gobj()); +} + +void CheckMenuItem::set_inconsistent(bool setting) +{ + gtk_check_menu_item_set_inconsistent(gobj(), static_cast(setting)); +} + +bool CheckMenuItem::get_inconsistent() const +{ + return gtk_check_menu_item_get_inconsistent(const_cast(gobj())); +} + +void CheckMenuItem::set_draw_as_radio(bool draw_as_radio) +{ + gtk_check_menu_item_set_draw_as_radio(gobj(), static_cast(draw_as_radio)); +} + +bool CheckMenuItem::get_draw_as_radio() const +{ + return gtk_check_menu_item_get_draw_as_radio(const_cast(gobj())); +} + + +Glib::SignalProxy0< void > CheckMenuItem::signal_toggled() +{ + return Glib::SignalProxy0< void >(this, &CheckMenuItem_signal_toggled_info); +} + + +Glib::PropertyProxy CheckMenuItem::property_active() +{ + return Glib::PropertyProxy(this, "active"); +} + +Glib::PropertyProxy_ReadOnly CheckMenuItem::property_active() const +{ + return Glib::PropertyProxy_ReadOnly(this, "active"); +} + +Glib::PropertyProxy CheckMenuItem::property_inconsistent() +{ + return Glib::PropertyProxy(this, "inconsistent"); +} + +Glib::PropertyProxy_ReadOnly CheckMenuItem::property_inconsistent() const +{ + return Glib::PropertyProxy_ReadOnly(this, "inconsistent"); +} + +Glib::PropertyProxy CheckMenuItem::property_draw_as_radio() +{ + return Glib::PropertyProxy(this, "draw-as-radio"); +} + +Glib::PropertyProxy_ReadOnly CheckMenuItem::property_draw_as_radio() const +{ + return Glib::PropertyProxy_ReadOnly(this, "draw-as-radio"); +} + + +void Gtk::CheckMenuItem::on_toggled() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->toggled) + (*base->toggled)(gobj()); +} + + +void Gtk::CheckMenuItem::draw_indicator_vfunc(GdkRectangle* area) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->draw_indicator) + (*base->draw_indicator)(gobj(),area); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/checkmenuitem.h b/libs/gtkmm2/gtk/gtkmm/checkmenuitem.h new file mode 100644 index 0000000000..faa95d431f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/checkmenuitem.h @@ -0,0 +1,237 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CHECKMENUITEM_H +#define _GTKMM_CHECKMENUITEM_H + +#include + +/* $Id$ */ + +/* checkmenuitem.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCheckMenuItem GtkCheckMenuItem; +typedef struct _GtkCheckMenuItemClass GtkCheckMenuItemClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class CheckMenuItem_Class; } // namespace Gtk +namespace Gtk +{ + +/** A menu item that maintains the state of a boolean value in addition to a Gtk::MenuItem's usual role in activating application code. + * A check box indicating the state of the boolean value is displayed at the left side of the Gtk::MenuItem. + * Activating the Gtk::MenuItem toggles the value. + * @ingroup Widgets + * @ingroup Menus + */ + +class CheckMenuItem : public MenuItem +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef CheckMenuItem CppObjectType; + typedef CheckMenuItem_Class CppClassType; + typedef GtkCheckMenuItem BaseObjectType; + typedef GtkCheckMenuItemClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~CheckMenuItem(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class CheckMenuItem_Class; + static CppClassType checkmenuitem_class_; + + // noncopyable + CheckMenuItem(const CheckMenuItem&); + CheckMenuItem& operator=(const CheckMenuItem&); + +protected: + explicit CheckMenuItem(const Glib::ConstructParams& construct_params); + explicit CheckMenuItem(GtkCheckMenuItem* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCheckMenuItem* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCheckMenuItem* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_toggled(); + + +private: + + +public: + + CheckMenuItem(); + explicit CheckMenuItem(const Glib::ustring& label, bool mnemonic = false); + + + void set_active(bool state = true); + + /** Returns whether the check menu item is active. See + * set_active(). + * @return true if the menu item is checked. + */ + bool get_active() const; + + + void toggled(); + + + /** If the user has selected a range of elements (such as some text or + * spreadsheet cells) that are affected by a boolean setting, and the + * current values in that range are inconsistent, you may want to + * display the check in an "in between" state. This function turns on + * "in between" display. Normally you would turn off the inconsistent + * state again if the user explicitly selects a setting. This has to be + * done manually, set_inconsistent() only affects + * visual appearance, it doesn't affect the semantics of the widget. + * @param setting true to display an "inconsistent" third state check. + */ + void set_inconsistent(bool setting = true); + + /** Retrieves the value set by set_inconsistent(). + * @return true if inconsistent. + */ + bool get_inconsistent() const; + + + /** Sets whether @a check_menu_item is drawn like a Gtk::RadioMenuItem + * + * Since: 2.4 + * @param draw_as_radio Whether @a check_menu_item is drawn like a Gtk::RadioMenuItem. + */ + void set_draw_as_radio(bool draw_as_radio = true); + + /** Returns whether @a check_menu_item looks like a Gtk::RadioMenuItem + * @return Whether @a check_menu_item looks like a Gtk::RadioMenuItem + * + * Since: 2.4. + */ + bool get_draw_as_radio() const; + + /** Triggered when the item changes state + * (Note : changing the item's state with set_active() will also trigger + * this signal) + */ + + + Glib::SignalProxy0< void > signal_toggled(); + + + /** Whether the menu item is checked. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_active() ; + +/** Whether the menu item is checked. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_active() const; + + /** Whether to display an inconsistent state. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_inconsistent() ; + +/** Whether to display an inconsistent state. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_inconsistent() const; + + /** Whether the menu item looks like a radio menu item. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_draw_as_radio() ; + +/** Whether the menu item looks like a radio menu item. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_draw_as_radio() const; + + +protected: + /** Triggered when the item is redrawn (e.g.after being toggled) + * Overload this signal if you want to implement your own check item + * look. Otherwise, you most likely don't care about it. + * The GdkRectangle specifies the area of the widget which will get + * redrawn. + */ + virtual void draw_indicator_vfunc(GdkRectangle* area); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::CheckMenuItem + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::CheckMenuItem* wrap(GtkCheckMenuItem* object, bool take_copy = false); +} +#endif /* _GTKMM_CHECKMENUITEM_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/clipboard.cc b/libs/gtkmm2/gtk/gtkmm/clipboard.cc new file mode 100644 index 0000000000..e543bb8eee --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/clipboard.cc @@ -0,0 +1,584 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include //For ScopedPtr<>. +#include + +namespace +{ + +// SignalProxy_GetClear: +// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function. +class SignalProxy_GetClear +{ +public: + SignalProxy_GetClear(const Gtk::Clipboard::SlotGet& slot_get, + const Gtk::Clipboard::SlotClear& slot_clear); + ~SignalProxy_GetClear(); + + static void gtk_callback_get(GtkClipboard* clipboard, GtkSelectionData* selection_data, + unsigned int info, void* data); + static void gtk_callback_clear(GtkClipboard* clipboard, void* data); + +protected: + Gtk::Clipboard::SlotGet slot_get_; + Gtk::Clipboard::SlotClear slot_clear_; +}; + +SignalProxy_GetClear::SignalProxy_GetClear(const Gtk::Clipboard::SlotGet& slot_get, + const Gtk::Clipboard::SlotClear& slot_clear) +: + slot_get_ (slot_get), + slot_clear_ (slot_clear) +{} + +SignalProxy_GetClear::~SignalProxy_GetClear() +{} + +void SignalProxy_GetClear::gtk_callback_get(GtkClipboard*, GtkSelectionData* selection_data, + unsigned int info, void* data) +{ + SignalProxy_GetClear *const self = static_cast(data); + + try + { + Gtk::SelectionData_WithoutOwnership cppSelectionData(selection_data); + (self->slot_get_)(cppSelectionData, info); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void SignalProxy_GetClear::gtk_callback_clear(GtkClipboard*, void* data) +{ + SignalProxy_GetClear *const self = static_cast(data); + + try + { + (self->slot_clear_)(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete self; // After this callback has been called, none of the 2 callbacks will be called again. + + //This might leak the last SignalProxy_GetClear(), but only the last one, + //because clear() is called when set() is called again. +} + + +// SignalProxy_Received: +// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function. +class SignalProxy_Received +{ +public: + typedef Gtk::Clipboard::SlotReceived SlotType; + + SignalProxy_Received(const SlotType& slot); + ~SignalProxy_Received(); + + static void gtk_callback(GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data); + +protected: + SlotType slot_; +}; + +SignalProxy_Received::SignalProxy_Received(const SlotType& slot) +: + slot_ (slot) +{} + +SignalProxy_Received::~SignalProxy_Received() +{} + +void SignalProxy_Received::gtk_callback(GtkClipboard*, GtkSelectionData* selection_data, void* data) +{ + SignalProxy_Received *const self = static_cast(data); + + try + { + Gtk::SelectionData cppSelectionData(selection_data, true /*take_copy=true*/); + (self->slot_)(cppSelectionData); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete self; +} + + +// SignalProxy_TargetsReceived: +// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function. +class SignalProxy_TargetsReceived +{ +public: + typedef Gtk::Clipboard::SlotTargetsReceived SlotType; + + SignalProxy_TargetsReceived(const SlotType& slot); + ~SignalProxy_TargetsReceived(); + + static void gtk_callback(GtkClipboard* clipboard, GdkAtom* atoms, gint n_atoms, gpointer data); + +protected: + SlotType slot_; +}; + +SignalProxy_TargetsReceived::SignalProxy_TargetsReceived(const SlotType& slot) +: + slot_ (slot) +{} + +SignalProxy_TargetsReceived::~SignalProxy_TargetsReceived() +{} + +//This is not public API: +typedef std::list listStrings; +static listStrings util_convert_atoms_to_strings(GdkAtom* targets, int n_targets) +{ + listStrings listTargets; + + //Add the targets to the C++ container: + for(int i = 0; i < n_targets; i++) + { + //Convert the atom to a string: + Glib::ustring target = gdk_atom_name(targets[i]); + listTargets.push_back(target); + } + + return listTargets; +} + +void SignalProxy_TargetsReceived::gtk_callback(GtkClipboard*, GdkAtom* atoms, gint n_atoms, gpointer data) +{ + SignalProxy_TargetsReceived *const self = static_cast(data); + + try + { + listStrings listTargets = util_convert_atoms_to_strings(atoms, n_atoms); + (self->slot_)(listTargets); + //I guess that GTK+ does a g_free of the GdkAtoms* array itself, so we do not need to. murrayc. + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete self; // the callback is only used once +} + + +// SignalProxy_TextReceived: +// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function. +class SignalProxy_TextReceived +{ +public: + typedef Gtk::Clipboard::SlotTextReceived SlotType; + + SignalProxy_TextReceived(const SlotType& slot); + ~SignalProxy_TextReceived(); + + static void gtk_callback(GtkClipboard* clipboard, const char* text, void* data); + +protected: + SlotType slot_; +}; + +SignalProxy_TextReceived::SignalProxy_TextReceived(const SlotType& slot) +: + slot_ (slot) +{} + +SignalProxy_TextReceived::~SignalProxy_TextReceived() +{} + +void SignalProxy_TextReceived::gtk_callback(GtkClipboard*, const char* text, void* data) +{ + SignalProxy_TextReceived *const self = static_cast(data); + + try + { + (self->slot_)((text) ? Glib::ustring(text) : Glib::ustring()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete self; // the callback is only used once +} + + +// SignalProxy_ImageReceived: +// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function. +class SignalProxy_ImageReceived +{ +public: + typedef Gtk::Clipboard::SlotImageReceived SlotType; + + SignalProxy_ImageReceived(const SlotType& slot); + ~SignalProxy_ImageReceived(); + + static void gtk_callback(GtkClipboard* clipboard, GdkPixbuf* image, void* data); + +protected: + SlotType slot_; +}; + +SignalProxy_ImageReceived::SignalProxy_ImageReceived(const SlotType& slot) +: + slot_ (slot) +{} + +SignalProxy_ImageReceived::~SignalProxy_ImageReceived() +{} + +void SignalProxy_ImageReceived::gtk_callback(GtkClipboard*, GdkPixbuf* image, void* data) +{ + SignalProxy_ImageReceived *const self = static_cast(data); + + try + { + (self->slot_)(Glib::wrap(image, true /* take_ref */)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + delete self; // the callback is only used once +} + +} // anonymous namespace + + +namespace Gtk +{ + +bool Clipboard::set(const ArrayHandle_TargetEntry& targets, + const SlotGet& slot_get, const SlotClear& slot_clear) +{ + // Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + SignalProxy_GetClear *const pSignalProxy = new SignalProxy_GetClear(slot_get, slot_clear); + + return gtk_clipboard_set_with_data( + gobj(), targets.data(), targets.size(), + &SignalProxy_GetClear::gtk_callback_get, + &SignalProxy_GetClear::gtk_callback_clear, + pSignalProxy); +} + +void Clipboard::set_text(const Glib::ustring& text) +{ + gtk_clipboard_set_text(gobj(), text.c_str(), text.bytes()); +} + + +void Clipboard::request_contents(const Glib::ustring& target, const SlotReceived& slot) +{ + // Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + SignalProxy_Received *const pSignalProxy = new SignalProxy_Received(slot); + + gtk_clipboard_request_contents(gobj(), gdk_atom_intern(target.c_str(), FALSE), + &SignalProxy_Received::gtk_callback, pSignalProxy); +} + +void Clipboard::request_text(const SlotTextReceived& slot) +{ + // Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + SignalProxy_TextReceived *const pSignalProxy = new SignalProxy_TextReceived(slot); + + gtk_clipboard_request_text(gobj(), + &SignalProxy_TextReceived::gtk_callback, pSignalProxy); +} + +void Clipboard::request_image(const SlotImageReceived& slot) +{ + // Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + SignalProxy_ImageReceived *const pSignalProxy = new SignalProxy_ImageReceived(slot); + + gtk_clipboard_request_image(gobj(), + &SignalProxy_ImageReceived::gtk_callback, pSignalProxy); +} + +void Clipboard::request_targets(const SlotTargetsReceived& slot) +{ + // Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + SignalProxy_TargetsReceived *const pSignalProxy = new SignalProxy_TargetsReceived(slot); + + gtk_clipboard_request_targets(gobj(), &SignalProxy_TargetsReceived::gtk_callback, pSignalProxy); +} + +SelectionData Clipboard::wait_for_contents(const Glib::ustring& target) const +{ + //gtk_clipboard_wait_for_contents returns a newly-allocated GtkSelectionData, or NULL. + GtkSelectionData* cData = gtk_clipboard_wait_for_contents( const_cast(gobj()), gdk_atom_intern(target.c_str(), FALSE) ); + return SelectionData(cData, false /* take_copy */); +} + +Glib::StringArrayHandle Clipboard::wait_for_targets() const +{ + std::list listTargets; + + //Get a newly-allocated array of atoms: + GdkAtom* targets = 0; + gint n_targets = 0; + gboolean test = gtk_clipboard_wait_for_targets( const_cast(gobj()), &targets, &n_targets ); + if(!test) + n_targets = 0; //otherwise it will be -1. + + //Add the targets to the C++ container: + for(int i = 0; i < n_targets; i++) + { + //Convert the atom to a string: + gchar* const atom_name = gdk_atom_name(targets[i]); + + Glib::ustring target; + if(atom_name) + target = Glib::ScopedPtr(atom_name).get(); //This frees the gchar*. + + listTargets.push_back(target); + } + + return listTargets; +} + +void Clipboard::set_can_store(const ArrayHandle_TargetEntry& targets) +{ + gtk_clipboard_set_can_store( gobj(), targets.data(), targets.size() ); +} + +void Clipboard::set_can_store() +{ + gtk_clipboard_set_can_store( gobj(), 0, 0 /* See C docs */ ); +} + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkClipboard* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Clipboard_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Clipboard_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_clipboard_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Clipboard_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Clipboard_Class::wrap_new(GObject* object) +{ + return new Clipboard((GtkClipboard*)object); +} + + +/* The implementation: */ + +GtkClipboard* Clipboard::gobj_copy() +{ + reference(); + return gobj(); +} + +Clipboard::Clipboard(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Clipboard::Clipboard(GtkClipboard* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Clipboard::~Clipboard() +{} + + +Clipboard::CppClassType Clipboard::clipboard_class_; // initialize static member + +GType Clipboard::get_type() +{ + return clipboard_class_.init().get_type(); +} + +GType Clipboard::get_base_type() +{ + return gtk_clipboard_get_type(); +} + + +Glib::RefPtr Clipboard::get(GdkAtom selection) +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_clipboard_get(selection)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Clipboard::get_for_display(const Glib::RefPtr& display, GdkAtom selection) +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_clipboard_get_for_display(Glib::unwrap(display), selection)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Clipboard::get_display() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_clipboard_get_display(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Clipboard::get_display() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_clipboard_get_display(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Clipboard::get_owner() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_clipboard_get_owner(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Clipboard::get_owner() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_clipboard_get_owner(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Clipboard::clear() +{ + gtk_clipboard_clear(gobj()); +} + +void Clipboard::set_image(const Glib::RefPtr& pixbuf) +{ + gtk_clipboard_set_image(gobj(), Glib::unwrap(pixbuf)); +} + +Glib::ustring Clipboard::wait_for_text() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_clipboard_wait_for_text(const_cast(gobj()))); +} + +Glib::RefPtr Clipboard::wait_for_image() const +{ + return Glib::wrap(gtk_clipboard_wait_for_image(const_cast(gobj()))); +} + +bool Clipboard::wait_is_text_available() const +{ + return gtk_clipboard_wait_is_text_available(const_cast(gobj())); +} + +bool Clipboard::wait_is_image_available() const +{ + return gtk_clipboard_wait_is_image_available(const_cast(gobj())); +} + +bool Clipboard::wait_is_target_available(const Glib::ustring& target) +{ + return gtk_clipboard_wait_is_target_available(gobj(), Gdk::AtomString::to_c_type(target)); +} + +void Clipboard::store() +{ + gtk_clipboard_store(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/clipboard.h b/libs/gtkmm2/gtk/gtkmm/clipboard.h new file mode 100644 index 0000000000..193eae10cc --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/clipboard.h @@ -0,0 +1,489 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CLIPBOARD_H +#define _GTKMM_CLIPBOARD_H + +#include + +/* $Id$ */ + +/* clipboard.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkClipboard GtkClipboard; +typedef struct _GtkClipboardClass GtkClipboardClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Clipboard_Class; } // namespace Gtk +namespace Gtk +{ + +/** The Clipboard object represents a clipboard of data shared between different processes or between + * different widgets in the same process. Each clipboard is identified by a name encoded as a GdkAtom. * + * (Conversion to and from strings can be done with gdk_atom_intern() and gdk_atom_name().) The default + * clipboard corresponds to the "CLIPBOARD" atom; another commonly used clipboard is the "PRIMARY" clipboard, + * which, in X, traditionally contains the currently selected text. + * + * To support having a number of different formats on the clipboard at the same time, the clipboard mechanism + * allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can + * either supply the data directly (via functions like set_text()), or you can supply a callback + * to be called at a later time when the data is needed (via set().) Providing a callback also avoids having to + * make copies of the data when it is not needed. + * + * Requesting the data from the clipboard is essentially asynchronous. If the contents of the clipboard are + * provided within the same process, then a direct function call will be made to retrieve the data, but if they + * are provided by another process, then the data needs to be retrieved from the other process, which may take + * some time. To avoid blocking the user interface, the call to request the selection, request_contents() takes + * a callback that will be called when the contents are received (or when the request fails.) If you don't want + * to deal with providing a separate callback, you can also use wait_for_contents(). This runs the + * GLib main loop recursively waiting for the contents. This can simplify the code flow, but you still have to + * be aware that other callbacks in your program can be called while this recursive mainloop is running. + * + * Along with the functions to get the clipboard contents as an arbitrary data chunk, there are also functions + * to retrieve it as text, request_text() and wait_for_text(). These functions take + * care of determining which formats are advertised by the clipboard provider, asking for the clipboard in the + * best available format and converting the results into the UTF-8 encoding. + */ + +class Clipboard : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Clipboard CppObjectType; + typedef Clipboard_Class CppClassType; + typedef GtkClipboard BaseObjectType; + typedef GtkClipboardClass BaseClassType; + +private: friend class Clipboard_Class; + static CppClassType clipboard_class_; + +private: + // noncopyable + Clipboard(const Clipboard&); + Clipboard& operator=(const Clipboard&); + +protected: + explicit Clipboard(const Glib::ConstructParams& construct_params); + explicit Clipboard(GtkClipboard* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Clipboard(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkClipboard* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkClipboard* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GtkClipboard* gobj_copy(); + +private: + +public: + + + /** Returns the clipboard object for the given selection. + * See gtk_clipboard_get_for_display() for complete details. + * @param selection A Gdk::Atom which identifies the clipboard + * to use. + * @return The appropriate clipboard object. If no + * clipboard already exists, a new one will + * be created. Once a clipboard object has + * been created, it is persistent and, since + * it is owned by GTK+, must not be freed or + * unrefd. + */ + static Glib::RefPtr get(GdkAtom selection = GDK_SELECTION_CLIPBOARD); + + /** Returns the clipboard object for the given selection. + * Cut/copy/paste menu items and keyboard shortcuts should use + * the default clipboard, returned by passing Gdk::SELECTION_CLIPBOARD for @a selection . + * (Gdk::NONE is supported as a synonym for GDK_SELECTION_CLIPBOARD + * for backwards compatibility reasons.) + * The currently-selected object or text should be provided on the clipboard + * identified by Gdk::SELECTION_PRIMARY. Cut/copy/paste menu items + * conceptually copy the contents of the Gdk::SELECTION_PRIMARY clipboard + * to the default clipboard, i.e. they copy the selection to what the + * user sees as the clipboard. + * + * (Passing Gdk::NONE is the same as using gdk_atom_intern + * ("CLIPBOARD", false). See + * http://www.freedesktop.org/standards/clipboards-spec/clipboards.txt + * for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY" + * selections under the X window system. On Win32 the + * Gdk::SELECTION_PRIMARY clipboard is essentially ignored.) + * + * It's possible to have arbitrary named clipboards; if you do invent + * new clipboards, you should prefix the selection name with an + * underscore (because the ICCCM requires that nonstandard atoms are + * underscore-prefixed), and namespace it as well. For example, + * if your application called "Foo" has a special-purpose + * clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD". + * @param display The display for which the clipboard is to be retrieved or created. + * @param selection A Gdk::Atom which identifies the clipboard + * to use. + * @return The appropriate clipboard object. If no + * clipboard already exists, a new one will + * be created. Once a clipboard object has + * been created, it is persistent and, since + * it is owned by GTK+, must not be freed or + * unrefd. + * + * Since: 2.2. + */ + static Glib::RefPtr get_for_display(const Glib::RefPtr& display, GdkAtom selection = GDK_SELECTION_CLIPBOARD); + + + /** Gets the Gdk::Display associated with @a clipboard + * @return The Gdk::Display associated with @a clipboard + * + * Since: 2.2. + */ + Glib::RefPtr get_display(); + + /** Gets the Gdk::Display associated with @a clipboard + * @return The Gdk::Display associated with @a clipboard + * + * Since: 2.2. + */ + Glib::RefPtr get_display() const; + + /// For instance: void on_get(Gtk::SelectionData& selection_data, guint info); + typedef sigc::slot SlotGet; + + /// For instance: void on_clear(); + typedef sigc::slot SlotClear; + + /** Virtually sets the contents of the specified clipboard by providing + * a list of supported formats for the clipboard data and a function + * to call to get the actual data when it is requested. + * + * @param targets Information about the available forms for the clipboard data. + * @param slot_get method to call to get the actual clipboard data. + * @param slot_clear When the clipboard contents are set again, this method will + * be called, and slot_get will not be subsequently called. + * + * @return true if setting the clipboard data succeeded. If setting + * the clipboard data failed then the provided callback methods + * will be ignored. + */ + bool set(const ArrayHandle_TargetEntry& targets, const SlotGet& slot_get, const SlotClear& slot_clear); + + + /** If the clipboard contents callbacks were set with + * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or + * gtk_clipboard_clear() has not subsequently called, returns the owner set + * by gtk_clipboard_set_with_owner(). + * @return The owner of the clipboard, if any; otherwise 0. + */ + Glib::RefPtr get_owner(); + + /** If the clipboard contents callbacks were set with + * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or + * gtk_clipboard_clear() has not subsequently called, returns the owner set + * by gtk_clipboard_set_with_owner(). + * @return The owner of the clipboard, if any; otherwise 0. + */ + Glib::RefPtr get_owner() const; + + /** + * Clears the contents of the clipboard. Generally this should only + * be called between the time you call set() + * and when the slot_clear you supplied is called. Otherwise, the + * clipboard may be owned by someone else. + */ + + /** Clears the contents of the clipboard. Generally this should only + * be called between the time you call gtk_clipboard_set_with_owner() + * or gtk_clipboard_set_with_data(), + * and when the @a clear_func you supplied is called. Otherwise, the + * clipboard may be owned by someone else. + */ + void clear(); + + /** + * Sets the contents of the clipboard to the given UTF-8 string. GTK+ will + * make a copy of the text and take responsibility for responding + * for requests for the text, and for converting the text into + * the requested format. + * + * @param text A UTF-8 string. + * + */ + void set_text(const Glib::ustring& text); + + + /** Sets the contents of the clipboard to the given Gdk::Pixbuf. + * GTK+ will take responsibility for responding for requests + * for the image, and for converting the image into the + * requested format. + * + * Since: 2.6 + * @param pixbuf A Gdk::Pixbuf. + */ + void set_image(const Glib::RefPtr& pixbuf); + + /// For instance: void on_received(const SelectionData& selection_data); + typedef sigc::slot SlotReceived; + + /** Requests the contents of clipboard as the given target. + * When the results of the result are later received the supplied callback + * will be called. + * + * @param target The form into which the clipboard + * owner should convert the selection. + * @param slot A function to call when the results are received + * (or the retrieval fails). If the retrieval fails + * the length field of selection_data will be + * negative. + **/ + void request_contents(const Glib::ustring& target, const SlotReceived& slot); + + + /// For instance: void on_text_received(const Glib::ustring& text); + typedef sigc::slot SlotTextReceived; + + /** Requests the contents of the clipboard as text. When the text is + * later received, it will be converted to UTF-8 if necessary, and + * slot will be called. + * + * The text parameter to slot will contain the resulting text if + * the request succeeded, or will be empty if it failed. This could happen for + * various reasons, in particular if the clipboard was empty or if the + * contents of the clipboard could not be converted into text form. + * + * @param slot: a function to call when the text is received, + * or the retrieval fails. (It will always be called + * one way or the other.) + */ + void request_text(const SlotTextReceived& slot); + + + /// For instance: void on_image_received(const Glib::RefPtr& text); + typedef sigc::slot&> SlotImageReceived; + + /** Requests the contents of the clipboard as image. When the image is + * later received, it will be converted to a Gdk::Pixbuf. + * This function waits for + * the data to be received using the main loop, so events, + * timeouts, etc, may be dispatched during the wait. + * + * The pixbuf parameter to slot will contain the resulting pixbuf if + * the request succeeded, or will be empty if it failed. This could happen for + * various reasons, in particular if the clipboard was empty or if the + * contents of the clipboard could not be converted into image form. + * + * @param slot: a function to call when the text is received, + * or the retrieval fails. (It will always be called + * one way or the other.) + */ + void request_image(const SlotImageReceived& slot); + + + /// For instance: void on_targetsreceived(const Glib::StringArrayHandle& targets); + typedef sigc::slot SlotTargetsReceived; + + /** Requests the contents of the clipboard as list of supported targets. + * When the list is later received, callback will be called. + * + * The targets parameter to slot will contain the resulting targets if + * the request succeeded. + * + * @param slot a function to call when the targets are received, + * or the retrieval fails. (It will always be called + * one way or the other.) Remember that Glib::StringArrayHandle + * is an intermediate type, so you should convert it to a + * standard C++ container. + * + * Since: 2.4 + */ + void request_targets(const SlotTargetsReceived& slot); + + + /** + * Requests the contents of the clipboard using the given target. + * This function waits for the data to be received using the main + * loop, so events, timeouts, etc, may be dispatched during the wait. + * + * @param target The form into which the clipboard owner should convert the selection. + * + * @return A SelectionData object, which will be invalid if retrieving the given target failed. + */ + SelectionData wait_for_contents(const Glib::ustring& target) const; + + + /** Requests the contents of the clipboard as text and converts + * the result to UTF-8 if necessary. This function waits for + * the data to be received using the main loop, so events, + * timeouts, etc, may be dispatched during the wait. + * @return A UTF-8 string, which is empty if retrieving + * the selection data failed. (This could happen + * for various reasons, in particular if the + * clipboard was empty or if the contents of the + * clipboard could not be converted into text form.). + */ + Glib::ustring wait_for_text() const; + + //Maybe the result should be const, but constness is not so clear-cut here. murrayc + + /** Requests the contents of the clipboard as image and converts + * the result to a Gdk::Pixbuf. This function waits for + * the data to be received using the main loop, so events, + * timeouts, etc, may be dispatched during the wait. + * @return A newly-allocated Gdk::Pixbuf object which must + * be disposed with Glib::object_unref(), or 0 if + * retrieving the selection data failed. (This + * could happen for various reasons, in particular + * if the clipboard was empty or if the contents of + * the clipboard could not be converted into an image.) + * + * Since: 2.6. + */ + Glib::RefPtr wait_for_image() const; + + + /** Test to see if there is text available to be pasted + * This is done by requesting the TARGETS atom and checking + * if it contains any of the supported text targets. This function + * waits for the data to be received using the main loop, so events, + * timeouts, etc, may be dispatched during the wait. + * + * This function is a little faster than calling + * gtk_clipboard_wait_for_text() since it doesn't need to retrieve + * the actual text. + * @return true is there is text available, false otherwise. + */ + bool wait_is_text_available() const; + + /** Test to see if there is an image available to be pasted + * This is done by requesting the TARGETS atom and checking + * if it contains any of the supported image targets. This function + * waits for the data to be received using the main loop, so events, + * timeouts, etc, may be dispatched during the wait. + * + * This function is a little faster than calling + * gtk_clipboard_wait_for_image() since it doesn't need to retrieve + * the actual image data. + * @return true is there is an image available, false otherwise. + * + * Since: 2.6. + */ + bool wait_is_image_available() const; + + /** Checks if a clipboard supports pasting data of a given type. This + * function can be used to determine if a "Paste" menu item should be + * insensitive or not. + * + * If you want to see if there's text available on the clipboard, use + * gtk_clipboard_wait_is_text_available() instead. + * @param target A Gdk::Atom indicating which target to look for. + * @return true if the target is available, false otherwise. + * + * Since: 2.6. + */ + bool wait_is_target_available(const Glib::ustring& target); + + /** Returns a list of targets that are present on the clipboard. + * This function waits for the data to be received using the main + * loop, so events, timeouts, etc, may be dispatched during the wait. + * + * @result targets: The targets. + * + * Since: 2.4 + */ + Glib::StringArrayHandle wait_for_targets() const; + + + /** Hints that the clipboard data should be stored somewhere when the application exits or when store() + * is called. + * + * This value is reset when the clipboard owner changes. Where the clipboard data is stored is platform + * dependent, see Gdk::Display::store_clipboard() for more information. + * + * @param targets Array containing information about which forms should be stored. + */ + void set_can_store(const ArrayHandle_TargetEntry& targets); + + /** Hints that all forms of clipboard data should be stored somewhere when the application exits or when store() + * is called. + * + * This value is reset when the clipboard owner changes. Where the clipboard data is stored is platform + * dependent, see Gdk::Display::store_clipboard() for more information. + */ + void set_can_store(); + + + /** Stores the current clipboard data somewhere so that it will stay + * around after the application has quit. + * + * Since: 2.6 + */ + void store(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Clipboard + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkClipboard* object, bool take_copy = false); +} + + +#endif /* _GTKMM_CLIPBOARD_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/colorbutton.cc b/libs/gtkmm2/gtk/gtkmm/colorbutton.cc new file mode 100644 index 0000000000..15b2f5ddd1 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/colorbutton.cc @@ -0,0 +1,287 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +Gdk::Color ColorButton::get_color() const +{ + Gdk::Color color; + gtk_color_button_get_color(const_cast(gobj()), color.gobj()); + return color; +} + + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo ColorButton_signal_color_set_info = +{ + "color-set", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::ColorButton* wrap(GtkColorButton* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ColorButton_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ColorButton_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_color_button_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ColorButton_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->color_set = &color_set_callback; +} + + +void ColorButton_Class::color_set_callback(GtkColorButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_color_set(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->color_set) + (*base->color_set)(self); + } +} + + +Glib::ObjectBase* ColorButton_Class::wrap_new(GObject* o) +{ + return manage(new ColorButton((GtkColorButton*)(o))); + +} + + +/* The implementation: */ + +ColorButton::ColorButton(const Glib::ConstructParams& construct_params) +: + Gtk::Button(construct_params) +{ + } + +ColorButton::ColorButton(GtkColorButton* castitem) +: + Gtk::Button((GtkButton*)(castitem)) +{ + } + +ColorButton::~ColorButton() +{ + destroy_(); +} + +ColorButton::CppClassType ColorButton::colorbutton_class_; // initialize static member + +GType ColorButton::get_type() +{ + return colorbutton_class_.init().get_type(); +} + +GType ColorButton::get_base_type() +{ + return gtk_color_button_get_type(); +} + + +ColorButton::ColorButton() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Button(Glib::ConstructParams(colorbutton_class_.init())) +{ + } + +ColorButton::ColorButton(const Gdk::Color& color) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Button(Glib::ConstructParams(colorbutton_class_.init(), "color", (color).gobj(), (char*) 0)) +{ + } + +void ColorButton::set_color(const Gdk::Color& color) +{ + gtk_color_button_set_color(gobj(), (color).gobj()); +} + +void ColorButton::set_alpha(guint16 alpha) +{ + gtk_color_button_set_alpha(gobj(), alpha); +} + +guint16 ColorButton::get_alpha() const +{ + return gtk_color_button_get_alpha(const_cast(gobj())); +} + +void ColorButton::set_use_alpha(bool use_alpha) +{ + gtk_color_button_set_use_alpha(gobj(), static_cast(use_alpha)); +} + +bool ColorButton::get_use_alpha() const +{ + return gtk_color_button_get_use_alpha(const_cast(gobj())); +} + +void ColorButton::set_title(const Glib::ustring& title) +{ + gtk_color_button_set_title(gobj(), title.c_str()); +} + +Glib::ustring ColorButton::get_title() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_color_button_get_title(const_cast(gobj()))); +} + + +Glib::SignalProxy0< void > ColorButton::signal_color_set() +{ + return Glib::SignalProxy0< void >(this, &ColorButton_signal_color_set_info); +} + + +Glib::PropertyProxy ColorButton::property_use_alpha() +{ + return Glib::PropertyProxy(this, "use-alpha"); +} + +Glib::PropertyProxy_ReadOnly ColorButton::property_use_alpha() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-alpha"); +} + +Glib::PropertyProxy ColorButton::property_title() +{ + return Glib::PropertyProxy(this, "title"); +} + +Glib::PropertyProxy_ReadOnly ColorButton::property_title() const +{ + return Glib::PropertyProxy_ReadOnly(this, "title"); +} + +Glib::PropertyProxy ColorButton::property_color() +{ + return Glib::PropertyProxy(this, "color"); +} + +Glib::PropertyProxy_ReadOnly ColorButton::property_color() const +{ + return Glib::PropertyProxy_ReadOnly(this, "color"); +} + +Glib::PropertyProxy ColorButton::property_alpha() +{ + return Glib::PropertyProxy(this, "alpha"); +} + +Glib::PropertyProxy_ReadOnly ColorButton::property_alpha() const +{ + return Glib::PropertyProxy_ReadOnly(this, "alpha"); +} + + +void Gtk::ColorButton::on_color_set() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->color_set) + (*base->color_set)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/colorbutton.h b/libs/gtkmm2/gtk/gtkmm/colorbutton.h new file mode 100644 index 0000000000..aea0bc1d16 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/colorbutton.h @@ -0,0 +1,277 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_COLORBUTTON_H +#define _GTKMM_COLORBUTTON_H + +#include + +/* $Id$ */ + +/* colorbutton.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkColorButton GtkColorButton; +typedef struct _GtkColorButtonClass GtkColorButtonClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ColorButton_Class; } // namespace Gtk +namespace Gtk +{ + +/** A button to launch a color selection dialog. + * + * The GtkColorButton is a button which displays the currently selected color an allows to + * open a color selection dialog to change the color. It is suitable widget for selecting a + * color in a preference dialog. + * + * @ingroup Widgets + */ + +class ColorButton : public Button +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ColorButton CppObjectType; + typedef ColorButton_Class CppClassType; + typedef GtkColorButton BaseObjectType; + typedef GtkColorButtonClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ColorButton(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ColorButton_Class; + static CppClassType colorbutton_class_; + + // noncopyable + ColorButton(const ColorButton&); + ColorButton& operator=(const ColorButton&); + +protected: + explicit ColorButton(const Glib::ConstructParams& construct_params); + explicit ColorButton(GtkColorButton* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkColorButton* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkColorButton* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_color_set(); + + +private: + +public: + + /** Creates a new color button. + * + * This creates a widget in the form of a small button containing a swatch representing + * the current selected color. When the button is clicked, a color-selection dialog will + * open, allowing the user to select a color. The swatch will be updated to reflect the + * new color when the user finishes. + * + * Since: 2.4 + */ + ColorButton(); + + + /** Creates a new color button with a predefined color. + * + * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::Color and + * initializes the button with this color. Equivalent to calling set_color(@a color) + * after the default constructor. + * + * @param color A Gdk::Color to set the current color with. + * + * Since: 2.4 + */ + explicit ColorButton(const Gdk::Color& color); + + + /** Sets the current color to be @a color . + * + * Since: 2.4 + * @param color A Gdk::Color to set the current color with. + */ + void set_color(const Gdk::Color& color); + + /** Sets the current opacity to be @a alpha . + * + * Since: 2.4 + * @param alpha An integer between 0 and 65535. + */ + void set_alpha(guint16 alpha); + + /** Returns a copy of the the current color. + * + * Changes to the return value will have no effect on the Gtk::ColorButton. + * + * @return A Gdk::Color representing the current internal color of the Gtk::ColorButton. + * + * Since: 2.4 + */ + Gdk::Color get_color() const; + + + /** Returns the current alpha value. + * @return An integer between 0 and 65535. + * + * Since: 2.4. + */ + guint16 get_alpha() const; + + /** Sets whether or not the color button should use the alpha channel. + * + * Since: 2.4 + * @param use_alpha true if color button should use alpha channel, false if not. + */ + void set_use_alpha(bool use_alpha = true); + + /** Does the color selection dialog use the alpha channel? + * @return true if the color sample uses alpha channel, false if not. + * + * Since: 2.4. + */ + bool get_use_alpha() const; + + /** Sets the title for the color selection dialog. + * + * Since: 2.4 + * @param title String containing new window title. + */ + void set_title(const Glib::ustring& title); + + /** Gets the title of the color selection dialog. + * @return An internal string, do not free the return value + * + * Since: 2.4. + */ + Glib::ustring get_title() const; + + /** Whether or not to give the color an alpha value. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_alpha() ; + +/** Whether or not to give the color an alpha value. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_alpha() const; + + /** The title of the color selection dialog. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_title() ; + +/** The title of the color selection dialog. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_title() const; + + /** The selected color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_color() ; + +/** The selected color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_color() const; + + /** The selected opacity value (0 fully transparent, 65535 fully opaque). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_alpha() ; + +/** The selected opacity value (0 fully transparent, 65535 fully opaque). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_alpha() const; + + + Glib::SignalProxy0< void > signal_color_set(); + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::ColorButton + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ColorButton* wrap(GtkColorButton* object, bool take_copy = false); +} +#endif /* _GTKMM_COLORBUTTON_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/colorselection.cc b/libs/gtkmm2/gtk/gtkmm/colorselection.cc new file mode 100644 index 0000000000..54525905bf --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/colorselection.cc @@ -0,0 +1,538 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ + +Gtk::ColorSelection::SlotChangePaletteHook* global_change_palette_hook = 0; + +void global_change_palette_hook_callback(GdkScreen* screen, const GdkColor* colors, int n_colors) +{ + g_return_if_fail(global_change_palette_hook != 0); + + try + { + (*global_change_palette_hook)( + Glib::wrap(screen, true), + Gdk::ArrayHandle_Color(colors, n_colors, Glib::OWNERSHIP_NONE)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +void old_change_palette_hook_callback(const Glib::RefPtr& screen, + const Gdk::ArrayHandle_Color& colors, + GtkColorSelectionChangePaletteWithScreenFunc func) +{ + g_return_if_fail(func != 0); + + (*func)(Glib::unwrap(screen), colors.data(), colors.size()); +} + +} // anonymous namespace + + +namespace Gtk +{ + +Gdk::Color ColorSelection::get_current_color() const +{ + Gdk::Color color; //GdkColor Just a simple struct. + gtk_color_selection_get_current_color(const_cast(gobj()), color.gobj()); + return color; +} + +Gdk::Color ColorSelection::get_previous_color() const +{ + Gdk::Color color; //GdkColor Just a simple struct. + gtk_color_selection_get_previous_color(const_cast(gobj()), color.gobj()); + return color; +} + +// static +Gdk::ArrayHandle_Color ColorSelection::palette_from_string(const Glib::ustring& str) +{ + GdkColor* colors = 0; + int n_colors = 0; + + gtk_color_selection_palette_from_string(str.c_str(), &colors, &n_colors); + + return Gdk::ArrayHandle_Color(colors, n_colors, Glib::OWNERSHIP_SHALLOW); +} + +// static +Glib::ustring ColorSelection::palette_to_string(const Gdk::ArrayHandle_Color& colors) +{ + if(char *const str = gtk_color_selection_palette_to_string(colors.data(), colors.size())) + return Glib::ustring(Glib::ScopedPtr(str).get()); + else + return Glib::ustring(); +} + +// static +ColorSelection::SlotChangePaletteHook +ColorSelection::set_change_palette_hook(const ColorSelection::SlotChangePaletteHook& slot) +{ + GtkColorSelectionChangePaletteWithScreenFunc new_func = 0; + SlotChangePaletteHook* new_slot = 0; + SlotChangePaletteHook old_slot; + + if(slot) + { + new_func = &global_change_palette_hook_callback; + new_slot = new SlotChangePaletteHook(slot); + } + + const GtkColorSelectionChangePaletteWithScreenFunc old_func = + gtk_color_selection_set_change_palette_with_screen_hook(new_func); + + if(old_func) + { + try + { + if(old_func != &global_change_palette_hook_callback) + old_slot = sigc::bind<-1>(sigc::ptr_fun(&old_change_palette_hook_callback), old_func); + else if(global_change_palette_hook) + old_slot = *global_change_palette_hook; + } + catch(...) + { + gtk_color_selection_set_change_palette_with_screen_hook(old_func); + delete new_slot; + throw; + } + } + + delete global_change_palette_hook; + global_change_palette_hook = new_slot; + + return old_slot; +} + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo ColorSelection_signal_color_changed_info = +{ + "color_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::ColorSelection* wrap(GtkColorSelection* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ColorSelection_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ColorSelection_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_color_selection_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ColorSelection_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->color_changed = &color_changed_callback; +} + + +void ColorSelection_Class::color_changed_callback(GtkColorSelection* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_color_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->color_changed) + (*base->color_changed)(self); + } +} + + +Glib::ObjectBase* ColorSelection_Class::wrap_new(GObject* o) +{ + return manage(new ColorSelection((GtkColorSelection*)(o))); + +} + + +/* The implementation: */ + +ColorSelection::ColorSelection(const Glib::ConstructParams& construct_params) +: + Gtk::VBox(construct_params) +{ + } + +ColorSelection::ColorSelection(GtkColorSelection* castitem) +: + Gtk::VBox((GtkVBox*)(castitem)) +{ + } + +ColorSelection::~ColorSelection() +{ + destroy_(); +} + +ColorSelection::CppClassType ColorSelection::colorselection_class_; // initialize static member + +GType ColorSelection::get_type() +{ + return colorselection_class_.init().get_type(); +} + +GType ColorSelection::get_base_type() +{ + return gtk_color_selection_get_type(); +} + + +ColorSelection::ColorSelection() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::VBox(Glib::ConstructParams(colorselection_class_.init())) +{ + } + +bool ColorSelection::get_has_opacity_control() const +{ + return gtk_color_selection_get_has_opacity_control(const_cast(gobj())); +} + +void ColorSelection::set_has_opacity_control(bool has_opacity) +{ + gtk_color_selection_set_has_opacity_control(gobj(), static_cast(has_opacity)); +} + +bool ColorSelection::get_has_palette() const +{ + return gtk_color_selection_get_has_palette(const_cast(gobj())); +} + +void ColorSelection::set_has_palette(bool has_palette) +{ + gtk_color_selection_set_has_palette(gobj(), static_cast(has_palette)); +} + +void ColorSelection::set_current_color(const Gdk::Color& color) +{ + gtk_color_selection_set_current_color(gobj(), (color).gobj()); +} + +void ColorSelection::set_current_alpha(guint16 alpha) +{ + gtk_color_selection_set_current_alpha(gobj(), alpha); +} + +guint16 ColorSelection::get_current_alpha() const +{ + return gtk_color_selection_get_current_alpha(const_cast(gobj())); +} + +void ColorSelection::set_previous_color(const Gdk::Color& color) +{ + gtk_color_selection_set_previous_color(gobj(), (color).gobj()); +} + +void ColorSelection::set_previous_alpha(guint16 alpha) +{ + gtk_color_selection_set_previous_alpha(gobj(), alpha); +} + +guint16 ColorSelection::get_previous_alpha() const +{ + return gtk_color_selection_get_previous_alpha(const_cast(gobj())); +} + +bool ColorSelection::is_adjusting() const +{ + return gtk_color_selection_is_adjusting(const_cast(gobj())); +} + + +Glib::SignalProxy0< void > ColorSelection::signal_color_changed() +{ + return Glib::SignalProxy0< void >(this, &ColorSelection_signal_color_changed_info); +} + + +Glib::PropertyProxy ColorSelection::property_has_palette() +{ + return Glib::PropertyProxy(this, "has-palette"); +} + +Glib::PropertyProxy_ReadOnly ColorSelection::property_has_palette() const +{ + return Glib::PropertyProxy_ReadOnly(this, "has-palette"); +} + +Glib::PropertyProxy ColorSelection::property_has_opacity_control() +{ + return Glib::PropertyProxy(this, "has-opacity-control"); +} + +Glib::PropertyProxy_ReadOnly ColorSelection::property_has_opacity_control() const +{ + return Glib::PropertyProxy_ReadOnly(this, "has-opacity-control"); +} + +Glib::PropertyProxy ColorSelection::property_current_color() +{ + return Glib::PropertyProxy(this, "current-color"); +} + +Glib::PropertyProxy_ReadOnly ColorSelection::property_current_color() const +{ + return Glib::PropertyProxy_ReadOnly(this, "current-color"); +} + +Glib::PropertyProxy ColorSelection::property_current_alpha() +{ + return Glib::PropertyProxy(this, "current-alpha"); +} + +Glib::PropertyProxy_ReadOnly ColorSelection::property_current_alpha() const +{ + return Glib::PropertyProxy_ReadOnly(this, "current-alpha"); +} + + +void Gtk::ColorSelection::on_color_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->color_changed) + (*base->color_changed)(gobj()); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::ColorSelectionDialog* wrap(GtkColorSelectionDialog* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ColorSelectionDialog_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ColorSelectionDialog_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_color_selection_dialog_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ColorSelectionDialog_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* ColorSelectionDialog_Class::wrap_new(GObject* o) +{ + return new ColorSelectionDialog((GtkColorSelectionDialog*)(o)); //top-level windows can not be manage()ed. + +} + + +/* The implementation: */ + +ColorSelectionDialog::ColorSelectionDialog(const Glib::ConstructParams& construct_params) +: + Gtk::Dialog(construct_params) +{ + } + +ColorSelectionDialog::ColorSelectionDialog(GtkColorSelectionDialog* castitem) +: + Gtk::Dialog((GtkDialog*)(castitem)) +{ + } + +ColorSelectionDialog::~ColorSelectionDialog() +{ + destroy_(); +} + +ColorSelectionDialog::CppClassType ColorSelectionDialog::colorselectiondialog_class_; // initialize static member + +GType ColorSelectionDialog::get_type() +{ + return colorselectiondialog_class_.init().get_type(); +} + +GType ColorSelectionDialog::get_base_type() +{ + return gtk_color_selection_dialog_get_type(); +} + +ColorSelectionDialog::ColorSelectionDialog() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(colorselectiondialog_class_.init())) +{ + } + +ColorSelectionDialog::ColorSelectionDialog(const Glib::ustring& title) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(colorselectiondialog_class_.init(), "title", title.c_str(), (char*) 0)) +{ + } + +ColorSelection* ColorSelectionDialog::get_colorsel() +{ + return Glib::wrap((GtkColorSelection*)(gobj()->colorsel)); +} + +const ColorSelection* ColorSelectionDialog::get_colorsel() const +{ + return Glib::wrap((GtkColorSelection*)(gobj()->colorsel)); +} + +Button* ColorSelectionDialog::get_ok_button() +{ + return Glib::wrap((GtkButton*)(gobj()->ok_button)); +} + +const Button* ColorSelectionDialog::get_ok_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->ok_button)); +} + +Button* ColorSelectionDialog::get_cancel_button() +{ + return Glib::wrap((GtkButton*)(gobj()->cancel_button)); +} + +const Button* ColorSelectionDialog::get_cancel_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->cancel_button)); +} + +Button* ColorSelectionDialog::get_help_button() +{ + return Glib::wrap((GtkButton*)(gobj()->help_button)); +} + +const Button* ColorSelectionDialog::get_help_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->help_button)); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/colorselection.h b/libs/gtkmm2/gtk/gtkmm/colorselection.h new file mode 100644 index 0000000000..0d77feb43e --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/colorselection.h @@ -0,0 +1,362 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_COLORSELECTION_H +#define _GTKMM_COLORSELECTION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkColorSelection GtkColorSelection; +typedef struct _GtkColorSelectionClass GtkColorSelectionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ColorSelection_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkColorSelectionDialog GtkColorSelectionDialog; +typedef struct _GtkColorSelectionDialogClass GtkColorSelectionDialogClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ColorSelectionDialog_Class; } // namespace Gtk +namespace Gtk +{ + +/** A widget used to select a color. + * + * This widget is used to select a color. It + * consists of a color wheel and number of sliders and entry boxes for color + * parameters such as hue, saturation, value, red, green, blue, and opacity. + * + * It is found on the standard color selection dialog box + * Gtk::ColorSelectionDialog. + * + * @ingroup Widgets + */ + +class ColorSelection : public VBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ColorSelection CppObjectType; + typedef ColorSelection_Class CppClassType; + typedef GtkColorSelection BaseObjectType; + typedef GtkColorSelectionClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ColorSelection(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ColorSelection_Class; + static CppClassType colorselection_class_; + + // noncopyable + ColorSelection(const ColorSelection&); + ColorSelection& operator=(const ColorSelection&); + +protected: + explicit ColorSelection(const Glib::ConstructParams& construct_params); + explicit ColorSelection(GtkColorSelection* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkColorSelection* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkColorSelection* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_color_changed(); + + +private: + + +public: + ColorSelection(); + + + /** Determines whether the colorsel has an opacity control. + * @return true if the @a colorsel has an opacity control. false if it does't. + */ + bool get_has_opacity_control() const; + + /** Sets the @a colorsel to use or not use opacity. + * @param has_opacity true if @a colorsel can set the opacity, false otherwise. + */ + void set_has_opacity_control(bool has_opacity = true); + + /** Determines whether the color selector has a color palette. + * @return true if the selector has a palette. false if it hasn't. + */ + bool get_has_palette() const; + + /** Shows and hides the palette based upon the value of @a has_palette . + * @param has_palette true if palette is to be visible, false otherwise. + */ + void set_has_palette(bool has_palette = true); + + /** Sets the current color to be @a color . The first time this is called, it will + * also set the original color to be @a color too. + * @param color A Gdk::Color to set the current color with. + */ + void set_current_color(const Gdk::Color& color); + + /** Sets the current opacity to be @a alpha . The first time this is called, it will + * also set the original opacity to be @a alpha too. + * @param alpha An integer between 0 and 65535. + */ + void set_current_alpha(guint16 alpha); + Gdk::Color get_current_color() const; + + /** Returns the current alpha value. + * @return An integer between 0 and 65535. + */ + guint16 get_current_alpha() const; + + /** Sets the 'previous' color to be @a color . This function should be called with + * some hesitations, as it might seem confusing to have that color change. + * Calling set_current_color() will also set this color the first + * time it is called. + * @param color A Gdk::Color to set the previous color with. + */ + void set_previous_color(const Gdk::Color& color); + + /** Sets the 'previous' alpha to be @a alpha . This function should be called with + * some hesitations, as it might seem confusing to have that alpha change. + * @param alpha An integer between 0 and 65535. + */ + void set_previous_alpha(guint16 alpha); + Gdk::Color get_previous_color() const; + + /** Returns the previous alpha value. + * @return An integer between 0 and 65535. + */ + guint16 get_previous_alpha() const; + + + /** Gets the current state of the @a colorsel . + * @return true if the user is currently dragging a color around, and false + * if the selection has stopped. + */ + bool is_adjusting() const; + + static Gdk::ArrayHandle_Color palette_from_string(const Glib::ustring& str); + static Glib::ustring palette_to_string(const Gdk::ArrayHandle_Color& colors); + + typedef sigc::slot&, + const Gdk::ArrayHandle_Color&> SlotChangePaletteHook; + + static SlotChangePaletteHook set_change_palette_hook(const SlotChangePaletteHook& slot); + + + Glib::SignalProxy0< void > signal_color_changed(); + + + /** Whether a palette should be used. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_has_palette() ; + +/** Whether a palette should be used. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_has_palette() const; + + /** Whether the color selector should allow setting opacity. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_has_opacity_control() ; + +/** Whether the color selector should allow setting opacity. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_has_opacity_control() const; + + /** The current color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_current_color() ; + +/** The current color. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_current_color() const; + + /** The current opacity value (0 fully transparent, 65535 fully opaque). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_current_alpha() ; + +/** The current opacity value (0 fully transparent, 65535 fully opaque). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_current_alpha() const; + + +}; + +/** This dialog allows the user to select a color. + * @ingroup Dialogs + */ + +class ColorSelectionDialog : public Dialog +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ColorSelectionDialog CppObjectType; + typedef ColorSelectionDialog_Class CppClassType; + typedef GtkColorSelectionDialog BaseObjectType; + typedef GtkColorSelectionDialogClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ColorSelectionDialog(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ColorSelectionDialog_Class; + static CppClassType colorselectiondialog_class_; + + // noncopyable + ColorSelectionDialog(const ColorSelectionDialog&); + ColorSelectionDialog& operator=(const ColorSelectionDialog&); + +protected: + explicit ColorSelectionDialog(const Glib::ConstructParams& construct_params); + explicit ColorSelectionDialog(GtkColorSelectionDialog* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkColorSelectionDialog* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkColorSelectionDialog* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + ColorSelectionDialog(); + explicit ColorSelectionDialog(const Glib::ustring& title); + + ColorSelection* get_colorsel(); + const ColorSelection* get_colorsel() const; + Button* get_ok_button(); + const Button* get_ok_button() const; + Button* get_cancel_button(); + const Button* get_cancel_button() const; + Button* get_help_button(); + const Button* get_help_button() const; + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::ColorSelection + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ColorSelection* wrap(GtkColorSelection* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::ColorSelectionDialog + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ColorSelectionDialog* wrap(GtkColorSelectionDialog* object, bool take_copy = false); +} +#endif /* _GTKMM_COLORSELECTION_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/combo.cc b/libs/gtkmm2/gtk/gtkmm/combo.cc new file mode 100644 index 0000000000..453c7ec39e --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/combo.cc @@ -0,0 +1,993 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +//These were deprecated between 1.2 and 2.0: +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace Gtk +{ + +namespace ComboDropDown_Helpers +{ + +ComboDropDownList::iterator ComboDropDownList::insert(ComboDropDownList::iterator position, const Element& item) +{ + int pos = -1; + + if(position.node_) + pos = g_list_position(glist(), position.node_); + + // gtk+ inserts the GList node allocated by g_list_append into the list as is! + gtk_list_insert_items((GtkList*)gparent(), g_list_append(0, const_cast(item.Widget::gobj())), pos); + + return --position; +} + +void ComboDropDownList::remove(const_reference child) +{ + GList child_list; + child_list.data = (gpointer)child.gobj(); + child_list.next = child_list.prev = 0; + gtk_list_remove_items(GTK_LIST(gparent_), &child_list); +} + +ComboDropDownList::iterator ComboDropDownList::erase(iterator position) +{ + //Check that it is a valid iterator, to a real item: + if ( !position.node_|| (position == end()) ) + return end(); + + //Get an iterator the the next item, to return: + iterator next = position; + next++; + + //Use GTK+ C function to remove it, by providing the GtkWidget*: + GList child_list; + child_list.data = (gpointer)position->gobj(); + child_list.next = child_list.prev = 0; + gtk_list_remove_items(GTK_LIST(gparent_), &child_list); + + return next; +} + +} // namespace ComboList_Helpers + +ComboDropDown::ComboDropDownList& ComboDropDown::children() +{ + children_proxy_ = ComboDropDownList(gobj()); + return children_proxy_; +} + +const ComboDropDown::ComboDropDownList& ComboDropDown::children() const +{ + children_proxy_ = ComboDropDownList(const_cast(gobj())); + return children_proxy_; +} + +} // namespace Gtk + + +namespace Gtk +{ + +void Combo::remove_item_string(Gtk::Item& item) +{ + gtk_combo_set_item_string(gobj(), item.gobj(), 0); +} + +Glib::ListHandle Combo::get_popdown_strings() const +{ + GList* popdown_strings = 0; + + GList *const list_children = + gtk_container_get_children(reinterpret_cast(gobj()->list)); + + for(const GList* node = list_children; node != 0; node = node->next) + { + GtkLabel *const label = reinterpret_cast( + gtk_bin_get_child(static_cast(node->data))); + + popdown_strings = g_list_prepend( + popdown_strings, const_cast(gtk_label_get_text(label))); + } + + g_list_free(list_children); + popdown_strings = g_list_reverse(popdown_strings); + + return Glib::ListHandle(popdown_strings, Glib::OWNERSHIP_SHALLOW); +} + +} // namespace Gtk + + +namespace +{ + +void ComboDropDownItem_signal_scroll_horizontal_callback(GtkListItem* self, GtkScrollType p0,gfloat p1,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,ScrollType,float > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(((ScrollType)(p0)) +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ComboDropDownItem_signal_scroll_horizontal_info = +{ + "scroll-horizontal", + (GCallback) &ComboDropDownItem_signal_scroll_horizontal_callback, + (GCallback) &ComboDropDownItem_signal_scroll_horizontal_callback +}; + + +void ComboDropDownItem_signal_scroll_vertical_callback(GtkListItem* self, GtkScrollType p0,gfloat p1,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,ScrollType,float > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(((ScrollType)(p0)) +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ComboDropDownItem_signal_scroll_vertical_info = +{ + "scroll-vertical", + (GCallback) &ComboDropDownItem_signal_scroll_vertical_callback, + (GCallback) &ComboDropDownItem_signal_scroll_vertical_callback +}; + + +void ComboDropDown_signal_select_child_callback(GtkList* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(*Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ComboDropDown_signal_select_child_info = +{ + "select_child", + (GCallback) &ComboDropDown_signal_select_child_callback, + (GCallback) &ComboDropDown_signal_select_child_callback +}; + + +const Glib::SignalProxyInfo ComboDropDown_signal_selection_changed_info = +{ + "selection_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void ComboDropDown_signal_unselect_child_callback(GtkList* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(*Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo ComboDropDown_signal_unselect_child_info = +{ + "unselect_child", + (GCallback) &ComboDropDown_signal_unselect_child_callback, + (GCallback) &ComboDropDown_signal_unselect_child_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::ComboDropDownItem* wrap(GtkListItem* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ComboDropDownItem_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ComboDropDownItem_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_list_item_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ComboDropDownItem_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->scroll_horizontal = &scroll_horizontal_callback; + klass->scroll_vertical = &scroll_vertical_callback; +} + + +void ComboDropDownItem_Class::scroll_horizontal_callback(GtkListItem* self, GtkScrollType p0, gfloat p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_scroll_horizontal(((ScrollType)(p0)) +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->scroll_horizontal) + (*base->scroll_horizontal)(self, p0, p1); + } +} + +void ComboDropDownItem_Class::scroll_vertical_callback(GtkListItem* self, GtkScrollType p0, gfloat p1) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_scroll_vertical(((ScrollType)(p0)) +, p1 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->scroll_vertical) + (*base->scroll_vertical)(self, p0, p1); + } +} + + +Glib::ObjectBase* ComboDropDownItem_Class::wrap_new(GObject* o) +{ + return manage(new ComboDropDownItem((GtkListItem*)(o))); + +} + + +/* The implementation: */ + +ComboDropDownItem::ComboDropDownItem(const Glib::ConstructParams& construct_params) +: + Gtk::Item(construct_params) +{ + } + +ComboDropDownItem::ComboDropDownItem(GtkListItem* castitem) +: + Gtk::Item((GtkItem*)(castitem)) +{ + } + +ComboDropDownItem::~ComboDropDownItem() +{ + destroy_(); +} + +ComboDropDownItem::CppClassType ComboDropDownItem::combodropdownitem_class_; // initialize static member + +GType ComboDropDownItem::get_type() +{ + return combodropdownitem_class_.init().get_type(); +} + +GType ComboDropDownItem::get_base_type() +{ + return gtk_list_item_get_type(); +} + + +ComboDropDownItem::ComboDropDownItem() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Item(Glib::ConstructParams(combodropdownitem_class_.init())) +{ + } + + +Glib::SignalProxy2< void,ScrollType,float > ComboDropDownItem::signal_scroll_horizontal() +{ + return Glib::SignalProxy2< void,ScrollType,float >(this, &ComboDropDownItem_signal_scroll_horizontal_info); +} + +Glib::SignalProxy2< void,ScrollType,float > ComboDropDownItem::signal_scroll_vertical() +{ + return Glib::SignalProxy2< void,ScrollType,float >(this, &ComboDropDownItem_signal_scroll_vertical_info); +} + + +void Gtk::ComboDropDownItem::on_scroll_horizontal(ScrollType scroll_type, float position) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->scroll_horizontal) + (*base->scroll_horizontal)(gobj(),((GtkScrollType)(scroll_type)),position); +} + +void Gtk::ComboDropDownItem::on_scroll_vertical(ScrollType scroll_type, float position) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->scroll_vertical) + (*base->scroll_vertical)(gobj(),((GtkScrollType)(scroll_type)),position); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::ComboDropDown* wrap(GtkList* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ComboDropDown_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ComboDropDown_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_list_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ComboDropDown_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->select_child = &select_child_callback; + klass->selection_changed = &selection_changed_callback; + klass->unselect_child = &unselect_child_callback; +} + + +void ComboDropDown_Class::select_child_callback(GtkList* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_select_child(*Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->select_child) + (*base->select_child)(self, p0); + } +} + +void ComboDropDown_Class::selection_changed_callback(GtkList* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_selection_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->selection_changed) + (*base->selection_changed)(self); + } +} + +void ComboDropDown_Class::unselect_child_callback(GtkList* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_unselect_child(*Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->unselect_child) + (*base->unselect_child)(self, p0); + } +} + + +Glib::ObjectBase* ComboDropDown_Class::wrap_new(GObject* o) +{ + return manage(new ComboDropDown((GtkList*)(o))); + +} + + +/* The implementation: */ + +ComboDropDown::ComboDropDown(const Glib::ConstructParams& construct_params) +: + Gtk::Container(construct_params) +{ + } + +ComboDropDown::ComboDropDown(GtkList* castitem) +: + Gtk::Container((GtkContainer*)(castitem)) +{ + } + +ComboDropDown::~ComboDropDown() +{ + destroy_(); +} + +ComboDropDown::CppClassType ComboDropDown::combodropdown_class_; // initialize static member + +GType ComboDropDown::get_type() +{ + return combodropdown_class_.init().get_type(); +} + +GType ComboDropDown::get_base_type() +{ + return gtk_list_get_type(); +} + + +namespace ComboDropDown_Helpers +{ + +ComboDropDownList::iterator ComboDropDownList::find(const_reference w) +{ + iterator i = begin(); + for(i = begin(); i != end() && (i->gobj() != w.gobj()); i++); + return i; +} + +ComboDropDownList::iterator ComboDropDownList::find(Widget& w) +{ + iterator i; + for(i = begin(); i != end() && ((GtkWidget*)i->gobj() != w.gobj()); i++); + return i; +} + +} /* namespace ComboDropDown_Helpers */ + + +namespace ComboDropDown_Helpers +{ + +ComboDropDownList::ComboDropDownList() +{} + +ComboDropDownList::ComboDropDownList(GtkList* gparent) +: type_base((GObject*)gparent) +{} + +ComboDropDownList::ComboDropDownList(const ComboDropDownList& src) +: + type_base(src) +{} + +ComboDropDownList& ComboDropDownList::operator=(const ComboDropDownList& src) +{ + type_base::operator=(src); + return *this; +} + +GList*& ComboDropDownList::glist() const +{ + return ((GtkList*)gparent_)->children; +} + +void ComboDropDownList::erase(iterator start, iterator stop) +{ + type_base::erase(start, stop); +} + +GtkList* ComboDropDownList::gparent() +{ + return (GtkList*)type_base::gparent(); +} + +const GtkList* ComboDropDownList::gparent() const +{ + return (GtkList*)type_base::gparent(); +} + +ComboDropDownList::reference ComboDropDownList::operator[](size_type l) const +{ + return type_base::operator[](l); +} + +} /* namespace ComboDropDown_Helpers */ + +ComboDropDown::ComboDropDown() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Container(Glib::ConstructParams(combodropdown_class_.init())) +{ + } + +void ComboDropDown::scroll_horizontal(ScrollType scroll_type, float position) +{ + gtk_list_scroll_horizontal(gobj(), ((GtkScrollType)(scroll_type)), position); +} + +void ComboDropDown::scroll_vertical(ScrollType scroll_type, float position) +{ + gtk_list_scroll_vertical(gobj(), ((GtkScrollType)(scroll_type)), position); +} + + +Glib::SignalProxy1< void,Widget& > ComboDropDown::signal_select_child() +{ + return Glib::SignalProxy1< void,Widget& >(this, &ComboDropDown_signal_select_child_info); +} + +Glib::SignalProxy0< void > ComboDropDown::signal_selection_changed() +{ + return Glib::SignalProxy0< void >(this, &ComboDropDown_signal_selection_changed_info); +} + +Glib::SignalProxy1< void,Widget& > ComboDropDown::signal_unselect_child() +{ + return Glib::SignalProxy1< void,Widget& >(this, &ComboDropDown_signal_unselect_child_info); +} + + +void Gtk::ComboDropDown::on_select_child(Widget& item) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->select_child) + (*base->select_child)(gobj(),(item).gobj()); +} + +void Gtk::ComboDropDown::on_selection_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->selection_changed) + (*base->selection_changed)(gobj()); +} + +void Gtk::ComboDropDown::on_unselect_child(Widget& item) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->unselect_child) + (*base->unselect_child)(gobj(),(item).gobj()); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::Combo* wrap(GtkCombo* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Combo_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Combo_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_combo_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Combo_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Combo_Class::wrap_new(GObject* o) +{ + return manage(new Combo((GtkCombo*)(o))); + +} + + +/* The implementation: */ + +Combo::Combo(const Glib::ConstructParams& construct_params) +: + Gtk::HBox(construct_params) +{ + } + +Combo::Combo(GtkCombo* castitem) +: + Gtk::HBox((GtkHBox*)(castitem)) +{ + } + +Combo::~Combo() +{ + destroy_(); +} + +Combo::CppClassType Combo::combo_class_; // initialize static member + +GType Combo::get_type() +{ + return combo_class_.init().get_type(); +} + +GType Combo::get_base_type() +{ + return gtk_combo_get_type(); +} + +Combo::Combo() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::HBox(Glib::ConstructParams(combo_class_.init())) +{ + } + +void Combo::set_value_in_list(bool value, bool empty) +{ + gtk_combo_set_value_in_list(gobj(), static_cast(value), static_cast(empty)); +} + +void Combo::set_use_arrows(bool arrows_on) +{ + gtk_combo_set_use_arrows(gobj(), static_cast(arrows_on)); +} + +void Combo::set_use_arrows_always(bool arrows_always) +{ + gtk_combo_set_use_arrows_always(gobj(), static_cast(arrows_always)); +} + +void Combo::set_case_sensitive(bool val) +{ + gtk_combo_set_case_sensitive(gobj(), static_cast(val)); +} + +void Combo::set_item_string(Gtk::Item& item, const Glib::ustring& item_value) +{ + gtk_combo_set_item_string(gobj(), (item).gobj(), item_value.c_str()); +} + +void Combo::set_popdown_strings(const Glib::ListHandle& strings) +{ + gtk_combo_set_popdown_strings(gobj(), strings.data()); +} + +void Combo::disable_activate() +{ + gtk_combo_disable_activate(gobj()); +} + +Entry* Combo::get_entry() +{ + return Glib::wrap((GtkEntry*)(gobj()->entry)); +} + +const Entry* Combo::get_entry() const +{ + return Glib::wrap((GtkEntry*)(gobj()->entry)); +} + +ComboDropDown* Combo::get_list() +{ + return Glib::wrap((GtkList*)(gobj()->list)); +} + +const ComboDropDown* Combo::get_list() const +{ + return Glib::wrap((GtkList*)(gobj()->list)); +} + + +Glib::PropertyProxy Combo::property_enable_arrow_keys() +{ + return Glib::PropertyProxy(this, "enable-arrow-keys"); +} + +Glib::PropertyProxy_ReadOnly Combo::property_enable_arrow_keys() const +{ + return Glib::PropertyProxy_ReadOnly(this, "enable-arrow-keys"); +} + +Glib::PropertyProxy Combo::property_enable_arrows_always() +{ + return Glib::PropertyProxy(this, "enable-arrows-always"); +} + +Glib::PropertyProxy_ReadOnly Combo::property_enable_arrows_always() const +{ + return Glib::PropertyProxy_ReadOnly(this, "enable-arrows-always"); +} + +Glib::PropertyProxy Combo::property_case_sensitive() +{ + return Glib::PropertyProxy(this, "case-sensitive"); +} + +Glib::PropertyProxy_ReadOnly Combo::property_case_sensitive() const +{ + return Glib::PropertyProxy_ReadOnly(this, "case-sensitive"); +} + +Glib::PropertyProxy Combo::property_allow_empty() +{ + return Glib::PropertyProxy(this, "allow-empty"); +} + +Glib::PropertyProxy_ReadOnly Combo::property_allow_empty() const +{ + return Glib::PropertyProxy_ReadOnly(this, "allow-empty"); +} + +Glib::PropertyProxy Combo::property_value_in_list() +{ + return Glib::PropertyProxy(this, "value-in-list"); +} + +Glib::PropertyProxy_ReadOnly Combo::property_value_in_list() const +{ + return Glib::PropertyProxy_ReadOnly(this, "value-in-list"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/combo.h b/libs/gtkmm2/gtk/gtkmm/combo.h new file mode 100644 index 0000000000..d0c973204d --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/combo.h @@ -0,0 +1,545 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_COMBO_H +#define _GTKMM_COMBO_H + +#include + +/* $Id$ */ + +/* combo.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkListItem GtkListItem; +typedef struct _GtkListItemClass GtkListItemClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ComboDropDownItem_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkList GtkList; +typedef struct _GtkListClass GtkListClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ComboDropDown_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCombo GtkCombo; +typedef struct _GtkComboClass GtkComboClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Combo_Class; } // namespace Gtk +namespace Gtk +{ + + +/** An item in a ComboDropDownList. + * + * Items in a ComboDropDownList inherit Item. Two signals are added. + * + * @deprecated Use the ComboBox widget instead. + */ + +class ComboDropDownItem : public Gtk::Item +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ComboDropDownItem CppObjectType; + typedef ComboDropDownItem_Class CppClassType; + typedef GtkListItem BaseObjectType; + typedef GtkListItemClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ComboDropDownItem(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ComboDropDownItem_Class; + static CppClassType combodropdownitem_class_; + + // noncopyable + ComboDropDownItem(const ComboDropDownItem&); + ComboDropDownItem& operator=(const ComboDropDownItem&); + +protected: + explicit ComboDropDownItem(const Glib::ConstructParams& construct_params); + explicit ComboDropDownItem(GtkListItem* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkListItem* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkListItem* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_scroll_horizontal(ScrollType scroll_type, float position); + virtual void on_scroll_vertical(ScrollType scroll_type, float position); + + +private: + + +public: + ComboDropDownItem(); + + + Glib::SignalProxy2< void,ScrollType,float > signal_scroll_horizontal(); + + + Glib::SignalProxy2< void,ScrollType,float > signal_scroll_vertical(); + + +}; + + +namespace ComboDropDown_Helpers +{ + +typedef Gtk::ComboDropDownItem Element; + + +class ComboDropDownList : public Glib::HelperList< ComboDropDownItem, const Element, Glib::List_Cpp_Iterator > +{ +public: + ComboDropDownList(); + explicit ComboDropDownList(GtkList* gparent); + ComboDropDownList(const ComboDropDownList& src); + virtual ~ComboDropDownList() {} + + ComboDropDownList& operator=(const ComboDropDownList& src); + + typedef Glib::HelperList< ComboDropDownItem, const Element, Glib::List_Cpp_Iterator > type_base; + + GtkList* gparent(); + const GtkList* gparent() const; + + virtual GList*& glist() const; // front of list + + virtual void erase(iterator start, iterator stop); + virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE + virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE + + /// This is order n. (use at own risk) + reference operator[](size_type l) const; + +public: + iterator insert(iterator position, element_type& e); //custom-implemented. + + template + inline void insert(iterator position, InputIterator first, InputIterator last) + { + for(;first != last; ++first) + position = insert(position, *first); + } + + inline void push_front(element_type& e) + { insert(begin(), e); } + inline void push_back(element_type& e) + { insert(end(), e); } + + + iterator find(const_reference c); + iterator find(Widget&); + + }; + + +} /* namespace ComboDropDown_Helpers */ + + +class Combo; + +/** The dropdown list of a Combo. + * + * A combo is a compound widget which crosses a text entry area and a pull + * down list. The dropdown list is implemented with the deprecated GtkList + * widget on the gtk+ side. ComboDropDown is a thin wrapper around GtkList + * containing just the functionality necessary for a Combo's list. To add + * and remove items use the STL-style interface that is accessible through + * ComboDropDown::children(). + * + * @deprecated Use the ComboBox widget instead. + */ + +class ComboDropDown : public Gtk::Container +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ComboDropDown CppObjectType; + typedef ComboDropDown_Class CppClassType; + typedef GtkList BaseObjectType; + typedef GtkListClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ComboDropDown(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ComboDropDown_Class; + static CppClassType combodropdown_class_; + + // noncopyable + ComboDropDown(const ComboDropDown&); + ComboDropDown& operator=(const ComboDropDown&); + +protected: + explicit ComboDropDown(const Glib::ConstructParams& construct_params); + explicit ComboDropDown(GtkList* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkList* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkList* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_select_child(Widget& item); + virtual void on_selection_changed(); + virtual void on_unselect_child(Widget& item); + + +private: + + +public: + typedef ComboDropDown_Helpers::ComboDropDownList ComboDropDownList; + +protected: + ComboDropDown(); + friend class Combo; +public: + + + void scroll_horizontal(ScrollType scroll_type, float position); + + void scroll_vertical(ScrollType scroll_type, float position); + + ComboDropDownList& children(); + const ComboDropDownList& children() const; + + + Glib::SignalProxy1< void,Widget& > signal_select_child(); + + + Glib::SignalProxy0< void > signal_selection_changed(); + + + Glib::SignalProxy1< void,Widget& > signal_unselect_child(); + + +protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + mutable ComboDropDownList children_proxy_; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +}; + + +class ScrolledWindow; +class Window; + +/** A text entry field with a dropdown list. + * + * A combo is a compound widget which crosses a text entry area and a pull + * down list. It may allow text entry or it may just allow list + * values depending on the settings. + * + * Access members allow altering of the widget components. + * + * @deprecated Use the ComboBox widget instead. + */ + +class Combo : public HBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Combo CppObjectType; + typedef Combo_Class CppClassType; + typedef GtkCombo BaseObjectType; + typedef GtkComboClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Combo(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Combo_Class; + static CppClassType combo_class_; + + // noncopyable + Combo(const Combo&); + Combo& operator=(const Combo&); + +protected: + explicit Combo(const Glib::ConstructParams& construct_params); + explicit Combo(GtkCombo* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCombo* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCombo* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + Combo(); + + + /** Allow direct text entry + * Whether the text in the entry must be or not be in the list. + * + * @param value Set to true if the value must be in list. + * @param empty Set to true if the text area is allowed to be empty. + */ + + void set_value_in_list(bool value = true, bool empty = false); + + /** Set arrows keys to change value + * Up and down will scroll through the list items. + * Useful when there is a small list of value that the + * list must have. + * + * @param arrows_on true indicates the arrow keys scroll. + */ + + void set_use_arrows(bool arrows_on = true); + + /** Set arrows keys to change if value not in list + * Up and down will scroll through the list items but only + * change the current value if the text does not match a list item.. + * Useful when there is a small list of value that the + * list must have. + * + * @param arrows_always true indicates the value will change. + */ + + void set_use_arrows_always(bool arrows_always = true); + + /** Sets list case sensitive + * Determines if the list items and text comparisons for + * set_use_arrows_always() should be case sensitive. + */ + + void set_case_sensitive(bool val = true); + + /** Set the current entry Glib::ustring + * Call this function on an item if it isn't a label or you + * want it to have a different value to be displayed in the entry + */ + + void set_item_string(Gtk::Item& item, const Glib::ustring& item_value); + void remove_item_string(Gtk::Item& item); + + /// Insert a list of items. + + void set_popdown_strings(const Glib::ListHandle& strings); + + Glib::ListHandle get_popdown_strings() const; + + + void disable_activate(); + + Entry* get_entry(); + const Entry* get_entry() const; + ComboDropDown* get_list(); + const ComboDropDown* get_list() const; + + /** Whether the arrow keys move through the list of items. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_enable_arrow_keys() ; + +/** Whether the arrow keys move through the list of items. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_enable_arrow_keys() const; + + /** Obsolete property + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_enable_arrows_always() ; + +/** Obsolete property + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_enable_arrows_always() const; + + /** Whether list item matching is case sensitive. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_case_sensitive() ; + +/** Whether list item matching is case sensitive. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_case_sensitive() const; + + /** Whether an empty value may be entered in this field. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_allow_empty() ; + +/** Whether an empty value may be entered in this field. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_allow_empty() const; + + /** Whether entered values must already be present in the list. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_value_in_list() ; + +/** Whether entered values must already be present in the list. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_value_in_list() const; + + +}; + + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::ComboDropDownItem + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ComboDropDownItem* wrap(GtkListItem* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::ComboDropDown + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ComboDropDown* wrap(GtkList* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::Combo + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Combo* wrap(GtkCombo* object, bool take_copy = false); +} +#endif /* _GTKMM_COMBO_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/combobox.cc b/libs/gtkmm2/gtk/gtkmm/combobox.cc new file mode 100644 index 0000000000..d16c27d274 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/combobox.cc @@ -0,0 +1,452 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include //For SignalProxy_RowSeparator. +#include +#include + +namespace Gtk +{ + +void ComboBox::unset_active() +{ + gtk_combo_box_set_active(gobj(), -1 /* see GTK+ docs */); +} + +TreeModel::iterator ComboBox::get_active() +{ + Gtk::TreeModel::iterator iter; + + Glib::RefPtr model = get_model(); + if(model) + { + gtk_combo_box_get_active_iter(gobj(), iter.gobj()); + + //It must be given the model, because the C++ wrapper has extra information. + iter.set_model_gobject(model->gobj()); + } + + return iter; +} + +TreeModel::const_iterator ComboBox::get_active() const +{ + Gtk::TreeModel::iterator iter; + + Glib::RefPtr model = get_model(); + if(model) + { + gtk_combo_box_get_active_iter(const_cast(gobj()), iter.gobj()); + + //It must be given the model, because the C++ wrapper has extra information. + iter.set_model_gobject(const_cast(model->gobj())); + } + + return iter; +} + + +void ComboBox::set_row_separator_func(const SlotRowSeparator& slot) +{ + //Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + //It will be deleted when SignalProxy_RowSeparator::gtk_callback_destroy() is called. + TreeView_Private::SignalProxy_RowSeparator *const pSignalProxy = new TreeView_Private::SignalProxy_RowSeparator(slot); + + gtk_combo_box_set_row_separator_func(gobj(), + &TreeView_Private::SignalProxy_RowSeparator::gtk_callback, pSignalProxy, + &TreeView_Private::SignalProxy_RowSeparator::gtk_callback_destroy); +} + +void ComboBox::unset_row_separator_func() +{ + gtk_combo_box_set_row_separator_func(gobj(), 0, 0, 0 /* See C docs. */); +} + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo ComboBox_signal_changed_info = +{ + "changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::ComboBox* wrap(GtkComboBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ComboBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ComboBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_combo_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + CellLayout::add_interface(get_type()); + } + + return *this; +} + +void ComboBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->changed = &changed_callback; +} + + +void ComboBox_Class::changed_callback(GtkComboBox* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->changed) + (*base->changed)(self); + } +} + + +Glib::ObjectBase* ComboBox_Class::wrap_new(GObject* o) +{ + return manage(new ComboBox((GtkComboBox*)(o))); + +} + + +/* The implementation: */ + +ComboBox::ComboBox(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +ComboBox::ComboBox(GtkComboBox* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +ComboBox::~ComboBox() +{ + destroy_(); +} + +ComboBox::CppClassType ComboBox::combobox_class_; // initialize static member + +GType ComboBox::get_type() +{ + return combobox_class_.init().get_type(); +} + +GType ComboBox::get_base_type() +{ + return gtk_combo_box_get_type(); +} + + +ComboBox::ComboBox() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(combobox_class_.init())) +{ + } + +ComboBox::ComboBox(const Glib::RefPtr& model) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(combobox_class_.init(), "model", Glib::unwrap(model), (char*) 0)) +{ + } + +void ComboBox::set_wrap_width(int width) +{ + gtk_combo_box_set_wrap_width(gobj(), width); +} + +int ComboBox::get_wrap_width() const +{ + return gtk_combo_box_get_wrap_width(const_cast(gobj())); +} + +void ComboBox::set_row_span_column(int row_span) +{ + gtk_combo_box_set_row_span_column(gobj(), row_span); +} + +int ComboBox::get_row_span_column() const +{ + return gtk_combo_box_get_row_span_column(const_cast(gobj())); +} + +void ComboBox::set_column_span_column(int column_span) +{ + gtk_combo_box_set_column_span_column(gobj(), column_span); +} + +int ComboBox::get_column_span_column() const +{ + return gtk_combo_box_get_column_span_column(const_cast(gobj())); +} + +bool ComboBox::get_add_tearoffs() const +{ + return gtk_combo_box_get_add_tearoffs(const_cast(gobj())); +} + +void ComboBox::set_add_tearoffs(bool add_tearoffs) +{ + gtk_combo_box_set_add_tearoffs(gobj(), static_cast(add_tearoffs)); +} + +bool ComboBox::get_focus_on_click() const +{ + return gtk_combo_box_get_focus_on_click(const_cast(gobj())); +} + +void ComboBox::set_focus_on_click(bool focus_on_click) +{ + gtk_combo_box_set_focus_on_click(gobj(), static_cast(focus_on_click)); +} + +int ComboBox::get_active_row_number() const +{ + return gtk_combo_box_get_active(const_cast(gobj())); +} + +void ComboBox::set_active(int index) +{ + gtk_combo_box_set_active(gobj(), index); +} + +void ComboBox::set_active(const TreeModel::iterator& iter) +{ + gtk_combo_box_set_active_iter(gobj(), const_cast((iter).gobj())); +} + +Glib::RefPtr ComboBox::get_model() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_combo_box_get_model(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr ComboBox::get_model() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_combo_box_get_model(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void ComboBox::set_model(const Glib::RefPtr& model) +{ + gtk_combo_box_set_model(gobj(), Glib::unwrap(model)); +} + +void ComboBox::popup() +{ + gtk_combo_box_popup(gobj()); +} + +void ComboBox::popdown() +{ + gtk_combo_box_popdown(gobj()); +} + +Glib::RefPtr ComboBox::get_popup_accessible() +{ + return Glib::wrap(gtk_combo_box_get_popup_accessible(gobj())); +} + +Glib::RefPtr ComboBox::get_popup_accessible() const +{ + return Glib::wrap(gtk_combo_box_get_popup_accessible(const_cast(gobj()))); +} + + +Glib::SignalProxy0< void > ComboBox::signal_changed() +{ + return Glib::SignalProxy0< void >(this, &ComboBox_signal_changed_info); +} + + +Glib::PropertyProxy< Glib::RefPtr > ComboBox::property_model() +{ + return Glib::PropertyProxy< Glib::RefPtr >(this, "model"); +} + +Glib::PropertyProxy_ReadOnly< Glib::RefPtr > ComboBox::property_model() const +{ + return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "model"); +} + +Glib::PropertyProxy ComboBox::property_wrap_width() +{ + return Glib::PropertyProxy(this, "wrap-width"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_wrap_width() const +{ + return Glib::PropertyProxy_ReadOnly(this, "wrap-width"); +} + +Glib::PropertyProxy ComboBox::property_row_span_column() +{ + return Glib::PropertyProxy(this, "row-span-column"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_row_span_column() const +{ + return Glib::PropertyProxy_ReadOnly(this, "row-span-column"); +} + +Glib::PropertyProxy ComboBox::property_column_span_column() +{ + return Glib::PropertyProxy(this, "column-span-column"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_column_span_column() const +{ + return Glib::PropertyProxy_ReadOnly(this, "column-span-column"); +} + +Glib::PropertyProxy ComboBox::property_active() +{ + return Glib::PropertyProxy(this, "active"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_active() const +{ + return Glib::PropertyProxy_ReadOnly(this, "active"); +} + +Glib::PropertyProxy ComboBox::property_add_tearoffs() +{ + return Glib::PropertyProxy(this, "add-tearoffs"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_add_tearoffs() const +{ + return Glib::PropertyProxy_ReadOnly(this, "add-tearoffs"); +} + +Glib::PropertyProxy ComboBox::property_has_frame() +{ + return Glib::PropertyProxy(this, "has-frame"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_has_frame() const +{ + return Glib::PropertyProxy_ReadOnly(this, "has-frame"); +} + +Glib::PropertyProxy ComboBox::property_focus_on_click() +{ + return Glib::PropertyProxy(this, "focus-on-click"); +} + +Glib::PropertyProxy_ReadOnly ComboBox::property_focus_on_click() const +{ + return Glib::PropertyProxy_ReadOnly(this, "focus-on-click"); +} + + +void Gtk::ComboBox::on_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->changed) + (*base->changed)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/combobox.h b/libs/gtkmm2/gtk/gtkmm/combobox.h new file mode 100644 index 0000000000..c143e59bc2 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/combobox.h @@ -0,0 +1,492 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_COMBOBOX_H +#define _GTKMM_COMBOBOX_H + +#include + +/* $Id$ */ + +/* combobox.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkComboBox GtkComboBox; +typedef struct _GtkComboBoxClass GtkComboBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ComboBox_Class; } // namespace Gtk +namespace Gtk +{ + +/** A widget used to choose from a list of items. + * + * A ComboBox is a widget that allows the user to choose from a list of valid choices. The ComboBox displays the + * selected choice. When activated, the ComboBox displays a popup which allows the user to make a new choice. The + * style in which the selected value is displayed, and the style of the popup is determined by the current theme. + * It may be similar to a OptionMenu, or similar to a Windows-style combo box. + * + * The ComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, + * and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in + * a tree view. This is possible since ComboBox implements the CellLayout interface. The tree model holding the + * valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree + * structure. + * + * See also ComboBoxText, which is specialised for a single text column. + * + * @ingroup Widgets + */ + +class ComboBox +: public Bin, + public CellLayout +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ComboBox CppObjectType; + typedef ComboBox_Class CppClassType; + typedef GtkComboBox BaseObjectType; + typedef GtkComboBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ComboBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ComboBox_Class; + static CppClassType combobox_class_; + + // noncopyable + ComboBox(const ComboBox&); + ComboBox& operator=(const ComboBox&); + +protected: + explicit ComboBox(const Glib::ConstructParams& construct_params); + explicit ComboBox(GtkComboBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkComboBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkComboBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_changed(); + + +private: + + +public: + ComboBox(); + + /** Creates a new ComboBox with the model initialized to @a model. + */ + explicit ComboBox(const Glib::RefPtr& model); + //See ComboBoxText for an equivalent of gtk_combo_box_new_text(). + + + /** Sets the wrap width of @a combo_box to be @a width . The wrap width is basically + * the preferred number of columns when you want the popup to be layed out + * in a table. + * + * Since: 2.4 + * @param width Preferred number of columns. + */ + void set_wrap_width(int width); + + /** Returns the wrap width which is used to determine the number + * of columns for the popup menu. If the wrap width is larger than + * 1, the combo box is in table mode. + * @return The wrap width. + * + * Since: 2.6. + */ + int get_wrap_width() const; + + + /** Sets the column with row span information for @a combo_box to be @a row_span . + * The row span column contains integers which indicate how many rows + * an item should span. + * + * Since: 2.4 + * @param row_span A column in the model passed during construction. + */ + void set_row_span_column(int row_span); + + /** Returns the column with row span information for @a combo_box . + * @return The row span column. + * + * Since: 2.6. + */ + int get_row_span_column() const; + + + /** Sets the column with column span information for @a combo_box to be + * @a column_span . The column span column contains integers which indicate + * how many columns an item should span. + * + * Since: 2.4 + * @param column_span A column in the model passed during construction. + */ + void set_column_span_column(int column_span); + + /** Returns the column with column span information for @a combo_box . + * @return The column span column. + * + * Since: 2.6. + */ + int get_column_span_column() const; + + + /** Gets the current value of the :add-tearoffs property. + * @return The current value of the :add-tearoffs property. + */ + bool get_add_tearoffs() const; + + /** Sets whether the popup menu should have a tearoff + * menu item. + * + * Since: 2.6 + * @param add_tearoffs true to add tearoff menu items. + */ + void set_add_tearoffs(bool add_tearoffs = true); + + + /** Returns whether the combo box grabs focus when it is clicked + * with the mouse. See set_focus_on_click(). + * @return true if the combo box grabs focus when it is + * clicked with the mouse. + * + * Since: 2.6. + */ + bool get_focus_on_click() const; + + /** Sets whether the combo box will grab focus when it is clicked with + * the mouse. Making mouse clicks not grab focus is useful in places + * like toolbars where you don't want the keyboard focus removed from + * the main area of the application. + * + * Since: 2.6 + * @param focus_on_click Whether the combo box grabs focus when clicked + * with the mouse. + */ + void set_focus_on_click(bool focus_on_click = true); + +/* get/set active item */ + + /** Returns the index of the currently active item, or -1 if there's no + * active item. If the model is a non-flat treemodel, and the active item + * is not an immediate child of the root of the tree, this function returns + * gtk_tree_path_get_indices (path)[0], where + * path is the Gtk::TreePath of the active item. + * @return An integer which is the index of the currently active item, or + * -1 if there's no active item. + * + * Since: 2.4. + */ + int get_active_row_number() const; + + /** Gets an iterator that points to the current active item, if it exists. + * @result The iterator. + */ + TreeModel::iterator get_active(); + + /** Gets an iterator that points to the current active item, if it exists. + * @result The iterator. + */ + TreeModel::const_iterator get_active() const; + + + /** Sets the active item of @a combo_box to be the item at @a index . + * + * Since: 2.4 + * @param index An index in the model passed during construction, or -1 to have + * no active item. + */ + void set_active(int index); + + /** Sets the current active item to be the one referenced by @a iter . + * @a iter must correspond to a path of depth one. + * + * Since: 2.4 + * @param iter The Gtk::TreeIter. + */ + void set_active(const TreeModel::iterator& iter); + + /** Causes no item to be active. See also set_active(). + */ + void unset_active(); + + + /** Returns the Gtk::TreeModel which is acting as data source for @a combo_box . + * @return A Gtk::TreeModel which was passed during construction. + * + * Since: 2.4. + */ + Glib::RefPtr get_model(); + + /** Returns the Gtk::TreeModel which is acting as data source for @a combo_box . + * @return A Gtk::TreeModel which was passed during construction. + * + * Since: 2.4. + */ + Glib::RefPtr get_model() const; + + /** Sets the model used by @a combo_box to be @a model . Will unset a previously set + * model (if applicable). If model is 0, then it will unset the model. + * + * Note that this function does not clear the cell renderers, you have to + * call gtk_combo_box_cell_layout_clear() yourself if you need to set up + * different cell renderers for the new model. + * + * Since: 2.4 + * @param model A Gtk::TreeModel. + */ + void set_model(const Glib::RefPtr& model); + + typedef TreeView::SlotRowSeparator SlotRowSeparator; + + /** Sets the row separator function, which is used to determine whether a row should be drawn as a separator. + * See also unset_row_separator_func(). + * + * @param slot The callback. + */ + void set_row_separator_func(const SlotRowSeparator& slot); + + /** Causes no separators to be drawn. + */ + void unset_row_separator_func(); + + + /** Pops up the menu or dropdown list of @a combo_box . + * + * This function is mostly intended for use by accessibility technologies; + * applications should have little use for it. + * + * Since: 2.4 + */ + void popup(); + + /** Hides the menu or dropdown list of @a combo_box . + * + * This function is mostly intended for use by accessibility technologies; + * applications should have little use for it. + * + * Since: 2.4 + */ + void popdown(); + + + /** Gets the accessible object corresponding to the combo box's popup. + * + * This function is mostly intended for use by accessibility technologies; + * applications should have little use for it. + * @return The accessible object corresponding to the combo box's popup. + * + * Since: 2.6. + */ + Glib::RefPtr get_popup_accessible(); + + /** Gets the accessible object corresponding to the combo box's popup. + * + * This function is mostly intended for use by accessibility technologies; + * applications should have little use for it. + * @return The accessible object corresponding to the combo box's popup. + * + * Since: 2.6. + */ + Glib::RefPtr get_popup_accessible() const; + + //These are in ComboBoxText. + + /** The model for the combo box. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy< Glib::RefPtr > property_model() ; + +/** The model for the combo box. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_model() const; + + /** Wrap width for layouting the items in a grid. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_wrap_width() ; + +/** Wrap width for layouting the items in a grid. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_wrap_width() const; + + /** TreeModel column containing the row span values. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_row_span_column() ; + +/** TreeModel column containing the row span values. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_row_span_column() const; + + /** TreeModel column containing the column span values. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_column_span_column() ; + +/** TreeModel column containing the column span values. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_column_span_column() const; + + /** The item which is currently active. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_active() ; + +/** The item which is currently active. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_active() const; + + /** Whether dropdowns should have a tearoff menu item. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_add_tearoffs() ; + +/** Whether dropdowns should have a tearoff menu item. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_add_tearoffs() const; + + /** Whether the combo box draws a frame around the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_has_frame() ; + +/** Whether the combo box draws a frame around the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_has_frame() const; + + /** Whether the combo box grabs focus when it is clicked with the mouse. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_focus_on_click() ; + +/** Whether the combo box grabs focus when it is clicked with the mouse. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_focus_on_click() const; + + + Glib::SignalProxy0< void > signal_changed(); + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::ComboBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ComboBox* wrap(GtkComboBox* object, bool take_copy = false); +} +#endif /* _GTKMM_COMBOBOX_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/comboboxentry.cc b/libs/gtkmm2/gtk/gtkmm/comboboxentry.cc new file mode 100644 index 0000000000..90a0bf6b39 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/comboboxentry.cc @@ -0,0 +1,176 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + + +Entry* ComboBoxEntry::get_entry() +{ + return Glib::wrap((GtkEntry*)(gtk_bin_get_child((GtkBin*)gobj()))); +} + +const Entry* ComboBoxEntry::get_entry() const +{ + GtkBin* base = (GtkBin*)const_cast(gobj()); + return Glib::wrap((GtkEntry*)(gtk_bin_get_child(base))); +} + + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::ComboBoxEntry* wrap(GtkComboBoxEntry* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& ComboBoxEntry_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &ComboBoxEntry_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_combo_box_entry_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void ComboBoxEntry_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* ComboBoxEntry_Class::wrap_new(GObject* o) +{ + return manage(new ComboBoxEntry((GtkComboBoxEntry*)(o))); + +} + + +/* The implementation: */ + +ComboBoxEntry::ComboBoxEntry(const Glib::ConstructParams& construct_params) +: + Gtk::ComboBox(construct_params) +{ + } + +ComboBoxEntry::ComboBoxEntry(GtkComboBoxEntry* castitem) +: + Gtk::ComboBox((GtkComboBox*)(castitem)) +{ + } + +ComboBoxEntry::~ComboBoxEntry() +{ + destroy_(); +} + +ComboBoxEntry::CppClassType ComboBoxEntry::comboboxentry_class_; // initialize static member + +GType ComboBoxEntry::get_type() +{ + return comboboxentry_class_.init().get_type(); +} + +GType ComboBoxEntry::get_base_type() +{ + return gtk_combo_box_entry_get_type(); +} + + +ComboBoxEntry::ComboBoxEntry() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::ComboBox(Glib::ConstructParams(comboboxentry_class_.init())) +{ + } + +ComboBoxEntry::ComboBoxEntry(const Glib::RefPtr& model, const TreeModelColumnBase& text_column) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::ComboBox(Glib::ConstructParams(comboboxentry_class_.init(), "model", Glib::unwrap(model), "text_column", (text_column).index(), (char*) 0)) +{ + } + +ComboBoxEntry::ComboBoxEntry(const Glib::RefPtr& model, int text_column) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::ComboBox(Glib::ConstructParams(comboboxentry_class_.init(), "model", Glib::unwrap(model), "text_column", text_column, (char*) 0)) +{ + } + +void ComboBoxEntry::set_text_column(const TreeModelColumnBase& text_column) const +{ + gtk_combo_box_entry_set_text_column(const_cast(gobj()), (text_column).index()); +} + +void ComboBoxEntry::set_text_column(int text_column) const +{ + gtk_combo_box_entry_set_text_column(const_cast(gobj()), text_column); +} + +int ComboBoxEntry::get_text_column() const +{ + return gtk_combo_box_entry_get_text_column(const_cast(gobj())); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/comboboxentry.h b/libs/gtkmm2/gtk/gtkmm/comboboxentry.h new file mode 100644 index 0000000000..dce4c67019 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/comboboxentry.h @@ -0,0 +1,183 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_COMBOBOXENTRY_H +#define _GTKMM_COMBOBOXENTRY_H + +#include + +/* $Id$ */ + +/* combobox.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkComboBoxEntry GtkComboBoxEntry; +typedef struct _GtkComboBoxEntryClass GtkComboBoxEntryClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class ComboBoxEntry_Class; } // namespace Gtk +namespace Gtk +{ + +/** A text entry field with a dropdown list + * A ComboBoxEntry is a widget that allows the user to choose from a list of valid choices or enter a different + * value. It is very similar to a ComboBox, but it displays the selected value in an entry to allow modifying it. + * + * In contrast to a ComboBox, the underlying model of a ComboBoxEntry must always have a text column (see + * set_text_column()), and the entry will show the content of the text column in the selected row. + * + * See also ComboBoxEntryText, , which is specialised for a single text column. + * + * To add and remove strings from the list, just modify the model using its data manipulation API. You can get the * Entry by using get_child(). + * + * @ingroup Widgets + */ + +class ComboBoxEntry : public ComboBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef ComboBoxEntry CppObjectType; + typedef ComboBoxEntry_Class CppClassType; + typedef GtkComboBoxEntry BaseObjectType; + typedef GtkComboBoxEntryClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~ComboBoxEntry(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class ComboBoxEntry_Class; + static CppClassType comboboxentry_class_; + + // noncopyable + ComboBoxEntry(const ComboBoxEntry&); + ComboBoxEntry& operator=(const ComboBoxEntry&); + +protected: + explicit ComboBoxEntry(const Glib::ConstructParams& construct_params); + explicit ComboBoxEntry(GtkComboBoxEntry* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkComboBoxEntry* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkComboBoxEntry* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + ComboBoxEntry(); + //See ComboBoxEntryText for an equivalent of gtk_combo_box_entry_new_text(). + + /** Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup. You can get the + * Entry from a ComboBoxEntry using get_entry(). To add and remove strings from the list, just modify @a model + * using its data manipulation API. + * + * @param model A TreeModel. + * @param text_column A column in @a model to get the strings from. + */ + explicit ComboBoxEntry(const Glib::RefPtr& model, const TreeModelColumnBase& text_column); + + /** Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup. You can get the + * Entry from a ComboBoxEntry using get_entry(). To add and remove strings from the list, just modify @a model + * using its data manipulation API. + * + * @param model A TreeModel. + * @param text_column A column in @a model to get the strings from. + */ + explicit ComboBoxEntry(const Glib::RefPtr& model, int text_column = 0); + + + /** Sets the model column which @a entry_box should use to get strings from + * to be @a text_column . + * + * Since: 2.4. + * @param text_column A column in @a model to get the strings from. + */ + void set_text_column(const TreeModelColumnBase& text_column) const; + + /** Sets the model column which @a entry_box should use to get strings from + * to be @a text_column . + * + * Since: 2.4. + * @param text_column A column in @a model to get the strings from. + */ + void set_text_column(int text_column) const; + + /** Returns the column which @a entry_box is using to get the strings from. + * @return A column in the data source model of @a entry_box . + * + * Since: 2.4. + */ + int get_text_column() const; + + //The child is always an entry: + + /** See Bin::get_entry(). + */ + Entry* get_entry(); + + /** See Bin::get_entry(). + */ + const Entry* get_entry() const; + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::ComboBoxEntry + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::ComboBoxEntry* wrap(GtkComboBoxEntry* object, bool take_copy = false); +} +#endif /* _GTKMM_COMBOBOXENTRY_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/comboboxentrytext.cc b/libs/gtkmm2/gtk/gtkmm/comboboxentrytext.cc new file mode 100644 index 0000000000..d74c01ae72 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/comboboxentrytext.cc @@ -0,0 +1,134 @@ +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#include +#include +#include +#include + +namespace Gtk +{ + +ComboBoxEntryText::ComboBoxEntryText() +{ + set_model( Gtk::ListStore::create(m_text_columns) ); + set_text_column(m_text_columns.m_column); +} + +ComboBoxEntryText::ComboBoxEntryText(GtkComboBoxEntry* castitem) +: Gtk::ComboBoxEntry(castitem) +{ + set_model( Gtk::ListStore::create(m_text_columns) ); + set_text_column(m_text_columns.m_column); +} + +void ComboBoxEntryText::append_text(const Glib::ustring& text) +{ + //We can not use gtk_combo_box_append_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + + //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI. + Glib::RefPtr model = get_model(); + Glib::RefPtr list_model = Glib::RefPtr::cast_dynamic(model); + + if(list_model) + { + Gtk::TreeModel::iterator iter = list_model->append(); + Gtk::TreeModel::Row row = *iter; + row[m_text_columns.m_column] = text; + } +} + +void ComboBoxEntryText::insert_text(int position, const Glib::ustring& text) +{ + //TODO: We should not use gtk_combo_box_insert_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + gtk_combo_box_insert_text(GTK_COMBO_BOX(gobj()), position, text.c_str()); +} + +void ComboBoxEntryText::prepend_text(const Glib::ustring& text) +{ + //We can not use gtk_combo_box_prepend_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + + //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI. + Glib::RefPtr model = get_model(); + Glib::RefPtr list_model = Glib::RefPtr::cast_dynamic(model); + + if(list_model) + { + Gtk::TreeModel::iterator iter = list_model->prepend(); + Gtk::TreeModel::Row row = *iter; + row[m_text_columns.m_column] = text; + } +} + +void ComboBoxEntryText::clear() +{ + //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI. + Glib::RefPtr model = get_model(); + Glib::RefPtr list_model = Glib::RefPtr::cast_dynamic(model); + + if(list_model) + list_model->clear(); +} + +Glib::ustring ComboBoxEntryText::get_active_text() const +{ + Glib::ustring result; + + //Get the active row: + TreeModel::iterator active_row = get_active(); + if(active_row) + { + Gtk::TreeModel::Row row = *active_row; + result = row[m_text_columns.m_column]; + } + + return result; +} + +void ComboBoxEntryText::set_active_text(const Glib::ustring& text) +{ + //Look for the row with this text, and activate it: + Glib::RefPtr model = get_model(); + if(model) + { + for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); ++iter) + { + const Glib::ustring& this_text = (*iter)[m_text_columns.m_column]; + + if(this_text == text) + { + set_active(iter); + return; //success + } + } + } + + //Not found, so mark it as blank: + unset_active(); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/comboboxentrytext.h b/libs/gtkmm2/gtk/gtkmm/comboboxentrytext.h new file mode 100644 index 0000000000..fe9e6bbdf8 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/comboboxentrytext.h @@ -0,0 +1,89 @@ +// -*- c++ -*- +#ifndef _GTKMM_COMBOBOXENTRYTEXT_H +#define _GTKMM_COMBOBOXENTRYTEXT_H + +/* comboboxentrytext.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +//This is a C++ convenience class that is equivalent to the gtk_combo_box_entry_new_text() C convenience function. +//This is copy/paste/search/replaced from ComboBoxText, but the only alternative I see is to use multiple inheritance. +//murrayc. + +/** This is a specialisation of the ComboBoxEntry which has one column of text (a simple list), + * and appropriate methods for setting and getting the text. + * + * @ingroup Widgets + */ + +class ComboBoxEntryText +: public ComboBoxEntry +{ +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + // noncopyable + ComboBoxEntryText(const ComboBoxEntryText&); + ComboBoxEntryText& operator=(const ComboBoxEntryText&); + +protected: + explicit ComboBoxEntryText(const Glib::ConstructParams& construct_params); + explicit ComboBoxEntryText(GtkComboBoxEntry* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + ComboBoxEntryText(); + + void append_text(const Glib::ustring& text); + + void insert_text(int position, const Glib::ustring& text); + + void prepend_text(const Glib::ustring& text); + + Glib::ustring get_active_text() const; + void set_active_text(const Glib::ustring& text); + + void clear(); + +protected: + + //Tree model columns: + //These columns are used by the model that is created by the default constructor + class TextModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + TextModelColumns() + { add(m_column); } + + Gtk::TreeModelColumn m_column; + }; + + TextModelColumns m_text_columns; +}; + + +} // namespace Gtk + + +#endif /* _GTKMM_COMBOBOXENTRYTEXT_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/comboboxtext.cc b/libs/gtkmm2/gtk/gtkmm/comboboxtext.cc new file mode 100644 index 0000000000..a9c8d20d5f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/comboboxtext.cc @@ -0,0 +1,138 @@ +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#include +#include +#include +#include + +namespace Gtk +{ + +ComboBoxText::ComboBoxText() +{ + set_model( Gtk::ListStore::create(m_text_columns) ); + pack_start(m_text_columns.m_column); +} + +ComboBoxText::ComboBoxText(GtkComboBox* castitem) +: Gtk::ComboBox(castitem) +{ + set_model( Gtk::ListStore::create(m_text_columns) ); + pack_start(m_text_columns.m_column); +} + + +void ComboBoxText::append_text(const Glib::ustring& text) +{ + //We can not use gtk_combo_box_append_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + + //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI. + Glib::RefPtr model = get_model(); + Glib::RefPtr list_model = Glib::RefPtr::cast_dynamic(model); + + if(list_model) + { + Gtk::TreeModel::iterator iter = list_model->append(); + Gtk::TreeModel::Row row = *iter; + row[m_text_columns.m_column] = text; + } +} + +void ComboBoxText::insert_text(int position, const Glib::ustring& text) +{ + //TODO: We should not use gtk_combo_box_insert_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + gtk_combo_box_insert_text(gobj(), position, text.c_str()); +} + +void ComboBoxText::prepend_text(const Glib::ustring& text) +{ + //We can not use gtk_combo_box_prepend_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + + //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI. + Glib::RefPtr model = get_model(); + Glib::RefPtr list_model = Glib::RefPtr::cast_dynamic(model); + + if(list_model) + { + Gtk::TreeModel::iterator iter = list_model->prepend(); + Gtk::TreeModel::Row row = *iter; + row[m_text_columns.m_column] = text; + } +} + +Glib::ustring ComboBoxText::get_active_text() const +{ + //We can not use gtk_combobox_get_active_text() here, because that can only be used if gtk_combo_box_new_text() has been used. + + Glib::ustring result; + + //Get the active row: + TreeModel::iterator active_row = get_active(); + if(active_row) + { + Gtk::TreeModel::Row row = *active_row; + result = row[m_text_columns.m_column]; + } + + return result; +} + +void ComboBoxText::clear() +{ + //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI. + Glib::RefPtr model = get_model(); + Glib::RefPtr list_model = Glib::RefPtr::cast_dynamic(model); + + if(list_model) + list_model->clear(); +} + +void ComboBoxText::set_active_text(const Glib::ustring& text) +{ + //Look for the row with this text, and activate it: + Glib::RefPtr model = get_model(); + if(model) + { + for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); ++iter) + { + const Glib::ustring& this_text = (*iter)[m_text_columns.m_column]; + + if(this_text == text) + { + set_active(iter); + return; //success + } + } + } + + //Not found, so mark it as blank: + unset_active(); +} + + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/comboboxtext.h b/libs/gtkmm2/gtk/gtkmm/comboboxtext.h new file mode 100644 index 0000000000..22b87f5f00 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/comboboxtext.h @@ -0,0 +1,92 @@ +// -*- c++ -*- +#ifndef _GTKMM_COMBOBOXTEXT_H +#define _GTKMM_COMBOBOXTEXT_H + +/* comboboxtext.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +//This is a C++ convenience class that is equivalent to the gtk_combo_box_new_text() C convenience function. + +/** This is a specialisation of the ComboBox which has one column of text (a simple list), + * and appropriate methods for setting and getting the text. + * + * Note that you can not use this class with Gnome::Glade::Xml::get_widget_derived() to wrap a GtkComboBox added + * in the Glade user interface designer, because Glade adds its own TreeModel instead of using the TreeModel from + * this class. You could use a normal Gtk::ComboBox instead, though you can not use Glade to add rows to a TreeModel + * that is defined in your C++ code. + * + * @ingroup Widgets + */ + +class ComboBoxText +: public ComboBox +{ +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + // noncopyable + ComboBoxText(const ComboBoxText&); + ComboBoxText& operator=(const ComboBoxText&); + +protected: + explicit ComboBoxText(const Glib::ConstructParams& construct_params); + explicit ComboBoxText(GtkComboBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + ComboBoxText(); + + void append_text(const Glib::ustring& text); + + void insert_text(int position, const Glib::ustring& text); + + void prepend_text(const Glib::ustring& text); + + Glib::ustring get_active_text() const; + void set_active_text(const Glib::ustring& text); + + void clear(); + +protected: + + //Tree model columns: + //These columns are used by the model that is created by the default constructor + class TextModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + TextModelColumns() + { add(m_column); } + + Gtk::TreeModelColumn m_column; + }; + + TextModelColumns m_text_columns; +}; + + +} // namespace Gtk + + +#endif /* _GTKMM_COMBOBOXTEXT_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/container.cc b/libs/gtkmm2/gtk/gtkmm/container.cc new file mode 100644 index 0000000000..c3db4bd7ef --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/container.cc @@ -0,0 +1,945 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +namespace +{ + + +void container_foreach_callback(GtkWidget* widget_gobj, void* data) +{ + try + { + Gtk::Container::ForeachSlot& slot = *static_cast(data); + Gtk::Widget *const widget = Glib::wrap(widget_gobj); + + g_return_if_fail(widget != 0); + + slot(*widget); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } +} + +} // anonymous namespace + + +namespace Gtk +{ + +void Container_Class::remove_callback_custom(GtkContainer* self, GtkWidget* p0) +{ + //GTKMM_LIFECYCLE + +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("Container_Class::remove_callback_custom() C self=%p: C child=%p\n", (void*)self, (void*)p0); + g_warning("gtypename self: %s\n, gtypename child: %s", G_OBJECT_TYPE_NAME(G_OBJECT(self)), G_OBJECT_TYPE_NAME(G_OBJECT(p0))); +#endif + + //Don't call wrap() on a GTK+ instance whose gtkmm instance has been deleted - just call the original C callback. + bool gtkmm_child_already_deleted = Glib::_gobject_cppinstance_already_deleted((GObject*)p0); + + if(!gtkmm_child_already_deleted) + { + //Call the regular, generated callback: + Container_Class::remove_callback(self, p0); + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + //Call the original underlying C function: + if(base && base->remove) + (*base->remove)(self, p0); + } +} + +void Container::foreach(const Container::ForeachSlot& slot) +{ + ForeachSlot slot_copy (slot); + gtk_container_foreach(gobj(), &container_foreach_callback, &slot_copy); +} + +void Container::add(Widget& widget) +{ + gtk_container_add(gobj(), widget.gobj()); +} + +bool Container::has_focus_chain() const +{ + return gtk_container_get_focus_chain(const_cast(gobj()), 0); +} + +Glib::ListHandle Container::get_focus_chain() +{ + GList* list = 0; + gtk_container_get_focus_chain(gobj(), &list); + + return Glib::ListHandle(list, Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle Container::get_focus_chain() const +{ + GList* list = 0; + gtk_container_get_focus_chain(const_cast(gobj()), &list); + + return Glib::ListHandle(list, Glib::OWNERSHIP_SHALLOW); +} + + +void Container::show_all_children(bool recursive) +{ + // Plain C version if this turns out to be performance-critical: + //GtkCallback callback = (GtkCallback) ((recursive) ? >k_widget_show_all : >k_widget_show); + //gtk_container_foreach(gobj(), callback, 0); + + // This could also be done with get_children() and an explicit loop, + // if any problems should arise. In gtkmm-1.2, foreach() is known to + // cause segfaults eventually, but it seems to work now. + + foreach(sigc::mem_fun((recursive) ? &Widget::show_all : &Widget::show)); +} + +void Container::remove(Widget& widget) +{ + //If this is a managed widget, + //then do an extra ref so that it will + //not be destroyed when adding to another container + //This should leave it in much the same state as when it was instantiated, + //before being added to the first container. + if(widget.is_managed_()) + widget.reference(); + + gtk_container_remove(gobj(), widget.gobj()); +} + +// static +void Container_Class::destroy_callback(GtkObject* self) +{ +#ifdef GLIBMM_DEBUG_REFCOUNTING + g_warning("Container_Class::destroy_callback() gobject_=%10X\n", self); + if(self) + g_warning("gtypename: %s\n", G_OBJECT_TYPE_NAME(G_OBJECT(self))); +#endif + + //Call the normal C destroy implementation, such as gtk_button_destroy: + //This will chain to gtk_container_destroy(), which will gtk_widget_destroy() any remaining child widgets. + GtkObjectClass *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self))); + + if(base->destroy) + (*base->destroy)(self); +} + +} // namespace Gtk + + +namespace +{ + +void Container_signal_add_callback(GtkContainer* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Container_signal_add_info = +{ + "add", + (GCallback) &Container_signal_add_callback, + (GCallback) &Container_signal_add_callback +}; + + +void Container_signal_remove_callback(GtkContainer* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Container_signal_remove_info = +{ + "remove", + (GCallback) &Container_signal_remove_callback, + (GCallback) &Container_signal_remove_callback +}; + + +const Glib::SignalProxyInfo Container_signal_check_resize_info = +{ + "check_resize", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +void Container_signal_set_focus_child_callback(GtkContainer* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Container_signal_set_focus_child_info = +{ + "set_focus_child", + (GCallback) &Container_signal_set_focus_child_callback, + (GCallback) &Container_signal_set_focus_child_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Container* wrap(GtkContainer* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Container_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Container_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_container_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Container_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->child_type = &child_type_vfunc_callback; + klass->forall = &forall_vfunc_callback; + klass->composite_name = &composite_name_vfunc_callback; + klass->set_child_property = &set_child_property_vfunc_callback; + klass->get_child_property = &get_child_property_vfunc_callback; + klass->add = &add_callback; + klass->remove = &remove_callback; + klass->check_resize = &check_resize_callback; + klass->set_focus_child = &set_focus_child_callback; + reinterpret_cast(klass)->destroy = &destroy_callback; + klass->remove = &remove_callback_custom; + + if(G_OBJECT_CLASS_TYPE(klass) == Gtk::Container::get_type()) + { + //Remove the parent class's (GtkContainer) remove callback - it just prints a warning. + //This prevents that warning when people derive directly from Gtk::Container. + BaseClassType *const base = static_cast( g_type_class_peek_parent(klass) ); + base->remove = 0; + } + + } + +GtkType Container_Class::child_type_vfunc_callback(GtkContainer* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->child_type_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->child_type) + return (*base->child_type)(self); + } + + typedef GtkType RType; + return RType(); +} + +void Container_Class::forall_vfunc_callback(GtkContainer* self, gboolean include_internals, GtkCallback callback, gpointer callback_data) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->forall_vfunc(include_internals, callback, callback_data); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->forall) + (*base->forall)(self, include_internals, callback, callback_data); + } +} + +gchar* Container_Class::composite_name_vfunc_callback(GtkContainer* self, GtkWidget* child) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->composite_name_vfunc(child); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->composite_name) + return (*base->composite_name)(self, child); + } + + typedef gchar* RType; + return RType(); +} + +void Container_Class::set_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_child_property_vfunc(child, property_id, value, pspec); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->set_child_property) + (*base->set_child_property)(self, child, property_id, value, pspec); + } +} + +void Container_Class::get_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->get_child_property_vfunc(child, property_id, value, pspec); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->get_child_property) + (*base->get_child_property)(self, child, property_id, value, pspec); + } +} + + +void Container_Class::add_callback(GtkContainer* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_add(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->add) + (*base->add)(self, p0); + } +} + +void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_remove(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->remove) + (*base->remove)(self, p0); + } +} + +void Container_Class::check_resize_callback(GtkContainer* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_check_resize(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->check_resize) + (*base->check_resize)(self); + } +} + +void Container_Class::set_focus_child_callback(GtkContainer* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_set_focus_child(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->set_focus_child) + (*base->set_focus_child)(self, p0); + } +} + + +Glib::ObjectBase* Container_Class::wrap_new(GObject* o) +{ + return manage(new Container((GtkContainer*)(o))); + +} + + +/* The implementation: */ + +Container::Container(const Glib::ConstructParams& construct_params) +: + Gtk::Widget(construct_params) +{ + } + +Container::Container(GtkContainer* castitem) +: + Gtk::Widget((GtkWidget*)(castitem)) +{ + } + +Container::~Container() +{ + destroy_(); +} + +Container::CppClassType Container::container_class_; // initialize static member + +GType Container::get_type() +{ + return container_class_.init().get_type(); +} + +GType Container::get_base_type() +{ + return gtk_container_get_type(); +} + + +void Container::set_border_width(guint border_width) +{ + gtk_container_set_border_width(gobj(), border_width); +} + +guint Container::get_border_width() const +{ + return gtk_container_get_border_width(const_cast(gobj())); +} + +void Container::set_resize_mode(ResizeMode resize_mode) +{ + gtk_container_set_resize_mode(gobj(), ((GtkResizeMode)(resize_mode))); +} + +ResizeMode Container::get_resize_mode() const +{ + return ((ResizeMode)(gtk_container_get_resize_mode(const_cast(gobj())))); +} + +void Container::check_resize() +{ + gtk_container_check_resize(gobj()); +} + +Glib::ListHandle Container::get_children() +{ + return Glib::ListHandle(gtk_container_get_children(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::ListHandle Container::get_children() const +{ + return Glib::ListHandle(gtk_container_get_children(const_cast(gobj())), Glib::OWNERSHIP_SHALLOW); +} + +void Container::propagate_expose(Widget& child, GdkEventExpose* event) +{ + gtk_container_propagate_expose(gobj(), (child).gobj(), event); +} + +void Container::set_focus_chain(const Glib::ListHandle& focusable_widgets) +{ + gtk_container_set_focus_chain(gobj(), focusable_widgets.data()); +} + +void Container::unset_focus_chain() +{ + gtk_container_unset_focus_chain(gobj()); +} + +void Container::set_reallocate_redraws(bool needs_redraws) +{ + gtk_container_set_reallocate_redraws(gobj(), static_cast(needs_redraws)); +} + +void Container::set_focus_child(Widget& widget) +{ + gtk_container_set_focus_child(gobj(), (widget).gobj()); +} + +void Container::set_focus_vadjustment(Adjustment& adjustment) +{ + gtk_container_set_focus_vadjustment(gobj(), (adjustment).gobj()); +} + +Adjustment* Container::get_focus_vadjustment() +{ + return Glib::wrap(gtk_container_get_focus_vadjustment(gobj())); +} + +const Adjustment* Container::get_focus_vadjustment() const +{ + return Glib::wrap(gtk_container_get_focus_vadjustment(const_cast(gobj()))); +} + +void Container::set_focus_hadjustment(Adjustment& adjustment) +{ + gtk_container_set_focus_hadjustment(gobj(), (adjustment).gobj()); +} + +Adjustment* Container::get_focus_hadjustment() +{ + return Glib::wrap(gtk_container_get_focus_hadjustment(gobj())); +} + +const Adjustment* Container::get_focus_hadjustment() const +{ + return Glib::wrap(gtk_container_get_focus_hadjustment(const_cast(gobj()))); +} + +void Container::resize_children() +{ + gtk_container_resize_children(gobj()); +} + +GType Container::child_type() const +{ + return gtk_container_child_type(const_cast(gobj())); +} + +Container::Container() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(container_class_.init())) +{ + } + + +Glib::SignalProxy1< void,Widget* > Container::signal_add() +{ + return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_add_info); +} + +Glib::SignalProxy1< void,Widget* > Container::signal_remove() +{ + return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_remove_info); +} + +Glib::SignalProxy0< void > Container::signal_check_resize() +{ + return Glib::SignalProxy0< void >(this, &Container_signal_check_resize_info); +} + +Glib::SignalProxy1< void,Widget* > Container::signal_set_focus_child() +{ + return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_set_focus_child_info); +} + + +Glib::PropertyProxy Container::property_border_width() +{ + return Glib::PropertyProxy(this, "border-width"); +} + +Glib::PropertyProxy_ReadOnly Container::property_border_width() const +{ + return Glib::PropertyProxy_ReadOnly(this, "border-width"); +} + +Glib::PropertyProxy Container::property_resize_mode() +{ + return Glib::PropertyProxy(this, "resize-mode"); +} + +Glib::PropertyProxy_ReadOnly Container::property_resize_mode() const +{ + return Glib::PropertyProxy_ReadOnly(this, "resize-mode"); +} + +Glib::PropertyProxy_WriteOnly Container::property_child() +{ + return Glib::PropertyProxy_WriteOnly(this, "child"); +} + +Glib::PropertyProxy_ReadOnly Container::property_child() const +{ + return Glib::PropertyProxy_ReadOnly(this, "child"); +} + + +void Gtk::Container::on_add(Widget* widget) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->add) + (*base->add)(gobj(),(GtkWidget*)Glib::unwrap(widget)); +} + +void Gtk::Container::on_remove(Widget* widget) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->remove) + (*base->remove)(gobj(),(GtkWidget*)Glib::unwrap(widget)); +} + +void Gtk::Container::on_check_resize() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->check_resize) + (*base->check_resize)(gobj()); +} + +void Gtk::Container::on_set_focus_child(Widget* widget) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->set_focus_child) + (*base->set_focus_child)(gobj(),(GtkWidget*)Glib::unwrap(widget)); +} + + +GtkType Gtk::Container::child_type_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->child_type) + return (*base->child_type)(const_cast(gobj())); + + typedef GtkType RType; + return RType(); +} + +void Gtk::Container::forall_vfunc(gboolean include_internals, GtkCallback callback, gpointer callback_data) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->forall) + (*base->forall)(gobj(),include_internals,callback,callback_data); +} + +char* Gtk::Container::composite_name_vfunc(GtkWidget* child) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->composite_name) + return (*base->composite_name)(gobj(),child); + + typedef char* RType; + return RType(); +} + +void Gtk::Container::set_child_property_vfunc(GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->set_child_property) + (*base->set_child_property)(gobj(),child,property_id,value,pspec); +} + +void Gtk::Container::get_child_property_vfunc(GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) const +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->get_child_property) + (*base->get_child_property)(const_cast(gobj()),child,property_id,value,pspec); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/container.h b/libs/gtkmm2/gtk/gtkmm/container.h new file mode 100644 index 0000000000..a555229bbf --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/container.h @@ -0,0 +1,446 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CONTAINER_H +#define _GTKMM_CONTAINER_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +/** @defgroup Containers Container Widgets + * These widgets can be used to group other widgets together. + */ + +/* we'll include gtkfeatures because we dont want to include the whole + gtk/gtk.h - this file is used by almost ALL our widgets, so dependencies + in minimum - adding things here will increase compile times ALOT */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkContainer GtkContainer; +typedef struct _GtkContainerClass GtkContainerClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Container_Class; } // namespace Gtk +namespace Gtk +{ + +class Adjustment; +class Label; + +/** Abstract container class + * + * This is the abstract container from which all gtk+ widgets which hold + * other items derive from. It mainly houses virtual functions + * used for inserting and removing children. Containers in gtk+ + * may hold one item or many items depending on the implementation. + * + * This interface is used for all single item holding containers. + * Multi-item containers provide their own unique interface as their + * items are generally more complex. The methods of the derived + * classes should be prefered over these. + * + * @ingroup Widgets + */ + +class Container : public Widget +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Container CppObjectType; + typedef Container_Class CppClassType; + typedef GtkContainer BaseObjectType; + typedef GtkContainerClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Container(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Container_Class; + static CppClassType container_class_; + + // noncopyable + Container(const Container&); + Container& operator=(const Container&); + +protected: + explicit Container(const Glib::ConstructParams& construct_params); + explicit Container(GtkContainer* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkContainer* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkContainer* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_add(Widget* widget); + virtual void on_remove(Widget* widget); + virtual void on_check_resize(); + virtual void on_set_focus_child(Widget* widget); + + +private: + + +public: + +/* Application-level methods */ + + + /** Sets the border width of the container. + * + * The border width of a container is the amount of space to leave + * around the outside of the container. The only exception to this is + * Gtk::Window; because toplevel windows can't leave space outside, + * they leave the space inside. The border is added on all sides of + * the container. To add space to only one side, one approach is to + * create a Gtk::Alignment widget, call Gtk::Widget::set_usize() to give + * it a size, and place it on the side of the container as a spacer. + * @param border_width Amount of blank space to leave outside the container. + * Valid values are in the range 0-65535 pixels. + */ + void set_border_width(guint border_width); + + + /** Retrieves the border width of the container. See + * set_border_width(). + * @return The current border width. + */ + guint get_border_width() const; + + //This is virtual so that we can override it in Gtk::ScrolledWindow: + virtual void add(Widget& widget); + + + /** Removes @a widget from @a container . @a widget must be inside @a container . + * Note that @a container will own a reference to @a widget , and that this + * may be the last reference held; so removing a widget from its + * container can destroy that widget. If you want to use @a widget + * again, you need to add a reference to it while it's not inside + * a container, using Glib::object_ref(). If you don't want to use @a widget + * again it's usually more efficient to simply destroy it directly + * using Gtk::Widget::destroy() since this will remove it from the + * container and help break any circular reference count cycles. + * @param widget A current child of @a container . + */ + + void remove(Widget& widget); + + + /** Sets the resize mode for the container. + * + * The resize mode of a container determines whether a resize request + * will be passed to the container's parent, queued for later execution + * or executed immediately. + * @param resize_mode The new resize mode. + */ + void set_resize_mode(ResizeMode resize_mode); + + + /** Returns the resize mode for the container. See + * set_resize_mode(). + * @return The current resize mode. + */ + ResizeMode get_resize_mode() const; + + /// Request that contained widgets check their size + + void check_resize(); + + /** For instance, + * void on_foreach(Gtk::Widget* widget); + */ + typedef sigc::slot ForeachSlot; + + /** Operate on contained items + * This is largely an internal used mainly for things like + * creating duplicates of internal lists and other such + * operations. The result is lossy as it only gets the + * the main child and not its external pieces. + * + * For example notebook pages contain a page, a label, and + * a menu item. But this only operates on the pages. + */ + void foreach(const ForeachSlot& slot); + + /// (internal) Operate on contained items (see foreach()) + //_WRAP_METHOD(void foreach_(GtkCallback callback,gpointer data),gtk_container_foreach) + + /// (internal) Operate on contained items (see foreach()) + //_WRAP_METHOD(void foreach_full_(GtkCallback callback,GtkCallbackMarshal marshal, gpointer data,GtkDestroyNotify notify),gtk_container_foreach_full) + + + /** Returns the the container's non-internal children. See + * forall() for details on what constitutes an "internal" child. + * @return A newly-allocated list of the container's non-internal children. + */ + Glib::ListHandle get_children(); + + /** Returns the the container's non-internal children. See + * forall() for details on what constitutes an "internal" child. + * @return A newly-allocated list of the container's non-internal children. + */ + Glib::ListHandle get_children() const; + + + /** When a container receives an expose event, it must send synthetic + * expose events to all children that don't have their own Gdk::Windows. + * This function provides a convenient way of doing this. A container, + * when it receives an expose event, calls propagate_expose() + * once for each child, passing in the event the container received. + * + * propagate_expose() takes care of deciding whether + * an expose event needs to be sent to the child, intersecting + * the event's area with the child area, and sending the event. + * + * In most cases, a container can simply either simply inherit the + * ::expose implementation from Gtk::Container, or, do some drawing + * and then chain to the ::expose implementation from Gtk::Container. + * @param child A child of @a container . + * @param event A expose event sent to container. + */ + void propagate_expose(Widget& child, GdkEventExpose* event); + + + /** Sets a focus chain, overriding the one computed automatically by GTK+. + * + * In principle each widget in the chain should be a descendant of the + * container, but this is not enforced by this method, since it's allowed + * to set the focus chain before you pack the widgets, or have a widget + * in the chain that isn't always packed. The necessary checks are done + * when the focus chain is actually traversed. + * @param focusable_widgets The new focus chain. + */ + void set_focus_chain(const Glib::ListHandle& focusable_widgets); + + // gtk_container_get_focus_chain() has been split up into two + // functions in order to make implicit container conversion possible. + bool has_focus_chain() const; + Glib::ListHandle get_focus_chain(); + Glib::ListHandle get_focus_chain() const; + + + /** Removes a focus chain explicitly set with set_focus_chain(). + */ + void unset_focus_chain(); + + +/* Widget-level methods */ + + + /** Sets the @a reallocate_redraws flag of the container to the given value. + * + * Containers requesting reallocation redraws get automatically + * redrawn if any of their children changed allocation. + * @param needs_redraws The new value for the container's @a reallocate_redraws flag. + */ + void set_reallocate_redraws(bool needs_redraws = true); + + /// Sets the focus on a child + + void set_focus_child(Widget& widget); + + + /** Hooks up an adjustment to focus handling in a container, so when a child of the + * container is focused, the adjustment is scrolled to show that widget. This function + * sets the vertical alignment. See Gtk::ScrolledWindow::get_vadjustment() for a typical + * way of obtaining the adjustment and set_focus_hadjustment() for setting + * the horizontal adjustment. + * + * The adjustments have to be in pixel units and in the same coordinate system as the + * allocation for immediate children of the container. + * @param adjustment An adjustment which should be adjusted when the focus is moved among the + * descendents of @a container . + */ + void set_focus_vadjustment(Adjustment& adjustment); + + + /** Retrieves the vertical focus adjustment for the container. See + * set_focus_vadjustment(). + * @return The vertical focus adjustment, or 0 if + * none has been set. + */ + Adjustment* get_focus_vadjustment(); + + /** Retrieves the vertical focus adjustment for the container. See + * set_focus_vadjustment(). + * @return The vertical focus adjustment, or 0 if + * none has been set. + */ + const Adjustment* get_focus_vadjustment() const; + + + /** Hooks up an adjustment to focus handling in a container, so when a child of the + * container is focused, the adjustment is scrolled to show that widget. This function + * sets the horizontal alignment. See Gtk::ScrolledWindow::get_hadjustment() for a typical + * way of obtaining the adjustment and set_focus_vadjustment() for setting + * the vertical adjustment. + * + * The adjustments have to be in pixel units and in the same coordinate system as the + * allocation for immediate children of the container. + * @param adjustment An adjustment which should be adjusted when the focus is moved among the + * descendents of @a container . + */ + void set_focus_hadjustment(Adjustment& adjustment); + + + /** Retrieves the horizontal focus adjustment for the container. See + * set_focus_hadjustment(). + * @return The horizontal focus adjustment, or 0 if + * none has been set. + */ + Adjustment* get_focus_hadjustment(); + + /** Retrieves the horizontal focus adjustment for the container. See + * set_focus_hadjustment(). + * @return The horizontal focus adjustment, or 0 if + * none has been set. + */ + const Adjustment* get_focus_hadjustment() const; + + + void resize_children(); + + + /** Returns the type of the children supported by the container. + * + * Note that this may return G::TYPE_NONE to indicate that no more + * children can be added, e.g. for a Gtk::Paned which already has two + * children. + * @return A G::Type. + */ + GType child_type() const; + + // Ignore functions such as gtk_container_class_install_child_property(), which I think are for themes, like the GtkWidget style properties. + + + Glib::SignalProxy1< void,Widget* > signal_add(); + + + Glib::SignalProxy1< void,Widget* > signal_remove(); + + + Glib::SignalProxy0< void > signal_check_resize(); + + + Glib::SignalProxy1< void,Widget* > signal_set_focus_child(); + + + void show_all_children(bool recursive = true); + +protected: + Container(); + + virtual GtkType child_type_vfunc() const; + virtual void forall_vfunc(gboolean include_internals, GtkCallback callback, gpointer callback_data); + //TODO: What is this? + virtual char* composite_name_vfunc(GtkWidget* child); + virtual void set_child_property_vfunc(GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec); + virtual void get_child_property_vfunc(GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) const; + + /** The width of the empty border outside the containers children. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_border_width() ; + +/** The width of the empty border outside the containers children. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_border_width() const; + + /** Specify how resize events are handled. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_resize_mode() ; + +/** Specify how resize events are handled. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_resize_mode() const; + + /** Can be used to add a new child to the container. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_WriteOnly property_child() ; + +/** Can be used to add a new child to the container. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_child() const; + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Container + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Container* wrap(GtkContainer* object, bool take_copy = false); +} +#endif /* _GTKMM_CONTAINER_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/curve.cc b/libs/gtkmm2/gtk/gtkmm/curve.cc new file mode 100644 index 0000000000..ed6b949ea3 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/curve.cc @@ -0,0 +1,378 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +Glib::ArrayHandle Curve::get_vector(int veclen) const +{ + float *const pdata = static_cast(g_malloc(veclen * sizeof(float))); + gtk_curve_get_vector(const_cast(gobj()), veclen, pdata); + + return Glib::ArrayHandle(pdata, veclen, Glib::OWNERSHIP_SHALLOW); +} + +void Curve::set_vector(const Glib::ArrayHandle& array) +{ + gtk_curve_set_vector(gobj(), array.size(), const_cast(array.data())); +} + +} /* namespace Gtk */ + + +namespace +{ + +const Glib::SignalProxyInfo Curve_signal_curve_type_changed_info = +{ + "curve_type_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Curve* wrap(GtkCurve* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Curve_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Curve_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_curve_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Curve_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->curve_type_changed = &curve_type_changed_callback; +} + + +void Curve_Class::curve_type_changed_callback(GtkCurve* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_curve_type_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->curve_type_changed) + (*base->curve_type_changed)(self); + } +} + + +Glib::ObjectBase* Curve_Class::wrap_new(GObject* o) +{ + return manage(new Curve((GtkCurve*)(o))); + +} + + +/* The implementation: */ + +Curve::Curve(const Glib::ConstructParams& construct_params) +: + Gtk::DrawingArea(construct_params) +{ + } + +Curve::Curve(GtkCurve* castitem) +: + Gtk::DrawingArea((GtkDrawingArea*)(castitem)) +{ + } + +Curve::~Curve() +{ + destroy_(); +} + +Curve::CppClassType Curve::curve_class_; // initialize static member + +GType Curve::get_type() +{ + return curve_class_.init().get_type(); +} + +GType Curve::get_base_type() +{ + return gtk_curve_get_type(); +} + + +Curve::Curve() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::DrawingArea(Glib::ConstructParams(curve_class_.init())) +{ + } + +void Curve::reset() +{ + gtk_curve_reset(gobj()); +} + +void Curve::set_gamma(float gamma) +{ + gtk_curve_set_gamma(gobj(), gamma); +} + +void Curve::set_range(float min_x, float max_x, float min_y, float max_y) +{ + gtk_curve_set_range(gobj(), min_x, max_x, min_y, max_y); +} + +void Curve::get_vector(int veclen, float* data) const +{ + gtk_curve_get_vector(const_cast(gobj()), veclen, data); +} + +void Curve::set_curve_type(CurveType type) +{ + gtk_curve_set_curve_type(gobj(), ((GtkCurveType)(type))); +} + + +Glib::SignalProxy0< void > Curve::signal_curve_type_changed() +{ + return Glib::SignalProxy0< void >(this, &Curve_signal_curve_type_changed_info); +} + + +Glib::PropertyProxy Curve::property_curve_type() +{ + return Glib::PropertyProxy(this, "curve-type"); +} + +Glib::PropertyProxy_ReadOnly Curve::property_curve_type() const +{ + return Glib::PropertyProxy_ReadOnly(this, "curve-type"); +} + +Glib::PropertyProxy Curve::property_min_x() +{ + return Glib::PropertyProxy(this, "min-x"); +} + +Glib::PropertyProxy_ReadOnly Curve::property_min_x() const +{ + return Glib::PropertyProxy_ReadOnly(this, "min-x"); +} + +Glib::PropertyProxy Curve::property_max_x() +{ + return Glib::PropertyProxy(this, "max-x"); +} + +Glib::PropertyProxy_ReadOnly Curve::property_max_x() const +{ + return Glib::PropertyProxy_ReadOnly(this, "max-x"); +} + +Glib::PropertyProxy Curve::property_min_y() +{ + return Glib::PropertyProxy(this, "min-y"); +} + +Glib::PropertyProxy_ReadOnly Curve::property_min_y() const +{ + return Glib::PropertyProxy_ReadOnly(this, "min-y"); +} + +Glib::PropertyProxy Curve::property_max_y() +{ + return Glib::PropertyProxy(this, "max-y"); +} + +Glib::PropertyProxy_ReadOnly Curve::property_max_y() const +{ + return Glib::PropertyProxy_ReadOnly(this, "max-y"); +} + + +void Gtk::Curve::on_curve_type_changed() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->curve_type_changed) + (*base->curve_type_changed)(gobj()); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::GammaCurve* wrap(GtkGammaCurve* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& GammaCurve_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &GammaCurve_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_gamma_curve_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void GammaCurve_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* GammaCurve_Class::wrap_new(GObject* o) +{ + return manage(new GammaCurve((GtkGammaCurve*)(o))); + +} + + +/* The implementation: */ + +GammaCurve::GammaCurve(const Glib::ConstructParams& construct_params) +: + Gtk::VBox(construct_params) +{ + } + +GammaCurve::GammaCurve(GtkGammaCurve* castitem) +: + Gtk::VBox((GtkVBox*)(castitem)) +{ + } + +GammaCurve::~GammaCurve() +{ + destroy_(); +} + +GammaCurve::CppClassType GammaCurve::gammacurve_class_; // initialize static member + +GType GammaCurve::get_type() +{ + return gammacurve_class_.init().get_type(); +} + +GType GammaCurve::get_base_type() +{ + return gtk_gamma_curve_get_type(); +} + +GammaCurve::GammaCurve() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::VBox(Glib::ConstructParams(gammacurve_class_.init())) +{ + } + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/curve.h b/libs/gtkmm2/gtk/gtkmm/curve.h new file mode 100644 index 0000000000..eaddc1116b --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/curve.h @@ -0,0 +1,303 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_CURVE_H +#define _GTKMM_CURVE_H + +#include + +/* $Id$ */ + +/* curve.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkCurve GtkCurve; +typedef struct _GtkCurveClass GtkCurveClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Curve_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkGammaCurve GtkGammaCurve; +typedef struct _GtkGammaCurveClass GtkGammaCurveClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class GammaCurve_Class; } // namespace Gtk +namespace Gtk +{ + +/** Allows direct editing of a curve. + * + * @ingroup Widgets + */ + +class Curve : public DrawingArea +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Curve CppObjectType; + typedef Curve_Class CppClassType; + typedef GtkCurve BaseObjectType; + typedef GtkCurveClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Curve(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Curve_Class; + static CppClassType curve_class_; + + // noncopyable + Curve(const Curve&); + Curve& operator=(const Curve&); + +protected: + explicit Curve(const Glib::ConstructParams& construct_params); + explicit Curve(GtkCurve* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkCurve* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkCurve* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_curve_type_changed(); + + +private: + + +public: + + Curve(); + + + void reset(); + + void set_gamma(float gamma); + + void set_range(float min_x, float max_x, float min_y, float max_y); + + void get_vector(int veclen, float* data) const; + + Glib::ArrayHandle get_vector(int veclen) const; + void set_vector(const Glib::ArrayHandle& array); + + + void set_curve_type(CurveType type); + + + Glib::SignalProxy0< void > signal_curve_type_changed(); + + + /** Is this curve linear + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_curve_type() ; + +/** Is this curve linear + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_curve_type() const; + + /** Minimum possible value for X. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_min_x() ; + +/** Minimum possible value for X. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_min_x() const; + + /** Maximum possible X value. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_max_x() ; + +/** Maximum possible X value. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_max_x() const; + + /** Minimum possible value for Y. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_min_y() ; + +/** Minimum possible value for Y. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_min_y() const; + + /** Maximum possible value for Y. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_max_y() ; + +/** Maximum possible value for Y. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_max_y() const; + + +}; + +/** A subclass of Gtk::Curve for editing gamma curves. + * + * @ingroup Widgets + */ + +class GammaCurve : public VBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef GammaCurve CppObjectType; + typedef GammaCurve_Class CppClassType; + typedef GtkGammaCurve BaseObjectType; + typedef GtkGammaCurveClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~GammaCurve(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class GammaCurve_Class; + static CppClassType gammacurve_class_; + + // noncopyable + GammaCurve(const GammaCurve&); + GammaCurve& operator=(const GammaCurve&); + +protected: + explicit GammaCurve(const Glib::ConstructParams& construct_params); + explicit GammaCurve(GtkGammaCurve* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkGammaCurve* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkGammaCurve* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + GammaCurve(); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Curve + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Curve* wrap(GtkCurve* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::GammaCurve + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::GammaCurve* wrap(GtkGammaCurve* object, bool take_copy = false); +} +#endif /* _GTKMM_CURVE_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/dialog.cc b/libs/gtkmm2/gtk/gtkmm/dialog.cc new file mode 100644 index 0000000000..b55b84f645 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/dialog.cc @@ -0,0 +1,331 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal, bool use_separator) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(), (char*) 0)) +{ + construct_(modal, use_separator); + set_transient_for(parent); +} + +Dialog::Dialog(const Glib::ustring& title, bool modal, bool use_separator) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(), (char*) 0)) +{ + construct_(modal, use_separator); +} + +void Dialog::construct_(bool modal, bool use_separator) +{ + set_modal(modal); + set_has_separator(use_separator); +} + +void Dialog::set_alternative_button_order_from_array(const Glib::ArrayHandle& new_order) +{ + gtk_dialog_set_alternative_button_order_from_array(gobj(), new_order.size(), const_cast(new_order.data())); +} + +} // namespace Gtk + + +namespace +{ + +void Dialog_signal_response_callback(GtkDialog* self, gint p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Dialog_signal_response_info = +{ + "response", + (GCallback) &Dialog_signal_response_callback, + (GCallback) &Dialog_signal_response_callback +}; + +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gtk_response_type_get_type(); +} + + +namespace Glib +{ + +Gtk::Dialog* wrap(GtkDialog* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Dialog_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Dialog_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_dialog_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Dialog_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->response = &response_callback; +} + + +void Dialog_Class::response_callback(GtkDialog* self, gint p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_response(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->response) + (*base->response)(self, p0); + } +} + + +Glib::ObjectBase* Dialog_Class::wrap_new(GObject* o) +{ + return new Dialog((GtkDialog*)(o)); //top-level windows can not be manage()ed. + +} + + +/* The implementation: */ + +Dialog::Dialog(const Glib::ConstructParams& construct_params) +: + Gtk::Window(construct_params) +{ + } + +Dialog::Dialog(GtkDialog* castitem) +: + Gtk::Window((GtkWindow*)(castitem)) +{ + } + +Dialog::~Dialog() +{ + destroy_(); +} + +Dialog::CppClassType Dialog::dialog_class_; // initialize static member + +GType Dialog::get_type() +{ + return dialog_class_.init().get_type(); +} + +GType Dialog::get_base_type() +{ + return gtk_dialog_get_type(); +} + + +Dialog::Dialog() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Window(Glib::ConstructParams(dialog_class_.init())) +{ + } + +void Dialog::add_action_widget(Widget& child, int response_id) +{ + gtk_dialog_add_action_widget(gobj(), (child).gobj(), response_id); +} + +Button* Dialog::add_button(const Glib::ustring& button_text, int response_id) +{ + return Glib::wrap((GtkButton*)(gtk_dialog_add_button(gobj(), button_text.c_str(), response_id))); +} + +Button* Dialog::add_button(const Gtk::StockID& stock_id, int response_id) +{ + return Glib::wrap((GtkButton*)(gtk_dialog_add_button(gobj(), (stock_id).get_c_str(), response_id))); +} + +void Dialog::set_response_sensitive(int response_id, bool setting) +{ + gtk_dialog_set_response_sensitive(gobj(), response_id, static_cast(setting)); +} + +void Dialog::set_default_response(int response_id) +{ + gtk_dialog_set_default_response(gobj(), response_id); +} + +void Dialog::set_has_separator(bool setting) +{ + gtk_dialog_set_has_separator(gobj(), static_cast(setting)); +} + +bool Dialog::get_has_separator() const +{ + return gtk_dialog_get_has_separator(const_cast(gobj())); +} + +bool Dialog::alternative_button_order(const Glib::RefPtr& screen) +{ + return gtk_alternative_dialog_button_order(const_cast(Glib::unwrap(screen))); +} + +void Dialog::response(int response_id) +{ + gtk_dialog_response(gobj(), response_id); +} + +int Dialog::run() +{ + return gtk_dialog_run(gobj()); +} + +VBox* Dialog::get_vbox() +{ + return Glib::wrap((GtkVBox*)(gobj()->vbox)); +} + +const VBox* Dialog::get_vbox() const +{ + return Glib::wrap((GtkVBox*)(gobj()->vbox)); +} + +HButtonBox* Dialog::get_action_area() +{ + return Glib::wrap((GtkHButtonBox*)(gobj()->action_area)); +} + +const HButtonBox* Dialog::get_action_area() const +{ + return Glib::wrap((GtkHButtonBox*)(gobj()->action_area)); +} + + +Glib::SignalProxy1< void,int > Dialog::signal_response() +{ + return Glib::SignalProxy1< void,int >(this, &Dialog_signal_response_info); +} + + +Glib::PropertyProxy Dialog::property_has_separator() +{ + return Glib::PropertyProxy(this, "has-separator"); +} + +Glib::PropertyProxy_ReadOnly Dialog::property_has_separator() const +{ + return Glib::PropertyProxy_ReadOnly(this, "has-separator"); +} + + +void Gtk::Dialog::on_response(int response_id) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->response) + (*base->response)(gobj(),response_id); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/dialog.h b/libs/gtkmm2/gtk/gtkmm/dialog.h new file mode 100644 index 0000000000..2b4ae3f461 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/dialog.h @@ -0,0 +1,346 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_DIALOG_H +#define _GTKMM_DIALOG_H + +#include + +/* $Id$ */ + +/* dialog.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkDialog GtkDialog; +typedef struct _GtkDialogClass GtkDialogClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Dialog_Class; } // namespace Gtk +namespace Gtk +{ + +/** @defgroup Dialogs Dialogs + */ + + +/** @addtogroup gtkmmEnums Enums and Flags */ + +/** + * @ingroup gtkmmEnums + */ +enum ResponseType +{ + RESPONSE_NONE = -1, + RESPONSE_REJECT = -2, + RESPONSE_ACCEPT = -3, + RESPONSE_DELETE_EVENT = -4, + RESPONSE_OK = -5, + RESPONSE_CANCEL = -6, + RESPONSE_CLOSE = -7, + RESPONSE_YES = -8, + RESPONSE_NO = -9, + RESPONSE_APPLY = -10, + RESPONSE_HELP = -11 +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/** Create popup windows. + * + * Dialog boxes are a convenient way to prompt the user for a small amount + * of input, eg. to display a message, ask a question, or anything else that + * does not require extensive effort on the user's part. + * + * gtkmm treats a dialog as a window split vertically. The top section is a + * Gtk::VBox, and is where widgets such as a Gtk::Label or a Gtk::Entry should be + * packed. The bottom area is known as the action_area. This is generally + * used for packing buttons into the dialog which may perform functions such + * as cancel, ok, or apply. The two areas are separated by a Gtk::HSeparator. + * + * The dialog can be 'modal' (that is, one which freezes the rest of the + * application from user input) - this can be specified in the Gtk::Dialog + * constructor. + * + * When adding buttons using add_button(), clicking the button will emit + * signal_response() with a "response id" you specified. You are encouraged + * to use the Gtk::ResponseType enum. If a dialog receives a delete event, + * the "response" signal will be emitted with a response id of + * Gtk::RESPONSE_NONE. + * + * If you want to block waiting for a dialog to return before returning control + * flow to your code, you can call run(). This function enters a + * recursive main loop and waits for the user to respond to the dialog, returning + * the response ID corresponding to the button the user clicked. + * + * @ingroup Dialogs + */ + +class Dialog : public Window +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Dialog CppObjectType; + typedef Dialog_Class CppClassType; + typedef GtkDialog BaseObjectType; + typedef GtkDialogClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Dialog(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Dialog_Class; + static CppClassType dialog_class_; + + // noncopyable + Dialog(const Dialog&); + Dialog& operator=(const Dialog&); + +protected: + explicit Dialog(const Glib::ConstructParams& construct_params); + explicit Dialog(GtkDialog* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkDialog* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkDialog* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_response(int response_id); + + +private: + + +public: + Dialog(); + explicit Dialog(const Glib::ustring& title, bool modal = false, bool use_separator = false); + Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal = false, bool use_separator = false); + + + /** Adds an activatable widget to the action area of a Gtk::Dialog, + * connecting a signal handler that will emit the "response" signal on + * the dialog when the widget is activated. The widget is appended to + * the end of the dialog's action area. If you want to add a + * non-activatable widget, simply pack it into the + * action_area field of the Gtk::Dialog struct. + * @param child An activatable widget. + * @param response_id Response ID for @a child . + */ + void add_action_widget(Widget& child, int response_id); + + /** Adds a button with the given text (or a stock button, if @a button_text is a + * stock ID) and sets things up so that clicking the button will emit the + * "response" signal with the given @a response_id . The button is appended to the + * end of the dialog's action area. The button widget is returned, but usually + * you don't need it. + * @param button_text Text of button, or stock ID. + * @param response_id Response ID for the button. + * @return The button widget that was added. + */ + Button* add_button(const Glib::ustring& button_text, int response_id); + + /** Adds a button with the given text (or a stock button, if @a button_text is a + * stock ID) and sets things up so that clicking the button will emit the + * "response" signal with the given @a response_id . The button is appended to the + * end of the dialog's action area. The button widget is returned, but usually + * you don't need it. + * @param button_text Text of button, or stock ID. + * @param response_id Response ID for the button. + * @return The button widget that was added. + */ + Button* add_button(const Gtk::StockID& stock_id, int response_id); + + /** Calls gtk_widget_set_sensitive (widget, @a setting ) + * for each widget in the dialog's action area with the given @a response_id . + * A convenient way to sensitize/desensitize dialog buttons. + * @param response_id A response ID. + * @param setting true for sensitive. + */ + void set_response_sensitive(int response_id, bool setting = true); + + /** Sets the last widget in the dialog's action area with the given @a response_id + * as the default widget for the dialog. Pressing "Enter" normally activates + * the default widget. + * @param response_id A response ID. + */ + void set_default_response(int response_id); + + /** Sets whether the dialog has a separator above the buttons. + * true by default. + * @param setting true to have a separator. + */ + void set_has_separator(bool setting = true); + + /** Accessor for whether the dialog has a separator. + * @return true if the dialog has a separator. + */ + bool get_has_separator() const; + + + /** Returns true if dialogs are expected to use an alternative + * button order on the screen @a screen . See + * Gtk::Dialog::set_alternative_button_order() for more details + * about alternative button order. + * + * If you need to use this function, you should probably connect + * to the ::notify:gtk-alternative-button-order signal on the + * Gtk::Settings object associated to @a screen , in order to be + * notified if the button order setting changes. + * @param screen A Gdk::Screen, or 0 to use the default screen. + * @return Whether the alternative button order should be used + * + * Since: 2.6. + */ + static bool alternative_button_order(const Glib::RefPtr& screen); + + //TODO: Document this: + void set_alternative_button_order_from_array(const Glib::ArrayHandle& new_order); + + + /** Emits the "response" signal with the given response ID. Used to + * indicate that the user has responded to the dialog in some way; + * typically either you or run() will be monitoring the + * "response" signal and take appropriate action. + * @param response_id Response ID. + */ + void response(int response_id); + + /** Blocks in a recursive main loop until the @a dialog emits the + * response signal. It returns the response ID from the "response" signal emission. + * Before entering the recursive main loop, run() calls + * Gtk::Widget::show() on the dialog for you. Note that you still + * need to show any children of the dialog yourself. + * + * If the dialog receives "delete_event", Gtk::Dialog::run() will return + * Gtk::RESPONSE_DELETE_EVENT. Also, during Gtk::Dialog::run() the dialog will be + * modal. You can force Gtk::Dialog::run() to return at any time by + * calling Gtk::Dialog::response() to emit the "response" + * signal. + * + * After Gtk::Dialog::run() returns, you are responsible for hiding or + * destroying the dialog if you wish to do so. + * + * Typical usage of this function might be: + * @code + * int result = dialog.run(); + * switch (result) + * { + * case GTK_RESPONSE_ACCEPT: + * do_application_specific_something (<!-- -->); + * break; + * default: + * do_nothing_since_dialog_was_cancelled (<!-- -->); + * break; + * } + * @endcode + * @return Response ID. + */ + int run(); + + VBox* get_vbox(); + const VBox* get_vbox() const; + HButtonBox* get_action_area(); + const HButtonBox* get_action_area() const; + + /** The dialog has a separator bar above its buttons. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_has_separator() ; + +/** The dialog has a separator bar above its buttons. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_has_separator() const; + + + Glib::SignalProxy1< void,int > signal_response(); + + +protected: + void construct_(bool modal, bool use_separator); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Dialog + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Dialog* wrap(GtkDialog* object, bool take_copy = false); +} +#endif /* _GTKMM_DIALOG_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/drawingarea.cc b/libs/gtkmm2/gtk/gtkmm/drawingarea.cc new file mode 100644 index 0000000000..53c90ec888 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/drawingarea.cc @@ -0,0 +1,129 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::DrawingArea* wrap(GtkDrawingArea* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& DrawingArea_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &DrawingArea_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_drawing_area_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void DrawingArea_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* DrawingArea_Class::wrap_new(GObject* o) +{ + return manage(new DrawingArea((GtkDrawingArea*)(o))); + +} + + +/* The implementation: */ + +DrawingArea::DrawingArea(const Glib::ConstructParams& construct_params) +: + Gtk::Widget(construct_params) +{ + } + +DrawingArea::DrawingArea(GtkDrawingArea* castitem) +: + Gtk::Widget((GtkWidget*)(castitem)) +{ + } + +DrawingArea::~DrawingArea() +{ + destroy_(); +} + +DrawingArea::CppClassType DrawingArea::drawingarea_class_; // initialize static member + +GType DrawingArea::get_type() +{ + return drawingarea_class_.init().get_type(); +} + +GType DrawingArea::get_base_type() +{ + return gtk_drawing_area_get_type(); +} + + +DrawingArea::DrawingArea() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(drawingarea_class_.init())) +{ + } + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/drawingarea.h b/libs/gtkmm2/gtk/gtkmm/drawingarea.h new file mode 100644 index 0000000000..3d3774deb6 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/drawingarea.h @@ -0,0 +1,120 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_DRAWINGAREA_H +#define _GTKMM_DRAWINGAREA_H + +#include + +/* $Id$ */ + +/* drawingarea.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkDrawingArea GtkDrawingArea; +typedef struct _GtkDrawingAreaClass GtkDrawingAreaClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class DrawingArea_Class; } // namespace Gtk +namespace Gtk +{ + +/** A widget for custom user interface elements. + * + * @ingroup Widgets + */ + +class DrawingArea : public Widget +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef DrawingArea CppObjectType; + typedef DrawingArea_Class CppClassType; + typedef GtkDrawingArea BaseObjectType; + typedef GtkDrawingAreaClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~DrawingArea(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class DrawingArea_Class; + static CppClassType drawingarea_class_; + + // noncopyable + DrawingArea(const DrawingArea&); + DrawingArea& operator=(const DrawingArea&); + +protected: + explicit DrawingArea(const Glib::ConstructParams& construct_params); + explicit DrawingArea(GtkDrawingArea* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkDrawingArea* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkDrawingArea* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + DrawingArea(); + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::DrawingArea + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::DrawingArea* wrap(GtkDrawingArea* object, bool take_copy = false); +} +#endif /* _GTKMM_DRAWINGAREA_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/editable.cc b/libs/gtkmm2/gtk/gtkmm/editable.cc new file mode 100644 index 0000000000..9109009a2f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/editable.cc @@ -0,0 +1,770 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ + +void Editable_signal_insert_text_callback(GtkEditable* self, const gchar* text,gint length,gint* position,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::ustring&,int* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))( Glib::ustring(text, text + length), position); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Editable_signal_insert_text_info = +{ + "insert_text", + (GCallback) &Editable_signal_insert_text_callback, + (GCallback) &Editable_signal_insert_text_callback +}; + + +void Editable_signal_delete_text_callback(GtkEditable* self, gint start_pos,gint end_pos,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,int,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Editable_signal_delete_text_info = +{ + "delete_text", + (GCallback) &Editable_signal_delete_text_callback, + (GCallback) &Editable_signal_delete_text_callback +}; + + +const Glib::SignalProxyInfo Editable_signal_changed_info = +{ + "changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkEditable* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& Editable_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &Editable_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = gtk_editable_get_type(); + } + + return *this; +} + +void Editable_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->do_insert_text = &do_insert_text_vfunc_callback; + klass->do_delete_text = &do_delete_text_vfunc_callback; + klass->get_chars = &get_chars_vfunc_callback; + klass->set_selection_bounds = &set_selection_bounds_vfunc_callback; + klass->get_selection_bounds = &get_selection_bounds_vfunc_callback; + klass->set_position = &set_position_vfunc_callback; + klass->get_position = &get_position_vfunc_callback; + klass->insert_text = &insert_text_callback; + klass->delete_text = &delete_text_callback; + klass->changed = &changed_callback; +} + +void Editable_Class::do_insert_text_vfunc_callback(GtkEditable* self, const gchar* text, gint length, gint* position) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*) self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->insert_text_vfunc( Glib::ustring(text, text + length), *position); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->do_insert_text) + (*base->do_insert_text)( self, text, length, position); + } +} + +void Editable_Class::do_delete_text_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->delete_text_vfunc(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->do_delete_text) + (*base->do_delete_text)(self, start_pos, end_pos); + } +} + +gchar* Editable_Class::get_chars_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return g_strdup((obj->get_chars_vfunc(start_pos +, end_pos +)).c_str()); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_chars) + return (*base->get_chars)(self, start_pos, end_pos); + } + + typedef gchar* RType; + return RType(); +} + +void Editable_Class::set_selection_bounds_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->select_region_vfunc(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_selection_bounds) + (*base->set_selection_bounds)(self, start_pos, end_pos); + } +} + +gboolean Editable_Class::get_selection_bounds_vfunc_callback(GtkEditable* self, gint* start_pos, gint* end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return static_cast(obj->get_selection_bounds_vfunc(*(start_pos) +, *(end_pos) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_selection_bounds) + return (*base->get_selection_bounds)(self, start_pos, end_pos); + } + + typedef gboolean RType; + return RType(); +} + +void Editable_Class::set_position_vfunc_callback(GtkEditable* self, gint position) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->set_position_vfunc(position +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->set_position) + (*base->set_position)(self, position); + } +} + +gint Editable_Class::get_position_vfunc_callback(GtkEditable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + return obj->get_position_vfunc(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->get_position) + return (*base->get_position)(self); + } + + typedef gint RType; + return RType(); +} + + +void Editable_Class::insert_text_callback(GtkEditable* self, const gchar* text, gint length, gint* position) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*) self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_insert_text( Glib::ustring(text, text + length), position); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->insert_text) + (*base->insert_text)( self, text, length, position); + } +} + +void Editable_Class::delete_text_callback(GtkEditable* self, gint start_pos, gint end_pos) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_delete_text(start_pos +, end_pos +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->delete_text) + (*base->delete_text)(self, start_pos, end_pos); + } +} + +void Editable_Class::changed_callback(GtkEditable* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_changed(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->changed) + (*base->changed)(self); + } +} + + +Glib::ObjectBase* Editable_Class::wrap_new(GObject* object) +{ + return new Editable((GtkEditable*)(object)); +} + + +/* The implementation: */ + +Editable::Editable() +: + Glib::Interface(editable_class_.init()) +{} + +Editable::Editable(GtkEditable* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +Editable::~Editable() +{} + +// static +void Editable::add_interface(GType gtype_implementer) +{ + editable_class_.init().add_interface(gtype_implementer); +} + +Editable::CppClassType Editable::editable_class_; // initialize static member + +GType Editable::get_type() +{ + return editable_class_.init().get_type(); +} + +GType Editable::get_base_type() +{ + return gtk_editable_get_type(); +} + + +void Editable::cut_clipboard() +{ + gtk_editable_cut_clipboard(gobj()); +} + +void Editable::copy_clipboard() +{ + gtk_editable_copy_clipboard(gobj()); +} + +void Editable::paste_clipboard() +{ + gtk_editable_paste_clipboard(gobj()); +} + +void Editable::delete_selection() +{ + gtk_editable_delete_selection(gobj()); +} + +void Editable::set_editable(bool is_editable) +{ + gtk_editable_set_editable(gobj(), static_cast(is_editable)); +} + +bool Editable::get_editable() const +{ + return gtk_editable_get_editable(const_cast(gobj())); +} + +void Editable::insert_text(const Glib::ustring& text, int length, int& position) +{ + gtk_editable_insert_text(gobj(), text.c_str(), length, &position); +} + +void Editable::delete_text(int start_pos, int end_pos) +{ + gtk_editable_delete_text(gobj(), start_pos, end_pos); +} + +Glib::ustring Editable::get_chars(int start_pos, int end_pos) const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_editable_get_chars(const_cast(gobj()), start_pos, end_pos)); +} + +void Editable::select_region(int start_pos, int end_pos) +{ + gtk_editable_select_region(gobj(), start_pos, end_pos); +} + +bool Editable::get_selection_bounds(int& start_pos, int& end_pos) const +{ + return gtk_editable_get_selection_bounds(const_cast(gobj()), &start_pos, &end_pos); +} + +void Editable::set_position(int position) +{ + gtk_editable_set_position(gobj(), position); +} + +int Editable::get_position() const +{ + return gtk_editable_get_position(const_cast(gobj())); +} + + +Glib::SignalProxy2< void,const Glib::ustring&,int* > Editable::signal_insert_text() +{ + return Glib::SignalProxy2< void,const Glib::ustring&,int* >(this, &Editable_signal_insert_text_info); +} + +Glib::SignalProxy2< void,int,int > Editable::signal_delete_text() +{ + return Glib::SignalProxy2< void,int,int >(this, &Editable_signal_delete_text_info); +} + +Glib::SignalProxy0< void > Editable::signal_changed() +{ + return Glib::SignalProxy0< void >(this, &Editable_signal_changed_info); +} + + +void Gtk::Editable::on_insert_text(const Glib::ustring& text, int* position) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->insert_text) + (*base->insert_text)(gobj(),text.data(),text.bytes(),position); +} + +void Gtk::Editable::on_delete_text(int start_pos, int end_pos) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->delete_text) + (*base->delete_text)(gobj(),start_pos,end_pos); +} + +void Gtk::Editable::on_changed() +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->changed) + (*base->changed)(gobj()); +} + + +void Gtk::Editable::insert_text_vfunc(const Glib::ustring& text, int& position) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->do_insert_text) + (*base->do_insert_text)(gobj(),text.data(),text.bytes(),&position); +} + +void Gtk::Editable::delete_text_vfunc(int start_pos, int end_pos) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->do_delete_text) + (*base->do_delete_text)(gobj(),start_pos,end_pos); +} + +Glib::ustring Gtk::Editable::get_chars_vfunc(int start_pos, int end_pos) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_chars) + return Glib::convert_const_gchar_ptr_to_ustring((*base->get_chars)(const_cast(gobj()),start_pos,end_pos)); + + typedef Glib::ustring RType; + return RType(); +} + +void Gtk::Editable::select_region_vfunc(int start_pos, int end_pos) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_selection_bounds) + (*base->set_selection_bounds)(gobj(),start_pos,end_pos); +} + +bool Gtk::Editable::get_selection_bounds_vfunc(int& start_pos, int& end_pos) const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_selection_bounds) + return (*base->get_selection_bounds)(const_cast(gobj()),&start_pos,&end_pos); + + typedef bool RType; + return RType(); +} + +void Gtk::Editable::set_position_vfunc(int position) +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->set_position) + (*base->set_position)(gobj(),position); +} + +int Gtk::Editable::get_position_vfunc() const +{ + BaseClassType *const base = static_cast( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->get_position) + return (*base->get_position)(const_cast(gobj())); + + typedef int RType; + return RType(); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/editable.h b/libs/gtkmm2/gtk/gtkmm/editable.h new file mode 100644 index 0000000000..89832dcba7 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/editable.h @@ -0,0 +1,190 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_EDITABLE_H +#define _GTKMM_EDITABLE_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkEditable GtkEditable; +typedef struct _GtkEditableClass GtkEditableClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Editable_Class; } // namespace Gtk +namespace Gtk +{ + +/** Base class for text-editing widgets. + * + * The Gtk::Editable class is a base class for widgets for editing text, + * such as Gtk::Entry. It cannot be instantiated by itself. The editable + * class contains functions for generically manipulating an editable widget, + * a large number of action signals used for key bindings, and several + * signals that an application can connect to to modify the behavior of a + * widget. + * + */ + +class Editable : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Editable CppObjectType; + typedef Editable_Class CppClassType; + typedef GtkEditable BaseObjectType; + typedef GtkEditableClass BaseClassType; + +private: + friend class Editable_Class; + static CppClassType editable_class_; + + // noncopyable + Editable(const Editable&); + Editable& operator=(const Editable&); + +protected: + Editable(); // you must derive from this class + explicit Editable(GtkEditable* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Editable(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkEditable* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkEditable* gobj() const { return reinterpret_cast(gobject_); } + +private: + + +public: + + void cut_clipboard(); + + void copy_clipboard(); + + void paste_clipboard(); + + void delete_selection(); + + void set_editable(bool is_editable = true); + + /** Retrieves whether @a editable is editable. See + * set_editable(). + * @return true if @a editable is editable. + */ + bool get_editable() const; + + + void insert_text(const Glib::ustring& text, int length, int& position); + + void delete_text(int start_pos, int end_pos); + + + Glib::ustring get_chars(int start_pos, int end_pos) const; + + + void select_region(int start_pos, int end_pos); + + bool get_selection_bounds(int& start_pos, int& end_pos) const; + + + void set_position(int position); + + int get_position() const; + + + Glib::SignalProxy2< void,const Glib::ustring&,int* > signal_insert_text(); + + + Glib::SignalProxy2< void,int,int > signal_delete_text(); + + + Glib::SignalProxy0< void > signal_changed(); + + +protected: + + + virtual void delete_text_vfunc(int start_pos, int end_pos); + + + virtual Glib::ustring get_chars_vfunc(int start_pos, int end_pos) const; + + virtual void select_region_vfunc(int start_pos, int end_pos); + virtual bool get_selection_bounds_vfunc(int& start_pos, int& end_pos) const; + virtual void set_position_vfunc(int position); + virtual int get_position_vfunc() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): +virtual void insert_text_vfunc(const Glib::ustring& text, int& position); + + + //Default Signal Handlers:: + virtual void on_insert_text(const Glib::ustring& text, int* position); + virtual void on_delete_text(int start_pos, int end_pos); + virtual void on_changed(); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Editable + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkEditable* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GTKMM_EDITABLE_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/entry.cc b/libs/gtkmm2/gtk/gtkmm/entry.cc new file mode 100644 index 0000000000..6b08e95c3b --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/entry.cc @@ -0,0 +1,598 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ + +void Entry_signal_populate_popup_callback(GtkEntry* self, GtkMenu* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Menu* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Entry_signal_populate_popup_info = +{ + "populate_popup", + (GCallback) &Entry_signal_populate_popup_callback, + (GCallback) &Entry_signal_populate_popup_callback +}; + + +void Entry_signal_insert_at_cursor_callback(GtkEntry* self, const gchar* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::ustring& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo Entry_signal_insert_at_cursor_info = +{ + "insert_at_cursor", + (GCallback) &Entry_signal_insert_at_cursor_callback, + (GCallback) &Entry_signal_insert_at_cursor_callback +}; + + +const Glib::SignalProxyInfo Entry_signal_activate_info = +{ + "activate", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Entry* wrap(GtkEntry* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Entry_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Entry_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_entry_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + Editable::add_interface(get_type()); + CellEditable::add_interface(get_type()); + } + + return *this; +} + +void Entry_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->populate_popup = &populate_popup_callback; + klass->insert_at_cursor = &insert_at_cursor_callback; + klass->activate = &activate_callback; +} + + +void Entry_Class::populate_popup_callback(GtkEntry* self, GtkMenu* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_populate_popup(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->populate_popup) + (*base->populate_popup)(self, p0); + } +} + +void Entry_Class::insert_at_cursor_callback(GtkEntry* self, const gchar* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_insert_at_cursor(Glib::convert_const_gchar_ptr_to_ustring(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->insert_at_cursor) + (*base->insert_at_cursor)(self, p0); + } +} + +void Entry_Class::activate_callback(GtkEntry* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_activate(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->activate) + (*base->activate)(self); + } +} + + +Glib::ObjectBase* Entry_Class::wrap_new(GObject* o) +{ + return manage(new Entry((GtkEntry*)(o))); + +} + + +/* The implementation: */ + +Entry::Entry(const Glib::ConstructParams& construct_params) +: + Gtk::Widget(construct_params) +{ + } + +Entry::Entry(GtkEntry* castitem) +: + Gtk::Widget((GtkWidget*)(castitem)) +{ + } + +Entry::~Entry() +{ + destroy_(); +} + +Entry::CppClassType Entry::entry_class_; // initialize static member + +GType Entry::get_type() +{ + return entry_class_.init().get_type(); +} + +GType Entry::get_base_type() +{ + return gtk_entry_get_type(); +} + + +Entry::Entry() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Widget(Glib::ConstructParams(entry_class_.init())) +{ + } + +void Entry::set_visibility(bool visible) +{ + gtk_entry_set_visibility(gobj(), static_cast(visible)); +} + +bool Entry::get_visibility() const +{ + return gtk_entry_get_visibility(const_cast(gobj())); +} + +void Entry::set_invisible_char(gunichar ch) +{ + gtk_entry_set_invisible_char(gobj(), ch); +} + +gunichar Entry::get_invisible_char() const +{ + return gtk_entry_get_invisible_char(const_cast(gobj())); +} + +void Entry::set_has_frame(bool setting) +{ + gtk_entry_set_has_frame(gobj(), static_cast(setting)); +} + +bool Entry::get_has_frame() const +{ + return gtk_entry_get_has_frame(const_cast(gobj())); +} + +void Entry::set_max_length(int max) +{ + gtk_entry_set_max_length(gobj(), max); +} + +int Entry::get_max_length() const +{ + return gtk_entry_get_max_length(const_cast(gobj())); +} + +void Entry::set_activates_default(bool setting) +{ + gtk_entry_set_activates_default(gobj(), static_cast(setting)); +} + +gboolean Entry::get_activates_default() const +{ + return gtk_entry_get_activates_default(const_cast(gobj())); +} + +void Entry::set_width_chars(int n_chars) +{ + gtk_entry_set_width_chars(gobj(), n_chars); +} + +int Entry::get_width_chars() const +{ + return gtk_entry_get_width_chars(const_cast(gobj())); +} + +void Entry::set_text(const Glib::ustring & text) +{ + gtk_entry_set_text(gobj(), text.c_str()); +} + +Glib::ustring Entry::get_text() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_entry_get_text(const_cast(gobj()))); +} + +Glib::RefPtr Entry::get_layout() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_entry_get_layout(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Entry::get_layout() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_entry_get_layout(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Entry::get_layout_offsets(int& x, int& y) +{ + gtk_entry_get_layout_offsets(gobj(), &x, &y); +} + +int Entry::layout_index_to_text_index(int layout_index) const +{ + return gtk_entry_layout_index_to_text_index(const_cast(gobj()), layout_index); +} + +int Entry::text_index_to_layout_index(int text_index) const +{ + return gtk_entry_text_index_to_layout_index(const_cast(gobj()), text_index); +} + +void Entry::set_alignment(float xalign) +{ + gtk_entry_set_alignment(gobj(), xalign); +} + +void Entry::set_alignment(AlignmentEnum xalign) +{ + gtk_entry_set_alignment(gobj(), _gtkmm_align_float_from_enum(xalign)); +} + +float Entry::get_alignment() const +{ + return gtk_entry_get_alignment(const_cast(gobj())); +} + +void Entry::set_completion(const Glib::RefPtr& completion) +{ + gtk_entry_set_completion(gobj(), Glib::unwrap(completion)); +} + +Glib::RefPtr Entry::get_completion() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_entry_get_completion(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr Entry::get_completion() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_entry_get_completion(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +guint16 Entry::get_text_length() const +{ + return gobj()->text_length; +} + + +Glib::SignalProxy1< void,Menu* > Entry::signal_populate_popup() +{ + return Glib::SignalProxy1< void,Menu* >(this, &Entry_signal_populate_popup_info); +} + +Glib::SignalProxy1< void,const Glib::ustring& > Entry::signal_insert_at_cursor() +{ + return Glib::SignalProxy1< void,const Glib::ustring& >(this, &Entry_signal_insert_at_cursor_info); +} + +Glib::SignalProxy0< void > Entry::signal_activate() +{ + return Glib::SignalProxy0< void >(this, &Entry_signal_activate_info); +} + + +Glib::PropertyProxy_ReadOnly Entry::property_cursor_position() const +{ + return Glib::PropertyProxy_ReadOnly(this, "cursor-position"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_selection_bound() const +{ + return Glib::PropertyProxy_ReadOnly(this, "selection-bound"); +} + +Glib::PropertyProxy Entry::property_editable() +{ + return Glib::PropertyProxy(this, "editable"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_editable() const +{ + return Glib::PropertyProxy_ReadOnly(this, "editable"); +} + +Glib::PropertyProxy Entry::property_max_length() +{ + return Glib::PropertyProxy(this, "max-length"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_max_length() const +{ + return Glib::PropertyProxy_ReadOnly(this, "max-length"); +} + +Glib::PropertyProxy Entry::property_visibility() +{ + return Glib::PropertyProxy(this, "visibility"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_visibility() const +{ + return Glib::PropertyProxy_ReadOnly(this, "visibility"); +} + +Glib::PropertyProxy Entry::property_has_frame() +{ + return Glib::PropertyProxy(this, "has-frame"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_has_frame() const +{ + return Glib::PropertyProxy_ReadOnly(this, "has-frame"); +} + +Glib::PropertyProxy Entry::property_invisible_char() +{ + return Glib::PropertyProxy(this, "invisible-char"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_invisible_char() const +{ + return Glib::PropertyProxy_ReadOnly(this, "invisible-char"); +} + +Glib::PropertyProxy Entry::property_activates_default() +{ + return Glib::PropertyProxy(this, "activates-default"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_activates_default() const +{ + return Glib::PropertyProxy_ReadOnly(this, "activates-default"); +} + +Glib::PropertyProxy Entry::property_width_chars() +{ + return Glib::PropertyProxy(this, "width-chars"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_width_chars() const +{ + return Glib::PropertyProxy_ReadOnly(this, "width-chars"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_scroll_offset() const +{ + return Glib::PropertyProxy_ReadOnly(this, "scroll-offset"); +} + +Glib::PropertyProxy Entry::property_text() +{ + return Glib::PropertyProxy(this, "text"); +} + +Glib::PropertyProxy_ReadOnly Entry::property_text() const +{ + return Glib::PropertyProxy_ReadOnly(this, "text"); +} + + +void Gtk::Entry::on_populate_popup(Menu* menu) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->populate_popup) + (*base->populate_popup)(gobj(),(GtkMenu*)Glib::unwrap(menu)); +} + +void Gtk::Entry::on_insert_at_cursor(const Glib::ustring& str) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->insert_at_cursor) + (*base->insert_at_cursor)(gobj(),str.c_str()); +} + +void Gtk::Entry::on_activate() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->activate) + (*base->activate)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/entry.h b/libs/gtkmm2/gtk/gtkmm/entry.h new file mode 100644 index 0000000000..d7b9a3fb3c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/entry.h @@ -0,0 +1,524 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ENTRY_H +#define _GTKMM_ENTRY_H + +#include + +/* $Id$ */ + +/* entry.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkEntry GtkEntry; +typedef struct _GtkEntryClass GtkEntryClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Entry_Class; } // namespace Gtk +namespace Gtk +{ + +/** A single line text entry field. + * + * The Gtk::Entry widget is a single line text entry widget. A fairly large + * set of key bindings are supported by default. If the entered text is + * longer than the allocation of the widget, the widget will scroll so that + * the cursor position is visible. + * + * @ingroup Widgets + */ + +class Entry +: public Widget, + public Editable, + public CellEditable +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Entry CppObjectType; + typedef Entry_Class CppClassType; + typedef GtkEntry BaseObjectType; + typedef GtkEntryClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Entry(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Entry_Class; + static CppClassType entry_class_; + + // noncopyable + Entry(const Entry&); + Entry& operator=(const Entry&); + +protected: + explicit Entry(const Glib::ConstructParams& construct_params); + explicit Entry(GtkEntry* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkEntry* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkEntry* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_populate_popup(Menu* menu); + virtual void on_insert_at_cursor(const Glib::ustring& str); + virtual void on_activate(); + + +private: + + +public: + + Entry(); + + + void set_visibility(bool visible = true); + + /** Retrieves whether the text in @a entry is visible. See + * set_visibility(). + * @return true if the text is currently visible. + */ + bool get_visibility() const; + + /** Sets the character to use in place of the actual text when + * set_visibility() has been called to set text visibility + * to false. i.e. this is the character used in "password mode" to + * show the user how many characters have been typed. The default + * invisible char is an asterisk ('*'). If you set the invisible char + * to 0, then the user will get no feedback at all; there will be + * no text on the screen as they type. + * @param ch A Unicode character. + */ + void set_invisible_char(gunichar ch); + + /** Retrieves the character displayed in place of the real characters + * for entries with visisbility set to false. See set_invisible_char(). + * @return The current invisible char, or 0, if the entry does not + * show invisible text at all. + */ + gunichar get_invisible_char() const; + + /** Sets whether the entry has a beveled frame around it. + * @param setting New value. + */ + void set_has_frame(bool setting = true); + + /** Gets the value set by set_has_frame(). + * @return Whether the entry has a beveled frame. + */ + bool get_has_frame() const; + + /** Sets the maximum allowed length of the contents of the widget. If + * the current contents are longer than the given length, then they + * will be truncated to fit. + * @param max The maximum length of the entry, or 0 for no maximum. + * (other than the maximum length of entries.) The value passed in will + * be clamped to the range 0-65536. + */ + void set_max_length(int max); + + /** Retrieves the maximum allowed length of the text in + * @a entry . See set_max_length(). + * @return The maximum allowed number of characters + * in Gtk::Entry, or 0 if there is no maximum. + */ + int get_max_length() const; + + /** If @a setting is true, pressing Enter in the @a entry will activate the default + * widget for the window containing the entry. This usually means that + * the dialog box containing the entry will be closed, since the default + * widget is usually one of the dialog buttons. + * + * (For experts: if @a setting is true, the entry calls + * Gtk::Window::activate_default() on the window containing the entry, in + * the default handler for the "activate" signal.) + * @param setting true to activate window's default widget on Enter keypress. + */ + void set_activates_default(bool setting = true); + + /** Retrieves the value set by set_activates_default(). + * @return true if the entry will activate the default widget. + */ + gboolean get_activates_default() const; + + /** Changes the size request of the entry to be about the right size + * for @a n_chars characters. Note that it changes the size + * request, the size can still be affected by + * how you pack the widget into containers. If @a n_chars is -1, the + * size reverts to the default entry size. + * @param n_chars Width in chars. + */ + void set_width_chars(int n_chars); + + /** Gets the value set by set_width_chars(). + * @return Number of chars to request space for, or negative if unset. + */ + int get_width_chars() const; + + void set_text(const Glib::ustring &text); + + /** Retrieves the contents of the entry widget. + * See also Gtk::Editable::get_chars(). + * @return A pointer to the contents of the widget as a + * string. This string points to internally allocated + * storage in the widget and must not be freed, modified or + * stored. + */ + Glib::ustring get_text() const; + + /** Gets the Pango::Layout used to display the entry. + * The layout is useful to e.g. convert text positions to + * pixel positions, in combination with get_layout_offsets(). + * The returned layout is owned by the entry so need not be + * freed by the caller. + * + * Keep in mind that the layout text may contain a preedit string, so + * layout_index_to_text_index() and + * text_index_to_layout_index() are needed to convert byte + * indices in the layout to byte indices in the entry contents. + * @return The Pango::Layout for this entry. + */ + Glib::RefPtr get_layout(); + + /** Gets the Pango::Layout used to display the entry. + * The layout is useful to e.g. convert text positions to + * pixel positions, in combination with get_layout_offsets(). + * The returned layout is owned by the entry so need not be + * freed by the caller. + * + * Keep in mind that the layout text may contain a preedit string, so + * layout_index_to_text_index() and + * text_index_to_layout_index() are needed to convert byte + * indices in the layout to byte indices in the entry contents. + * @return The Pango::Layout for this entry. + */ + Glib::RefPtr get_layout() const; + + /** Obtains the position of the Pango::Layout used to render text + * in the entry, in widget coordinates. Useful if you want to line + * up the text in an entry with some other text, e.g. when using the + * entry to implement editable cells in a sheet widget. + * + * Also useful to convert mouse events into coordinates inside the + * Pango::Layout, e.g. to take some action if some part of the entry text + * is clicked. + * + * Note that as the user scrolls around in the entry the offsets will + * change; you'll need to connect to the "notify::scroll-offset" + * signal to track this. Remember when using the Pango::Layout + * functions you need to convert to and from pixels using + * PANGO_PIXELS() or Pango::SCALE. + * + * Keep in mind that the layout text may contain a preedit string, so + * layout_index_to_text_index() and + * text_index_to_layout_index() are needed to convert byte + * indices in the layout to byte indices in the entry contents. + * @param x Location to store X offset of layout, or 0. + * @param y Location to store Y offset of layout, or 0. + */ + void get_layout_offsets(int& x, int& y); + + + /** Converts from a position in the entry contents (returned + * by get_text()) to a position in the + * entry's Pango::Layout (returned by get_layout(), + * with text retrieved via pango_layout_get_text()). + * @param layout_index Byte index into the entry layout text. + * @return Byte index into the entry contents. + */ + int layout_index_to_text_index(int layout_index) const; + + /** Converts from a position in the entry's Pango::Layout (returned by + * get_layout()) to a position in the entry contents + * (returned by get_text()). + * @param text_index Byte index into the entry contents. + * @return Byte index into the entry layout text. + */ + int text_index_to_layout_index(int text_index) const; + + + /** Sets the alignment for the contents of the entry. This controls + * the horizontal positioning of the contents when the displayed + * text is shorter than the width of the entry. + * + * Since: 2.4 + * @param xalign The horizontal alignment, from 0 (left) to 1 (right). + * Reversed for RTL layouts. + */ + void set_alignment(float xalign); + + /** Sets the alignment for the contents of the entry. This controls + * the horizontal positioning of the contents when the displayed + * text is shorter than the width of the entry. + * + * Since: 2.4 + * @param xalign The horizontal alignment, from 0 (left) to 1 (right). + * Reversed for RTL layouts. + */ + void set_alignment(AlignmentEnum xalign); + + /** Gets the value set by set_alignment(). + * @return The alignment + * + * Since: 2.4. + */ + float get_alignment() const; + + + /** Sets @a completion to be the auxiliary completion object to use with @a entry . + * All further configuration of the completion mechanism is done on + * @a completion using the Gtk::EntryCompletion API. + * + * Since: 2.4 + * @param completion The Gtk::EntryCompletion. + */ + void set_completion(const Glib::RefPtr& completion); + + /** Returns the auxiliary completion object currently in use by @a entry . + * @return The auxiliary completion object currently in use by @a entry . + * + * Since: 2.4. + */ + Glib::RefPtr get_completion(); + + /** Returns the auxiliary completion object currently in use by @a entry . + * @return The auxiliary completion object currently in use by @a entry . + * + * Since: 2.4. + */ + Glib::RefPtr get_completion() const; + + guint16 get_text_length() const; + + + Glib::SignalProxy1< void,Menu* > signal_populate_popup(); + + + Glib::SignalProxy1< void,const Glib::ustring& > signal_insert_at_cursor(); + + + //Key-binding signals: + + + Glib::SignalProxy0< void > signal_activate(); + //TODO: ignore this too? It's used in an example. + + + /** The current position of the insertion cursor in chars. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_cursor_position() const; + + + /** The position of the opposite end of the selection from the cursor in chars. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_selection_bound() const; + + + /** Whether the entry contents can be edited. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_editable() ; + +/** Whether the entry contents can be edited. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_editable() const; + + /** Maximum number of characters for this entry. Zero if no maximum. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_max_length() ; + +/** Maximum number of characters for this entry. Zero if no maximum. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_max_length() const; + + /** FALSE displays the invisible char instead of the actual text (password mode). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_visibility() ; + +/** FALSE displays the invisible char instead of the actual text (password mode). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_visibility() const; + + /** FALSE removes outside bevel from entry. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_has_frame() ; + +/** FALSE removes outside bevel from entry. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_has_frame() const; + + /** The character to use when masking entry contents (in password mode). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_invisible_char() ; + +/** The character to use when masking entry contents (in password mode). + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_invisible_char() const; + + /** Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_activates_default() ; + +/** Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_activates_default() const; + + /** Number of characters to leave space for in the entry. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_width_chars() ; + +/** Number of characters to leave space for in the entry. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_width_chars() const; + + /** Number of pixels of the entry scrolled off the screen to the left. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_scroll_offset() const; + + + /** The contents of the entry. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_text() ; + +/** The contents of the entry. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_text() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Entry + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Entry* wrap(GtkEntry* object, bool take_copy = false); +} +#endif /* _GTKMM_ENTRY_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/entrycompletion.cc b/libs/gtkmm2/gtk/gtkmm/entrycompletion.cc new file mode 100644 index 0000000000..4b7d15975d --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/entrycompletion.cc @@ -0,0 +1,611 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace //anonymous +{ + +// This Signal Proxy allows the C++ coder to specify +// a sigc::slot instead of a static function. +class SignalProxy_Match +{ +public: + typedef Gtk::EntryCompletion::SlotMatch SlotType; + + SignalProxy_Match(const SlotType& slot) + : slot_(slot) {} + + ~SignalProxy_Match(); + + static gboolean gtk_callback(GtkEntryCompletion* completion, const gchar* key, GtkTreeIter* iter, gpointer user_data); + static void gtk_callback_destroy(void* data); + +private: + SlotType slot_; +}; + +SignalProxy_Match::~SignalProxy_Match() +{} + +gboolean SignalProxy_Match::gtk_callback(GtkEntryCompletion* completion, const gchar* key, GtkTreeIter* iter, gpointer user_data) +{ + SignalProxy_Match *const self = static_cast(user_data); + + try + { + GtkTreeModel* tree_model = gtk_entry_completion_get_model(completion); + return (self->slot_)(Glib::convert_const_gchar_ptr_to_ustring(key), + Gtk::TreeModel::const_iterator(tree_model, iter) + ); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return FALSE; //An arbitary default, just to avoid the compiler warning. +} + +void SignalProxy_Match::gtk_callback_destroy(void* data) +{ + delete static_cast(data); +} + +} // anonymous namespace + + +namespace Gtk +{ + +void EntryCompletion::set_match_func(const SlotMatch& slot) +{ + // Create a signal proxy. A pointer to this will be passed + // through the callback's data parameter. It will be deleted + // when SignalProxy_Match::gtk_callback_destroy() is called. + SignalProxy_Match *const pSignalProxy = new SignalProxy_Match(slot); + + gtk_entry_completion_set_match_func(gobj(), + &SignalProxy_Match::gtk_callback, pSignalProxy, + &SignalProxy_Match::gtk_callback_destroy); +} + +void EntryCompletion::insert_action_text(const Glib::ustring& text, int index) +{ + gtk_entry_completion_insert_action_text(gobj(), index, text.c_str()); +} + +void EntryCompletion::insert_action_markup(const Glib::ustring& markup, int index) +{ + gtk_entry_completion_insert_action_markup(gobj(), index, markup.c_str()); +} + +void EntryCompletion::prepend_action_text(const Glib::ustring& text) +{ + //We know that gtk_entry_completion_insert_action_text() uses gtk_list_store_insert(), + //and we know that gtk_list_store_insert() prepends if the position is 0, though + //this is not actually documented. + gtk_entry_completion_insert_action_text(gobj(), 0, text.c_str()); +} + +void EntryCompletion::prepend_action_markup(const Glib::ustring& markup) +{ + //We know that gtk_entry_completion_insert_action_markup() uses gtk_list_store_insert(), + //and we know that gtk_list_store_insert() prepends if the position is 0, though + //this is not actually documented. + gtk_entry_completion_insert_action_markup(gobj(), 0 /* See C docs */, markup.c_str()); +} + +} //namespace Gtk + + +namespace //anonymous +{ + +gboolean Widget_signal_match_selected_callback(GtkEntryCompletion* self, GtkTreeModel* c_model, GtkTreeIter* c_iter, void* data) +{ + using namespace Gtk; + typedef sigc::slot< bool, const TreeModel::iterator& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + { + //This conversion is the custom-written part: + Gtk::TreeModel::iterator cppIter(c_model, c_iter); + + return static_cast( (*static_cast(slot))(cppIter) ); + } + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + + typedef gboolean RType; + return RType(); +} + +gboolean Widget_signal_match_selected_notify_callback(GtkEntryCompletion* self, GtkTreeModel* c_model, GtkTreeIter* c_iter, void* data) +{ + using namespace Gtk; + typedef sigc::slot< void, const TreeModel::iterator& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + { + //This conversion is the custom-written part: + Gtk::TreeModel::iterator cppIter(c_model, c_iter); + + (*static_cast(slot))(cppIter); + } + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + + typedef gboolean RType; + return RType(); +} + +const Glib::SignalProxyInfo EntryCompletion_signal_match_selected_info = +{ + "match_selected", + (GCallback) &Widget_signal_match_selected_callback, + (GCallback) &Widget_signal_match_selected_notify_callback +}; + +} //anonymous namespace + + +namespace Gtk +{ + + +//Hand-coded signal wrapping: + +bool Gtk::EntryCompletion::on_match_selected(const TreeModel::iterator& iter) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->match_selected) + return (*base->match_selected)(gobj(), iter.get_model_gobject(), const_cast(iter.gobj())); + else + { + typedef bool RType; + return RType(); //There should always be an implementation in the C object, so this will never happen. + } +} + +gboolean EntryCompletion_Class::match_selected_callback_custom(GtkEntryCompletion* self, GtkTreeModel* c_model, GtkTreeIter* c_iter) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + + //This conversion is the custom-written part: + Gtk::TreeModel::iterator cppIter(c_model, c_iter); + return obj->on_match_selected(cppIter); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->match_selected) + return (*base->match_selected)(self, c_model, c_iter); + } + + typedef gboolean RType; + return RType(); +} + +Glib::SignalProxy1< bool, const TreeModel::iterator& > EntryCompletion::signal_match_selected() +{ + return Glib::SignalProxy1< bool, const TreeModel::iterator& >(this, &EntryCompletion_signal_match_selected_info); +} + + +} // namespace Gtk + + +namespace +{ + +void EntryCompletion_signal_action_activated_callback(GtkEntryCompletion* self, gint p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,int > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo EntryCompletion_signal_action_activated_info = +{ + "action_activated", + (GCallback) &EntryCompletion_signal_action_activated_callback, + (GCallback) &EntryCompletion_signal_action_activated_callback +}; + + +gboolean EntryCompletion_signal_insert_prefix_callback(GtkEntryCompletion* self, const gchar* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< bool,const Glib::ustring& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + return static_cast((*static_cast(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0) +)); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + + typedef gboolean RType; + return RType(); +} + +gboolean EntryCompletion_signal_insert_prefix_notify_callback(GtkEntryCompletion* self, const gchar* p0, void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,const Glib::ustring& > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + + typedef gboolean RType; + return RType(); +} + +const Glib::SignalProxyInfo EntryCompletion_signal_insert_prefix_info = +{ + "insert_prefix", + (GCallback) &EntryCompletion_signal_insert_prefix_callback, + (GCallback) &EntryCompletion_signal_insert_prefix_notify_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkEntryCompletion* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& EntryCompletion_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &EntryCompletion_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_entry_completion_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void EntryCompletion_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->action_activated = &action_activated_callback; + klass->match_selected = &match_selected_callback_custom; + } + + +void EntryCompletion_Class::action_activated_callback(GtkEntryCompletion* self, gint p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_action_activated(p0 +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->action_activated) + (*base->action_activated)(self, p0); + } +} + + +Glib::ObjectBase* EntryCompletion_Class::wrap_new(GObject* object) +{ + return new EntryCompletion((GtkEntryCompletion*)object); +} + + +/* The implementation: */ + +GtkEntryCompletion* EntryCompletion::gobj_copy() +{ + reference(); + return gobj(); +} + +EntryCompletion::EntryCompletion(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +EntryCompletion::EntryCompletion(GtkEntryCompletion* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +EntryCompletion::~EntryCompletion() +{} + + +EntryCompletion::CppClassType EntryCompletion::entrycompletion_class_; // initialize static member + +GType EntryCompletion::get_type() +{ + return entrycompletion_class_.init().get_type(); +} + +GType EntryCompletion::get_base_type() +{ + return gtk_entry_completion_get_type(); +} + + +EntryCompletion::EntryCompletion() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(entrycompletion_class_.init())) +{ + } + +Glib::RefPtr EntryCompletion::create() +{ + return Glib::RefPtr( new EntryCompletion() ); +} +Entry* EntryCompletion::get_entry() +{ + return Glib::wrap((GtkEntry*)(gtk_entry_completion_get_entry(gobj()))); +} + +const Entry* EntryCompletion::get_entry() const +{ + return Glib::wrap((GtkEntry*)(gtk_entry_completion_get_entry(const_cast(gobj())))); +} + +void EntryCompletion::set_model(const Glib::RefPtr& model) +{ + gtk_entry_completion_set_model(gobj(), Glib::unwrap(model)); +} + +Glib::RefPtr EntryCompletion::get_model() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_entry_completion_get_model(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr EntryCompletion::get_model() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_entry_completion_get_model(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void EntryCompletion::set_minimum_key_length(int length) +{ + gtk_entry_completion_set_minimum_key_length(gobj(), length); +} + +int EntryCompletion::get_minimum_key_length() const +{ + return gtk_entry_completion_get_minimum_key_length(const_cast(gobj())); +} + +void EntryCompletion::complete() +{ + gtk_entry_completion_complete(gobj()); +} + +void EntryCompletion::insert_prefix() +{ + gtk_entry_completion_insert_prefix(gobj()); +} + +void EntryCompletion::delete_action(int index) +{ + gtk_entry_completion_delete_action(gobj(), index); +} + +void EntryCompletion::set_inline_completion(bool inline_completion) +{ + gtk_entry_completion_set_inline_completion(gobj(), static_cast(inline_completion)); +} + +bool EntryCompletion::get_inline_completion() const +{ + return gtk_entry_completion_get_inline_completion(const_cast(gobj())); +} + +void EntryCompletion::set_popup_completion(bool popup_completion) +{ + gtk_entry_completion_set_popup_completion(gobj(), static_cast(popup_completion)); +} + +bool EntryCompletion::get_popup_completion() const +{ + return gtk_entry_completion_get_popup_completion(const_cast(gobj())); +} + +void EntryCompletion::set_text_column(const TreeModelColumnBase& column) +{ + gtk_entry_completion_set_text_column(gobj(), (column).index()); +} + +void EntryCompletion::set_text_column(int column) +{ + gtk_entry_completion_set_text_column(gobj(), column); +} + +int EntryCompletion::get_text_column() +{ + return gtk_entry_completion_get_text_column(gobj()); +} + + +Glib::SignalProxy1< void,int > EntryCompletion::signal_action_activated() +{ + return Glib::SignalProxy1< void,int >(this, &EntryCompletion_signal_action_activated_info); +} + +Glib::SignalProxy1< bool,const Glib::ustring& > EntryCompletion::signal_insert_prefix() +{ + return Glib::SignalProxy1< bool,const Glib::ustring& >(this, &EntryCompletion_signal_insert_prefix_info); +} + + +void Gtk::EntryCompletion::on_action_activated(int index) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->action_activated) + (*base->action_activated)(gobj(),index); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/entrycompletion.h b/libs/gtkmm2/gtk/gtkmm/entrycompletion.h new file mode 100644 index 0000000000..2d8e0c5bd0 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/entrycompletion.h @@ -0,0 +1,323 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ENTRYCOMPLETION_H +#define _GTKMM_ENTRYCOMPLETION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkEntryCompletion GtkEntryCompletion; +typedef struct _GtkEntryCompletionClass GtkEntryCompletionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class EntryCompletion_Class; } // namespace Gtk +namespace Gtk +{ + +class Entry; + + +class EntryCompletion : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef EntryCompletion CppObjectType; + typedef EntryCompletion_Class CppClassType; + typedef GtkEntryCompletion BaseObjectType; + typedef GtkEntryCompletionClass BaseClassType; + +private: friend class EntryCompletion_Class; + static CppClassType entrycompletion_class_; + +private: + // noncopyable + EntryCompletion(const EntryCompletion&); + EntryCompletion& operator=(const EntryCompletion&); + +protected: + explicit EntryCompletion(const Glib::ConstructParams& construct_params); + explicit EntryCompletion(GtkEntryCompletion* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~EntryCompletion(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkEntryCompletion* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkEntryCompletion* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GtkEntryCompletion* gobj_copy(); + +private: + + +protected: + EntryCompletion(); + +public: + + static Glib::RefPtr create(); + + + //Careful, this actually returns a GtkWidget*, so it might not always be a GtkEntry in future GTK+ versions. + + /** Gets the entry @a completion has been attached to. + * @return The entry @a completion has been attached to. + * + * Since: 2.4. + */ + Entry* get_entry(); + + /** Gets the entry @a completion has been attached to. + * @return The entry @a completion has been attached to. + * + * Since: 2.4. + */ + const Entry* get_entry() const; + + + /** Sets the model for a Gtk::EntryCompletion. If @a completion already has + * a model set, it will remove it before setting the new model. + * If model is 0, then it will unset the model. + * + * Since: 2.4 + * @param model The Gtk::TreeModel. + */ + void set_model(const Glib::RefPtr& model); + + /** Returns the model the Gtk::EntryCompletion is using as data source. + * Returns 0 if the model is unset. + * @return A Gtk::TreeModel, or 0 if none is currently being used. + * + * Since: 2.4. + */ + Glib::RefPtr get_model(); + + /** Returns the model the Gtk::EntryCompletion is using as data source. + * Returns 0 if the model is unset. + * @return A Gtk::TreeModel, or 0 if none is currently being used. + * + * Since: 2.4. + */ + Glib::RefPtr get_model() const; + + /// For example, bool on_match(const Glib::ustring& key, const TreeModel::const_iterator& iter); + typedef sigc::slot SlotMatch; + + void set_match_func(const SlotMatch& slot); + + + /** Requires the length of the search key for @a completion to be at least + * @a length . This is useful for long lists, where completing using a small + * key takes a lot of time and will come up with meaningless results anyway + * (ie, a too large dataset). + * + * Since: 2.4 + * @param length The minimum length of the key in order to start completing. + */ + void set_minimum_key_length(int length); + + /** Returns the minimum key length as set for @a completion . + * @return The currently used minimum key length. + * + * Since: 2.4. + */ + int get_minimum_key_length() const; + + /** Requests a completion operation, or in other words a refiltering of the + * current list with completions, using the current key. The completion list + * view will be updated accordingly. + * + * Since: 2.4 + */ + void complete(); + + + /** Requests a prefix insertion. + * + * Since: 2.6 + */ + void insert_prefix(); + + //We reordered the parameters, compared to the C version, so that we can have method overloads without the index. + + // TODO: We would really like an insert() which before-inserts an iterator, like ListStore::insert(), + // but there is no EntryCompletion::insert_before() for us to use. + void insert_action_text(const Glib::ustring& text, int index); + void prepend_action_text(const Glib::ustring& text); + //TODO: Add append_action_text() somehow? It would be slow if we count the children each time. murrayc. + + void insert_action_markup(const Glib::ustring& markup, int index); + void prepend_action_markup(const Glib::ustring& markup); + + + //TODO: Change default - it would be nicer to delete the last action instead of the first. + + /** Deletes the action at @a index from @a completion 's action list. + * + * Since: 2.4 + * @param index The index of the item to Delete. + */ + void delete_action(int index = 0); + + + /** Sets whether the common prefix of the possible completions should + * be automatically inserted in the entry. + * + * Since: 2.6 + * @param inline_completion true to do inline completion. + */ + void set_inline_completion(bool inline_completion = true); + + /** Returns whether the common prefix of the possible completions should + * be automatically inserted in the entry. + * @return true if inline completion is turned on + * + * Since: 2.6. + */ + bool get_inline_completion() const; + + /** Sets whether the completions should be presented in a popup window. + * + * Since: 2.6 + * @param popup_completion true to do popup completion. + */ + void set_popup_completion(bool popup_completion = true); + + /** Returns whether the completions should be presented in a popup window. + * @return true if popup completion is turned on + * + * Since: 2.6. + */ + bool get_popup_completion() const; + + + /** Convenience function for setting up the most used case of this code: a + * completion list with just strings. This function will set up @a completion + * to have a list displaying all (and just) strings in the completion list, + * and to get those strings from @a column in the model of @a completion . + * + * This functions creates and adds a Gtk::CellRendererText for the selected + * column. If you need to set the text column, but don't want the cell + * renderer, use Glib::object_set() to set the ::text_column property directly. + * + * Since: 2.4 + * @param column The column in the model of @a completion to get strings from. + */ + void set_text_column(const TreeModelColumnBase& column); + + /** Convenience function for setting up the most used case of this code: a + * completion list with just strings. This function will set up @a completion + * to have a list displaying all (and just) strings in the completion list, + * and to get those strings from @a column in the model of @a completion . + * + * This functions creates and adds a Gtk::CellRendererText for the selected + * column. If you need to set the text column, but don't want the cell + * renderer, use Glib::object_set() to set the ::text_column property directly. + * + * Since: 2.4 + * @param column The column in the model of @a completion to get strings from. + */ + void set_text_column(int column); + + /** Returns the column in the model of @a completion to get strings from. + * @return The column containing the strings + * + * Since: 2.6. + */ + int get_text_column(); + + + Glib::SignalProxy1< void,int > signal_action_activated(); + + + //We completely hand-code this signal because we want to change how the parameters are wrapped, + //because we need both the iter and the model to make the C++ iter. + + + /** + * @par Prototype: + * bool %match_selected(const TreeModel::iterator& iter) + */ + Glib::SignalProxy1< bool, const TreeModel::iterator& > signal_match_selected(); + + + //We use no_default_handler for this, because we can not add a new vfunc to 2.5 without breaking ABI. + //TODO: Remove no_default_handler when we do an ABI-break-with-parallel-install. + + + Glib::SignalProxy1< bool,const Glib::ustring& > signal_insert_prefix(); + + +protected: + + //Default Signal Handler: + virtual bool on_match_selected(const TreeModel::iterator& iter); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_action_activated(int index); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::EntryCompletion + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkEntryCompletion* object, bool take_copy = false); +} + + +#endif /* _GTKMM_ENTRYCOMPLETION_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/enums.cc b/libs/gtkmm2/gtk/gtkmm/enums.cc new file mode 100644 index 0000000000..a20f39360f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/enums.cc @@ -0,0 +1,283 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +#include +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +// static +GType Glib::Value::value_type() +{ + return gtk_icon_size_get_type(); +} + +namespace Gtk +{ + +float _gtkmm_align_float_from_enum(AlignmentEnum value) +{ + //Choose the float alignment value appropriate for this human-readable enum value: + switch(value) + { + case ALIGN_LEFT: + return 0.0; break; + case ALIGN_CENTER: + return 0.5; break; + case ALIGN_RIGHT: + return 1.0; break; + case ALIGN_TOP: + return _gtkmm_align_float_from_enum(ALIGN_LEFT); break; + case ALIGN_BOTTOM: + return _gtkmm_align_float_from_enum(ALIGN_RIGHT); break; + default: + return _gtkmm_align_float_from_enum(ALIGN_LEFT); break; + } +} + +} //namespace Gtk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gtk_accel_flags_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_anchor_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_arrow_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_attach_options_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_button_box_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_curve_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_delete_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_direction_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_expander_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_icon_size_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_text_direction_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_justification_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_menu_direction_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_metric_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_movement_step_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_orientation_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_corner_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_pack_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_path_priority_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_path_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_policy_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_position_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_relief_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_resize_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_scroll_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_selection_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_shadow_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_state_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_target_flags_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_toolbar_style_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_update_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_visibility_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_window_position_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_window_type_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_wrap_mode_get_type(); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_sort_type_get_type(); +} + + diff --git a/libs/gtkmm2/gtk/gtkmm/enums.h b/libs/gtkmm2/gtk/gtkmm/enums.h new file mode 100644 index 0000000000..07d0830d40 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/enums.h @@ -0,0 +1,1422 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ENUMS_H +#define _GTKMM_ENUMS_H + +#include + +/* $Id$ */ + +/* enums.h + * + * Copyright (C) 2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +namespace Gtk +{ + + +/** @addtogroup gtkmmEnums Enums and Flags */ + +/** + * @ingroup gtkmmEnums + * @par Bitwise operators: + * %AccelFlags operator|(AccelFlags, AccelFlags)
+ * %AccelFlags operator&(AccelFlags, AccelFlags)
+ * %AccelFlags operator^(AccelFlags, AccelFlags)
+ * %AccelFlags operator~(AccelFlags)
+ * %AccelFlags& operator|=(AccelFlags&, AccelFlags)
+ * %AccelFlags& operator&=(AccelFlags&, AccelFlags)
+ * %AccelFlags& operator^=(AccelFlags&, AccelFlags)
+ */ +enum AccelFlags +{ + ACCEL_VISIBLE = 1 << 0, + ACCEL_LOCKED = 1 << 1, + ACCEL_MASK = 0x07 +}; + +/** @ingroup gtkmmEnums */ +inline AccelFlags operator|(AccelFlags lhs, AccelFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline AccelFlags operator&(AccelFlags lhs, AccelFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline AccelFlags operator^(AccelFlags lhs, AccelFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline AccelFlags operator~(AccelFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gtkmmEnums */ +inline AccelFlags& operator|=(AccelFlags& lhs, AccelFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline AccelFlags& operator&=(AccelFlags& lhs, AccelFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline AccelFlags& operator^=(AccelFlags& lhs, AccelFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum AnchorType +{ + ANCHOR_CENTER, + ANCHOR_NORTH, + ANCHOR_NORTH_WEST, + ANCHOR_NORTH_EAST, + ANCHOR_SOUTH, + ANCHOR_SOUTH_WEST, + ANCHOR_SOUTH_EAST, + ANCHOR_WEST, + ANCHOR_EAST, + ANCHOR_N = ANCHOR_NORTH, + ANCHOR_NW = ANCHOR_NORTH_WEST, + ANCHOR_NE = ANCHOR_NORTH_EAST, + ANCHOR_S = ANCHOR_SOUTH, + ANCHOR_SW = ANCHOR_SOUTH_WEST, + ANCHOR_SE = ANCHOR_SOUTH_EAST, + ANCHOR_W = ANCHOR_WEST, + ANCHOR_E = ANCHOR_EAST +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/** Used to indicate the direction in which a Gtk::Arrow should point. + * @ingroup gtkmmEnums + */ +enum ArrowType +{ + ARROW_UP, + ARROW_DOWN, + ARROW_LEFT, + ARROW_RIGHT +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +// TODO: There must be a better way to document the enum values. +// Extract them from the GTK+ docs as well? + +/*! @var ArrowType ARROW_UP + * Represents an upward pointing arrow. + */ +/*! @var ArrowType ARROW_DOWN + * Represents a downward pointing arrow. + */ +/*! @var ArrowType ARROW_LEFT + * Represents a left pointing arrow. + */ +/*! @var ArrowType ARROW_RIGHT + * Represents a right pointing arrow. + */ + +/** Denotes the expansion properties that a widget will have when it (or its parent) is resized. + * @ingroup gtkmmEnums + * @par Bitwise operators: + * %AttachOptions operator|(AttachOptions, AttachOptions)
+ * %AttachOptions operator&(AttachOptions, AttachOptions)
+ * %AttachOptions operator^(AttachOptions, AttachOptions)
+ * %AttachOptions operator~(AttachOptions)
+ * %AttachOptions& operator|=(AttachOptions&, AttachOptions)
+ * %AttachOptions& operator&=(AttachOptions&, AttachOptions)
+ * %AttachOptions& operator^=(AttachOptions&, AttachOptions)
+ */ +enum AttachOptions +{ + EXPAND = 1 << 0, + SHRINK = 1 << 1, + FILL = 1 << 2 +}; + +/** @ingroup gtkmmEnums */ +inline AttachOptions operator|(AttachOptions lhs, AttachOptions rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline AttachOptions operator&(AttachOptions lhs, AttachOptions rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline AttachOptions operator^(AttachOptions lhs, AttachOptions rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline AttachOptions operator~(AttachOptions flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gtkmmEnums */ +inline AttachOptions& operator|=(AttachOptions& lhs, AttachOptions rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline AttachOptions& operator&=(AttachOptions& lhs, AttachOptions rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline AttachOptions& operator^=(AttachOptions& lhs, AttachOptions rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/*! @var AttachOptions EXPAND + * The widget should expand to take up any extra space in its container that has been allocated. + */ +/*! @var AttachOptions SHRINK + * The widget should shrink as and when possible. + */ +/*! @var AttachOptions FILL + * The widget should fill the space allocated to it. + */ + +/** + * @ingroup gtkmmEnums + */ +enum ButtonBoxStyle +{ + BUTTONBOX_DEFAULT_STYLE, + BUTTONBOX_SPREAD, + BUTTONBOX_EDGE, + BUTTONBOX_START, + BUTTONBOX_END +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum CurveType +{ + CURVE_TYPE_LINEAR, + CURVE_TYPE_SPLINE, + CURVE_TYPE_FREE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum DeleteType +{ + DELETE_CHARS, + DELETE_WORDS, + DELETE_DISPLAY_LINES, + DELETE_DISPLAY_LINE_ENDS, + DELETE_PARAGRAPH_ENDS, + DELETE_PARAGRAPHS, + DELETE_WHITESPACE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum DirectionType +{ + DIR_TAB_FORWARD, + DIR_TAB_BACKWARD, + DIR_UP, + DIR_DOWN, + DIR_LEFT, + DIR_RIGHT +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum ExpanderStyle +{ + EXPANDER_COLLAPSED, + EXPANDER_SEMI_COLLAPSED, + EXPANDER_SEMI_EXPANDED, + EXPANDER_EXPANDED +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum BuiltinIconSize +{ + ICON_SIZE_INVALID, + ICON_SIZE_MENU, + ICON_SIZE_SMALL_TOOLBAR, + ICON_SIZE_LARGE_TOOLBAR, + ICON_SIZE_BUTTON, + ICON_SIZE_DND, + ICON_SIZE_DIALOG +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum TextDirection +{ + TEXT_DIR_NONE, + TEXT_DIR_LTR, + TEXT_DIR_RTL +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum Justification +{ + JUSTIFY_LEFT, + JUSTIFY_RIGHT, + JUSTIFY_CENTER, + JUSTIFY_FILL +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum MenuDirectionType +{ + MENU_DIR_PARENT, + MENU_DIR_CHILD, + MENU_DIR_NEXT, + MENU_DIR_PREV +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum MetricType +{ + PIXELS, + INCHES, + CENTIMETERS +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum MovementStep +{ + MOVEMENT_LOGICAL_POSITIONS, + MOVEMENT_VISUAL_POSITIONS, + MOVEMENT_WORDS, + MOVEMENT_DISPLAY_LINES, + MOVEMENT_DISPLAY_LINE_ENDS, + MOVEMENT_PARAGRAPHS, + MOVEMENT_PARAGRAPH_ENDS, + MOVEMENT_PAGES, + MOVEMENT_BUFFER_ENDS, + MOVEMENT_HORIZONTAL_PAGES +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum Orientation +{ + ORIENTATION_HORIZONTAL, + ORIENTATION_VERTICAL +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum CornerType +{ + CORNER_TOP_LEFT, + CORNER_BOTTOM_LEFT, + CORNER_TOP_RIGHT, + CORNER_BOTTOM_RIGHT +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum PackType +{ + PACK_START, + PACK_END +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum PathPriorityType +{ + PATH_PRIO_LOWEST = 0, + PATH_PRIO_GTK = 4, + PATH_PRIO_APPLICATION = 8, + PATH_PRIO_THEME = 10, + PATH_PRIO_RC = 12, + PATH_PRIO_HIGHEST = 15 +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum PathType +{ + PATH_WIDGET, + PATH_WIDGET_CLASS, + PATH_CLASS +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum PolicyType +{ + POLICY_ALWAYS, + POLICY_AUTOMATIC, + POLICY_NEVER +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum PositionType +{ + POS_LEFT, + POS_RIGHT, + POS_TOP, + POS_BOTTOM +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum ReliefStyle +{ + RELIEF_NORMAL, + RELIEF_HALF, + RELIEF_NONE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum ResizeMode +{ + RESIZE_PARENT, + RESIZE_QUEUE, + RESIZE_IMMEDIATE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum ScrollType +{ + SCROLL_NONE, + SCROLL_JUMP, + SCROLL_STEP_BACKWARD, + SCROLL_STEP_FORWARD, + SCROLL_PAGE_BACKWARD, + SCROLL_PAGE_FORWARD, + SCROLL_STEP_UP, + SCROLL_STEP_DOWN, + SCROLL_PAGE_UP, + SCROLL_PAGE_DOWN, + SCROLL_STEP_LEFT, + SCROLL_STEP_RIGHT, + SCROLL_PAGE_LEFT, + SCROLL_PAGE_RIGHT, + SCROLL_START, + SCROLL_END +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum SelectionMode +{ + SELECTION_NONE, + SELECTION_SINGLE, + SELECTION_BROWSE, + SELECTION_MULTIPLE, + SELECTION_EXTENDED = SELECTION_MULTIPLE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum ShadowType +{ + SHADOW_NONE, + SHADOW_IN, + SHADOW_OUT, + SHADOW_ETCHED_IN, + SHADOW_ETCHED_OUT +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum StateType +{ + STATE_NORMAL, + STATE_ACTIVE, + STATE_PRELIGHT, + STATE_SELECTED, + STATE_INSENSITIVE +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + * @par Bitwise operators: + * %TargetFlags operator|(TargetFlags, TargetFlags)
+ * %TargetFlags operator&(TargetFlags, TargetFlags)
+ * %TargetFlags operator^(TargetFlags, TargetFlags)
+ * %TargetFlags operator~(TargetFlags)
+ * %TargetFlags& operator|=(TargetFlags&, TargetFlags)
+ * %TargetFlags& operator&=(TargetFlags&, TargetFlags)
+ * %TargetFlags& operator^=(TargetFlags&, TargetFlags)
+ */ +enum TargetFlags +{ + TARGET_SAME_APP = 1 << 0, + TARGET_SAME_WIDGET = 1 << 1 +}; + +/** @ingroup gtkmmEnums */ +inline TargetFlags operator|(TargetFlags lhs, TargetFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline TargetFlags operator&(TargetFlags lhs, TargetFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline TargetFlags operator^(TargetFlags lhs, TargetFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline TargetFlags operator~(TargetFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gtkmmEnums */ +inline TargetFlags& operator|=(TargetFlags& lhs, TargetFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline TargetFlags& operator&=(TargetFlags& lhs, TargetFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline TargetFlags& operator^=(TargetFlags& lhs, TargetFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum ToolbarStyle +{ + TOOLBAR_ICONS, + TOOLBAR_TEXT, + TOOLBAR_BOTH, + TOOLBAR_BOTH_HORIZ +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum UpdateType +{ + UPDATE_CONTINUOUS, + UPDATE_DISCONTINUOUS, + UPDATE_DELAYED +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum Visibility +{ + VISIBILITY_NONE, + VISIBILITY_PARTIAL, + VISIBILITY_FULL +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum WindowPosition +{ + WIN_POS_NONE, + WIN_POS_CENTER, + WIN_POS_MOUSE, + WIN_POS_CENTER_ALWAYS, + WIN_POS_CENTER_ON_PARENT +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum WindowType +{ + WINDOW_TOPLEVEL, + WINDOW_POPUP +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum WrapMode +{ + WRAP_NONE, + WRAP_CHAR, + WRAP_WORD, + WRAP_WORD_CHAR +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + +/** + * @ingroup gtkmmEnums + */ +enum SortType +{ + SORT_ASCENDING, + SORT_DESCENDING +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/* We use a class to implement the GtkIconSize enum, because you can register + * new "enum" values. The strict type rules of C++ don't allow using an enum + * like that. Gtk::BuiltinIconSize is the actual GtkIconSize wrapper enum. + */ + +/** + * Represents registered icon sizes. + * You can also use a Gtk::BuiltinIconSize instead of an IconSize. + */ +class IconSize +{ +private: + int size_; + +public: + IconSize() : size_ (0) {} + IconSize(BuiltinIconSize size) : size_ (size) {} + + // Behave like an ordinary enum. + explicit IconSize(int size) : size_ (size) {} + operator int() const { return size_; } + + // These static methods are implement in iconfactory.ccg. + static bool lookup(IconSize size, int& width, int& height); + static IconSize register_new(const Glib::ustring& name, int width, int height); + static void register_alias(const Glib::ustring& alias, IconSize target); + static IconSize from_name(const Glib::ustring& name); + static Glib::ustring get_name(IconSize size); +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +namespace Gtk +{ + + /** Methods are overriden so you can use these simple enums, or floats for more precision. + * @ingroup gtkmmEnums + */ + enum AlignmentEnum + { + ALIGN_LEFT, /**< Same as 0.0 */ + ALIGN_CENTER, /**< Same as 0.5 */ + ALIGN_RIGHT, /**< Same as 1.0 */ + ALIGN_TOP, /**< Same as ALIGN_LEFT */ + ALIGN_BOTTOM /**< Same as ALIGN_RIGHT */ + }; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +//We need this because we can't just use floats for enum value. +float _gtkmm_align_float_from_enum(AlignmentEnum value); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} //namespace Gtk + + +#endif /* _GTKMM_ENUMS_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/eventbox.cc b/libs/gtkmm2/gtk/gtkmm/eventbox.cc new file mode 100644 index 0000000000..9b15790c9d --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/eventbox.cc @@ -0,0 +1,170 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::EventBox* wrap(GtkEventBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& EventBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &EventBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_event_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void EventBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* EventBox_Class::wrap_new(GObject* o) +{ + return manage(new EventBox((GtkEventBox*)(o))); + +} + + +/* The implementation: */ + +EventBox::EventBox(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +EventBox::EventBox(GtkEventBox* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +EventBox::~EventBox() +{ + destroy_(); +} + +EventBox::CppClassType EventBox::eventbox_class_; // initialize static member + +GType EventBox::get_type() +{ + return eventbox_class_.init().get_type(); +} + +GType EventBox::get_base_type() +{ + return gtk_event_box_get_type(); +} + + +EventBox::EventBox() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(eventbox_class_.init())) +{ + } + +bool EventBox::get_visible_window() const +{ + return gtk_event_box_get_visible_window(const_cast(gobj())); +} + +void EventBox::set_visible_window(bool visible_window) +{ + gtk_event_box_set_visible_window(gobj(), static_cast(visible_window)); +} + +bool EventBox::get_above_child() const +{ + return gtk_event_box_get_above_child(const_cast(gobj())); +} + +void EventBox::set_above_child(bool above_child) +{ + gtk_event_box_set_above_child(gobj(), static_cast(above_child)); +} + + +Glib::PropertyProxy EventBox::property_visible_window() +{ + return Glib::PropertyProxy(this, "visible-window"); +} + +Glib::PropertyProxy_ReadOnly EventBox::property_visible_window() const +{ + return Glib::PropertyProxy_ReadOnly(this, "visible-window"); +} + +Glib::PropertyProxy EventBox::property_above_child() +{ + return Glib::PropertyProxy(this, "above-child"); +} + +Glib::PropertyProxy_ReadOnly EventBox::property_above_child() const +{ + return Glib::PropertyProxy_ReadOnly(this, "above-child"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/eventbox.h b/libs/gtkmm2/gtk/gtkmm/eventbox.h new file mode 100644 index 0000000000..927f196888 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/eventbox.h @@ -0,0 +1,232 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_EVENTBOX_H +#define _GTKMM_EVENTBOX_H + +#include + +/* $Id$ */ + +/* eventbox.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkEventBox GtkEventBox; +typedef struct _GtkEventBoxClass GtkEventBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class EventBox_Class; } // namespace Gtk +namespace Gtk +{ + +/** Event capturing box. + * + * This widget adds an X Window where one does not + * normally appear, allowing you to capture events. + * It will receive any event which is specified + * with set_events(). + * + * This widget is generally used to add Gtk::Tooltips, button presses, + * and clipping to widgets derived from Gtk::Misc. + * + * @ingroup Widgets + */ + +class EventBox : public Bin +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef EventBox CppObjectType; + typedef EventBox_Class CppClassType; + typedef GtkEventBox BaseObjectType; + typedef GtkEventBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~EventBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class EventBox_Class; + static CppClassType eventbox_class_; + + // noncopyable + EventBox(const EventBox&); + EventBox& operator=(const EventBox&); + +protected: + explicit EventBox(const Glib::ConstructParams& construct_params); + explicit EventBox(GtkEventBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkEventBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkEventBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + EventBox(); + + + /** Returns whether the event box has a visible window. + * See set_visible_window() for details. + * @return true if the event box window is visible + * + * Since: 2.4. + */ + bool get_visible_window() const; + + /** Set whether the event box uses a visible or invisible child + * window. The default is to use visible windows. + * + * In an invisible window event box, the window that that the + * event box creates is a Gdk::INPUT_ONLY window, which + * means that it is invisible and only serves to receive + * events. + * + * A visible window event box creates a visible (Gdk::INPUT_OUTPUT) + * window that acts as the parent window for all the widgets + * contained in the event box. + * + * You should generally make your event box invisible if + * you just want to trap events. Creating a visible window + * may cause artifacts that are visible to the user, especially + * if the user is using a theme with gradients or pixmaps. + * + * The main reason to create a non input-only event box is if + * you want to set the background to a different color or + * draw on it. + * + * <note> + * There is one unexpected issue for an invisible event box that has its + * window below the child. (See set_above_child().) + * Since the input-only window is not an ancestor window of any windows + * that descendent widgets of the event box create, events on these + * windows aren't propagated up by the windowing system, but only by GTK+. + * The practical effect of this is if an event isn't in the event + * mask for the descendant window (see Gtk::Widget::add_events()), + * it won't be received by the event box. + * + * This problem doesn't occur for visible event boxes, because in + * that case, the event box window is actually the ancestor of the + * descendant windows, not just at the same place on the screen. + * </note> + * + * Since: 2.4 + * @param visible_window Boolean value. + */ + void set_visible_window(bool visible_window = true); + + /** Returns whether the event box window is above or below the + * windows of its child. See set_above_child() for + * details. + * @return true if the event box window is above the window + * of its child. + * + * Since: 2.4. + */ + bool get_above_child() const; + + /** Set whether the event box window is positioned above the windows of its child, + * as opposed to below it. If the window is above, all events inside the + * event box will go to the event box. If the window is below, events + * in windows of child widgets will first got to that widget, and then + * to its parents. + * + * The default is to keep the window below the child. + * + * Since: 2.4 + * @param above_child true if the event box window is above the windows of its child. + */ + void set_above_child(bool above_child = true); + + /** Whether the event box is visible + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_visible_window() ; + +/** Whether the event box is visible + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_visible_window() const; + + /** Whether the event-trapping window of the eventbox is above the window of the child widget as opposed to below it. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_above_child() ; + +/** Whether the event-trapping window of the eventbox is above the window of the child widget as opposed to below it. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_above_child() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::EventBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::EventBox* wrap(GtkEventBox* object, bool take_copy = false); +} +#endif /* _GTKMM_EVENTBOX_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/expander.cc b/libs/gtkmm2/gtk/gtkmm/expander.cc new file mode 100644 index 0000000000..e2c7f83908 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/expander.cc @@ -0,0 +1,266 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +Expander::Expander(const Glib::ustring& label, bool mnemonic) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(expander_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0)) +{} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Expander* wrap(GtkExpander* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Expander_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Expander_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_expander_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Expander_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Expander_Class::wrap_new(GObject* o) +{ + return manage(new Expander((GtkExpander*)(o))); + +} + + +/* The implementation: */ + +Expander::Expander(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +Expander::Expander(GtkExpander* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +Expander::~Expander() +{ + destroy_(); +} + +Expander::CppClassType Expander::expander_class_; // initialize static member + +GType Expander::get_type() +{ + return expander_class_.init().get_type(); +} + +GType Expander::get_base_type() +{ + return gtk_expander_get_type(); +} + + +Expander::Expander() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(expander_class_.init())) +{ + } + +void Expander::set_expanded(bool expanded) +{ + gtk_expander_set_expanded(gobj(), static_cast(expanded)); +} + +bool Expander::get_expanded() const +{ + return gtk_expander_get_expanded(const_cast(gobj())); +} + +void Expander::set_spacing(int spacing) +{ + gtk_expander_set_spacing(gobj(), spacing); +} + +int Expander::get_spacing() const +{ + return gtk_expander_get_spacing(const_cast(gobj())); +} + +void Expander::set_label(const Glib::ustring& label) +{ + gtk_expander_set_label(gobj(), label.c_str()); +} + +Glib::ustring Expander::get_label() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_expander_get_label(const_cast(gobj()))); +} + +void Expander::set_use_underline(bool use_underline) +{ + gtk_expander_set_use_underline(gobj(), static_cast(use_underline)); +} + +bool Expander::get_use_underline() const +{ + return gtk_expander_get_use_underline(const_cast(gobj())); +} + +void Expander::set_use_markup(bool use_markup) +{ + gtk_expander_set_use_markup(gobj(), static_cast(use_markup)); +} + +bool Expander::get_use_markup() const +{ + return gtk_expander_get_use_markup(const_cast(gobj())); +} + +void Expander::set_label_widget(Widget& label_widget) +{ + gtk_expander_set_label_widget(gobj(), (label_widget).gobj()); +} + +Widget* Expander::get_label_widget() +{ + return Glib::wrap(gtk_expander_get_label_widget(gobj())); +} + +const Widget* Expander::get_label_widget() const +{ + return Glib::wrap(gtk_expander_get_label_widget(const_cast(gobj()))); +} + + +Glib::PropertyProxy Expander::property_expanded() +{ + return Glib::PropertyProxy(this, "expanded"); +} + +Glib::PropertyProxy_ReadOnly Expander::property_expanded() const +{ + return Glib::PropertyProxy_ReadOnly(this, "expanded"); +} + +Glib::PropertyProxy Expander::property_label() +{ + return Glib::PropertyProxy(this, "label"); +} + +Glib::PropertyProxy_ReadOnly Expander::property_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label"); +} + +Glib::PropertyProxy Expander::property_use_underline() +{ + return Glib::PropertyProxy(this, "use-underline"); +} + +Glib::PropertyProxy_ReadOnly Expander::property_use_underline() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-underline"); +} + +Glib::PropertyProxy Expander::property_use_markup() +{ + return Glib::PropertyProxy(this, "use-markup"); +} + +Glib::PropertyProxy_ReadOnly Expander::property_use_markup() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-markup"); +} + +Glib::PropertyProxy Expander::property_spacing() +{ + return Glib::PropertyProxy(this, "spacing"); +} + +Glib::PropertyProxy_ReadOnly Expander::property_spacing() const +{ + return Glib::PropertyProxy_ReadOnly(this, "spacing"); +} + +Glib::PropertyProxy Expander::property_label_widget() +{ + return Glib::PropertyProxy(this, "label-widget"); +} + +Glib::PropertyProxy_ReadOnly Expander::property_label_widget() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label-widget"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/expander.h b/libs/gtkmm2/gtk/gtkmm/expander.h new file mode 100644 index 0000000000..8f4d52b425 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/expander.h @@ -0,0 +1,362 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_EXPANDER_H +#define _GTKMM_EXPANDER_H + +#include + +/* $Id$ */ + +/* expander.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkExpander GtkExpander; +typedef struct _GtkExpanderClass GtkExpanderClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Expander_Class; } // namespace Gtk +namespace Gtk +{ + +/** A container which can hide its child. + * + * A Expander allows the user to hide or show its child by clicking on an + * expander triangle similar to the triangles used in a Gtk::TreeView. + * + * @ingroup Widgets + */ + +class Expander : public Bin +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Expander CppObjectType; + typedef Expander_Class CppClassType; + typedef GtkExpander BaseObjectType; + typedef GtkExpanderClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Expander(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Expander_Class; + static CppClassType expander_class_; + + // noncopyable + Expander(const Expander&); + Expander& operator=(const Expander&); + +protected: + explicit Expander(const Glib::ConstructParams& construct_params); + explicit Expander(GtkExpander* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkExpander* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkExpander* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + /** Creates a new Expander. + * + * The Expander has an empty label. + * + * Since: 2.4 + */ + Expander(); + + /** Creates a new Expander with a label. + * + * Creates a new expander using label as the text of the label. Settin @a mnemonic to true + * will allow you to precede characters in the label with an underscore which will make them + * underlined. If you need a literal underscore character in a label, use '__' (two underscores). + * The first underlined character represents a keyboard accelerator called a mnemonic. + * Pressing Alt and that key activates the button. + * + * @param label The string for the label describing the Expander. + * @param mnemonic Wether the label may contain underscores to set up accelerators. + + * Since: 2.4 + */ + explicit Expander(const Glib::ustring& label, bool mnemonic = false); + + + /** Sets the state of the expander. Set to true, if you want + * the child widget to be revealed, and false if you want the + * child widget to be hidden. + * + * Since: 2.4 + * @param expanded Whether the child widget is revealed. + */ + void set_expanded(bool expanded = true); + + /** Queries a Gtk::Expander and returns its current state. Returns true + * if the child widget is revealed. + * + * See set_expanded(). + * @return The current state of the expander. + * + * Since: 2.4. + */ + bool get_expanded() const; + + + /** Sets the spacing field of @a expander , which is the number of pixels to + * place between expander and the child. + * + * Since: 2.4 + * @param spacing Distance between the expander and child in pixels. + */ + void set_spacing(int spacing); + + /** Gets the value set by set_spacing(). + * @return Spacing between the expander and child. + * + * Since: 2.4. + */ + int get_spacing() const; + + + /** Sets the text of the label of the expander to @a label . + * + * This will also clear any previously set labels. + * + * Since: 2.4 + * @param label A string. + */ + void set_label(const Glib::ustring& label); + + /** Fetches the text from the label of the expander, as set by + * set_label(). If the label text has not + * been set the return value will be 0. This will be the + * case if you create an empty button with Gtk::Button::new() to + * use as a container. + * @return The text of the label widget. This string is owned + * by the widget and must not be modified or freed. + * + * Since: 2.4. + */ + Glib::ustring get_label() const; + + + /** If true, an underline in the text of the expander label indicates + * the next character should be used for the mnemonic accelerator key. + * + * Since: 2.4 + * @param use_underline true if underlines in the text indicate mnemonics. + */ + void set_use_underline(bool use_underline = true); + + /** Returns whether an embedded underline in the expander label indicates a + * mnemonic. See set_use_underline(). + * @return true if an embedded underline in the expander label + * indicates the mnemonic accelerator keys. + * + * Since: 2.4. + */ + bool get_use_underline() const; + + + /** Sets whether the text of the label contains markup in Pango's text markup + * language. See Gtk::Label::set_markup(). + * + * Since: 2.4 + * @param use_markup true if the label's text should be parsed for markup. + */ + void set_use_markup(bool use_markup = true); + + /** Returns whether the label's text is interpreted as marked up with + * the Pango text markup + * language. See set_use_markup(). + * @return true if the label's text will be parsed for markup + * + * Since: 2.4. + */ + bool get_use_markup() const; + + + /** Set the label widget for the expander. This is the widget + * that will appear embedded alongside the expander arrow. + * + * Since: 2.4 + * @param label_widget The new label widget. + */ + void set_label_widget(Widget& label_widget); + + /** Retrieves the label widget for the frame. See + * set_label_widget(). + * @return The label widget, or 0 if there is none. + * + * Since: 2.4. + */ + Widget* get_label_widget(); + + /** Retrieves the label widget for the frame. See + * set_label_widget(). + * @return The label widget, or 0 if there is none. + * + * Since: 2.4. + */ + const Widget* get_label_widget() const; + + //keybinding + + /** Whether the expander has been opened to reveal the child widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_expanded() ; + +/** Whether the expander has been opened to reveal the child widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_expanded() const; + + /** Text of the expander's label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label() ; + +/** Text of the expander's label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label() const; + + /** If set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_underline() ; + +/** If set + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_underline() const; + + /** The text of the label includes XML markup. See pango_parse_markup. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_markup() ; + +/** The text of the label includes XML markup. See pango_parse_markup. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_markup() const; + + /** Space to put between the label and the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_spacing() ; + +/** Space to put between the label and the child. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_spacing() const; + + /** A widget to display in place of the usual expander label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label_widget() ; + +/** A widget to display in place of the usual expander label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label_widget() const; + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Expander + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Expander* wrap(GtkExpander* object, bool take_copy = false); +} +#endif /* _GTKMM_EXPANDER_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooser.cc b/libs/gtkmm2/gtk/gtkmm/filechooser.cc new file mode 100644 index 0000000000..708a94365c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooser.cc @@ -0,0 +1,581 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +//#include //We include this semi-private header just to get GTK_FILE_SYSTEM_ERROR. + + +namespace +{ + +const Glib::SignalProxyInfo FileChooser_signal_current_folder_changed_info = +{ + "current_folder_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo FileChooser_signal_selection_changed_info = +{ + "selection_changed", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo FileChooser_signal_update_preview_info = +{ + "update_preview", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo FileChooser_signal_file_activated_info = +{ + "file_activated", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gtk_file_chooser_action_get_type(); +} + + +Gtk::FileChooserError::FileChooserError(Gtk::FileChooserError::Code error_code, const Glib::ustring& error_message) +: + Glib::Error (GTK_FILE_CHOOSER_ERROR, error_code, error_message) +{} + +Gtk::FileChooserError::FileChooserError(GError* gobject) +: + Glib::Error (gobject) +{} + +Gtk::FileChooserError::Code Gtk::FileChooserError::code() const +{ + return static_cast(Glib::Error::code()); +} + +void Gtk::FileChooserError::throw_func(GError* gobject) +{ + throw Gtk::FileChooserError(gobject); +} + +// static +GType Glib::Value::value_type() +{ + return gtk_file_chooser_error_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkFileChooser* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& FileChooser_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &FileChooser_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = gtk_file_chooser_get_type(); + } + + return *this; +} + +void FileChooser_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + +} + + +Glib::ObjectBase* FileChooser_Class::wrap_new(GObject* object) +{ + return new FileChooser((GtkFileChooser*)(object)); +} + + +/* The implementation: */ + +FileChooser::FileChooser() +: + Glib::Interface(filechooser_class_.init()) +{} + +FileChooser::FileChooser(GtkFileChooser* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +FileChooser::~FileChooser() +{} + +// static +void FileChooser::add_interface(GType gtype_implementer) +{ + filechooser_class_.init().add_interface(gtype_implementer); +} + +FileChooser::CppClassType FileChooser::filechooser_class_; // initialize static member + +GType FileChooser::get_type() +{ + return filechooser_class_.init().get_type(); +} + +GType FileChooser::get_base_type() +{ + return gtk_file_chooser_get_type(); +} + + +void FileChooser::set_action(FileChooserAction action) +{ + gtk_file_chooser_set_action(gobj(), ((GtkFileChooserAction)(action))); +} + +FileChooserAction FileChooser::get_action() const +{ + return ((FileChooserAction)(gtk_file_chooser_get_action(const_cast(gobj())))); +} + +void FileChooser::set_local_only(bool local_only) +{ + gtk_file_chooser_set_local_only(gobj(), static_cast(local_only)); +} + +bool FileChooser::get_local_only() const +{ + return gtk_file_chooser_get_local_only(const_cast(gobj())); +} + +void FileChooser::set_select_multiple(bool select_multiple) +{ + gtk_file_chooser_set_select_multiple(gobj(), static_cast(select_multiple)); +} + +bool FileChooser::get_select_multiple() const +{ + return gtk_file_chooser_get_select_multiple(const_cast(gobj())); +} + +void FileChooser::set_show_hidden(bool show_hidden) +{ + gtk_file_chooser_set_show_hidden(gobj(), static_cast(show_hidden)); +} + +bool FileChooser::get_show_hidden() const +{ + return gtk_file_chooser_get_show_hidden(const_cast(gobj())); +} + +void FileChooser::set_current_name(const Glib::ustring& name) +{ + gtk_file_chooser_set_current_name(gobj(), name.c_str()); +} + +Glib::ustring FileChooser::get_filename() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_filename(const_cast(gobj()))); +} + +bool FileChooser::set_filename(const Glib::ustring& filename) +{ + return gtk_file_chooser_set_filename(gobj(), filename.c_str()); +} + +bool FileChooser::select_filename(const Glib::ustring& filename) +{ + return gtk_file_chooser_select_filename(gobj(), filename.c_str()); +} + +void FileChooser::unselect_filename(const Glib::ustring& filename) +{ + gtk_file_chooser_unselect_filename(gobj(), filename.c_str()); +} + +void FileChooser::select_all() +{ + gtk_file_chooser_select_all(gobj()); +} + +void FileChooser::unselect_all() +{ + gtk_file_chooser_unselect_all(gobj()); +} + +Glib::SListHandle FileChooser::get_filenames() const +{ + return Glib::SListHandle(gtk_file_chooser_get_filenames(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + +bool FileChooser::set_current_folder(const Glib::ustring& filename) +{ + return gtk_file_chooser_set_current_folder(gobj(), filename.c_str()); +} + +Glib::ustring FileChooser::get_current_folder() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_current_folder(const_cast(gobj()))); +} + +Glib::ustring FileChooser::get_uri() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_uri(const_cast(gobj()))); +} + +bool FileChooser::set_uri(const Glib::ustring& uri) +{ + return gtk_file_chooser_set_uri(gobj(), uri.c_str()); +} + +bool FileChooser::select_uri(const Glib::ustring& uri) +{ + return gtk_file_chooser_select_uri(gobj(), uri.c_str()); +} + +void FileChooser::unselect_uri(const Glib::ustring& uri) +{ + gtk_file_chooser_unselect_uri(gobj(), uri.c_str()); +} + +Glib::SListHandle FileChooser::get_uris() const +{ + return Glib::SListHandle(gtk_file_chooser_get_uris(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + +bool FileChooser::set_current_folder_uri(const Glib::ustring& uri) +{ + return gtk_file_chooser_set_current_folder_uri(gobj(), uri.c_str()); +} + +Glib::ustring FileChooser::get_current_folder_uri() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_current_folder_uri(const_cast(gobj()))); +} + +void FileChooser::set_preview_widget(Gtk::Widget& preview_widget) +{ + gtk_file_chooser_set_preview_widget(gobj(), (preview_widget).gobj()); +} + +const Gtk::Widget* FileChooser::get_preview_widget() const +{ + return Glib::wrap(gtk_file_chooser_get_preview_widget(const_cast(gobj()))); +} + +Gtk::Widget* FileChooser::get_preview_widget() +{ + return Glib::wrap(gtk_file_chooser_get_preview_widget(gobj())); +} + +void FileChooser::set_preview_widget_active(bool active) +{ + gtk_file_chooser_set_preview_widget_active(gobj(), static_cast(active)); +} + +bool FileChooser::get_preview_widget_active() const +{ + return gtk_file_chooser_get_preview_widget_active(const_cast(gobj())); +} + +void FileChooser::set_use_preview_label(bool use_label) +{ + gtk_file_chooser_set_use_preview_label(gobj(), static_cast(use_label)); +} + +bool FileChooser::get_use_preview_label() const +{ + return gtk_file_chooser_get_use_preview_label(const_cast(gobj())); +} + +Glib::ustring FileChooser::get_preview_filename() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_preview_filename(const_cast(gobj()))); +} + +Glib::ustring FileChooser::get_preview_uri() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_preview_uri(const_cast(gobj()))); +} + +void FileChooser::set_extra_widget(Gtk::Widget& extra_widget) +{ + gtk_file_chooser_set_extra_widget(gobj(), (extra_widget).gobj()); +} + +Gtk::Widget* FileChooser::get_extra_widget() +{ + return Glib::wrap(gtk_file_chooser_get_extra_widget(gobj())); +} + +const Gtk::Widget* FileChooser::get_extra_widget() const +{ + return Glib::wrap(gtk_file_chooser_get_extra_widget(const_cast(gobj()))); +} + +void FileChooser::add_filter(const FileFilter& filter) +{ + gtk_file_chooser_add_filter(gobj(), const_cast((filter).gobj())); +} + +void FileChooser::remove_filter(const FileFilter& filter) +{ + gtk_file_chooser_remove_filter(gobj(), const_cast((filter).gobj())); +} + +Glib::SListHandle< FileFilter* > FileChooser::list_filters() +{ + return Glib::SListHandle< FileFilter* >(gtk_file_chooser_list_filters(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +Glib::SListHandle< const FileFilter* > FileChooser::list_filters() const +{ + return Glib::SListHandle< const FileFilter* >(gtk_file_chooser_list_filters(const_cast(gobj())), Glib::OWNERSHIP_SHALLOW); +} + +void FileChooser::set_filter(const FileFilter& filter) +{ + gtk_file_chooser_set_filter(gobj(), const_cast((filter).gobj())); +} + +FileFilter* FileChooser::get_filter() +{ + + FileFilter* retvalue = Glib::wrap(gtk_file_chooser_get_filter(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +const FileFilter* FileChooser::get_filter() const +{ + + const FileFilter* retvalue = Glib::wrap(gtk_file_chooser_get_filter(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +bool FileChooser::add_shortcut_folder(const Glib::ustring& folder) +{ + GError *error = 0; + bool retvalue = gtk_file_chooser_add_shortcut_folder(gobj(), folder.c_str(), &(error)); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +bool FileChooser::remove_shortcut_folder(const Glib::ustring& folder) +{ + GError *error = 0; + bool retvalue = gtk_file_chooser_remove_shortcut_folder(gobj(), folder.c_str(), &(error)); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +Glib::SListHandle FileChooser::list_shortcut_folders() const +{ + return Glib::SListHandle(gtk_file_chooser_list_shortcut_folders(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + +bool FileChooser::add_shortcut_folder_uri(const Glib::ustring& uri) +{ + GError *error = 0; + bool retvalue = gtk_file_chooser_add_shortcut_folder_uri(gobj(), uri.c_str(), &(error)); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +bool FileChooser::remove_shortcut_folder_uri(const Glib::ustring& uri) +{ + GError *error = 0; + bool retvalue = gtk_file_chooser_remove_shortcut_folder_uri(gobj(), uri.c_str(), &(error)); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +Glib::SListHandle FileChooser::list_shortcut_folder_uris() const +{ + return Glib::SListHandle(gtk_file_chooser_list_shortcut_folder_uris(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + + +Glib::SignalProxy0< void > FileChooser::signal_current_folder_changed() +{ + return Glib::SignalProxy0< void >(this, &FileChooser_signal_current_folder_changed_info); +} + +Glib::SignalProxy0< void > FileChooser::signal_selection_changed() +{ + return Glib::SignalProxy0< void >(this, &FileChooser_signal_selection_changed_info); +} + +Glib::SignalProxy0< void > FileChooser::signal_update_preview() +{ + return Glib::SignalProxy0< void >(this, &FileChooser_signal_update_preview_info); +} + +Glib::SignalProxy0< void > FileChooser::signal_file_activated() +{ + return Glib::SignalProxy0< void >(this, &FileChooser_signal_file_activated_info); +} + + +Glib::PropertyProxy FileChooser::property_action() +{ + return Glib::PropertyProxy(this, "action"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_action() const +{ + return Glib::PropertyProxy_ReadOnly(this, "action"); +} + +Glib::PropertyProxy FileChooser::property_filter() +{ + return Glib::PropertyProxy(this, "filter"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_filter() const +{ + return Glib::PropertyProxy_ReadOnly(this, "filter"); +} + +Glib::PropertyProxy FileChooser::property_folder_mode() +{ + return Glib::PropertyProxy(this, "folder-mode"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_folder_mode() const +{ + return Glib::PropertyProxy_ReadOnly(this, "folder-mode"); +} + +Glib::PropertyProxy FileChooser::property_local_only() +{ + return Glib::PropertyProxy(this, "local-only"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_local_only() const +{ + return Glib::PropertyProxy_ReadOnly(this, "local-only"); +} + +Glib::PropertyProxy FileChooser::property_preview_widget() +{ + return Glib::PropertyProxy(this, "preview-widget"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_preview_widget() const +{ + return Glib::PropertyProxy_ReadOnly(this, "preview-widget"); +} + +Glib::PropertyProxy FileChooser::property_preview_widget_active() +{ + return Glib::PropertyProxy(this, "preview-widget-active"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_preview_widget_active() const +{ + return Glib::PropertyProxy_ReadOnly(this, "preview-widget-active"); +} + +Glib::PropertyProxy FileChooser::property_use_preview_label() +{ + return Glib::PropertyProxy(this, "use-preview-label"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_use_preview_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-preview-label"); +} + +Glib::PropertyProxy FileChooser::property_extra_widget() +{ + return Glib::PropertyProxy(this, "extra-widget"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_extra_widget() const +{ + return Glib::PropertyProxy_ReadOnly(this, "extra-widget"); +} + +Glib::PropertyProxy FileChooser::property_select_multiple() +{ + return Glib::PropertyProxy(this, "select-multiple"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_select_multiple() const +{ + return Glib::PropertyProxy_ReadOnly(this, "select-multiple"); +} + +Glib::PropertyProxy FileChooser::property_show_hidden() +{ + return Glib::PropertyProxy(this, "show-hidden"); +} + +Glib::PropertyProxy_ReadOnly FileChooser::property_show_hidden() const +{ + return Glib::PropertyProxy_ReadOnly(this, "show-hidden"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooser.h b/libs/gtkmm2/gtk/gtkmm/filechooser.h new file mode 100644 index 0000000000..2bbc5954ab --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooser.h @@ -0,0 +1,935 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FILECHOOSER_H +#define _GTKMM_FILECHOOSER_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFileChooser GtkFileChooser; +typedef struct _GtkFileChooserClass GtkFileChooserClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FileChooser_Class; } // namespace Gtk +namespace Gtk +{ + +/** @addtogroup gtkmmEnums Enums and Flags */ + +/** + * @ingroup gtkmmEnums + */ +enum FileChooserAction +{ + FILE_CHOOSER_ACTION_OPEN, + FILE_CHOOSER_ACTION_SAVE, + FILE_CHOOSER_ACTION_SELECT_FOLDER, + FILE_CHOOSER_ACTION_CREATE_FOLDER +}; + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +//TODO: //Is GTK_FILE_SYSTEM_ERROR really part of the public API? For instance, do app writers ever need to check for it?. +//If so, then it needs to have a generated get_type() function, like the others. murrayc. +//_TODO_GERROR(FileSystemError,GtkFileSystemError,GTK_FILE_SYSTEM_ERROR) + +/** Exception class for Gdk::FileChooser errors. + */ +class FileChooserError : public Glib::Error +{ +public: + enum Code + { + NONEXISTENT, + BAD_FILENAME + }; + + FileChooserError(Code error_code, const Glib::ustring& error_message); + explicit FileChooserError(GError* gobject); + Code code() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +private: + static void throw_func(GError* gobject); + friend void wrap_init(); // uses throw_func() +#endif +}; + +} // namespace Gtk + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Enum +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +/** + * Gtk::FileChooser is an interface that can be implemented by file selection + * widgets. In gtkmm, the main objects that implement this interface are + * FileChooserWidget and FileChooserDialog. You do not need to write an + * object that implements the FileChooser interface unless you are trying to + * adapt an existing file selector to expose a standard programming interface. + * + * @par File Names and Encodings + * When the user is finished selecting files in a FileChooser, your program + * can get the selected names either as filenames or as URIs. For URIs, the + * normal escaping rules are applied if the URI contains non-ASCII characters. + * However, filenames are always returned in the character set specified by the + * G_FILENAME_ENCODING environment variable. Please see the Glib documentation + * for more details about this variable. + * + * @par Important + * This means that while you can pass the result of FileChooser::get_filename() + * to open(2) or fopen(3), you may not be able to directly + * set it as the text of a Gtk::Label widget unless you convert it first to + * UTF-8, which all gtkmm widgets expect. You should use + * Glib::filename_to_utf8() to convert filenames into strings that can be + * passed to gtkmm widgets. + * + * @note + * The gtkmm FileChooser API is broken in that methods return Glib::ustring + * even though the returned string is not necessarily UTF-8 encoded. Any + * FileChooser method that takes or returns a filename (not a URI) should + * have std::string as parameter or return type. Fortunately this mistake + * doesn't prevent you from handling filenames correctly in your application. + * Just pretend that the API uses std::string and call Glib::filename_to_utf8() + * or Glib::filename_from_utf8() as appropriate. + * + * See http://bugzilla.gnome.org/show_bug.cgi?id=142138 for more information. + */ + +class FileChooser : public Glib::Interface +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef FileChooser CppObjectType; + typedef FileChooser_Class CppClassType; + typedef GtkFileChooser BaseObjectType; + typedef GtkFileChooserClass BaseClassType; + +private: + friend class FileChooser_Class; + static CppClassType filechooser_class_; + + // noncopyable + FileChooser(const FileChooser&); + FileChooser& operator=(const FileChooser&); + +protected: + FileChooser(); // you must derive from this class + explicit FileChooser(GtkFileChooser* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~FileChooser(); + + static void add_interface(GType gtype_implementer); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkFileChooser* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkFileChooser* gobj() const { return reinterpret_cast(gobject_); } + +private: + +public: + + + /** Sets the type of operation that that the chooser is performing; the + * user interface is adapted to suit the selected action. For example, + * an option to create a new folder might be shown if the action is + * Gtk::FILE_CHOOSER_ACTION_SAVE but not if the action is + * Gtk::FILE_CHOOSER_ACTION_OPEN. + * + * Since: 2.4 + * @param action The action that the file selector is performing. + */ + void set_action(FileChooserAction action); + + /** Gets the type of operation that the file chooser is performing; see + * set_action(). + * @return The action that the file selector is performing + * + * Since: 2.4. + */ + FileChooserAction get_action() const; + + /** Sets whether only local files can be selected in the + * file selector. If @a local_only is true (the default), + * then the selected file are files are guaranteed to be + * accessible through the operating systems native file + * file system and therefore the application only + * needs to worry about the filename functions in + * Gtk::FileChooser, like get_filename(), + * rather than the URI functions like + * get_uri(), + * + * Since: 2.4 + * @param local_only true if only local files can be selected. + */ + void set_local_only(bool local_only = true); + + /** Gets whether only local files can be selected in the + * file selector. See set_local_only() + * @return true if only local files can be selected. + * + * Since: 2.4. + */ + bool get_local_only() const; + + /** Sets whether multiple files can be selected in the file selector. This is + * only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN or + * GTK_FILE_CHOOSER_ACTION_SAVE. It cannot be set with either of the folder + * actions. + * + * Since: 2.4 + * @param select_multiple true if multiple files can be selected. + */ + void set_select_multiple(bool select_multiple = true); + + /** Gets whether multiple files can be selected in the file + * selector. See set_select_multiple(). + * @return true if multiple files can be selected. + * + * Since: 2.4. + */ + bool get_select_multiple() const; + + + /** Sets whether hidden files and folders are displayed in the file selector. + * + * Since: 2.6 + * @param show_hidden true if hidden files and folders should be displayed. + */ + void set_show_hidden(bool show_hidden = true); + + /** Gets whether hidden files and folders are displayed in the file selector. + * See set_show_hidden(). + * @return true if hidden files and folders are displayed. + * + * Since: 2.6. + */ + bool get_show_hidden() const; + + + /** Sets the current name in the file selector, as if entered + * by the user. Note that the name passed in here is a UTF-8 + * string rather than a filename. This function is meant for + * such uses as a suggested name in a "Save As..." dialog. + * + * If you want to preselect a particular existing file, you + * should use set_filename() instead. + * + * Since: 2.4 + * @param name The filename to use, as a UTF-8 string. + */ + void set_current_name(const Glib::ustring& name); + + /** Gets the filename for the currently selected file in + * the file selector. If multiple files are selected, + * one of the filenames will be returned at random. + * + * If the file chooser is in folder mode, this function returns the selected + * folder. + * @return The currently selected filename, or an empty string + * if no file is selected, or the selected file can't + * be represented with a local filename. + */ + Glib::ustring get_filename() const; + + /** Sets @a filename as the current filename for the the file chooser; + * If the file name isn't in the current folder of @a chooser , then the + * current folder of @a chooser will be changed to the folder containing + * @a filename . This is equivalent to a sequence of + * unselect_all() followed by select_filename(). + * + * Note that the file must exist, or nothing will be done except + * for the directory change. To pre-enter a filename for the user, as in + * a save-as dialog, use set_current_name() + * @param filename The filename to set as current. + * @return true if both the folder could be changed and the file was + * selected successfully, false otherwise. + * + * Since: 2.4. + */ + bool set_filename(const Glib::ustring& filename); + + /** Selects a filename. If the file name isn't in the current + * folder of @a chooser , then the current folder of @a chooser will + * be changed to the folder containing @a filename . + * @param filename The filename to select. + * @return true if both the folder could be changed and the file was + * selected successfully, false otherwise. + * + * Since: 2.4. + */ + bool select_filename(const Glib::ustring& filename); + + /** Unselects a currently selected filename. If the filename + * is not in the current directory, does not exist, or + * is otherwise not currently selected, does nothing. + * + * Since: 2.4 + * @param filename The filename to unselect. + */ + void unselect_filename(const Glib::ustring& filename); + + /** Selects all the files in the current folder of a file chooser. + * + * Since: 2.4 + */ + void select_all(); + + /** Unselects all the files in the current folder of a file chooser. + * + * Since: 2.4 + */ + void unselect_all(); + + /** Lists all the selected files and subfolders in the current folder of + * @a chooser . The returned names are full absolute paths. If files in the current + * folder cannot be represented as local filenames they will be ignored. (See + * get_uris()) + * @return A G::SList containing the filenames of all selected + * files and subfolders in the current folder. Free the returned list + * with Glib::slist_free(), and the filenames with Glib::free(). + * + * Since: 2.4. + */ + Glib::SListHandle get_filenames() const; + + /** Sets the current folder for @a chooser from a local filename. + * The user will be shown the full contents of the current folder, + * plus user interface elements for navigating to other folders. + * @param filename The full path of the new current folder. + * @return true if the folder could be changed successfully, false + * otherwise. + * + * Since: 2.4. + */ + bool set_current_folder(const Glib::ustring& filename); + + /** Gets the current folder of @a chooser as a local filename. + * See set_current_folder(). + * @return The full path of the current folder, or 0 + * if the current path cannot be represented as a local filename. + * Free with Glib::free(). + * + * Since: 2.4. + */ + Glib::ustring get_current_folder() const; + + +/* URI manipulation + */ + + /** Gets the URI for the currently selected file in + * the file selector. If multiple files are selected, + * one of the filenames will be returned at random. + * + * If the file chooser is in folder mode, this function returns the selected + * folder. + * @return The currently selected URI, or an empty string + * if no file is selected. + */ + Glib::ustring get_uri() const; + + /** Sets the file referred to by @a uri as the current file for the the + * file chooser; If the file name isn't in the current folder of @a chooser , + * then the current folder of @a chooser will be changed to the folder containing + * @a uri . This is equivalent to a sequence of unselect_all() + * followed by select_uri(). + * + * Note that the file must exist, or nothing will be done except + * for the directory change. To pre-enter a filename for the user, as in + * a save-as dialog, use set_current_name() + * @param uri The URI to set as current. + * @return true if both the folder could be changed and the URI was + * selected successfully, false otherwise. + * + * Since: 2.4. + */ + bool set_uri(const Glib::ustring& uri); + + /** Selects the file to by @a uri . If the URI doesn't refer to a + * file in the current folder of @a chooser , then the current folder of + * @a chooser will be changed to the folder containing @a filename . + * @param uri The URI to select. + * @return true if both the folder could be changed and the URI was + * selected successfully, false otherwise. + * + * Since: 2.4. + */ + bool select_uri(const Glib::ustring& uri); + + /** Unselects the file referred to by @a uri . If the file + * is not in the current directory, does not exist, or + * is otherwise not currently selected, does nothing. + * + * Since: 2.4 + * @param uri The URI to unselect. + */ + void unselect_uri(const Glib::ustring& uri); + + /** Lists all the selected files and subfolders in the current folder of + * @a chooser . The returned names are full absolute URIs. + * @return A G::SList containing the URIs of all selected + * files and subfolders in the current folder. Free the returned list + * with Glib::slist_free(), and the filenames with Glib::free(). + * + * Since: 2.4. + */ + Glib::SListHandle get_uris() const; + + + /** Sets the current folder for @a chooser from an URI. + * The user will be shown the full contents of the current folder, + * plus user interface elements for navigating to other folders. + * @param uri The URI for the new current folder. + * @return true if the folder could be changed successfully, false + * otherwise. + * + * Since: 2.4. + */ + bool set_current_folder_uri(const Glib::ustring& uri); + + /** Gets the current folder of @a chooser as an URI. + * See set_current_folder_uri(). + * @return The URI for the current folder. + */ + Glib::ustring get_current_folder_uri() const; + +/* Preview widget + */ + + /** Sets an application-supplied widget to use to display a custom preview + * of the currently selected file. To implement a preview, after setting the + * preview widget, you connect to the ::update-preview + * signal, and call get_preview_filename() or + * get_preview_uri() on each change. If you can + * display a preview of the new file, update your widget and + * set the preview active using set_preview_widget_active(). + * Otherwise, set the preview inactive. + * + * When there is no application-supplied preview widget, or the + * application-supplied preview widget is not active, the file chooser + * may display an internally generated preview of the current file or + * it may display no preview at all. + * + * Since: 2.4 + * @param preview_widget Widget for displaying preview. + */ + void set_preview_widget(Gtk::Widget& preview_widget); + + /** Gets the current preview widget; see + * set_preview_widget(). + * @return The current preview widget, or 0 + * + * Since: 2.4. + */ + const Gtk::Widget* get_preview_widget() const; + + /** Gets the current preview widget; see + * set_preview_widget(). + * @return The current preview widget, or 0 + * + * Since: 2.4. + */ + Gtk::Widget* get_preview_widget(); + + /** Sets whether the preview widget set by + * set_preview_widget_active() should be shown for the + * current filename. When @a active is set to false, the file chooser + * may display an internally generated preview of the current file + * or it may display no preview at all. See + * set_preview_widget() for more details. + * + * Since: 2.4 + * @param active Whether to display the user-specified preview widget. + */ + void set_preview_widget_active(bool active = true); + + /** Gets whether the preview widget set by set_preview_widget() + * should be shown for the current filename. See + * set_preview_widget_active(). + * @return true if the preview widget is active for the current filename. + * + * Since: 2.4. + */ + bool get_preview_widget_active() const; + + + /** Sets whether the file chooser should display a stock label with the name of + * the file that is being previewed; the default is true. Applications that + * want to draw the whole preview area themselves should set this to false and + * display the name themselves in their preview widget. + * + * See also: set_preview_widget() + * + * Since: 2.4 + * @param use_label Whether to display a stock label with the name of the previewed file. + */ + void set_use_preview_label(bool use_label = true); + + /** Gets whether a stock label should be drawn with the name of the previewed + * file. See set_use_preview_label(). + * @return true if the file chooser is set to display a label with the + * name of the previewed file, false otherwise. + */ + bool get_use_preview_label() const; + + + /** Gets the filename that should be previewed in a custom preview + * widget. See set_preview_widget(). + * @return The filename to preview, or an empty string if no file + * is selected, or if the selected file cannot be represented + * as a local filename. + */ + Glib::ustring get_preview_filename() const; + + /** Gets the URI that should be previewed in a custom preview + * widget. See set_preview_widget(). + * @return The URI for the file to preview, or an empty string if no file is + * selected. + */ + Glib::ustring get_preview_uri() const; + +/* Extra widget + */ + + /** Sets an application-supplied widget to provide extra options to the user. + * + * Since: 2.4 + * @param extra_widget Widget for extra options. + */ + void set_extra_widget(Gtk::Widget& extra_widget); + + /** Gets the current preview widget; see + * set_extra_widget(). + * @return The current extra widget, or 0 + * + * Since: 2.4. + */ + Gtk::Widget* get_extra_widget(); + + /** Gets the current preview widget; see + * set_extra_widget(). + * @return The current extra widget, or 0 + * + * Since: 2.4. + */ + const Gtk::Widget* get_extra_widget() const; + +/* List of user selectable filters + */ + + /** Adds @a filter to the list of filters that the user can select between. + * When a filter is selected, only files that are passed by that + * filter are displayed. + * + * Since: 2.4 + * @param filter A Gtk::FileFilter. + */ + void add_filter(const FileFilter& filter); + + /** Removes @a filter from the list of filters that the user can select between. + * + * Since: 2.4 + * @param filter A Gtk::FileFilter. + */ + void remove_filter (const FileFilter& filter); + + + /** Lists the current set of user-selectable filters; see + * add_filter(), remove_filter(). + * @return A G::SList containing the current set of + * user selectable filters. The contents of the list are + * owned by GTK+, but you must free the list itself with + * Glib::slist_free() when you are done with it. + * + * Since: 2.4. + */ + Glib::SListHandle< FileFilter* > list_filters(); + + /** Lists the current set of user-selectable filters; see + * add_filter(), remove_filter(). + * @return A G::SList containing the current set of + * user selectable filters. The contents of the list are + * owned by GTK+, but you must free the list itself with + * Glib::slist_free() when you are done with it. + * + * Since: 2.4. + */ + Glib::SListHandle< const FileFilter* > list_filters() const; + +/* Current filter + */ + + /** Sets the current filter; only the files that pass the + * filter will be displayed. If the user-selectable list of filters + * is non-empty, then the filter should be one of the filters + * in that list. Setting the current filter when the list of + * filters is empty is useful if you want to restrict the displayed + * set of files without letting the user change it. + * + * Since: 2.4 + * @param filter A Gtk::FileFilter. + */ + void set_filter(const FileFilter& filter); + + /** Gets the current filter; see set_filter(). + * @return The current filter, or 0 + * + * Since: 2.4. + */ + FileFilter* get_filter(); + + /** Gets the current filter; see set_filter(). + * @return The current filter, or 0 + * + * Since: 2.4. + */ + const FileFilter* get_filter() const; + +/* Per-application shortcut folders */ + + + /** Adds a folder to be displayed with the shortcut folders in a file chooser. + * Note that shortcut folders do not get saved, as they are provided by the + * application. For example, you can use this to add a + * "/usr/share/mydrawprogram/Clipart" folder to the volume list. + * @param folder Filename of the folder to add. + * @return true if the folder could be added successfully, false + * otherwise. In the latter case, the @a error will be set as appropriate. + * + * Since: 2.4. + */ + bool add_shortcut_folder(const Glib::ustring& folder); + + /** Removes a folder from a file chooser's list of shortcut folders. + * @param folder Filename of the folder to remove. + * @return true if the operation succeeds, false otherwise. + * In the latter case, the @a error will be set as appropriate. + * + * See also: add_shortcut_folder() + * + * Since: 2.4. + */ + bool remove_shortcut_folder(const Glib::ustring& folder); + + /** Queries the list of shortcut folders in the file chooser, as set by + * add_shortcut_folder(). + * @return A list of folder filenames, or 0 if there are no shortcut + * folders. Free the returned list with Glib::slist_free(), and the filenames with + * Glib::free(). + * + * Since: 2.4. + */ + Glib::SListHandle list_shortcut_folders() const; + + + /** Adds a folder URI to be displayed with the shortcut folders in a file + * chooser. Note that shortcut folders do not get saved, as they are provided + * by the application. For example, you can use this to add a + * "file:///usr/share/mydrawprogram/Clipart" folder to the volume list. + * @param uri URI of the folder to add. + * @return true if the folder could be added successfully, false + * otherwise. In the latter case, the @a error will be set as appropriate. + * + * Since: 2.4. + */ + bool add_shortcut_folder_uri(const Glib::ustring& uri); + + /** Removes a folder URI from a file chooser's list of shortcut folders. + * @param uri URI of the folder to remove. + * @return true if the operation succeeds, false otherwise. + * In the latter case, the @a error will be set as appropriate. + * + * See also: add_shortcut_folder_uri() + * + * Since: 2.4. + */ + bool remove_shortcut_folder_uri(const Glib::ustring& uri); + + /** Queries the list of shortcut folders in the file chooser, as set by + * add_shortcut_folder_uri(). + * @return A list of folder URIs, or 0 if there are no shortcut + * folders. Free the returned list with Glib::slist_free(), and the URIs with + * Glib::free(). + * + * Since: 2.4. + */ + Glib::SListHandle list_shortcut_folder_uris() const; + + + Glib::SignalProxy0< void > signal_current_folder_changed(); + + + Glib::SignalProxy0< void > signal_selection_changed(); + + + Glib::SignalProxy0< void > signal_update_preview(); + + + Glib::SignalProxy0< void > signal_file_activated(); + + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_action() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_action() const; + + //TODO: _WRAP_PROPERTY("file-system", FileSystem) //FileSystem is not really public API. + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_filter() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_filter() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_folder_mode() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_folder_mode() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_local_only() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_local_only() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_preview_widget() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_preview_widget() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_preview_widget_active() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_preview_widget_active() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_preview_label() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_preview_label() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_extra_widget() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_extra_widget() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_select_multiple() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_select_multiple() const; + + /** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_show_hidden() ; + +/** + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_show_hidden() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FileChooser + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkFileChooser* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _GTKMM_FILECHOOSER_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooserbutton.cc b/libs/gtkmm2/gtk/gtkmm/filechooserbutton.cc new file mode 100644 index 0000000000..ebdc540ddd --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooserbutton.cc @@ -0,0 +1,203 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +FileChooserButton::FileChooserButton(FileChooserAction action) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::HBox(Glib::ConstructParams(filechooserbutton_class_.init(), "action",action, (char*) 0)) +{ +} + + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::FileChooserButton* wrap(GtkFileChooserButton* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FileChooserButton_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FileChooserButton_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_file_chooser_button_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + FileChooser::add_interface(get_type()); + } + + return *this; +} + +void FileChooserButton_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FileChooserButton_Class::wrap_new(GObject* o) +{ + return manage(new FileChooserButton((GtkFileChooserButton*)(o))); + +} + + +/* The implementation: */ + +FileChooserButton::FileChooserButton(const Glib::ConstructParams& construct_params) +: + Gtk::HBox(construct_params) +{ + } + +FileChooserButton::FileChooserButton(GtkFileChooserButton* castitem) +: + Gtk::HBox((GtkHBox*)(castitem)) +{ + } + +FileChooserButton::~FileChooserButton() +{ + destroy_(); +} + +FileChooserButton::CppClassType FileChooserButton::filechooserbutton_class_; // initialize static member + +GType FileChooserButton::get_type() +{ + return filechooserbutton_class_.init().get_type(); +} + +GType FileChooserButton::get_base_type() +{ + return gtk_file_chooser_button_get_type(); +} + + +FileChooserButton::FileChooserButton(const Glib::ustring& title, FileChooserAction action) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::HBox(Glib::ConstructParams(filechooserbutton_class_.init(), "title", title.c_str(), "action", ((GtkFileChooserAction)(action)), (char*) 0)) +{ + } + +FileChooserButton::FileChooserButton(const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::HBox(Glib::ConstructParams(filechooserbutton_class_.init(), "title", title.c_str(), "action", ((GtkFileChooserAction)(action)), "backend", backend.c_str(), (char*) 0)) +{ + } + +FileChooserButton::FileChooserButton(FileChooserDialog& dialog) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::HBox(Glib::ConstructParams(filechooserbutton_class_.init(), "dialog", (dialog).Gtk::Widget::gobj(), (char*) 0)) +{ + } + +Glib::ustring FileChooserButton::get_title() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_file_chooser_button_get_title(const_cast(gobj()))); +} + +void FileChooserButton::set_title(const Glib::ustring& title) +{ + gtk_file_chooser_button_set_title(gobj(), title.c_str()); +} + +int FileChooserButton::get_width_chars() const +{ + return gtk_file_chooser_button_get_width_chars(const_cast(gobj())); +} + +void FileChooserButton::set_width_chars(int n_chars) +{ + gtk_file_chooser_button_set_width_chars(gobj(), n_chars); +} + + +Glib::PropertyProxy_ReadOnly FileChooserButton::property_dialog() const +{ + return Glib::PropertyProxy_ReadOnly(this, "dialog"); +} + +Glib::PropertyProxy FileChooserButton::property_title() +{ + return Glib::PropertyProxy(this, "title"); +} + +Glib::PropertyProxy_ReadOnly FileChooserButton::property_title() const +{ + return Glib::PropertyProxy_ReadOnly(this, "title"); +} + +Glib::PropertyProxy FileChooserButton::property_width_chars() +{ + return Glib::PropertyProxy(this, "width-chars"); +} + +Glib::PropertyProxy_ReadOnly FileChooserButton::property_width_chars() const +{ + return Glib::PropertyProxy_ReadOnly(this, "width-chars"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooserbutton.h b/libs/gtkmm2/gtk/gtkmm/filechooserbutton.h new file mode 100644 index 0000000000..0865ac58e6 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooserbutton.h @@ -0,0 +1,234 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FILECHOOSERBUTTON_H +#define _GTKMM_FILECHOOSERBUTTON_H + +#include + +/* $Id$ */ + +/* filechooserbutton.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFileChooserButton GtkFileChooserButton; +typedef struct _GtkFileChooserButtonClass GtkFileChooserButtonClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FileChooserButton_Class; } // namespace Gtk +namespace Gtk +{ + +/** A button to launch a file chooser dialog. + * + * This widget lets the user select a file. It implements the FileChooser interface. Visually, it is a file name with a + * button to bring up a FileChooserDialog. The user can then use that dialog to change the file associated with that + * button. This widget does not support setting the "select_multiple" property to true. + * + * The FileChooserButton supports the FileChooserActions FILE_CHOOSER_ACTION_OPEN and FILE_CHOOSER_ACTION_SELECT_FOLDER. + * + * The FileChooserButton will ellipsize the label, and will thus request little horizontal space. To give the button more + * space, you should call size_request(), set_width_chars(), or pack the button in such a way that other interface + * elements give space to the widget. + * + * @ingroup Widgets + */ + +class FileChooserButton + : public HBox, + public FileChooser +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FileChooserButton CppObjectType; + typedef FileChooserButton_Class CppClassType; + typedef GtkFileChooserButton BaseObjectType; + typedef GtkFileChooserButtonClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FileChooserButton(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FileChooserButton_Class; + static CppClassType filechooserbutton_class_; + + // noncopyable + FileChooserButton(const FileChooserButton&); + FileChooserButton& operator=(const FileChooserButton&); + +protected: + explicit FileChooserButton(const Glib::ConstructParams& construct_params); + explicit FileChooserButton(GtkFileChooserButton* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFileChooserButton* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFileChooserButton* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + /** Creates a new file-selecting button widget with the default title. + * @param title The title of the browse dialog. + * @param action The open mode for the widget. + * @param backend The name of the Gtk::FileSystem backend to use. + */ + explicit FileChooserButton(FileChooserAction action = FILE_CHOOSER_ACTION_OPEN); + + /** Creates a new file-selecting button widget. + * + * @param title The title of the browse dialog. + * @param action The open mode for the widget. + */ + explicit FileChooserButton(const Glib::ustring& title, FileChooserAction action = FILE_CHOOSER_ACTION_OPEN); + + /** Creates a new file-selecting button widget using backend. + * + * @param title The title of the browse dialog. + * @param action The open mode for the widget. + * @param backend The name of the Gtk::FileSystem backend to use. + */ + explicit FileChooserButton(const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend); + + /** Creates a new file-selecting button widget which uses dialog as its file-picking window. + * + * @param dialog The dialog to use. + */ + explicit FileChooserButton(FileChooserDialog& dialog); + + + /** Retrieves the title of the browse dialog used by @a button . The returned value + * should not be modified or freed. + * @return A pointer to the browse dialog's title. + * + * Since: 2.6. + */ + Glib::ustring get_title() const; + + /** Modifies the @a title of the browse dialog used by @a button . + * + * Since: 2.6 + * @param title The new browse dialog title. + */ + void set_title(const Glib::ustring& title); + + + /** Retrieves the width in characters of the @a button widget's entry and/or label. + * @return An integer width (in characters) that the button will use to size itself. + * + * Since: 2.6. + */ + int get_width_chars() const; + + /** Sets the width (in characters) that @a button will use to @a n_chars . + * + * Since: 2.6 + * @param n_chars The new width, in chracters. + */ + void set_width_chars(int n_chars); + + + /** The file chooser dialog to use. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_dialog() const; + + + /** The title of the file chooser dialog. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_title() ; + +/** The title of the file chooser dialog. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_title() const; + + /** The desired width of the button widget + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_width_chars() ; + +/** The desired width of the button widget + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_width_chars() const; + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FileChooserButton + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FileChooserButton* wrap(GtkFileChooserButton* object, bool take_copy = false); +} +#endif /* _GTKMM_FILECHOOSERBUTTON_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooserdialog.cc b/libs/gtkmm2/gtk/gtkmm/filechooserdialog.cc new file mode 100644 index 0000000000..88dc4078e5 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooserdialog.cc @@ -0,0 +1,158 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +namespace Gtk +{ + +FileChooserDialog::FileChooserDialog(Gtk::Window& parent, const Glib::ustring& title, FileChooserAction action) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(filechooserdialog_class_.init(), "title",title.c_str(),"action",(GtkFileChooserAction)action, (char*) 0)) +{ + set_transient_for(parent); +} + +FileChooserDialog::FileChooserDialog(const Glib::ustring& title, FileChooserAction action) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(filechooserdialog_class_.init(), "title",title.c_str(),"action",(GtkFileChooserAction)action, (char*) 0)) +{ +} + +FileChooserDialog::FileChooserDialog(const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(filechooserdialog_class_.init(), "title",title.c_str(),"action",(GtkFileChooserAction)action,"file-system-backend",backend.c_str(), (char*) 0)) +{ +} + +FileChooserDialog::FileChooserDialog(Gtk::Window& parent, const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(filechooserdialog_class_.init(), "title",title.c_str(),"action",(GtkFileChooserAction)action,"file-system-backend",backend.c_str(), (char*) 0)) +{ + set_transient_for(parent); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::FileChooserDialog* wrap(GtkFileChooserDialog* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FileChooserDialog_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FileChooserDialog_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_file_chooser_dialog_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + FileChooser::add_interface(get_type()); + } + + return *this; +} + +void FileChooserDialog_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FileChooserDialog_Class::wrap_new(GObject* o) +{ + return new FileChooserDialog((GtkFileChooserDialog*)(o)); //top-level windows can not be manage()ed. + +} + + +/* The implementation: */ + +FileChooserDialog::FileChooserDialog(const Glib::ConstructParams& construct_params) +: + Gtk::Dialog(construct_params) +{ + } + +FileChooserDialog::FileChooserDialog(GtkFileChooserDialog* castitem) +: + Gtk::Dialog((GtkDialog*)(castitem)) +{ + } + +FileChooserDialog::~FileChooserDialog() +{ + destroy_(); +} + +FileChooserDialog::CppClassType FileChooserDialog::filechooserdialog_class_; // initialize static member + +GType FileChooserDialog::get_type() +{ + return filechooserdialog_class_.init().get_type(); +} + +GType FileChooserDialog::get_base_type() +{ + return gtk_file_chooser_dialog_get_type(); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooserdialog.h b/libs/gtkmm2/gtk/gtkmm/filechooserdialog.h new file mode 100644 index 0000000000..08ba746815 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooserdialog.h @@ -0,0 +1,129 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FILECHOOSERDIALOG_H +#define _GTKMM_FILECHOOSERDIALOG_H + +#include + +/* $Id$ */ + +/* filechooserdialog.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFileChooserDialog GtkFileChooserDialog; +typedef struct _GtkFileChooserDialogClass GtkFileChooserDialogClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FileChooserDialog_Class; } // namespace Gtk +namespace Gtk +{ + +/** Convenient file chooser window. + * + * @ingroup Dialogs + */ + +class FileChooserDialog + : public Dialog, + public FileChooser +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FileChooserDialog CppObjectType; + typedef FileChooserDialog_Class CppClassType; + typedef GtkFileChooserDialog BaseObjectType; + typedef GtkFileChooserDialogClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FileChooserDialog(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FileChooserDialog_Class; + static CppClassType filechooserdialog_class_; + + // noncopyable + FileChooserDialog(const FileChooserDialog&); + FileChooserDialog& operator=(const FileChooserDialog&); + +protected: + explicit FileChooserDialog(const Glib::ConstructParams& construct_params); + explicit FileChooserDialog(GtkFileChooserDialog* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFileChooserDialog* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFileChooserDialog* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + explicit FileChooserDialog(Gtk::Window& parent, const Glib::ustring& title, FileChooserAction action = FILE_CHOOSER_ACTION_OPEN); + explicit FileChooserDialog(const Glib::ustring& title, FileChooserAction action = FILE_CHOOSER_ACTION_OPEN); + + + explicit FileChooserDialog(Gtk::Window& parent, const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend); + explicit FileChooserDialog(const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FileChooserDialog + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FileChooserDialog* wrap(GtkFileChooserDialog* object, bool take_copy = false); +} +#endif /* _GTKMM_FILECHOOSERDIALOG_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooserwidget.cc b/libs/gtkmm2/gtk/gtkmm/filechooserwidget.cc new file mode 100644 index 0000000000..db14e802eb --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooserwidget.cc @@ -0,0 +1,150 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::FileChooserWidget* wrap(GtkFileChooserWidget* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FileChooserWidget_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FileChooserWidget_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_file_chooser_widget_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + FileChooser::add_interface(get_type()); + } + + return *this; +} + +void FileChooserWidget_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FileChooserWidget_Class::wrap_new(GObject* o) +{ + return manage(new FileChooserWidget((GtkFileChooserWidget*)(o))); + +} + + +/* The implementation: */ + +FileChooserWidget::FileChooserWidget(const Glib::ConstructParams& construct_params) +: + Gtk::VBox(construct_params) +{ + } + +FileChooserWidget::FileChooserWidget(GtkFileChooserWidget* castitem) +: + Gtk::VBox((GtkVBox*)(castitem)) +{ + } + +FileChooserWidget::~FileChooserWidget() +{ + destroy_(); +} + +FileChooserWidget::CppClassType FileChooserWidget::filechooserwidget_class_; // initialize static member + +GType FileChooserWidget::get_type() +{ + return filechooserwidget_class_.init().get_type(); +} + +GType FileChooserWidget::get_base_type() +{ + return gtk_file_chooser_widget_get_type(); +} + + +FileChooserWidget::FileChooserWidget() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::VBox(Glib::ConstructParams(filechooserwidget_class_.init())) +{ + } + +FileChooserWidget::FileChooserWidget(FileChooserAction action) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::VBox(Glib::ConstructParams(filechooserwidget_class_.init(), "action", ((GtkFileChooserAction)(action)), (char*) 0)) +{ + } + +FileChooserWidget::FileChooserWidget(FileChooserAction action, const Glib::ustring& backend) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::VBox(Glib::ConstructParams(filechooserwidget_class_.init(), "action", ((GtkFileChooserAction)(action)), "backend", backend.c_str(), (char*) 0)) +{ + } + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/filechooserwidget.h b/libs/gtkmm2/gtk/gtkmm/filechooserwidget.h new file mode 100644 index 0000000000..fa8afffd6c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filechooserwidget.h @@ -0,0 +1,140 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FILECHOOSERWIDGET_H +#define _GTKMM_FILECHOOSERWIDGET_H + +#include + +/* $Id$ */ + +/* box.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFileChooserWidget GtkFileChooserWidget; +typedef struct _GtkFileChooserWidgetClass GtkFileChooserWidgetClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FileChooserWidget_Class; } // namespace Gtk +namespace Gtk +{ + +/** File chooser widget that can be embedded in other widgets. + * + * FileChooserWidget is a widget suitable for selecting files. It is the main + * building block of a Gtk::FileChooserDialog. Most applications will only need to use + * the latter; you can use FileChooserWidget as part of a larger window if you have + * special needs. + * + * @ingroup Widgets + */ + +class FileChooserWidget +: public VBox, + public FileChooser +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FileChooserWidget CppObjectType; + typedef FileChooserWidget_Class CppClassType; + typedef GtkFileChooserWidget BaseObjectType; + typedef GtkFileChooserWidgetClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FileChooserWidget(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FileChooserWidget_Class; + static CppClassType filechooserwidget_class_; + + // noncopyable + FileChooserWidget(const FileChooserWidget&); + FileChooserWidget& operator=(const FileChooserWidget&); + +protected: + explicit FileChooserWidget(const Glib::ConstructParams& construct_params); + explicit FileChooserWidget(GtkFileChooserWidget* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFileChooserWidget* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFileChooserWidget* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + FileChooserWidget(); + + /** Creates a file chooser widget that can be embedded in other widgets. + * + * Creates a new FileChooserWidget. This is a file chooser widget that can be embedded in + * custom windows, and it is the same widget that is used by Gtk::FileChooserDialog. + * + * @param action Open or save mode for the widget + * + * Since: 2.4 + */ + explicit FileChooserWidget(FileChooserAction action); + explicit FileChooserWidget(FileChooserAction action, const Glib::ustring& backend); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FileChooserWidget + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FileChooserWidget* wrap(GtkFileChooserWidget* object, bool take_copy = false); +} +#endif /* _GTKMM_FILECHOOSERWIDGET_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/filefilter.cc b/libs/gtkmm2/gtk/gtkmm/filefilter.cc new file mode 100644 index 0000000000..72c921934d --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filefilter.cc @@ -0,0 +1,240 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include //For gtk_file_filter_flags_get_type(). + +namespace +{ + +//SignalProxy_Custom: + +//This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function. +class SignalProxy_Custom +{ +public: + typedef Gtk::FileFilter::SlotCustom SlotType; + + SignalProxy_Custom(const SlotType& slot); + ~SignalProxy_Custom(); + + static gboolean gtk_callback(const GtkFileFilterInfo* filter_info, gpointer data); + static void gtk_callback_destroy(void* data); + +protected: + SlotType slot_; +}; + +SignalProxy_Custom::SignalProxy_Custom(const SlotType& slot) +: + slot_ (slot) +{} + +SignalProxy_Custom::~SignalProxy_Custom() +{} + +gboolean SignalProxy_Custom::gtk_callback(const GtkFileFilterInfo* filter_info, gpointer data) +{ + SignalProxy_Custom *const self = static_cast(data); + + try + { + //Create a suitable C++ instance to pass to the C++ method: + Gtk::FileFilter::Info cppInfo; + cppInfo.contains = (Gtk::FileFilterFlags)filter_info->contains; + cppInfo.filename = Glib::convert_const_gchar_ptr_to_ustring(filter_info->filename); + cppInfo.uri = Glib::convert_const_gchar_ptr_to_ustring(filter_info->uri); + cppInfo.display_name = Glib::convert_const_gchar_ptr_to_ustring(filter_info->display_name); + cppInfo.mime_type = Glib::convert_const_gchar_ptr_to_ustring(filter_info->mime_type); + + return (self->slot_)(cppInfo); + } + catch(...) + { + Glib::exception_handlers_invoke(); + return false; //arbitrary default; + } +} + +void SignalProxy_Custom::gtk_callback_destroy(void* data) +{ + delete static_cast(data); +} + +} //anonymous namespace + +namespace Gtk +{ + +void FileFilter::add_custom(FileFilterFlags needed, const SlotCustom& slot) +{ + //Create a signal proxy. A pointer to this will be passed through the callback's data parameter. + //It will be deleted when SignalProxy_Custom::gtk_callback_destroy() is called. + SignalProxy_Custom *const pSignalProxy = new SignalProxy_Custom(slot); + + gtk_file_filter_add_custom(gobj(), (GtkFileFilterFlags)needed, + &SignalProxy_Custom::gtk_callback, + pSignalProxy, + &SignalProxy_Custom::gtk_callback_destroy); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value::value_type() +{ + return gtk_file_filter_flags_get_type(); +} + + +namespace Glib +{ + +Gtk::FileFilter* wrap(GtkFileFilter* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FileFilter_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FileFilter_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_file_filter_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FileFilter_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FileFilter_Class::wrap_new(GObject* o) +{ + return manage(new FileFilter((GtkFileFilter*)(o))); + +} + + +/* The implementation: */ + +FileFilter::FileFilter(const Glib::ConstructParams& construct_params) +: + Gtk::Object(construct_params) +{ + } + +FileFilter::FileFilter(GtkFileFilter* castitem) +: + Gtk::Object((GtkObject*)(castitem)) +{ + } + +FileFilter::~FileFilter() +{ + destroy_(); +} + +FileFilter::CppClassType FileFilter::filefilter_class_; // initialize static member + +GType FileFilter::get_type() +{ + return filefilter_class_.init().get_type(); +} + +GType FileFilter::get_base_type() +{ + return gtk_file_filter_get_type(); +} + + +FileFilter::FileFilter() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Object(Glib::ConstructParams(filefilter_class_.init())) +{ + } + +void FileFilter::set_name(const Glib::ustring& name) +{ + gtk_file_filter_set_name(gobj(), name.c_str()); +} + +Glib::ustring FileFilter::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_file_filter_get_name(const_cast(gobj()))); +} + +void FileFilter::add_mime_type(const Glib::ustring& mime_type) +{ + gtk_file_filter_add_mime_type(gobj(), mime_type.c_str()); +} + +void FileFilter::add_pattern(const Glib::ustring& pattern) +{ + gtk_file_filter_add_pattern(gobj(), pattern.c_str()); +} + +void FileFilter::add_pixbuf_formats() +{ + gtk_file_filter_add_pixbuf_formats(gobj()); +} + +FileFilterFlags FileFilter::get_needed() const +{ + return ((FileFilterFlags)(gtk_file_filter_get_needed(const_cast(gobj())))); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/filefilter.h b/libs/gtkmm2/gtk/gtkmm/filefilter.h new file mode 100644 index 0000000000..1800856266 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/filefilter.h @@ -0,0 +1,264 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FILEFILTER_H +#define _GTKMM_FILEFILTER_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +//TODO: remove this if we wrap this in a C++ type: +#ifndef DOXYGEN_SHOULD_SKIP_THIS +//typedef struct _GtkFileFilterInfo GtkFileFilterInfo; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFileFilter GtkFileFilter; +typedef struct _GtkFileFilterClass GtkFileFilterClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FileFilter_Class; } // namespace Gtk +namespace Gtk +{ + +/** @addtogroup gtkmmEnums Enums and Flags */ + +/** + * @ingroup gtkmmEnums + * @par Bitwise operators: + * %FileFilterFlags operator|(FileFilterFlags, FileFilterFlags)
+ * %FileFilterFlags operator&(FileFilterFlags, FileFilterFlags)
+ * %FileFilterFlags operator^(FileFilterFlags, FileFilterFlags)
+ * %FileFilterFlags operator~(FileFilterFlags)
+ * %FileFilterFlags& operator|=(FileFilterFlags&, FileFilterFlags)
+ * %FileFilterFlags& operator&=(FileFilterFlags&, FileFilterFlags)
+ * %FileFilterFlags& operator^=(FileFilterFlags&, FileFilterFlags)
+ */ +enum FileFilterFlags +{ + FILE_FILTER_FILENAME = 1 << 0, + FILE_FILTER_URI = 1 << 1, + FILE_FILTER_DISPLAY_NAME = 1 << 2, + FILE_FILTER_MIME_TYPE = 1 << 3 +}; + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags operator|(FileFilterFlags lhs, FileFilterFlags rhs) + { return static_cast(static_cast(lhs) | static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags operator&(FileFilterFlags lhs, FileFilterFlags rhs) + { return static_cast(static_cast(lhs) & static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags operator^(FileFilterFlags lhs, FileFilterFlags rhs) + { return static_cast(static_cast(lhs) ^ static_cast(rhs)); } + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags operator~(FileFilterFlags flags) + { return static_cast(~static_cast(flags)); } + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags& operator|=(FileFilterFlags& lhs, FileFilterFlags rhs) + { return (lhs = static_cast(static_cast(lhs) | static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags& operator&=(FileFilterFlags& lhs, FileFilterFlags rhs) + { return (lhs = static_cast(static_cast(lhs) & static_cast(rhs))); } + +/** @ingroup gtkmmEnums */ +inline FileFilterFlags& operator^=(FileFilterFlags& lhs, FileFilterFlags rhs) + { return (lhs = static_cast(static_cast(lhs) ^ static_cast(rhs))); } + +} // namespace Gtk + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value : public Glib::Value_Flags +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ + + +class FileFilter : public Gtk::Object +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FileFilter CppObjectType; + typedef FileFilter_Class CppClassType; + typedef GtkFileFilter BaseObjectType; + typedef GtkFileFilterClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FileFilter(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FileFilter_Class; + static CppClassType filefilter_class_; + + // noncopyable + FileFilter(const FileFilter&); + FileFilter& operator=(const FileFilter&); + +protected: + explicit FileFilter(const Glib::ConstructParams& construct_params); + explicit FileFilter(GtkFileFilter* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFileFilter* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFileFilter* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + FileFilter(); + + + /** Sets the human-readable name of the filter; this is the string + * that will be displayed in the file selector user interface if + * there is a selectable list of filters. + * + * Since: 2.4 + * @param name The human-readable-name for the filter, or 0 + * to remove any existing name. + */ + void set_name(const Glib::ustring& name); + + /** Gets the human-readable name for the filter. See gtk_file_filter_set_name(). + * @return The human-readable name of the filter, + * or 0. This value is owned by GTK+ and must not + * be modified or freed. + * + * Since: 2.4. + */ + Glib::ustring get_name() const; + + + /** Adds a rule allowing a given mime type to @a filter . + * + * Since: 2.4 + * @param mime_type Name of a MIME type. + */ + void add_mime_type(const Glib::ustring& mime_type); + + /** Adds a rule allowing a shell style glob to a filter. + * + * Since: 2.4 + * @param pattern A shell style glob. + */ + void add_pattern(const Glib::ustring& pattern); + + /** Adds a rule allowing image files in the formats supported + * by GdkPixbuf. + * + * Since: 2.6 + */ + void add_pixbuf_formats(); + + class Info + { + public: + FileFilterFlags contains; + Glib::ustring filename; + Glib::ustring uri; + Glib::ustring display_name; + Glib::ustring mime_type; + }; + + /// For instance, bool on_custom(const Gtk::FileFilter::Info& filter_info); + typedef sigc::slot SlotCustom; + + void add_custom(FileFilterFlags needed, const SlotCustom& slot); + + + /** Gets the fields that need to be filled in for the structure + * passed to gtk_file_filter_filter() + * + * This function will not typically be used by applications; it + * is intended principally for use in the implementation of + * Gtk::FileChooser. + * @return Bitfield of flags indicating needed fields when + * calling gtk_file_filter_filter() + * + * Since: 2.4. + */ + FileFilterFlags get_needed() const; + + //TODO: This method is used by FileChooser implementors, so we don't need to wrap it. + + //_WRAP_METHOD(bool filter(const GtkFileFilterInfo* filter_info), gtk_file_filter_filter) + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FileFilter + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FileFilter* wrap(GtkFileFilter* object, bool take_copy = false); +} +#endif /* _GTKMM_FILEFILTER_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/fileselection.cc b/libs/gtkmm2/gtk/gtkmm/fileselection.cc new file mode 100644 index 0000000000..9379da1c9f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fileselection.cc @@ -0,0 +1,324 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include + + +namespace Gtk +{ + +FileSelection::FileSelection() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(fileselection_class_.init(), "title",(char*) 0, (char*) 0)) +{} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::FileSelection* wrap(GtkFileSelection* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FileSelection_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FileSelection_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_file_selection_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FileSelection_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FileSelection_Class::wrap_new(GObject* o) +{ + return new FileSelection((GtkFileSelection*)(o)); //top-level windows can not be manage()ed. + +} + + +/* The implementation: */ + +FileSelection::FileSelection(const Glib::ConstructParams& construct_params) +: + Gtk::Dialog(construct_params) +{ + } + +FileSelection::FileSelection(GtkFileSelection* castitem) +: + Gtk::Dialog((GtkDialog*)(castitem)) +{ + } + +FileSelection::~FileSelection() +{ + destroy_(); +} + +FileSelection::CppClassType FileSelection::fileselection_class_; // initialize static member + +GType FileSelection::get_type() +{ + return fileselection_class_.init().get_type(); +} + +GType FileSelection::get_base_type() +{ + return gtk_file_selection_get_type(); +} + + +FileSelection::FileSelection(const Glib::ustring& title) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(fileselection_class_.init(), "title", title.c_str(), (char*) 0)) +{ + } + +void FileSelection::set_filename(const std::string& filename) +{ + gtk_file_selection_set_filename(gobj(), (filename).c_str()); +} + +std::string FileSelection::get_filename() const +{ + return std::string(gtk_file_selection_get_filename(const_cast(gobj()))); +} + +void FileSelection::complete(const Glib::ustring& pattern) +{ + gtk_file_selection_complete(gobj(), pattern.c_str()); +} + +void FileSelection::show_fileop_buttons() +{ + gtk_file_selection_show_fileop_buttons(gobj()); +} + +void FileSelection::hide_fileop_buttons() +{ + gtk_file_selection_hide_fileop_buttons(gobj()); +} + +Glib::ArrayHandle FileSelection::get_selections() const +{ + return Glib::ArrayHandle(gtk_file_selection_get_selections(const_cast(gobj())), Glib::OWNERSHIP_DEEP); +} + +void FileSelection::set_select_multiple(bool select_multiple) +{ + gtk_file_selection_set_select_multiple(gobj(), static_cast(select_multiple)); +} + +bool FileSelection::get_select_multiple() const +{ + return gtk_file_selection_get_select_multiple(const_cast(gobj())); +} + +TreeView* FileSelection::get_dir_list() +{ + return Glib::wrap((GtkTreeView*)(gobj()->dir_list)); +} + +const TreeView* FileSelection::get_dir_list() const +{ + return Glib::wrap((GtkTreeView*)(gobj()->dir_list)); +} + +TreeView* FileSelection::get_file_list() +{ + return Glib::wrap((GtkTreeView*)(gobj()->file_list)); +} + +const TreeView* FileSelection::get_file_list() const +{ + return Glib::wrap((GtkTreeView*)(gobj()->file_list)); +} + +OptionMenu* FileSelection::get_history_pulldown() +{ + return Glib::wrap((GtkOptionMenu*)(gobj()->history_pulldown)); +} + +const OptionMenu* FileSelection::get_history_pulldown() const +{ + return Glib::wrap((GtkOptionMenu*)(gobj()->history_pulldown)); +} + +Entry* FileSelection::get_selection_entry() +{ + return Glib::wrap((GtkEntry*)(gobj()->selection_entry)); +} + +const Entry* FileSelection::get_selection_entry() const +{ + return Glib::wrap((GtkEntry*)(gobj()->selection_entry)); +} + +Label* FileSelection::get_selection_text() +{ + return Glib::wrap((GtkLabel*)(gobj()->selection_text)); +} + +const Label* FileSelection::get_selection_text() const +{ + return Glib::wrap((GtkLabel*)(gobj()->selection_text)); +} + +VBox* FileSelection::get_main_vbox() +{ + return Glib::wrap((GtkVBox*)(gobj()->main_vbox)); +} + +const VBox* FileSelection::get_main_vbox() const +{ + return Glib::wrap((GtkVBox*)(gobj()->main_vbox)); +} + +Button* FileSelection::get_ok_button() +{ + return Glib::wrap((GtkButton*)(gobj()->ok_button)); +} + +const Button* FileSelection::get_ok_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->ok_button)); +} + +Button* FileSelection::get_cancel_button() +{ + return Glib::wrap((GtkButton*)(gobj()->cancel_button)); +} + +const Button* FileSelection::get_cancel_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->cancel_button)); +} + +Button* FileSelection::get_help_button() +{ + return Glib::wrap((GtkButton*)(gobj()->help_button)); +} + +const Button* FileSelection::get_help_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->help_button)); +} + +HButtonBox* FileSelection::get_button_area() +{ + return Glib::wrap((GtkHButtonBox*)(gobj()->button_area)); +} + +const HButtonBox* FileSelection::get_button_area() const +{ + return Glib::wrap((GtkHButtonBox*)(gobj()->button_area)); +} + +HBox* FileSelection::get_action_area() +{ + return Glib::wrap((GtkHBox*)(gobj()->action_area)); +} + +const HBox* FileSelection::get_action_area() const +{ + return Glib::wrap((GtkHBox*)(gobj()->action_area)); +} + + +Glib::PropertyProxy FileSelection::property_show_fileops() +{ + return Glib::PropertyProxy(this, "show-fileops"); +} + +Glib::PropertyProxy_ReadOnly FileSelection::property_show_fileops() const +{ + return Glib::PropertyProxy_ReadOnly(this, "show-fileops"); +} + +Glib::PropertyProxy FileSelection::property_filename() +{ + return Glib::PropertyProxy(this, "filename"); +} + +Glib::PropertyProxy_ReadOnly FileSelection::property_filename() const +{ + return Glib::PropertyProxy_ReadOnly(this, "filename"); +} + +Glib::PropertyProxy FileSelection::property_select_multiple() +{ + return Glib::PropertyProxy(this, "select-multiple"); +} + +Glib::PropertyProxy_ReadOnly FileSelection::property_select_multiple() const +{ + return Glib::PropertyProxy_ReadOnly(this, "select-multiple"); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/fileselection.h b/libs/gtkmm2/gtk/gtkmm/fileselection.h new file mode 100644 index 0000000000..6a5e734362 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fileselection.h @@ -0,0 +1,270 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FILESELECTION_H +#define _GTKMM_FILESELECTION_H + +#include + +/* $Id$ */ + + +/* fileselection.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFileSelection GtkFileSelection; +typedef struct _GtkFileSelectionClass GtkFileSelectionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FileSelection_Class; } // namespace Gtk +namespace Gtk +{ + +/** Prompt the user for a file or directory name. + * + * Gtk::FileSelection should be used to retrieve file or directory names from + * the user. It will create a new dialog window containing a directory list, + * and a file list corresponding to the current working directory. The + * filesystem can be navigated using the directory list or the drop-down + * history menu. Alternatively, the TAB key can be used to navigate using + * filename completion - common in text based editors such as emacs and jed. + * + * @deprecated Use the FileChooserDialog instead. + */ + +class FileSelection : public Dialog +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FileSelection CppObjectType; + typedef FileSelection_Class CppClassType; + typedef GtkFileSelection BaseObjectType; + typedef GtkFileSelectionClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FileSelection(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FileSelection_Class; + static CppClassType fileselection_class_; + + // noncopyable + FileSelection(const FileSelection&); + FileSelection& operator=(const FileSelection&); + +protected: + explicit FileSelection(const Glib::ConstructParams& construct_params); + explicit FileSelection(GtkFileSelection* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFileSelection* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFileSelection* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + FileSelection(); + explicit FileSelection(const Glib::ustring& title); + + + /** Sets a default path for the file requestor. If @a filename includes a + * directory path, then the requestor will open with that path as its + * current working directory. + * + * This has the consequence that in order to open the requestor with a + * working directory and an empty filename, @a filename must have a trailing + * directory separator. + * + * The encoding of @a filename is preferred GLib file name encoding, which + * may not be UTF-8. See Glib::filename_from_utf8(). + * @param filename A string to set as the default file name. + */ + void set_filename(const std::string& filename); + + + /** This function returns the selected filename in the GLib file name + * encoding. To convert to UTF-8, call Glib::filename_to_utf8(). The + * returned string points to a statically allocated buffer and should + * be copied if you plan to keep it around. + * + * If no file is selected then the selected directory path is returned. + * @return Currently-selected filename in the on-disk encoding. + */ + std::string get_filename() const; + + + void complete(const Glib::ustring& pattern); + + void show_fileop_buttons(); + + void hide_fileop_buttons(); + + + /** Retrieves the list of file selections the user has made in the dialog box. + * This function is intended for use when the user can select multiple files + * in the file list. + * + * The filenames are in the GLib file name encoding. To convert to + * UTF-8, call Glib::filename_to_utf8() on each string. + * @return A newly-allocated 0-terminated array of strings. Use + * Glib::strfreev() to free it. + */ + Glib::ArrayHandle get_selections() const; + + + /** Sets whether the user is allowed to select multiple files in the file list. + * Use get_selections() to get the list of selected files. + * @param select_multiple Whether or not the user is allowed to select multiple + * files in the file list. + */ + void set_select_multiple(bool select_multiple = true); + + /** Determines whether or not the user is allowed to select multiple files in + * the file list. See set_select_multiple(). + * @return true if the user is allowed to select multiple files in the + * file list. + */ + bool get_select_multiple() const; + + //: Accessors + TreeView* get_dir_list(); + const TreeView* get_dir_list() const; + TreeView* get_file_list(); + const TreeView* get_file_list() const; + OptionMenu* get_history_pulldown(); + const OptionMenu* get_history_pulldown() const; + Entry* get_selection_entry(); + const Entry* get_selection_entry() const; + Label* get_selection_text(); + const Label* get_selection_text() const; + VBox* get_main_vbox(); + const VBox* get_main_vbox() const; + Button* get_ok_button(); + const Button* get_ok_button() const; + Button* get_cancel_button(); + const Button* get_cancel_button() const; + Button* get_help_button(); + const Button* get_help_button() const; + HButtonBox* get_button_area(); + const HButtonBox* get_button_area() const; + HBox* get_action_area(); + const HBox* get_action_area() const; + + /** Whether buttons for creating/manipulating files should be displayed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_show_fileops() ; + +/** Whether buttons for creating/manipulating files should be displayed. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_show_fileops() const; + + /** The currently selected filename. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_filename() ; + +/** The currently selected filename. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_filename() const; + + /** Whether to allow multiple files to be selected. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_select_multiple() ; + +/** Whether to allow multiple files to be selected. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_select_multiple() const; + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FileSelection + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FileSelection* wrap(GtkFileSelection* object, bool take_copy = false); +} +#endif /* _GTKMM_FILESELECTION_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/fixed.cc b/libs/gtkmm2/gtk/gtkmm/fixed.cc new file mode 100644 index 0000000000..9edbae969a --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fixed.cc @@ -0,0 +1,153 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ +} + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Fixed* wrap(GtkFixed* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Fixed_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Fixed_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_fixed_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Fixed_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Fixed_Class::wrap_new(GObject* o) +{ + return manage(new Fixed((GtkFixed*)(o))); + +} + + +/* The implementation: */ + +Fixed::Fixed(const Glib::ConstructParams& construct_params) +: + Gtk::Container(construct_params) +{ + } + +Fixed::Fixed(GtkFixed* castitem) +: + Gtk::Container((GtkContainer*)(castitem)) +{ + } + +Fixed::~Fixed() +{ + destroy_(); +} + +Fixed::CppClassType Fixed::fixed_class_; // initialize static member + +GType Fixed::get_type() +{ + return fixed_class_.init().get_type(); +} + +GType Fixed::get_base_type() +{ + return gtk_fixed_get_type(); +} + + +Fixed::Fixed() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Container(Glib::ConstructParams(fixed_class_.init())) +{ + } + +void Fixed::put(Widget& widget, int x, int y) +{ + gtk_fixed_put(gobj(), (widget).gobj(), x, y); +} + +void Fixed::move(Widget& widget, int x, int y) +{ + gtk_fixed_move(gobj(), (widget).gobj(), x, y); +} + +void Fixed::set_has_window(bool has_window) +{ + gtk_fixed_set_has_window(gobj(), static_cast(has_window)); +} + +bool Fixed::get_has_window() const +{ + return gtk_fixed_get_has_window(const_cast(gobj())); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/fixed.h b/libs/gtkmm2/gtk/gtkmm/fixed.h new file mode 100644 index 0000000000..c7b334a238 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fixed.h @@ -0,0 +1,149 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FIXED_H +#define _GTKMM_FIXED_H + +#include + +/* $Id$ */ + +/* fixed.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFixed GtkFixed; +typedef struct _GtkFixedClass GtkFixedClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Fixed_Class; } // namespace Gtk +namespace Gtk +{ + +/** A container which allows you to position widgets at fixed coordinates. + * + * The Gtk::Fixed widget is a container which can place child widgets at fixed positions and with fixed sizes, given in pixels. It performs no automatic layout management. + * For most applications, you should not use this container, because it will result in truncated text, overlapping widgets, and other display bugs: + * - Themes may change widget sizes. + * - Fonts other than the one you used to write the app will of course change the size of widgets containing text; keep in mind that users may use a larger font because of difficulty reading the default, or they may be using Windows or the framebuffer port of GTK+, where different fonts are available. + * - Translation of text into other languages changes its size. Also, display of non-English text will use a different font in many cases. + * In addition, the fixed widget can't properly be mirrored in right-to-left languages such as Hebrew and Arabic. i.e. normally GTK+ will flip the interface to put labels to the right of the thing they label, but it can't do that with Gtk::Fixed. So your application will not be usable in right-to-left languages. + * Finally, fixed positioning makes it kind of annoying to add/remove GUI elements, since you have to reposition all the other elements. This is a long-term maintenance problem for your application. + * If you know none of these things are an issue for your application, and prefer the simplicity of Gtk::Fixed, by all means use the widget. But you should be aware of the tradeoffs. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class Fixed : public Container +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Fixed CppObjectType; + typedef Fixed_Class CppClassType; + typedef GtkFixed BaseObjectType; + typedef GtkFixedClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Fixed(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Fixed_Class; + static CppClassType fixed_class_; + + // noncopyable + Fixed(const Fixed&); + Fixed& operator=(const Fixed&); + +protected: + explicit Fixed(const Glib::ConstructParams& construct_params); + explicit Fixed(GtkFixed* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFixed* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFixed* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + Fixed(); + + + void put(Widget& widget, int x, int y); + + void move(Widget& widget, int x, int y); + + /** Sets whether a Gtk::Fixed widget is created with a separate + * Gdk::Window for widget->window or not. (By default, it will be + * created with no separate Gdk::Window). This function must be called + * while the Gtk::Fixed is not realized, for instance, immediately after the + * window is created. + * @param has_window true if a separate window should be created. + */ + void set_has_window(bool has_window = true); + + /** Gets whether the Gtk::Fixed has its own Gdk::Window. + * See gdk_fixed_set_has_window(). + * @return true if @a fixed has its own window. + */ + bool get_has_window() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::Fixed + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Fixed* wrap(GtkFixed* object, bool take_copy = false); +} +#endif /* _GTKMM_FIXED_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/fontbutton.cc b/libs/gtkmm2/gtk/gtkmm/fontbutton.cc new file mode 100644 index 0000000000..4644534f21 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fontbutton.cc @@ -0,0 +1,324 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + + +} // namespace Gtk + + +namespace +{ + +const Glib::SignalProxyInfo FontButton_signal_font_set_info = +{ + "font-set", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::FontButton* wrap(GtkFontButton* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FontButton_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FontButton_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_font_button_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FontButton_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->font_set = &font_set_callback; +} + + +void FontButton_Class::font_set_callback(GtkFontButton* self) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_font_set(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->font_set) + (*base->font_set)(self); + } +} + + +Glib::ObjectBase* FontButton_Class::wrap_new(GObject* o) +{ + return manage(new FontButton((GtkFontButton*)(o))); + +} + + +/* The implementation: */ + +FontButton::FontButton(const Glib::ConstructParams& construct_params) +: + Gtk::Button(construct_params) +{ + } + +FontButton::FontButton(GtkFontButton* castitem) +: + Gtk::Button((GtkButton*)(castitem)) +{ + } + +FontButton::~FontButton() +{ + destroy_(); +} + +FontButton::CppClassType FontButton::fontbutton_class_; // initialize static member + +GType FontButton::get_type() +{ + return fontbutton_class_.init().get_type(); +} + +GType FontButton::get_base_type() +{ + return gtk_font_button_get_type(); +} + + +FontButton::FontButton() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Button(Glib::ConstructParams(fontbutton_class_.init())) +{ + } + +FontButton::FontButton(const Glib::ustring& fontname) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Button(Glib::ConstructParams(fontbutton_class_.init(), "fontname", fontname.c_str(), (char*) 0)) +{ + } + +Glib::ustring FontButton::get_title() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_font_button_get_title(const_cast(gobj()))); +} + +void FontButton::set_title(const Glib::ustring& title) +{ + gtk_font_button_set_title(gobj(), title.c_str()); +} + +bool FontButton::get_use_font() const +{ + return gtk_font_button_get_use_font(const_cast(gobj())); +} + +void FontButton::set_use_font(bool use_font) +{ + gtk_font_button_set_use_font(gobj(), static_cast(use_font)); +} + +bool FontButton::get_use_size() const +{ + return gtk_font_button_get_use_size(const_cast(gobj())); +} + +void FontButton::set_use_size(bool use_size) +{ + gtk_font_button_set_use_size(gobj(), static_cast(use_size)); +} + +Glib::ustring FontButton::get_font_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_font_button_get_font_name(const_cast(gobj()))); +} + +bool FontButton::set_font_name(const Glib::ustring& fontname) +{ + return gtk_font_button_set_font_name(gobj(), fontname.c_str()); +} + +bool FontButton::get_show_style() const +{ + return gtk_font_button_get_show_style(const_cast(gobj())); +} + +void FontButton::set_show_style(bool show_style) +{ + gtk_font_button_set_show_style(gobj(), static_cast(show_style)); +} + +bool FontButton::get_show_size() const +{ + return gtk_font_button_get_show_size(const_cast(gobj())); +} + +void FontButton::set_show_size(bool show_size) +{ + gtk_font_button_set_show_size(gobj(), static_cast(show_size)); +} + + +Glib::SignalProxy0< void > FontButton::signal_font_set() +{ + return Glib::SignalProxy0< void >(this, &FontButton_signal_font_set_info); +} + + +Glib::PropertyProxy FontButton::property_title() +{ + return Glib::PropertyProxy(this, "title"); +} + +Glib::PropertyProxy_ReadOnly FontButton::property_title() const +{ + return Glib::PropertyProxy_ReadOnly(this, "title"); +} + +Glib::PropertyProxy FontButton::property_font_name() +{ + return Glib::PropertyProxy(this, "font-name"); +} + +Glib::PropertyProxy_ReadOnly FontButton::property_font_name() const +{ + return Glib::PropertyProxy_ReadOnly(this, "font-name"); +} + +Glib::PropertyProxy FontButton::property_use_font() +{ + return Glib::PropertyProxy(this, "use-font"); +} + +Glib::PropertyProxy_ReadOnly FontButton::property_use_font() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-font"); +} + +Glib::PropertyProxy FontButton::property_use_size() +{ + return Glib::PropertyProxy(this, "use-size"); +} + +Glib::PropertyProxy_ReadOnly FontButton::property_use_size() const +{ + return Glib::PropertyProxy_ReadOnly(this, "use-size"); +} + +Glib::PropertyProxy FontButton::property_show_style() +{ + return Glib::PropertyProxy(this, "show-style"); +} + +Glib::PropertyProxy_ReadOnly FontButton::property_show_style() const +{ + return Glib::PropertyProxy_ReadOnly(this, "show-style"); +} + +Glib::PropertyProxy FontButton::property_show_size() +{ + return Glib::PropertyProxy(this, "show-size"); +} + +Glib::PropertyProxy_ReadOnly FontButton::property_show_size() const +{ + return Glib::PropertyProxy_ReadOnly(this, "show-size"); +} + + +void Gtk::FontButton::on_font_set() +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->font_set) + (*base->font_set)(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/fontbutton.h b/libs/gtkmm2/gtk/gtkmm/fontbutton.h new file mode 100644 index 0000000000..79edaa1d02 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fontbutton.h @@ -0,0 +1,311 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FONTBUTTON_H +#define _GTKMM_FONTBUTTON_H + +#include + +/* $Id$ */ + +/* fontbutton.h + * + * Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFontButton GtkFontButton; +typedef struct _GtkFontButtonClass GtkFontButtonClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FontButton_Class; } // namespace Gtk +namespace Gtk +{ + +/** A button to launch a font selection dialog. + * + * The Gtk::FontButton is a button which displays the currently selected font and + * allows to open a font selection dialog to change the font. It is suitable widget + * for selecting a font in a preference dialog. + * @ingroup Widgets + */ + +class FontButton : public Button +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontButton CppObjectType; + typedef FontButton_Class CppClassType; + typedef GtkFontButton BaseObjectType; + typedef GtkFontButtonClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FontButton(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FontButton_Class; + static CppClassType fontbutton_class_; + + // noncopyable + FontButton(const FontButton&); + FontButton& operator=(const FontButton&); + +protected: + explicit FontButton(const Glib::ConstructParams& construct_params); + explicit FontButton(GtkFontButton* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFontButton* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFontButton* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_font_set(); + + +private: + +public: + FontButton(); + explicit FontButton(const Glib::ustring& fontname); + + + /** Retrieves the title of the font selection dialog. + * @return An internal copy of the title string which must not be freed. + * + * Since: 2.4. + */ + Glib::ustring get_title() const; + + /** Sets the title for the font selection dialog. + * + * Since: 2.4 + * @param title A string containing the font selection dialog title. + */ + void set_title(const Glib::ustring& title); + + /** Returns whether the selected font is used in the label. + * @return Whether the selected font is used in the label. + * + * Since: 2.4. + */ + bool get_use_font() const; + + /** If @a use_font is true, the font name will be written using the selected font. + * + * Since: 2.4 + * @param use_font If true, font name will be written using font chosen. + */ + void set_use_font(bool use_font = true); + + /** Returns whether the selected size is used in the label. + * @return Whether the selected size is used in the label. + * + * Since: 2.4. + */ + bool get_use_size() const; + + /** If @a use_size is true, the font name will be written using the selected size. + * + * Since: 2.4 + * @param use_size If true, font name will be written using the selected size. + */ + void set_use_size(bool use_size = true); + + /** Retrieves the name of the currently selected font. + * @return An internal copy of the font name which must not be freed. + * + * Since: 2.4. + */ + Glib::ustring get_font_name() const; + + /** Sets or updates the currently-displayed font in font picker dialog. + * @param fontname Name of font to display in font selection dialog. + * @return Return value of Gtk::FontSelectionDialog::set_font_name() if the + * font selection dialog exists, otherwise false. + * + * Since: 2.4. + */ + bool set_font_name(const Glib::ustring& fontname); + + /** Returns whether the name of the font style will be shown in the label. + * @return Whether the font style will be shown in the label. + * + * Since: 2.4. + */ + bool get_show_style() const; + + /** If @a show_style is true, the font style will be displayed along with name of the selected font. + * + * Since: 2.4 + * @param show_style true if font style should be displayed in label. + */ + void set_show_style(bool show_style = true); + + /** Returns whether the font size will be shown in the label. + * @return Whether the font size will be shown in the label. + * + * Since: 2.4. + */ + bool get_show_size() const; + + /** If @a show_size is true, the font size will be displayed along with the name of the selected font. + * + * Since: 2.4 + * @param show_size true if font size should be displayed in dialog. + */ + void set_show_size(bool show_size = true); + + /** The title of the font selection dialog. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_title() ; + +/** The title of the font selection dialog. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_title() const; + + /** The name of the selected font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_font_name() ; + +/** The name of the selected font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_font_name() const; + + /** Whether the label is drawn in the selected font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_font() ; + +/** Whether the label is drawn in the selected font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_font() const; + + /** Whether the label is drawn with the selected font size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_use_size() ; + +/** Whether the label is drawn with the selected font size. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_use_size() const; + + /** Whether the selected font style is shown in the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_show_style() ; + +/** Whether the selected font style is shown in the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_show_style() const; + + /** Whether selected font size is shown in the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_show_size() ; + +/** Whether selected font size is shown in the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_show_size() const; + + + Glib::SignalProxy0< void > signal_font_set(); + + +}; + + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FontButton + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FontButton* wrap(GtkFontButton* object, bool take_copy = false); +} +#endif /* _GTKMM_FONTBUTTON_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/fontselection.cc b/libs/gtkmm2/gtk/gtkmm/fontselection.cc new file mode 100644 index 0000000000..45ccfcee76 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fontselection.cc @@ -0,0 +1,401 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::FontSelection* wrap(GtkFontSelection* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FontSelection_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FontSelection_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_font_selection_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FontSelection_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FontSelection_Class::wrap_new(GObject* o) +{ + return manage(new FontSelection((GtkFontSelection*)(o))); + +} + + +/* The implementation: */ + +FontSelection::FontSelection(const Glib::ConstructParams& construct_params) +: + Gtk::VBox(construct_params) +{ + } + +FontSelection::FontSelection(GtkFontSelection* castitem) +: + Gtk::VBox((GtkVBox*)(castitem)) +{ + } + +FontSelection::~FontSelection() +{ + destroy_(); +} + +FontSelection::CppClassType FontSelection::fontselection_class_; // initialize static member + +GType FontSelection::get_type() +{ + return fontselection_class_.init().get_type(); +} + +GType FontSelection::get_base_type() +{ + return gtk_font_selection_get_type(); +} + + +FontSelection::FontSelection() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::VBox(Glib::ConstructParams(fontselection_class_.init())) +{ + } + +Glib::ustring FontSelection::get_font_name() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_font_selection_get_font_name(const_cast(gobj()))); +} + +bool FontSelection::set_font_name(const Glib::ustring& fontname) +{ + return gtk_font_selection_set_font_name(gobj(), fontname.c_str()); +} + +Glib::ustring FontSelection::get_preview_text() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_font_selection_get_preview_text(const_cast(gobj()))); +} + +void FontSelection::set_preview_text(const Glib::ustring& fontname) +{ + gtk_font_selection_set_preview_text(gobj(), fontname.c_str()); +} + +Entry* FontSelection::get_font_entry() +{ + return Glib::wrap((GtkEntry*)(gobj()->font_entry)); +} + +const Entry* FontSelection::get_font_entry() const +{ + return Glib::wrap((GtkEntry*)(gobj()->font_entry)); +} + +Entry* FontSelection::get_font_style_entry() +{ + return Glib::wrap((GtkEntry*)(gobj()->font_style_entry)); +} + +const Entry* FontSelection::get_font_style_entry() const +{ + return Glib::wrap((GtkEntry*)(gobj()->font_style_entry)); +} + +Entry* FontSelection::get_size_entry() +{ + return Glib::wrap((GtkEntry*)(gobj()->size_entry)); +} + +const Entry* FontSelection::get_size_entry() const +{ + return Glib::wrap((GtkEntry*)(gobj()->size_entry)); +} + +RadioButton* FontSelection::get_pixels_button() +{ + return Glib::wrap((GtkRadioButton*)(gobj()->pixels_button)); +} + +const RadioButton* FontSelection::get_pixels_button() const +{ + return Glib::wrap((GtkRadioButton*)(gobj()->pixels_button)); +} + +RadioButton* FontSelection::get_points_button() +{ + return Glib::wrap((GtkRadioButton*)(gobj()->points_button)); +} + +const RadioButton* FontSelection::get_points_button() const +{ + return Glib::wrap((GtkRadioButton*)(gobj()->points_button)); +} + +Button* FontSelection::get_filter_button() +{ + return Glib::wrap((GtkButton*)(gobj()->filter_button)); +} + +const Button* FontSelection::get_filter_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->filter_button)); +} + +Entry* FontSelection::get_preview_entry() +{ + return Glib::wrap((GtkEntry*)(gobj()->preview_entry)); +} + +const Entry* FontSelection::get_preview_entry() const +{ + return Glib::wrap((GtkEntry*)(gobj()->preview_entry)); +} + + +Glib::PropertyProxy FontSelection::property_font_name() +{ + return Glib::PropertyProxy(this, "font-name"); +} + +Glib::PropertyProxy_ReadOnly FontSelection::property_font_name() const +{ + return Glib::PropertyProxy_ReadOnly(this, "font-name"); +} + +Glib::PropertyProxy FontSelection::property_preview_text() +{ + return Glib::PropertyProxy(this, "preview-text"); +} + +Glib::PropertyProxy_ReadOnly FontSelection::property_preview_text() const +{ + return Glib::PropertyProxy_ReadOnly(this, "preview-text"); +} + + +} // namespace Gtk + + +namespace Glib +{ + +Gtk::FontSelectionDialog* wrap(GtkFontSelectionDialog* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FontSelectionDialog_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FontSelectionDialog_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_font_selection_dialog_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FontSelectionDialog_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FontSelectionDialog_Class::wrap_new(GObject* o) +{ + return new FontSelectionDialog((GtkFontSelectionDialog*)(o)); //top-level windows can not be manage()ed. + +} + + +/* The implementation: */ + +FontSelectionDialog::FontSelectionDialog(const Glib::ConstructParams& construct_params) +: + Gtk::Dialog(construct_params) +{ + } + +FontSelectionDialog::FontSelectionDialog(GtkFontSelectionDialog* castitem) +: + Gtk::Dialog((GtkDialog*)(castitem)) +{ + } + +FontSelectionDialog::~FontSelectionDialog() +{ + destroy_(); +} + +FontSelectionDialog::CppClassType FontSelectionDialog::fontselectiondialog_class_; // initialize static member + +GType FontSelectionDialog::get_type() +{ + return fontselectiondialog_class_.init().get_type(); +} + +GType FontSelectionDialog::get_base_type() +{ + return gtk_font_selection_dialog_get_type(); +} + +FontSelectionDialog::FontSelectionDialog() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(fontselectiondialog_class_.init())) +{ + } + +FontSelectionDialog::FontSelectionDialog(const Glib::ustring& title) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Dialog(Glib::ConstructParams(fontselectiondialog_class_.init(), "title", title.c_str(), (char*) 0)) +{ + } + +bool FontSelectionDialog::set_font_name(const Glib::ustring& fontname) +{ + return gtk_font_selection_dialog_set_font_name(gobj(), fontname.c_str()); +} + +Glib::ustring FontSelectionDialog::get_font_name() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(gtk_font_selection_dialog_get_font_name(const_cast(gobj()))); +} + +Glib::ustring FontSelectionDialog::get_preview_text() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_font_selection_dialog_get_preview_text(const_cast(gobj()))); +} + +void FontSelectionDialog::set_preview_text(const Glib::ustring& fontname) +{ + gtk_font_selection_dialog_set_preview_text(gobj(), fontname.c_str()); +} + +FontSelection* FontSelectionDialog::get_font_selection() +{ + return Glib::wrap((GtkFontSelection*)(gobj()->fontsel)); +} + +const FontSelection* FontSelectionDialog::get_font_selection() const +{ + return Glib::wrap((GtkFontSelection*)(gobj()->fontsel)); +} + +Button* FontSelectionDialog::get_ok_button() +{ + return Glib::wrap((GtkButton*)(gobj()->ok_button)); +} + +const Button* FontSelectionDialog::get_ok_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->ok_button)); +} + +Button* FontSelectionDialog::get_apply_button() +{ + return Glib::wrap((GtkButton*)(gobj()->apply_button)); +} + +const Button* FontSelectionDialog::get_apply_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->apply_button)); +} + +Button* FontSelectionDialog::get_cancel_button() +{ + return Glib::wrap((GtkButton*)(gobj()->cancel_button)); +} + +const Button* FontSelectionDialog::get_cancel_button() const +{ + return Glib::wrap((GtkButton*)(gobj()->cancel_button)); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/fontselection.h b/libs/gtkmm2/gtk/gtkmm/fontselection.h new file mode 100644 index 0000000000..ae0b9045d6 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/fontselection.h @@ -0,0 +1,292 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FONTSELECTION_H +#define _GTKMM_FONTSELECTION_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFontSelection GtkFontSelection; +typedef struct _GtkFontSelectionClass GtkFontSelectionClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FontSelection_Class; } // namespace Gtk +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFontSelectionDialog GtkFontSelectionDialog; +typedef struct _GtkFontSelectionDialogClass GtkFontSelectionDialogClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class FontSelectionDialog_Class; } // namespace Gtk +namespace Gtk +{ + +class Button; +class Entry; +class RadioButton; + + +/** A widget for selecting fonts. + * + * The Gtk::FontSelection widget lists the available fonts, styles and + * sizes, allowing the user to select a font. It is used in the + * Gtk::FontSelectionDialog widget to provide a dialog box for selecting + * fonts. + * + * @ingroup Widgets + */ + +class FontSelection : public VBox +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontSelection CppObjectType; + typedef FontSelection_Class CppClassType; + typedef GtkFontSelection BaseObjectType; + typedef GtkFontSelectionClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FontSelection(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FontSelection_Class; + static CppClassType fontselection_class_; + + // noncopyable + FontSelection(const FontSelection&); + FontSelection& operator=(const FontSelection&); + +protected: + explicit FontSelection(const Glib::ConstructParams& construct_params); + explicit FontSelection(GtkFontSelection* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFontSelection* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFontSelection* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + FontSelection(); + + + Glib::ustring get_font_name() const; + + bool set_font_name(const Glib::ustring& fontname); + + Glib::ustring get_preview_text() const; + + void set_preview_text(const Glib::ustring& fontname); + + // Font page + Entry* get_font_entry(); + const Entry* get_font_entry() const; + Entry* get_font_style_entry(); + const Entry* get_font_style_entry() const; + Entry* get_size_entry(); + const Entry* get_size_entry() const; + + RadioButton* get_pixels_button(); + const RadioButton* get_pixels_button() const; + RadioButton* get_points_button(); + const RadioButton* get_points_button() const; + Button* get_filter_button(); + const Button* get_filter_button() const; + + Entry* get_preview_entry(); + const Entry* get_preview_entry() const; + + /** The X string that represents this font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_font_name() ; + +/** The X string that represents this font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_font_name() const; + + /** The text to display in order to demonstrate the selected font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_preview_text() ; + +/** The text to display in order to demonstrate the selected font. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_preview_text() const; + + +}; + +/** A dialog box for selecting fonts. + * + * The Gtk::FontSelectionDialog widget is a dialog box for selecting a font. + * + * @ingroup Dialogs + */ + +class FontSelectionDialog : public Dialog +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontSelectionDialog CppObjectType; + typedef FontSelectionDialog_Class CppClassType; + typedef GtkFontSelectionDialog BaseObjectType; + typedef GtkFontSelectionDialogClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~FontSelectionDialog(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class FontSelectionDialog_Class; + static CppClassType fontselectiondialog_class_; + + // noncopyable + FontSelectionDialog(const FontSelectionDialog&); + FontSelectionDialog& operator=(const FontSelectionDialog&); + +protected: + explicit FontSelectionDialog(const Glib::ConstructParams& construct_params); + explicit FontSelectionDialog(GtkFontSelectionDialog* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFontSelectionDialog* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFontSelectionDialog* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + + +public: + + FontSelectionDialog(); + explicit FontSelectionDialog(const Glib::ustring& title); + + + bool set_font_name(const Glib::ustring& fontname); + + Glib::ustring get_font_name() const; + + Glib::ustring get_preview_text() const; + + void set_preview_text(const Glib::ustring& fontname); + + FontSelection* get_font_selection(); + const FontSelection* get_font_selection() const; + Button* get_ok_button(); + const Button* get_ok_button() const; + Button* get_apply_button(); + const Button* get_apply_button() const; + Button* get_cancel_button(); + const Button* get_cancel_button() const; + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::FontSelection + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FontSelection* wrap(GtkFontSelection* object, bool take_copy = false); +} +namespace Glib +{ + /** @relates Gtk::FontSelectionDialog + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::FontSelectionDialog* wrap(GtkFontSelectionDialog* object, bool take_copy = false); +} +#endif /* _GTKMM_FONTSELECTION_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/frame.cc b/libs/gtkmm2/gtk/gtkmm/frame.cc new file mode 100644 index 0000000000..d24fa422c7 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/frame.cc @@ -0,0 +1,292 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +void Frame::unset_label() +{ + gtk_frame_set_label(gobj(), 0); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::Frame* wrap(GtkFrame* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Frame_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Frame_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_frame_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Frame_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->compute_child_allocation = &compute_child_allocation_vfunc_callback; +} + +void Frame_Class::compute_child_allocation_vfunc_callback(GtkFrame* self, GtkAllocation* allocation) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->compute_child_allocation_vfunc((Allocation&)(Glib::wrap(allocation)) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->compute_child_allocation) + (*base->compute_child_allocation)(self, allocation); + } +} + + +Glib::ObjectBase* Frame_Class::wrap_new(GObject* o) +{ + return manage(new Frame((GtkFrame*)(o))); + +} + + +/* The implementation: */ + +Frame::Frame(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +Frame::Frame(GtkFrame* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +Frame::~Frame() +{ + destroy_(); +} + +Frame::CppClassType Frame::frame_class_; // initialize static member + +GType Frame::get_type() +{ + return frame_class_.init().get_type(); +} + +GType Frame::get_base_type() +{ + return gtk_frame_get_type(); +} + + +Frame::Frame() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(frame_class_.init())) +{ + } + +Frame::Frame(const Glib::ustring& label) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(frame_class_.init(), "label", label.c_str(), (char*) 0)) +{ + } + +void Frame::set_label(const Glib::ustring& label) +{ + gtk_frame_set_label(gobj(), label.c_str()); +} + +Glib::ustring Frame::get_label() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_frame_get_label(const_cast(gobj()))); +} + +void Frame::set_label_widget(Widget& label_widget) +{ + gtk_frame_set_label_widget(gobj(), (label_widget).gobj()); +} + +Widget* Frame::get_label_widget() +{ + return Glib::wrap(gtk_frame_get_label_widget(gobj())); +} + +const Widget* Frame::get_label_widget() const +{ + return Glib::wrap(gtk_frame_get_label_widget(const_cast(gobj()))); +} + +void Frame::set_label_align(float xalign, float yalign) +{ + gtk_frame_set_label_align(gobj(), xalign, yalign); +} + +void Frame::set_label_align(AlignmentEnum xalign, AlignmentEnum yalign) +{ + gtk_frame_set_label_align(gobj(), _gtkmm_align_float_from_enum(xalign), _gtkmm_align_float_from_enum(yalign)); +} + +void Frame::get_label_align(float& xalign, float& yalign) const +{ + gtk_frame_get_label_align(const_cast(gobj()), &(xalign), &(yalign)); +} + +void Frame::set_shadow_type(ShadowType type) +{ + gtk_frame_set_shadow_type(gobj(), ((GtkShadowType)(type))); +} + +ShadowType Frame::get_shadow_type() const +{ + return ((ShadowType)(gtk_frame_get_shadow_type(const_cast(gobj())))); +} + + +Glib::PropertyProxy Frame::property_label() +{ + return Glib::PropertyProxy(this, "label"); +} + +Glib::PropertyProxy_ReadOnly Frame::property_label() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label"); +} + +Glib::PropertyProxy Frame::property_label_xalign() +{ + return Glib::PropertyProxy(this, "label-xalign"); +} + +Glib::PropertyProxy_ReadOnly Frame::property_label_xalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label-xalign"); +} + +Glib::PropertyProxy Frame::property_label_yalign() +{ + return Glib::PropertyProxy(this, "label-yalign"); +} + +Glib::PropertyProxy_ReadOnly Frame::property_label_yalign() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label-yalign"); +} + +Glib::PropertyProxy Frame::property_shadow_type() +{ + return Glib::PropertyProxy(this, "shadow-type"); +} + +Glib::PropertyProxy_ReadOnly Frame::property_shadow_type() const +{ + return Glib::PropertyProxy_ReadOnly(this, "shadow-type"); +} + +Glib::PropertyProxy Frame::property_label_widget() +{ + return Glib::PropertyProxy(this, "label-widget"); +} + +Glib::PropertyProxy_ReadOnly Frame::property_label_widget() const +{ + return Glib::PropertyProxy_ReadOnly(this, "label-widget"); +} + + +void Gtk::Frame::compute_child_allocation_vfunc(Allocation& allocation) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->compute_child_allocation) + (*base->compute_child_allocation)(gobj(),(GtkAllocation*)(allocation.gobj())); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/frame.h b/libs/gtkmm2/gtk/gtkmm/frame.h new file mode 100644 index 0000000000..aaac3dd63c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/frame.h @@ -0,0 +1,305 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_FRAME_H +#define _GTKMM_FRAME_H + +#include + +/* $Id$ */ + +/* frame.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkFrame GtkFrame; +typedef struct _GtkFrameClass GtkFrameClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class Frame_Class; } // namespace Gtk +namespace Gtk +{ + +/** A Gtk::Bin with a decorative frame and optional label. + * + * The Frame widget surrounds its single child with a decorative frame and + * an optional label. If present, the label is drawn in a gap in the top + * side of the frame. The position of the label can be controlled with + * set_label_align(). + * + * @ingroup Widgets + * @ingroup Containers + */ + +class Frame : public Bin +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Frame CppObjectType; + typedef Frame_Class CppClassType; + typedef GtkFrame BaseObjectType; + typedef GtkFrameClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~Frame(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class Frame_Class; + static CppClassType frame_class_; + + // noncopyable + Frame(const Frame&); + Frame& operator=(const Frame&); + +protected: + explicit Frame(const Glib::ConstructParams& construct_params); + explicit Frame(GtkFrame* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkFrame* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkFrame* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +private: + +public: + + Frame(); + explicit Frame(const Glib::ustring& label); + + //TODO: Add a bool use_markup arg to set_label() as a convenience - it would have to use set_label_widget(). + + /** Set the label to appear in the top edge of the frame. + * Label alignment defaults to the upper left corner of the frame. + */ + + /** Sets the text of the label. If @a label is 0, + * the current label is removed. + * @param label The text to use as the label of the frame. + */ + void set_label(const Glib::ustring& label); + void unset_label(); + + /** If the frame's label widget is a Gtk::Label, returns the + * text in the label widget. (The frame will have a Gtk::Label + * for the label widget if a non-0 argument was passed + * to new().) + * @return The text in the label, or 0 if there + * was no label widget or the lable widget was not + * a Gtk::Label. This string is owned by GTK+ and + * must not be modified or freed. + */ + Glib::ustring get_label() const; + + + /** Sets the label widget for the frame. This is the widget that + * will appear embedded in the top edge of the frame as a + * title. + * @param label_widget The new label widget. + */ + void set_label_widget(Widget& label_widget); + + /** Retrieves the label widget for the frame. See + * set_label_widget(). + * @return The label widget, or 0 if there is none. + */ + Widget* get_label_widget(); + + /** Retrieves the label widget for the frame. See + * set_label_widget(). + * @return The label widget, or 0 if there is none. + */ + const Widget* get_label_widget() const; + + /** Set the alignment of the Frame's label. + * @param xalign The position of the label along the top edge of the widget. + * A value of 0.0 represents left alignment; 1.0 represents right alignment. + * The default value for a newly created Frame is 0.0. + * @param yalign The y alignment of the label. Currently ignored. + */ + + /** Sets the alignment of the frame widget's label. The + * default values for a newly created frame are 0.0 and 0.5. + * @param xalign The position of the label along the top edge + * of the widget. A value of 0.0 represents left alignment; + * 1.0 represents right alignment. + * @param yalign The y alignment of the label. A value of 0.0 aligns under + * the frame; 1.0 aligns above the frame. + */ + void set_label_align(float xalign = 0.0, float yalign = 0.5); + + /** Sets the alignment of the frame widget's label. The + * default values for a newly created frame are 0.0 and 0.5. + * @param xalign The position of the label along the top edge + * of the widget. A value of 0.0 represents left alignment; + * 1.0 represents right alignment. + * @param yalign The y alignment of the label. A value of 0.0 aligns under + * the frame; 1.0 aligns above the frame. + */ + void set_label_align(AlignmentEnum xalign, AlignmentEnum yalign = Gtk::ALIGN_CENTER); + + + /** Retrieves the X and Y alignment of the frame's label. See + * set_label_align(). + * @param xalign Location to store X alignment of frame's label, or 0. + * @param yalign Location to store X alignment of frame's label, or 0. + */ + void get_label_align(float& xalign, float& yalign) const; + + /** Sets shadow type of the frame. + */ + + /** Sets the shadow type for @a frame . + * @param type The new Gtk::ShadowType. + */ + void set_shadow_type(ShadowType type); + + /** Retrieves the shadow type of the frame. See + * set_shadow_type(). + * @return The current shadow type of the frame. + */ + ShadowType get_shadow_type() const; + + /** Text of the frame's label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label() ; + +/** Text of the frame's label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label() const; + + /** The horizontal alignment of the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label_xalign() ; + +/** The horizontal alignment of the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label_xalign() const; + + /** The vertical alignment of the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label_yalign() ; + +/** The vertical alignment of the label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label_yalign() const; + + /** Appearance of the frame border. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_shadow_type() ; + +/** Appearance of the frame border. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_shadow_type() const; + + /** A widget to display in place of the usual frame label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_label_widget() ; + +/** A widget to display in place of the usual frame label. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_label_widget() const; + + +protected: + virtual void compute_child_allocation_vfunc(Allocation& allocation); + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::Frame + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::Frame* wrap(GtkFrame* object, bool take_copy = false); +} +#endif /* _GTKMM_FRAME_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/handlebox.cc b/libs/gtkmm2/gtk/gtkmm/handlebox.cc new file mode 100644 index 0000000000..86c2a0fe9c --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/handlebox.cc @@ -0,0 +1,419 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +namespace Gtk +{ + +bool HandleBox::is_child_detached() const +{ + return gobj()->child_detached; +} + +bool HandleBox::is_float_window_mapped() const +{ + return gobj()->float_window_mapped; +} + +bool HandleBox::is_in_drag() const +{ + return gobj()->in_drag; +} + +bool HandleBox::shrinks_on_detach() const +{ + return gobj()->shrink_on_detach; +} + +} /* namespace Gtk */ + + +namespace +{ + +void HandleBox_signal_child_attached_callback(GtkHandleBox* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo HandleBox_signal_child_attached_info = +{ + "child_attached", + (GCallback) &HandleBox_signal_child_attached_callback, + (GCallback) &HandleBox_signal_child_attached_callback +}; + + +void HandleBox_signal_child_detached_callback(GtkHandleBox* self, GtkWidget* p0,void* data) +{ + using namespace Gtk; + typedef sigc::slot< void,Widget* > SlotType; + + // Do not try to call a signal on a disassociated wrapper. + if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) + { + try + { + if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) + (*static_cast(slot))(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } +} + +const Glib::SignalProxyInfo HandleBox_signal_child_detached_info = +{ + "child_detached", + (GCallback) &HandleBox_signal_child_detached_callback, + (GCallback) &HandleBox_signal_child_detached_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Gtk::HandleBox* wrap(GtkHandleBox* object, bool take_copy) +{ + return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); +} + +} /* namespace Glib */ + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& HandleBox_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &HandleBox_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_handle_box_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void HandleBox_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + + klass->child_attached = &child_attached_callback; + klass->child_detached = &child_detached_callback; +} + + +void HandleBox_Class::child_attached_callback(GtkHandleBox* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_child_attached(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->child_attached) + (*base->child_attached)(self, p0); + } +} + +void HandleBox_Class::child_detached_callback(GtkHandleBox* self, GtkWidget* p0) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_child_detached(Glib::wrap(p0) +); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). + ); + + // Call the original underlying C function: + if(base && base->child_detached) + (*base->child_detached)(self, p0); + } +} + + +Glib::ObjectBase* HandleBox_Class::wrap_new(GObject* o) +{ + return manage(new HandleBox((GtkHandleBox*)(o))); + +} + + +/* The implementation: */ + +HandleBox::HandleBox(const Glib::ConstructParams& construct_params) +: + Gtk::Bin(construct_params) +{ + } + +HandleBox::HandleBox(GtkHandleBox* castitem) +: + Gtk::Bin((GtkBin*)(castitem)) +{ + } + +HandleBox::~HandleBox() +{ + destroy_(); +} + +HandleBox::CppClassType HandleBox::handlebox_class_; // initialize static member + +GType HandleBox::get_type() +{ + return handlebox_class_.init().get_type(); +} + +GType HandleBox::get_base_type() +{ + return gtk_handle_box_get_type(); +} + + +HandleBox::HandleBox() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Gtk::Bin(Glib::ConstructParams(handlebox_class_.init())) +{ + } + +void HandleBox::set_shadow_type(ShadowType type) +{ + gtk_handle_box_set_shadow_type(gobj(), ((GtkShadowType)(type))); +} + +ShadowType HandleBox::get_shadow_type() const +{ + return ((ShadowType)(gtk_handle_box_get_shadow_type(const_cast(gobj())))); +} + +void HandleBox::set_handle_position(PositionType position) +{ + gtk_handle_box_set_handle_position(gobj(), ((GtkPositionType)(position))); +} + +PositionType HandleBox::get_handle_position() const +{ + return ((PositionType)(gtk_handle_box_get_handle_position(const_cast(gobj())))); +} + +void HandleBox::set_snap_edge(PositionType edge) +{ + gtk_handle_box_set_snap_edge(gobj(), ((GtkPositionType)(edge))); +} + +PositionType HandleBox::get_snap_edge() const +{ + return ((PositionType)(gtk_handle_box_get_snap_edge(const_cast(gobj())))); +} + +Glib::RefPtr HandleBox::get_bin_window() +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->bin_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr HandleBox::get_bin_window() const +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->bin_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr HandleBox::get_float_window() +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->float_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr HandleBox::get_float_window() const +{ + Glib::RefPtr ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->float_window))); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + + +Glib::SignalProxy1< void,Widget* > HandleBox::signal_child_attached() +{ + return Glib::SignalProxy1< void,Widget* >(this, &HandleBox_signal_child_attached_info); +} + +Glib::SignalProxy1< void,Widget* > HandleBox::signal_child_detached() +{ + return Glib::SignalProxy1< void,Widget* >(this, &HandleBox_signal_child_detached_info); +} + + +Glib::PropertyProxy HandleBox::property_shadow_type() +{ + return Glib::PropertyProxy(this, "shadow-type"); +} + +Glib::PropertyProxy_ReadOnly HandleBox::property_shadow_type() const +{ + return Glib::PropertyProxy_ReadOnly(this, "shadow-type"); +} + +Glib::PropertyProxy HandleBox::property_handle_position() +{ + return Glib::PropertyProxy(this, "handle-position"); +} + +Glib::PropertyProxy_ReadOnly HandleBox::property_handle_position() const +{ + return Glib::PropertyProxy_ReadOnly(this, "handle-position"); +} + +Glib::PropertyProxy HandleBox::property_snap_edge() +{ + return Glib::PropertyProxy(this, "snap-edge"); +} + +Glib::PropertyProxy_ReadOnly HandleBox::property_snap_edge() const +{ + return Glib::PropertyProxy_ReadOnly(this, "snap-edge"); +} + + +void Gtk::HandleBox::on_child_attached(Widget* child) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->child_attached) + (*base->child_attached)(gobj(),(GtkWidget*)Glib::unwrap(child)); +} + +void Gtk::HandleBox::on_child_detached(Widget* child) +{ + BaseClassType *const base = static_cast( + g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). + ); + + if(base && base->child_detached) + (*base->child_detached)(gobj(),(GtkWidget*)Glib::unwrap(child)); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/handlebox.h b/libs/gtkmm2/gtk/gtkmm/handlebox.h new file mode 100644 index 0000000000..89d4614bfc --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/handlebox.h @@ -0,0 +1,220 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_HANDLEBOX_H +#define _GTKMM_HANDLEBOX_H + +#include + + /* $Id$ */ + +/* handlebox.h + * + * Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkHandleBox GtkHandleBox; +typedef struct _GtkHandleBoxClass GtkHandleBoxClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class HandleBox_Class; } // namespace Gtk +namespace Gtk +{ + +/** A widget for detachable window portions. + * + * The Gtk::HandleBox widget allows a portion of a window to be "torn off". + * It displays its child and a handle that the user can drag to tear off a separate window (the float window) containing the child widget. A thin ghost is drawn in the original location of the handlebox. By dragging the separate window back to its original location, it can be reattached. + * When reattaching, the ghost and float window must be aligned along one of the edges, the snap edge. This can be specified by the application programmer explicitely, or GTK+ will pick a reasonable default based on the handle position. + * To make detaching and reattaching the handlebox as minimally confusing as possible to the user, it is important to set the snap edge so that the snap edge does not move when the handlebox is deattached. + * For instance, if the handlebox is packed at the bottom of a VBox, then when the handlebox is detached, the bottom edge of the handlebox's allocation will remain fixed as the height of the handlebox shrinks, so the snap edge should be set to GTK_POS_BOTTOM. + * + * @ingroup Widgets + * @ingroup Containers + */ + +class HandleBox : public Bin +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef HandleBox CppObjectType; + typedef HandleBox_Class CppClassType; + typedef GtkHandleBox BaseObjectType; + typedef GtkHandleBoxClass BaseClassType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + virtual ~HandleBox(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +private: + friend class HandleBox_Class; + static CppClassType handlebox_class_; + + // noncopyable + HandleBox(const HandleBox&); + HandleBox& operator=(const HandleBox&); + +protected: + explicit HandleBox(const Glib::ConstructParams& construct_params); + explicit HandleBox(GtkHandleBox* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GtkObject. + GtkHandleBox* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GtkObject. + const GtkHandleBox* gobj() const { return reinterpret_cast(gobject_); } + + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + virtual void on_child_attached(Widget* child); + virtual void on_child_detached(Widget* child); + + +private: + +public: + HandleBox(); + + + void set_shadow_type(ShadowType type); + + /** Gets the type of shadow drawn around the handle box. See + * set_shadow_type(). + * @return The type of shadow currently drawn around the handle box. + */ + ShadowType get_shadow_type() const; + + void set_handle_position(PositionType position); + + /** Gets the handle position of the handle box. See + * set_handle_position(). + * @return The current handle position. + */ + PositionType get_handle_position() const; + + void set_snap_edge(PositionType edge); + + /** Gets the edge used for determining reattachment of the handle box. See + * set_snap_edge(). + * @return The edge used for determining reattachment, or (GtkPositionType)-1 if this + * is determined (as per default) from the handle position. + */ + PositionType get_snap_edge() const; + + + Glib::SignalProxy1< void,Widget* > signal_child_attached(); + + + Glib::SignalProxy1< void,Widget* > signal_child_detached(); + + + Glib::RefPtr get_bin_window(); + Glib::RefPtr get_bin_window() const; + Glib::RefPtr get_float_window(); + Glib::RefPtr get_float_window() const; + + bool is_child_detached() const; + bool is_float_window_mapped() const; + bool is_in_drag() const; + bool shrinks_on_detach() const; + + //_WRAP_PROPERTY("shadow", ShadowType); //deprecated. + /** Appearance of the shadow that surrounds the container. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_shadow_type() ; + +/** Appearance of the shadow that surrounds the container. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_shadow_type() const; + + /** Position of the handle relative to the child widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_handle_position() ; + +/** Position of the handle relative to the child widget. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_handle_position() const; + + /** Side of the handlebox that's lined up with the docking point to dock the handlebox. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy property_snap_edge() ; + +/** Side of the handlebox that's lined up with the docking point to dock the handlebox. + * + * You rarely need to use properties because there are get_ and set_ methods for almost all of them. + * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when + * the value of the property changes. + */ + Glib::PropertyProxy_ReadOnly property_snap_edge() const; + + +}; + +} /* namespace Gtk */ + + +namespace Glib +{ + /** @relates Gtk::HandleBox + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Gtk::HandleBox* wrap(GtkHandleBox* object, bool take_copy = false); +} +#endif /* _GTKMM_HANDLEBOX_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/iconfactory.cc b/libs/gtkmm2/gtk/gtkmm/iconfactory.cc new file mode 100644 index 0000000000..4a305d1291 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/iconfactory.cc @@ -0,0 +1,189 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +// static +bool IconSize::lookup(IconSize size, int& width, int& height) +{ + return gtk_icon_size_lookup((GtkIconSize) int(size), &width, &height); +} + +// static +IconSize IconSize::register_new(const Glib::ustring& name, int width, int height) +{ + const int size = gtk_icon_size_register(name.c_str(), width, height); + return IconSize(size); +} + +// static +void IconSize::register_alias(const Glib::ustring& alias, IconSize target) +{ + gtk_icon_size_register_alias(alias.c_str(), (GtkIconSize) int(target)); +} + +// static +IconSize IconSize::from_name(const Glib::ustring& name) +{ + const int size = gtk_icon_size_from_name(name.c_str()); + return IconSize(size); +} + +// static +Glib::ustring IconSize::get_name(IconSize size) +{ + return gtk_icon_size_get_name((GtkIconSize) int(size)); +} + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GtkIconFactory* object, bool take_copy) +{ + return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Class& IconFactory_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &IconFactory_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(gtk_icon_factory_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void IconFactory_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* IconFactory_Class::wrap_new(GObject* object) +{ + return new IconFactory((GtkIconFactory*)object); +} + + +/* The implementation: */ + +GtkIconFactory* IconFactory::gobj_copy() +{ + reference(); + return gobj(); +} + +IconFactory::IconFactory(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +IconFactory::IconFactory(GtkIconFactory* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +IconFactory::~IconFactory() +{} + + +IconFactory::CppClassType IconFactory::iconfactory_class_; // initialize static member + +GType IconFactory::get_type() +{ + return iconfactory_class_.init().get_type(); +} + +GType IconFactory::get_base_type() +{ + return gtk_icon_factory_get_type(); +} + + +IconFactory::IconFactory() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(iconfactory_class_.init())) +{ + } + +Glib::RefPtr IconFactory::create() +{ + return Glib::RefPtr( new IconFactory() ); +} +void IconFactory::add(const Gtk::StockID& stock_id, const IconSet& icon_set) +{ + gtk_icon_factory_add(gobj(), (stock_id).get_c_str(), const_cast((icon_set).gobj())); +} + +void IconFactory::add_default() +{ + gtk_icon_factory_add_default(gobj()); +} + +void IconFactory::remove_default() +{ + gtk_icon_factory_remove_default(gobj()); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/iconfactory.h b/libs/gtkmm2/gtk/gtkmm/iconfactory.h new file mode 100644 index 0000000000..39b98e792f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/iconfactory.h @@ -0,0 +1,160 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ICONFACTORY_H +#define _GTKMM_ICONFACTORY_H + +#include + +/* $Id$ */ + +/* Copyright (C) 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include +#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GtkIconFactory GtkIconFactory; +typedef struct _GtkIconFactoryClass GtkIconFactoryClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gtk +{ class IconFactory_Class; } // namespace Gtk +namespace Gtk +{ + + +class IconFactory : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef IconFactory CppObjectType; + typedef IconFactory_Class CppClassType; + typedef GtkIconFactory BaseObjectType; + typedef GtkIconFactoryClass BaseClassType; + +private: friend class IconFactory_Class; + static CppClassType iconfactory_class_; + +private: + // noncopyable + IconFactory(const IconFactory&); + IconFactory& operator=(const IconFactory&); + +protected: + explicit IconFactory(const Glib::ConstructParams& construct_params); + explicit IconFactory(GtkIconFactory* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~IconFactory(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + GtkIconFactory* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GtkIconFactory* gobj() const { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + GtkIconFactory* gobj_copy(); + +private: + + +protected: + + IconFactory(); + +public: + + static Glib::RefPtr create(); + + + /** Adds the given @a icon_set to the icon factory, under the name + * @a stock_id . @a stock_id should be namespaced for your application, + * e.g. "myapp-whatever-icon". Normally applications create a + * Gtk::IconFactory, then add it to the list of default factories with + * add_default(). Then they pass the @a stock_id to + * widgets such as Gtk::Image to display the icon. Themes can provide + * an icon with the same name (such as "myapp-whatever-icon") to + * override your application's default icons. If an icon already + * existed in @a factory for @a stock_id , it is unreferenced and replaced + * with the new @a icon_set . + * @param stock_id Icon name. + * @param icon_set Icon set. + */ + void add(const Gtk::StockID& stock_id, const IconSet& icon_set); + + /** Adds an icon factory to the list of icon factories searched by + * Gtk::Style::lookup_icon_set(). This means that, for example, + * Gtk::Image::new_from_stock() will be able to find icons in @a factory . + * There will normally be an icon factory added for each library or + * application that comes with icons. The default icon factories + * can be overridden by themes. + */ + void add_default(); + + /** Removes an icon factory from the list of default icon + * factories. Not normally used; you might use it for a library that + * can be unloaded or shut down. + */ + void remove_default(); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Gtk + + +namespace Glib +{ + /** @relates Gtk::IconFactory + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr wrap(GtkIconFactory* object, bool take_copy = false); +} + + +#endif /* _GTKMM_ICONFACTORY_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/iconinfo.cc b/libs/gtkmm2/gtk/gtkmm/iconinfo.cc new file mode 100644 index 0000000000..7dfaa15c79 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/iconinfo.cc @@ -0,0 +1,177 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +/* Copyright 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +namespace Gtk +{ + +bool IconInfo::get_attach_points(Glib::ArrayHandle& /* points */) const +{ + GdkPoint* c_attach_points = 0; + gint n_points = 0; + bool result = gtk_icon_info_get_attach_points (const_cast(gobj()), &c_attach_points, &n_points); + + if(c_attach_points) + { + //TODO: Why doesn't this compile? + //points = Glib::ArrayHandle(c_attach_points, n_points, Glib::OWNERSHIP_SHALLOW); //We use OWNERSHIP_SHALLOW because we just need to g_free() the array and nothing more. + } + return result; +} + +IconInfo::operator bool() +{ + return gobj() != 0; +} + + +} // namespace Gtk + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::IconInfo wrap(GtkIconInfo* object, bool take_copy) +{ + return Gtk::IconInfo(object, take_copy); +} + +} // namespace Glib + + +namespace Gtk +{ + + +// static +GType IconInfo::get_type() +{ + return gtk_icon_info_get_type(); +} + +IconInfo::IconInfo() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +IconInfo::IconInfo(const IconInfo& other) +: + gobject_ ((other.gobject_) ? gtk_icon_info_copy(other.gobject_) : 0) +{} + +IconInfo::IconInfo(GtkIconInfo* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gtk_icon_info_copy(gobject) : gobject) +{} + +IconInfo& IconInfo::operator=(const IconInfo& other) +{ + IconInfo temp (other); + swap(temp); + return *this; +} + +IconInfo::~IconInfo() +{ + if(gobject_) + gtk_icon_info_free(gobject_); +} + +void IconInfo::swap(IconInfo& other) +{ + GtkIconInfo *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GtkIconInfo* IconInfo::gobj_copy() const +{ + return gtk_icon_info_copy(gobject_); +} + + +int IconInfo::get_base_size() const +{ + return gtk_icon_info_get_base_size(const_cast(gobj())); +} + +Glib::ustring IconInfo::get_filename() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_icon_info_get_filename(const_cast(gobj()))); +} + +Glib::RefPtr IconInfo::get_builtin_pixbuf() +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_icon_info_get_builtin_pixbuf(gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr IconInfo::get_builtin_pixbuf() const +{ + + Glib::RefPtr retvalue = Glib::wrap(gtk_icon_info_get_builtin_pixbuf(const_cast(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr IconInfo::load_icon() const +{ + GError *error = 0; + Glib::RefPtr retvalue = Glib::wrap(gtk_icon_info_load_icon(const_cast(gobj()), &(error))); + if(error) ::Glib::Error::throw_exception(error); + return retvalue; +} + +void IconInfo::set_raw_coordinates(bool raw_coordinates) +{ + gtk_icon_info_set_raw_coordinates(gobj(), static_cast(raw_coordinates)); +} + +bool IconInfo::get_embedded_rect(Gdk::Rectangle& rectangle) const +{ + return gtk_icon_info_get_embedded_rect(const_cast(gobj()), (rectangle).gobj()); +} + +Glib::ustring IconInfo::get_display_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gtk_icon_info_get_display_name(const_cast(gobj()))); +} + + +} // namespace Gtk + + diff --git a/libs/gtkmm2/gtk/gtkmm/iconinfo.h b/libs/gtkmm2/gtk/gtkmm/iconinfo.h new file mode 100644 index 0000000000..73f36a2f6f --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/iconinfo.h @@ -0,0 +1,227 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _GTKMM_ICONINFO_H +#define _GTKMM_ICONINFO_H + +#include + +/* Copyright (C) 2003 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +//#include + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _GtkIconInfo GtkIconInfo; } +#endif + +namespace Gtk +{ + +class IconInfo +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef IconInfo CppObjectType; + typedef GtkIconInfo BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + IconInfo(); + + explicit IconInfo(GtkIconInfo* gobject, bool make_a_copy = true); + + IconInfo(const IconInfo& other); + IconInfo& operator=(const IconInfo& other); + + ~IconInfo(); + + void swap(IconInfo& other); + + ///Provides access to the underlying C instance. + GtkIconInfo* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const GtkIconInfo* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + GtkIconInfo* gobj_copy() const; + +protected: + GtkIconInfo* gobject_; + +private: + + +public: + + ///Tests whether the IconInfo is valid. + operator bool(); + + + /** Gets the base size for the icon. The base size + * is a size for the icon that was specified by + * the icon theme creator. This may be different + * than the actual size of image; an example of + * this is small emblem icons that can be attached + * to a larger icon. These icons will be given + * the same base size as the larger icons to which + * they are attached. + * @return The base size, or 0, if no base + * size is known for the icon. + * + * Since: 2.4. + */ + int get_base_size() const; + + /** Gets the filename for the icon. If the + * Gtk::ICON_LOOKUP_USE_BUILTIN flag was passed + * to Gtk::IconTheme::lookup_icon(), there may be + * no filename if a builtin icon is returned; in this + * case, you should use gtk_icon_info_get_builtin_pixbuf(). + * @return The filename for the icon, or 0 + * if gtk_icon_info_get_builtin_pixbuf() should + * be used instead. + */ + Glib::ustring get_filename() const; + + /** Gets the built-in image for this icon, if any. To allow + * GTK+ to use built in icon images, you must pass the + * Gtk::ICON_LOOKUP_USE_BUILTIN to + * Gtk::IconTheme::lookup_icon(). + * @return The built-in image pixbuf, or 0. + * The returned image must not be modified. + */ + Glib::RefPtr get_builtin_pixbuf(); + + /** Gets the built-in image for this icon, if any. To allow + * GTK+ to use built in icon images, you must pass the + * Gtk::ICON_LOOKUP_USE_BUILTIN to + * Gtk::IconTheme::lookup_icon(). + * @return The built-in image pixbuf, or 0. + * The returned image must not be modified. + */ + Glib::RefPtr get_builtin_pixbuf() const; + + /** Renders an icon previously looked up in an icon theme using + * Gtk::IconTheme::lookup_icon(); the size will be based on the size + * passed to Gtk::IconTheme::lookup_icon(). Note that the resulting + * pixbuf may not be exactly this size; an icon theme may have icons + * that differ slightly from their nominal sizes, and in addition GTK+ + * will avoid scaling icons that it considers sufficiently close to the + * requested size or for which the source image would have to be scaled + * up too far. (This maintains sharpness.) + * @return The rendered icon; this may be a newly created icon + * or a new reference to an internal icon, so you must not modify + * the icon. Use Glib::object_unref() to release your reference to the + * icon. + * + * Since: 2.4. + */ + Glib::RefPtr load_icon() const; + + /** Sets whether the coordinates returned by gtk_icon_info_get_embedded_rect() + * and gtk_icon_info_get_attach_points() should be returned in their + * original form as specified in the icon theme, instead of scaled + * appropriately for the pixbuf returned by gtk_icon_info_load_icon(). + * + * Raw coordinates are somewhat strange; they are specified to be with + * respect to the unscaled pixmap for PNG and XPM icons, but for SVG + * icons, they are in a 1000x1000 coordinate space that is scaled + * to the final size of the icon. You can determine if the icon is an SVG + * icon by using gtk_icon_info_get_filename(), and seeing if it is non-0 + * and ends in '.svg'. + * + * This function is provided primarily to allow compatibility wrappers + * for older API's, and is not expected to be useful for applications. + * + * Since: 2.4 + * @param raw_coordinates Whether the coordinates of embedded rectangles + * and attached points should be returned in their original + * (unscaled) form. + */ + void set_raw_coordinates(bool raw_coordinates = true); + + /** Gets the coordinates of a rectangle within the icon + * that can be used for display of information such + * as a preview of the contents of a text file. + * See gtk_icon_info_set_raw_coordinates() for further + * information about the coordinate system. + * @param rectangle Gdk::Rectangle in which to store embedded + * rectangle coordinates; coordinates are only stored + * when this function returns true. + * @return true if the icon has an embedded rectangle + * + * Since: 2.4. + */ + bool get_embedded_rect(Gdk::Rectangle& rectangle) const; + bool get_attach_points(Glib::ArrayHandle& points) const; + + /** Gets the display name for an icon. A display name is a + * string to be used in place of the icon name in a user + * visible context like a list of icons. + * @return The display name for the icon or 0, if + * the icon doesn't have a specified display name. This value + * is owned @a icon_info and must not be modified or free. + * + * Since: 2.4. + */ + Glib::ustring get_display_name() const; + + +}; + +} // namespace Gtk + + +namespace Gtk +{ + +/** @relates Gtk::IconInfo + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(IconInfo& lhs, IconInfo& rhs) + { lhs.swap(rhs); } + +} // namespace Gtk + +namespace Glib +{ + +/** @relates Gtk::IconInfo + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Gtk::IconInfo wrap(GtkIconInfo* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value : public Glib::Value_Boxed +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _GTKMM_ICONINFO_H */ + diff --git a/libs/gtkmm2/gtk/gtkmm/iconset.cc b/libs/gtkmm2/gtk/gtkmm/iconset.cc new file mode 100644 index 0000000000..7546b7d7d2 --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/iconset.cc @@ -0,0 +1,146 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include + +namespace Gtk +{ + +IconSet::IconSet(const Glib::RefPtr& pixbuf) +{ + gobject_ = gtk_icon_set_new_from_pixbuf(pixbuf->gobj()); +} + +Glib::ArrayHandle IconSet::get_sizes() const +{ + GtkIconSize* pSizes = 0; + int n_sizes = 0; + gtk_icon_set_get_sizes(const_cast(gobj()), &pSizes, &n_sizes); + + return Glib::ArrayHandle((IconSize*) pSizes, n_sizes, Glib::OWNERSHIP_SHALLOW); +} + +IconSet IconSet::lookup_default(const Gtk::StockID& stock_id) //static +{ + GtkIconSet* pIconSet = gtk_icon_factory_lookup_default(stock_id.get_string().c_str()); + return IconSet(pIconSet, true); //true = take_copy. +} + +} /* namespace Gtk */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Gtk::IconSet wrap(GtkIconSet* object, bool take_copy) +{ + return Gtk::IconSet(object, take_copy); +} + +} // namespace Glib + + +namespace Gtk +{ + + +// static +GType IconSet::get_type() +{ + return gtk_icon_set_get_type(); +} + +IconSet::IconSet() +: + gobject_ (gtk_icon_set_new()) +{} + +IconSet::IconSet(const IconSet& other) +: + gobject_ ((other.gobject_) ? gtk_icon_set_ref(other.gobject_) : 0) +{} + +IconSet::IconSet(GtkIconSet* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? gtk_icon_set_ref(gobject) : gobject) +{} + +IconSet& IconSet::operator=(const IconSet& other) +{ + IconSet temp (other); + swap(temp); + return *this; +} + +IconSet::~IconSet() +{ + if(gobject_) + gtk_icon_set_unref(gobject_); +} + +void IconSet::swap(IconSet& other) +{ + GtkIconSet *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +GtkIconSet* IconSet::gobj_copy() const +{ + return gtk_icon_set_ref(gobject_); +} + + +IconSet IconSet::copy() const +{ + return Glib::wrap(gtk_icon_set_copy(const_cast(gobj()))); +} + +Glib::RefPtr IconSet::render_icon(const Glib::RefPtr