From c9f039a92457221e9e76e06c7ee4e4a34dc72d05 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 11 Nov 2005 04:30:28 +0000 Subject: added libglademm git-svn-id: svn://localhost/trunk/ardour2@78 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/libglademm/AUTHORS | 2 + libs/libglademm/COPYING | 504 +++++++++++++++++++++++++++++ libs/libglademm/ChangeLog | 361 +++++++++++++++++++++ libs/libglademm/INSTALL | 182 +++++++++++ libs/libglademm/NEWS | 95 ++++++ libs/libglademm/README | 0 libs/libglademm/SConscript | 14 + libs/libglademm/TODO | 0 libs/libglademm/libglademm.h | 31 ++ libs/libglademm/libglademm/init.cc | 34 ++ libs/libglademm/libglademm/init.h | 38 +++ libs/libglademm/libglademm/private/xml_p.h | 50 +++ libs/libglademm/libglademm/variablesmap.cc | 199 ++++++++++++ libs/libglademm/libglademm/variablesmap.h | 96 ++++++ libs/libglademm/libglademm/wrap_init.cc | 50 +++ libs/libglademm/libglademm/wrap_init.h | 37 +++ libs/libglademm/libglademm/xml.cc | 343 ++++++++++++++++++++ libs/libglademm/libglademm/xml.h | 348 ++++++++++++++++++++ libs/libglademm/libglademmconfig.h | 15 + 19 files changed, 2399 insertions(+) create mode 100644 libs/libglademm/AUTHORS create mode 100644 libs/libglademm/COPYING create mode 100644 libs/libglademm/ChangeLog create mode 100644 libs/libglademm/INSTALL create mode 100644 libs/libglademm/NEWS create mode 100644 libs/libglademm/README create mode 100644 libs/libglademm/SConscript create mode 100644 libs/libglademm/TODO create mode 100644 libs/libglademm/libglademm.h create mode 100644 libs/libglademm/libglademm/init.cc create mode 100644 libs/libglademm/libglademm/init.h create mode 100644 libs/libglademm/libglademm/private/xml_p.h create mode 100644 libs/libglademm/libglademm/variablesmap.cc create mode 100644 libs/libglademm/libglademm/variablesmap.h create mode 100644 libs/libglademm/libglademm/wrap_init.cc create mode 100644 libs/libglademm/libglademm/wrap_init.h create mode 100644 libs/libglademm/libglademm/xml.cc create mode 100644 libs/libglademm/libglademm/xml.h create mode 100644 libs/libglademm/libglademmconfig.h (limited to 'libs') diff --git a/libs/libglademm/AUTHORS b/libs/libglademm/AUTHORS new file mode 100644 index 0000000000..0258b21bfe --- /dev/null +++ b/libs/libglademm/AUTHORS @@ -0,0 +1,2 @@ +Maintainers: +Murray Cumming diff --git a/libs/libglademm/COPYING b/libs/libglademm/COPYING new file mode 100644 index 0000000000..b1e3f5a263 --- /dev/null +++ b/libs/libglademm/COPYING @@ -0,0 +1,504 @@ + 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. + + 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. + + 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 + + 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.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 + +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/libglademm/ChangeLog b/libs/libglademm/ChangeLog new file mode 100644 index 0000000000..90bd943ff9 --- /dev/null +++ b/libs/libglademm/ChangeLog @@ -0,0 +1,361 @@ +2.6.1: + +2005-09-07 Murray Cumming + + * NEWS: Updated. + * configure.in: Increased version. + +2005-03-10 Cedric Gustin + + * MSVC_Net2003/Makefile.am: Add blank.cpp to EXTRA_DIST. + * MSVC_Net2003/libglademm/libglademm.vcproj: Disable warning #4250. + * MSVC_Net2003/examples/*/*.vcproj: Change name of + PDB file to $(OutDir)/$(TargetName).pdb. Disable warning #4250. + +2.6.0: + +2005-01-24 Cedric Gustin + + * MSVC_Net2003/libglademm/Makefile.am: Rewrote rule for local copy + of glibmmconfig.h (required for 'make distcheck'). + * MSVC_Net2003/libglademm/libglademm.vcproj: Removed GLIBMM_BUILD + macro. + +2.5.1: + +2005-01-11 Murray Cumming + + * MSVC_Net2003/libglademm/Makefile.am: Add libglademmconfig.h to + DISTCLEANFILES, to fix the distcheck. + +2004-12-13 Cedric Gustin + + * configure.in : parse version tags at configure time (for + libglademm-2.4.rc). + * MSVC_Net2003/libglademm/libglademm-2.4.rc.in : New resource file. + * MSVC_Net2003/libglademm/Makefile.am: Include libglademm-2.4.rc + in distribution. + * MSVC_Net2003/libglademm/libglademm.vcproj: Added resource file. + +2004-12-08 Cedric Gustin + + * MSVC_Net2003/: Initial release. + * configure.in: Added MSVC_Net2003 Makefiles. + * Makefile.am: Added MSVC_Net2003 subdir. + +2004-08-28 Alberto Paro + + * libglade/xml.{ccg|hg}: Added connect_clicked() for easy connection of + buttons and menuitems signals to a signal handler. + * libglade/variablesmap.[ccg|hg]: Glade::VariablesMap now handles + Entry, ComboTextEntry, SpinButton, *Scale, Calendar and CheckBox. + * example/variablesmap: Improved the example to handle new + VariablesMap types. + +2004-09-19 Murray Cumming + + * This is the HEAD branch. + +2004-09-19 Murray Cumming + + * libglademm/xml.hg: Fix from Denis Leroy in bug #151872. + +2.4.1: + +2004-06-02 Bryan Forbes + + * examples/derived/deriveddialog.h: fix to compile with gcc 3.4.0. + +2.4.0: + +2.3.3: + +2004-03-28 + + * libglade/xml.hg: Check the return value of get_cwidget(). + +2004-03-18 Murray Cumming + + * docs/reference/Makefile.am: Removed make target dependency on + installed beautify_docs, so it does not try to rebuild them when + building from a tarball. Bug #137548 from Dalgoda. + +2004-03-15 Cedric Gustin + + * tools/m4/Makefile.am: install m4 files in libglademm-2.4 subdir + instead of libglademm-2.0. + +2004-03-15 Cedric Gustin + + * configure.in: Added test for struct packing convention on win32 + (-mms-bitfields / -fnative-struct). + +2004-03-12 Murray Cumming + + * libglade/src/xml.hg: get_widget_derived(): actually return the + existing widget when a wrapper instance already exists. Bug #136913 + from Roger Whinlatter who submitted it to debian but should have + submitted it to bugzilla.gnome.org first. + +2.3.2: + +2004-02-13 Murray Cumming + + * Updated for latest libsigc++ 2 API. + +2.3.1: + +2003-12-31 Murray Cumming + + * docs/reference/Makefile.am: Generate a real devhelp file. Added + a doxygen_to_devhelp.xsl file for this, by copying it from gtkmm and + modifying it. + +2003-12-29 Murray Cumming + + * configure.in: Use glibmm_check_perl() m4 macro installed by glibmm, + so that doxygen can know the PERL_PATH. + * docs/reference/Makefile.am: Added the docs rules from the same + file in gtkmm, so that the docs are built and distributed and installed + and uploaded. + +2003-12-22 Murray Cumming + + * docs/reference/Makefile.am: Use beautify_docs.pl installed from + glibmm 2.4. + +2.3.0: + +2003-12-07 Murray Cumming + + * examples/menus/example.glade: Corrected the text. Patch by + Billy O'Connor in bug 128683. + +2003-11-29 Murray Cumming + + * libglade/libglade-2.0.pc.in: Corrected library name. + +2003-11-06 Cedric Gustin + + * configure.in: Added test of win32 platform. Commented + out AM_DISABLE_SHARED (DLLs are shared libraries). + * build_shared/Makefile_build.am_fragment: added a few LDFLAGS + for win32 DLLs (defined in win32_dlls_ldflags and appended to + common_ldflags). + +2003-11-06 Murray Cumming + + * Added examples/menus. + * examples/basic: Added and distributed basic.gladep which is + necessary to prevent glade-2 from creating libgnomeui menus. + +2003-11-02 Murray Cumming + + * This is now libglademm 2.4, which builds against gtkmm 2.4, and is + parallel-installable with libglademm 2.0/2.2. + +This is HEAD, for GNOME 2.6, using gtkmm 2.4. + +2003-10-30 Murray Cumming + + * libglade/libglademm.h: Include gtkmmconfig.h rather than + libgnomemmconfig.h. These are platform-specific stuff. I am + surprised that it built before, because this does not depend + on libgnomemm at all. + +2003-10-17 Alberto Paro + + * docs/reference/Doxyfile.in: fixed docs generation + +2.1.2: + +2003-09-25 Eric Bourque + + * libglademm.spec.in: new file + +2003-09-02 Murray Cumming + + * libglademm/src/xml.hg: Added code to get_widget_derived(), + to return an existing C++ instance if one exists. This makes + get_widget_derived() always return the same instance, like + get_widget() already does. I added some more explicit explanation + to the gtkmm book about this. + +2.1.1: + +2003-09-01 Murray Cumming + + * Just rebuilt the tarball. Some corruption was causing the + .la files to not be installed. + +2.1.0: + +2003-08-23 Murray Cumming + + * libglademm/src/xml.[hg|ccg]: Added + Glade::Xml::get_widget_derived() templated method. + * Added examples/derived/ to demonstrate it. This allows you + to encapsulate the handling of the child widgets inside the + container widget's code. + * Makefile.am: Added examples to SUBDIRS so that they are built + by default, for regression testing. + * examples/Makefile.am_fragment: Added top_srcdir include for + distcheck. + +2.0.0: + +2002-12-20 Daniel Elstner + + * examples/basic/basic.cc (main): Exit the program if loading + the glade file failed, so that it won't segfault. + +2002-12-20 Murray Cumming + + * _IGNORE()ed some internal libglade functions. + +2002-12-20 Murray Cumming + + * examples/basic/basic.cc: Used try/catch to catch the new XmlError + exception. Added some comments. + +2002-12-20 Daniel Elstner + + * libglade/src/xml.{ccg,hg} (XmlError): New exception class. + (Xml::Xml): Throw an XmlError exception if glade_xml_construct() + or glade_xml_create_from_buffer() failed. + +2002-12-16 Daniel Elstner + + * libglade/src/xml.{ccg,hg} (Xml::Xml): In order to reduce code + size, replace the ctor overloads with a single ctor and default + arguments, and treat empty strings as 0. Also, use std::string + instead of Glib::ustring for the filename argument. + (Xml::Xml): Add ctor overload for glade_xml_new_from_buffer(). + We should use a construct() function instead but that requires + an API addition to libglade. + (Xml::create): Use std::string for the filename argument, and + reduce code by using default arguments instead of 3 overloads. + (Xml::create_from_buffer): Take a plain const char* for the buffer + argument, plus an int for its size. We already need to do this + for the ctor to avoid overload ambiguities, and I don't see much + of a point in providing an additional create_from_buffer() overload + since it's rarely used. + (Xml::get_widget_checked): New internal method that checks the + type of the widget and prints a warning on failure. + (Xml::get_widget): Move most of the code into the non-templated + method get_widget_checked(), to reduce binary size. + (Xml::relative_file): Take and return std::string, since it's + a filename. + (Xml::get_filename): New accessor to public struct data member. + (Xml::get_widget_name): Add. + (Xml::glade_get_widget_tree): Add. + + * tools/m4/convert_libglademm.m4: Add conversion from GladeXML* + to Glib::RefPtr. + +2002-12-16 Murray Cumming + + * src/xml.hg: reparent_widget() is no longer virtual. + +2002-12-16 Murray Cumming + + * src/xml.[hg|ccg]: Renamed lookup_type() to lookup_type_vfunc(), to + be consistent with other gtkmm vfuncs, and made it virtual. + +2002-12-12 Murray Cumming + + * configure.in: Increased version from 1.3.x to 2.0 + * libglademm/libglademm/Makefile.am: Changed librarary name. + * libglademm/*.pc.in: Changed library name. + * examples/Makefile.am_fragment: Changed library name. + +2002-12-10 Bradley Bell + + * scripts/Makefile.am: distribute macros.m4 + +1.3.5: + * Updated for gtkmm2. + +1.3.4: + +2002-08-07 Murray Cumming + + * Glade::Xml now uses the new gtkmm _CONSTRUCT macro, so it uses + the correct Glib::Object constructor. + +2002-08-06 Martin Schulze + + * examples/basic/Makefile.am: Replace 'example' with 'basic' to + match the actual file names. + +1.3.3: + +2002-07-16 Murray Cumming + + * Rebuilt for latest gtkmm. + +1.3.2: + +2002-06-23 Murray Cumming + + * Rebuilt for latest gtkmm. + * VariablesMap: Fixed "no return statement" warning. + +1.3.1: + +2002-05-02 Murray Cumming + + * Added Gnome::Glade::VariablesMap, with an example. This allows + you to map named Glade widgets to member variables, and transfer + all the data with one method call. + +1.3.0: + +2002-04-29 Murray Cumming + + * Added reparent_widget() method. + +2002-04-28 Murray Cumming + + * Added templated get_widget(name, widget) override, which + does the dynamic casting and warns about any runtime errors, so + that application code doesn't need to. + +2002-04-25 Murray Cumming + + * examples/basic: Use a GtkDialog in the .glade file instead of + the deprecated GnomeDialog. The signal connection now seems to + work. + * libglade/src/xml.[hg|ccg]: Added a lookup_type() vfunc + that instantiates gtkmm types instead of gtk+ types. This requires + the latest libglade. + +2002-04-25 Michael A. Koziarski + + * libglade/src/xml.ccg + * libglade/src/xml.hg: As requested, implemented overloaded + create_from_buffer methods. + +2002-04-25 Murray Cumming + + * Added "basic" example based on the libglade docs and Michael + Koziarski's .glade file. + +2002-04-24 Michael A. Koziarski + + * libglade/src/xml.ccg + * libglade/src/xml.hg: Implemented overloaded create methods & + constructors. Most applications won't need to send a domain + parameter, and some don't need a root parameter + +2002-04-23 Murray Cumming + + * Generated sources are now distributed. The + build_shared/*.am_fragement files were copied from libgnomecanvasmm. + +2002-04-23 Murray Cumming + + * Xml constructor uses the glade_xml_construct() function because + GladeXML doesn't have construct-time properties yet. + + diff --git a/libs/libglademm/INSTALL b/libs/libglademm/INSTALL new file mode 100644 index 0000000000..b42a17ac46 --- /dev/null +++ b/libs/libglademm/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/libglademm/NEWS b/libs/libglademm/NEWS new file mode 100644 index 0000000000..52eacdedbe --- /dev/null +++ b/libs/libglademm/NEWS @@ -0,0 +1,95 @@ +2.6.1: + +* Windows build fixes. (Cedric Gustin) + +2.6.0: + +libglademm 2.6 is API/ABI-compatible with libglademm 2.4. + +Changes since libglademm 2.4: + +* Glade::Xml: Added connect_clicked() for easy connection of + buttons and menuitems signals. (Alberto Paro) +* Glade::VariablesMap: now handles Entry, ComboTextEntry, + SpinButton, *Scale, Calendar and CheckBox. (Alberto Paro). + + +2.5.1: + +* Glade::Xml: Added connect_clicked() for easy connection of + buttons and menuitems signals. (Alberto Paro) +* Glade::VariablesMap: now handles Entry, ComboTextEntry, + SpinButton, *Scale, Calendar and CheckBox. (Alberto Paro). + +2.4.1: + +* gcc 3.4 build fix. (Bryan Forbes) + +2.4.0: + +The API is now stable. + +2.3.3: + +* get_widget(): + - Don't create a C++ object with a null C object, when the + C object can not be found. (jdhall) + - Really return existing widget wrappers. (Murray Cumming) +* Stop accidental need for doxygen when building from tarballs. + (Murray Cumming) +* win32: Test for -mms-bitfields / -fnative-struct. + +2.3.2: + +* Updated for new libsigc++ 2 syntax. + +2.3.1: + +Documentation: +- Generate and install devhelp file. +- beautify hmtl documentation, like the gtkmm docs. +- Install html documentation. + +2.3.0: + +This is the new unstable branch of the parallel-installable libglademm 2.4, +for use with gtkmm 2.4. + +2.1.2: + +* get_widget_derived() now returns an existing C++ instance if one exists, like + get_widget() already does. (Murray Cumming) + +2.1.1: + +No changes. Just recreated the tarball - it was not installing the .la files. + +2.1.0: + +This is the development phase for libglademm 2.2.0, +which will add API but will not break API or ABI. + +* Added Glade::Xml::get_widget_derived() and + examples/derived/ to demonstrate it. + This allows you to use Glade to layout your + own derived container widgets. Tell me what you + think. + (Murray Cumming) + + +2.0.1: + +* Rebuilt the tarball with newer autotools, fixing the $SED problem. + +2.0.0 + +* Glade::Xml::create() now throws an XmlError expection if it fails. + (Daniel Elstner) +* Minimise use of templates, to reduce application code size. + (Daniel Elstner) + +1.3.5 + + + + diff --git a/libs/libglademm/README b/libs/libglademm/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/libglademm/SConscript b/libs/libglademm/SConscript new file mode 100644 index 0000000000..b2a506013d --- /dev/null +++ b/libs/libglademm/SConscript @@ -0,0 +1,14 @@ +# -*- python -*- +import glob +import os + +Import('env libraries') + +libglademm_files = glob.glob('libglademm/*.cc') + +libglademm = env.Copy() +libglademm.Merge([libraries['gtk2'], libraries['glade2'], libraries['sigc2'], libraries['glibmm2'], libraries['pangomm'], libraries['atkmm'], libraries['gdkmm2'], libraries['gtkmm2']]) + +libglade = libglademm.StaticLibrary('libglademm', libglademm_files) + +Default(libglade) diff --git a/libs/libglademm/TODO b/libs/libglademm/TODO new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/libglademm/libglademm.h b/libs/libglademm/libglademm.h new file mode 100644 index 0000000000..fb37dfb10d --- /dev/null +++ b/libs/libglademm/libglademm.h @@ -0,0 +1,31 @@ +/* $Id$ */ +/* libglademm - a C++ wrapper for libglade + * + * Copyright 1999-2001 Free Software Foundation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU 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 LIBGLADEMM_H +#define LIBGLADEMM_H + +/* libglademm version. */ +extern const int libglademm_major_version; +extern const int libglademm_minor_version; +extern const int libglademm_micro_version; + +#include + +#endif /* #ifndef LIBGLADEMM_H */ diff --git a/libs/libglademm/libglademm/init.cc b/libs/libglademm/libglademm/init.cc new file mode 100644 index 0000000000..5e394a8a40 --- /dev/null +++ b/libs/libglademm/libglademm/init.cc @@ -0,0 +1,34 @@ +// -*- c++ -*- +/* $Id$ */ + +/* init.cc + * + * Copyright 2001 Free Software Foundation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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 Gnome +{ + +namespace Glade +{ + + +} //namespace Glade +} //namespace Gnome diff --git a/libs/libglademm/libglademm/init.h b/libs/libglademm/libglademm/init.h new file mode 100644 index 0000000000..8924769150 --- /dev/null +++ b/libs/libglademm/libglademm/init.h @@ -0,0 +1,38 @@ +// -*- c++ -*- +#ifndef _LIBGLADEMM_INIT_H +#define _LIBGLADEMM_INIT_H +/* $Id$ */ + +/* init.h + * + * Copyright 2001 Free Software Foundation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU 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 Gnome +{ + +namespace Glade +{ + + + +} /* namespace Glade */ +} //namespace Gnome + +#endif //_LIBGLADEMM_INIT_H + diff --git a/libs/libglademm/libglademm/private/xml_p.h b/libs/libglademm/libglademm/private/xml_p.h new file mode 100644 index 0000000000..e69f6798cc --- /dev/null +++ b/libs/libglademm/libglademm/private/xml_p.h @@ -0,0 +1,50 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _LIBGLADEMM_XML_P_H +#define _LIBGLADEMM_XML_P_H +#include + +#include + +namespace Gnome +{ + +namespace Glade +{ + +class Xml_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Xml CppObjectType; + typedef GladeXML BaseObjectType; + typedef GladeXMLClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Xml; +#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): + static GType lookup_type_vfunc_callback(GladeXML* self, const char* classname); + }; + + +} // namespace Glade + +} // namespace Gnome + +#endif /* _LIBGLADEMM_XML_P_H */ + diff --git a/libs/libglademm/libglademm/variablesmap.cc b/libs/libglademm/libglademm/variablesmap.cc new file mode 100644 index 0000000000..57d9785bc3 --- /dev/null +++ b/libs/libglademm/libglademm/variablesmap.cc @@ -0,0 +1,199 @@ +/* variablesmap.cc + * + * Copyright (C) 2002 The libglademm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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 Gnome +{ + +namespace Glade +{ + +VariablesMap::VariablesMap(const Glib::RefPtr& glade) +: m_refGlade(glade) +{ +} + +VariablesMap::~VariablesMap() +{ +} + + +void VariablesMap::connect_widget(const Glib::ustring& widget_name, bool& variable) +{ + Gtk::ToggleButton* pToggleButton = 0; + m_refGlade->get_widget(widget_name, pToggleButton); //Glade::Xml will complain if it is not a ToggleButton. + if(pToggleButton) + { + m_mapWidgetsToVariables[pToggleButton] = (void*)(&variable); + } +} + +void VariablesMap::connect_widget(const Glib::ustring& widget_name, Glib::ustring& variable) +{ + Gtk::Widget* pWidget = 0; + m_refGlade->get_widget(widget_name, pWidget); + + Gtk::Entry* pEntry = dynamic_cast(pWidget); //it mange both Gtk::entry and Gtk::SpinButton + Gtk::ComboBoxEntry* pComboBoxEntry = dynamic_cast(pWidget); + if(pEntry) + { + m_mapWidgetsToVariables[pEntry] = (void*)(&variable); + } + if(pComboBoxEntry) + { + m_mapWidgetsToVariables[pComboBoxEntry] = (void*)(&variable); + } +} + +void VariablesMap::connect_widget(const Glib::ustring& widget_name, double& variable) +{ + Gtk::Widget* pWidget = 0; + m_refGlade->get_widget(widget_name, pWidget); + + Gtk::Scale* pScale = dynamic_cast(pWidget); + if(pScale) + { + m_mapWidgetsToVariables[pScale] = (void*)(&variable); + } +} + +void VariablesMap::connect_widget(const Glib::ustring& widget_name, Glib::Date& variable) +{ + Gtk::Widget* pWidget = 0; + m_refGlade->get_widget(widget_name, pWidget); + + Gtk::Calendar* pCalendar = dynamic_cast(pWidget); + if(pCalendar) + { + m_mapWidgetsToVariables[pCalendar] = (void*)(&variable); + } +} + +void VariablesMap::transfer_widgets_to_variables() +{ + if(validate_widgets()) //If the widgets' data is correct. Useful to override. + { + for(type_mapWidgetsToVariables::iterator iter = m_mapWidgetsToVariables.begin(); iter != m_mapWidgetsToVariables.end(); ++iter) + { + transfer_one_widget(iter->first, true); //true = to_variable. + } + } +} + +void VariablesMap::transfer_variables_to_widgets() +{ + for(type_mapWidgetsToVariables::iterator iter = m_mapWidgetsToVariables.begin(); iter != m_mapWidgetsToVariables.end(); ++iter) + { + transfer_one_widget(iter->first, false); //false = to_widget. + } +} + + +void VariablesMap::transfer_one_widget(Gtk::Widget* pWidget, bool to_variable) +{ + //Find the widget in the map: + type_mapWidgetsToVariables::iterator iterFind = m_mapWidgetsToVariables.find(pWidget); + if(iterFind != m_mapWidgetsToVariables.end()) + { + //Get the variable for the widget: + void* pVariable = iterFind->second; + if(pVariable) + { + //Cast the variable appropriately and set it appropriately: + Gtk::Entry* pEntry = dynamic_cast(pWidget); + Gtk::ComboBoxEntry* pComboBoxEntry = dynamic_cast(pWidget); + + Gtk::ToggleButton* pToggleButton = dynamic_cast(pWidget); //CheckButtons and RadioButtons. + Gtk::Scale* pScale = dynamic_cast(pWidget); + Gtk::Calendar* pCalendar = dynamic_cast(pWidget); + + if(pEntry) + { + Glib::ustring* pVar = (Glib::ustring*)(pVariable); + + if(to_variable) + (*pVar) = pEntry->get_text(); + else + pEntry->set_text(*pVar); + } + if(pComboBoxEntry) + { + Glib::ustring* pVar = (Glib::ustring*)(pVariable); + Gtk::Entry* pIEntry = dynamic_cast(pComboBoxEntry->get_child()); + + if(to_variable){ + if(pIEntry) + (*pVar) = pIEntry->get_text(); + } else { + if(pIEntry) + pIEntry->set_text(*pVar); + } + } + if(pToggleButton) + { + bool* pVar = (bool*)(pVariable); + + if(to_variable) + (*pVar) = pToggleButton->get_active(); + else + pToggleButton->set_active(*pVar); + } + if(pScale) + { + double* pVar = (double*)(pVariable); + + if(to_variable) + (*pVar) = pScale->get_value(); + else + pScale->set_value(*pVar); + } + if(pCalendar) + { + Glib::Date* pVar = (Glib::Date*)(pVariable); + + if(to_variable){ + guint year,month,day; + pCalendar->get_date(year,month,day); + (*pVar) = Glib::Date(day,(Glib::Date::Month)month,year); + } else { + pCalendar->select_day(pVar->get_day()); + pCalendar->select_month(pVar->get_month(), pVar->get_year()); + } + } + } + } +} + +bool VariablesMap::validate_widgets() +{ + //Override to add validation. + //TODO: We could add some automatic data-range and text-length validation. + return true; +} + + + +} /* namespace Glade */ +} /* namespace Gnome */ diff --git a/libs/libglademm/libglademm/variablesmap.h b/libs/libglademm/libglademm/variablesmap.h new file mode 100644 index 0000000000..af8bbcdbb9 --- /dev/null +++ b/libs/libglademm/libglademm/variablesmap.h @@ -0,0 +1,96 @@ +/* variablesmap.h + * + * Copyright (C) 2002 The libglademm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU 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 _LIBGLADEMM_VARIABLESMAP_H +#define _LIBGLADEMM_VARIABLESMAP_H + +#include +#include + +namespace Gnome +{ + +namespace Glade +{ + +/** Associates named Glade widgets with member variables. + * Use connect_widget() to link the widgets with variables that will contain their data. + * Then use transfer_widgets_to_variables() and transfer_variables_to_widgets() to get or set all of the variables at once. + * + * This is meant to be a bit like MFC's "Dialog Data Exchange and Validation". + * + * The association of widget and member varables follow this mapping: + * + * Gtk::Entry --> Glib::ustring + * Gtk::SpinBox --> Glib::ustring + * Gtk::ComboBoxEntry --> Glib::ustring + * Gtk::Scale --> double + * Gtk::Calendar --> Glib::Date + * Gtk::CheckBox --> bool + * Gtk::RadioButton --> bool + * + */ +class VariablesMap +{ +public: + explicit VariablesMap(const Glib::RefPtr& glade); + virtual ~VariablesMap(); + + ///For ToggleButton (CheckBox and RadioButton) + virtual void connect_widget(const Glib::ustring& widget_name, bool& variable); + + ///For Entry, ComboBoxEntry and SpinBox + virtual void connect_widget(const Glib::ustring& widget_name, Glib::ustring& variable); + + ///For Scale (HScale and VScale) + virtual void connect_widget(const Glib::ustring& widget_name, double& variable); + + ///For Calendar + virtual void connect_widget(const Glib::ustring& widget_name, Glib::Date& variable); + + ///Transfer data from the widget to the variable. + virtual void transfer_widgets_to_variables(); + + ///Transfer data from the variable to the widget. + virtual void transfer_variables_to_widgets(); + +protected: + + /** Override this to validate the data that the user enters into the widgets. + * The return value indicates whether the widgets' data is valid. + */ + virtual bool validate_widgets(); + + virtual void transfer_one_widget(Gtk::Widget* pWidget, bool to_variable); + + typedef std::map type_mapWidgetsToVariables; + type_mapWidgetsToVariables m_mapWidgetsToVariables; + + Glib::RefPtr m_refGlade; +}; + +} /* namespace Glade */ +} /* namespace Gnome */ + + + + +#endif /* _LIBGLADEMM_VARIABLESMAP_H */ + + diff --git a/libs/libglademm/libglademm/wrap_init.cc b/libs/libglademm/libglademm/wrap_init.cc new file mode 100644 index 0000000000..ff78f96a4f --- /dev/null +++ b/libs/libglademm/libglademm/wrap_init.cc @@ -0,0 +1,50 @@ + +#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 "xml.h" + +extern "C" +{ + +//Declarations of the *_get_type() functions: + +GType glade_xml_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 Gnome { namespace Glade { class Xml_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } } + +namespace Gnome { namespace Glade { + +void wrap_init() +{ + // Register Error domains: + +// Map gtypes to gtkmm wrapper-creation functions: + Glib::wrap_register(glade_xml_get_type(), &Gnome::Glade::Xml_Class::wrap_new); + + // Register the gtkmm gtypes: + Gnome::Glade::Xml::get_type(); + +} // wrap_init() + +} //Glade +} //Gnome + + diff --git a/libs/libglademm/libglademm/wrap_init.h b/libs/libglademm/libglademm/wrap_init.h new file mode 100644 index 0000000000..59dcf4ae07 --- /dev/null +++ b/libs/libglademm/libglademm/wrap_init.h @@ -0,0 +1,37 @@ +#ifndef _LIBGLADEMM_WRAP_INIT_H +#define _LIBGLADEMM_WRAP_INIT_H + +/* wrap_init.h + * + * Copyright (C) 1998-2001 The libglademm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU 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 Gnome +{ + +namespace UI +{ + +void wrap_init(); + +} /* namespace UI */ + +} /* namespace Gnome */ + +#endif // _LIBGLADEMM_WRAP_INIT_H diff --git a/libs/libglademm/libglademm/xml.cc b/libs/libglademm/libglademm/xml.cc new file mode 100644 index 0000000000..5b672bc582 --- /dev/null +++ b/libs/libglademm/libglademm/xml.cc @@ -0,0 +1,343 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The libglademm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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 Gnome +{ + +namespace Glade +{ + +XmlError::XmlError(const Glib::ustring& message) +: + message_ (message) +{} + +XmlError::~XmlError() throw() +{} + +XmlError::XmlError(const XmlError& other) +: + Glib::Exception (other), + message_ (other.message_) +{} + +XmlError& XmlError::operator=(const XmlError& other) +{ + message_ = other.message_; + return *this; +} + +Glib::ustring XmlError::what() const +{ + return message_; +} + + +Xml::Xml(const std::string& filename, const Glib::ustring& root, const Glib::ustring& domain) +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(xml_class_.init(), (char*) 0)) +{ + if(!glade_xml_construct(gobj(), filename.c_str(), root.empty() ? 0 : root.c_str(), + domain.empty() ? 0 : domain.c_str())) + { + throw XmlError("Failed to load glade file `" + Glib::filename_to_utf8(filename) + '\''); + } +} + +// TODO: we need glade_xml_construct_from_buffer() +Xml::Xml(const char* buffer, int size, const Glib::ustring& root, const Glib::ustring& domain) +: + Glib::ObjectBase(0), + Glib::Object((GObject*) glade_xml_new_from_buffer( + buffer, size, root.empty() ? 0 : root.c_str(), domain.empty() ? 0 : domain.c_str())) +{ + if(!gobj()) + throw XmlError("Failed to read glade input buffer"); +} + +// static +Glib::RefPtr Xml::create(const std::string& filename, + const Glib::ustring& root, const Glib::ustring& domain) +{ + return Glib::RefPtr(new Xml(filename, root, domain)); +} + +// static +Glib::RefPtr Xml::create_from_buffer(const char* buffer, int size, + const Glib::ustring& root, const Glib::ustring& domain) +{ + return Glib::RefPtr(new Xml(buffer, size, root, domain)); +} + +void Xml::reparent_widget(const Glib::ustring& name, Gtk::Container& container) +{ + Gtk::Widget* pWidget = 0; + get_widget(name, pWidget); + + g_return_if_fail(pWidget != 0); + + pWidget->reparent(container); +} + +Gtk::Widget* Xml::get_widget_checked(const Glib::ustring& name, GType type) +{ + // Get the widget from the glade file. + Gtk::Widget *const pWidget = get_widget(name); + + if(!pWidget) + { + g_critical("widget `%s' not found in glade file `%s'", name.c_str(), gobj()->filename); + return 0; + } + + // Check if it has the correct type. + if(!g_type_is_a(G_OBJECT_TYPE(pWidget->gobj()), type)) + { + g_critical("widget `%s' (in glade file `%s') is of type `%s' but `%s' was expected", + name.c_str(), gobj()->filename, G_OBJECT_TYPE_NAME(pWidget->gobj()), g_type_name(type)); + return 0; + } + + return pWidget; +} + +GtkWidget* Xml::get_cwidget(const Glib::ustring& name) +{ + GtkWidget* pCWidget = glade_xml_get_widget(gobj(), name.c_str()); + if(!pCWidget) + g_critical("Glade::Xml::get_cwidget(): glade_xml_get_widget() failed."); + + return pCWidget; +} + +// Custom coded so that we can custom-code the vfunc in the Xml class. +// This is marginally better than modifying gtkmmproc to allow this. +// +GType Xml_Class::lookup_type_vfunc_callback(GladeXML* self, const char* classname) +{ + CppObjectType *const obj = dynamic_cast( + Glib::ObjectBase::_get_current_wrapper((GObject*) self)); + + if(obj) + { + try + { + return obj->lookup_type_vfunc(Glib::convert_const_gchar_ptr_to_ustring(classname)); + } + 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. + ); + + if(base && base->lookup_type) + return (*base->lookup_type)(self, classname); + } + + return 0; +} + +GType Xml::lookup_type_vfunc(const Glib::ustring& classname) +{ + // See if there is a gtkmm version of the gclass: + Glib::ustring classname_prefixed ("gtkmm__"); // gtkmm uses a prefix + classname_prefixed += classname; + + GType gtype = g_type_from_name(classname_prefixed.c_str()); + + if(gtype == G_TYPE_INVALID) // if it's not a registered typename + { + // There's no gtkmm derived type, so just use the normal one. + gtype = g_type_from_name(classname.c_str()); + } + + return gtype; +} + +void Xml::connect_clicked(const Glib::ustring& widget_name, const sigc::slot& slot_ ) +{ + Gtk::Widget* pWidget = 0; + get_widget(widget_name, pWidget); + + Gtk::Button* pButton = dynamic_cast(pWidget); + Gtk::MenuItem* pMenuItem = dynamic_cast(pWidget); + + if(pButton) + pButton->signal_clicked().connect( slot_); + + if(pMenuItem) + pMenuItem->signal_activate().connect( slot_ ); +} + +} // namespace Glade +} // namespace Gnome + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr wrap(GladeXML* 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 Gnome +{ + +namespace Glade +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Xml_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_ = &Xml_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(glade_xml_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Xml_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->lookup_type = &lookup_type_vfunc_callback; + } + + +Glib::ObjectBase* Xml_Class::wrap_new(GObject* object) +{ + return new Xml((GladeXML*)object); +} + + +/* The implementation: */ + +GladeXML* Xml::gobj_copy() +{ + reference(); + return gobj(); +} + +Xml::Xml(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Xml::Xml(GladeXML* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Xml::~Xml() +{} + + +Xml::CppClassType Xml::xml_class_; // initialize static member + +GType Xml::get_type() +{ + return xml_class_.init().get_type(); +} + +GType Xml::get_base_type() +{ + return glade_xml_get_type(); +} + + +std::string Xml::get_filename() const +{ + return Glib::convert_const_gchar_ptr_to_stdstring(gobj()->filename); +} + +Gtk::Widget* Xml::get_widget(const Glib::ustring& name) +{ + return Glib::wrap(glade_xml_get_widget(gobj(), name.c_str())); +} + +Glib::ListHandle Xml::get_widget_prefix(const Glib::ustring& name) +{ + return Glib::ListHandle(glade_xml_get_widget_prefix(gobj(), name.c_str()), Glib::OWNERSHIP_SHALLOW); +} + +std::string Xml::relative_file(const std::string& filename) const +{ + return Glib::convert_return_gchar_ptr_to_stdstring(glade_xml_relative_file(const_cast(gobj()), filename.c_str())); +} + +Glib::ustring Xml::get_widget_name(Gtk::Widget& widget) +{ + return Glib::convert_const_gchar_ptr_to_ustring(glade_get_widget_name((widget).gobj())); +} + +Glib::RefPtr Xml::get_widget_tree(Gtk::Widget& widget) +{ + + Glib::RefPtr retvalue = Glib::wrap(glade_get_widget_tree((widget).gobj())); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + + +} // namespace Glade + +} // namespace Gnome + + diff --git a/libs/libglademm/libglademm/xml.h b/libs/libglademm/libglademm/xml.h new file mode 100644 index 0000000000..b0e5c440f7 --- /dev/null +++ b/libs/libglademm/libglademm/xml.h @@ -0,0 +1,348 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _LIBGLADEMM_XML_H +#define _LIBGLADEMM_XML_H + +#include + +/* $Id$ */ + +/* Copyright (C) 2002 The libglademm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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 _GladeXML GladeXML; +typedef struct _GladeXMLClass GladeXMLClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Gnome +{ + +namespace Glade +{ class Xml_Class; } // namespace Glade + +} // namespace Gnome +namespace Gnome +{ + +namespace Glade +{ + +class XmlError : public Glib::Exception +{ +public: + explicit XmlError(const Glib::ustring& message); + virtual ~XmlError() throw(); + + XmlError(const XmlError& other); + XmlError& operator=(const XmlError& other); + + virtual Glib::ustring what() const; + +private: + Glib::ustring message_; +}; + + +class Xml : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Xml CppObjectType; + typedef Xml_Class CppClassType; + typedef GladeXML BaseObjectType; + typedef GladeXMLClass BaseClassType; + +private: friend class Xml_Class; + static CppClassType xml_class_; + +private: + // noncopyable + Xml(const Xml&); + Xml& operator=(const Xml&); + +protected: + explicit Xml(const Glib::ConstructParams& construct_params); + explicit Xml(GladeXML* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Xml(); + +#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. + GladeXML* gobj() { return reinterpret_cast(gobject_); } + + ///Provides access to the underlying C GObject. + const GladeXML* 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. + GladeXML* gobj_copy(); + +private: + + + //Ignore private glade_xml functions. + +protected: + /** Loads a glade XML file. + * @throw XmlError + */ + Xml(const std::string& filename, const Glib::ustring& root, const Glib::ustring& domain); + + /** Reads glade XML data from memory. + * @throw XmlError + */ + Xml(const char* buffer, int size, const Glib::ustring& root, const Glib::ustring& domain); + + Gtk::Widget* get_widget_checked(const Glib::ustring& name, GType type); + GtkWidget* get_cwidget(const Glib::ustring& name); + +public: + typedef Gnome::Glade::XmlError Error; + + /** Loads a glade XML file. + * @throw XmlError + */ + static Glib::RefPtr create(const std::string& filename, + const Glib::ustring& root = Glib::ustring(), + const Glib::ustring& domain = Glib::ustring()); + + /** Reads glade XML data from memory. + * @throw XmlError + */ + static Glib::RefPtr create_from_buffer(const char* buffer, int size, + const Glib::ustring& root = Glib::ustring(), + const Glib::ustring& domain = Glib::ustring()); + + std::string get_filename() const; + +//void glade_xml_signal_connect (GladeXML *self, +// const char *handlername, +// GCallback func); +//void glade_xml_signal_connect_data (GladeXML *self, +// const char *handlername, +// GCallback func, +// gpointer user_data); +// +//void glade_xml_signal_autoconnect (GladeXML *self); +// +// +//typedef void (*GladeXMLConnectFunc) (const gchar *handler_name, +// GObject *object, +// const gchar *signal_name, +// const gchar *signal_data, +// GObject *connect_object, +// gboolean after, +// gpointer user_data); +// +// +//void glade_xml_signal_connect_full (GladeXML *self, +// const gchar *handler_name, +// GladeXMLConnectFunc func, +// gpointer user_data); +// +//void glade_xml_signal_autoconnect_full (GladeXML *self, +// GladeXMLConnectFunc func, +// gpointer user_data); +// +// + /** Get a widget from the glade file. + * For instance: + * @code + * Gtk::Table* pTable = dynamic_cast(refXml->get_widget("mytable")); + * @endcode + * @param name The name of the widget. + * @return A pointer to the widget, or 0 on failure. + */ + + Gtk::Widget* get_widget(const Glib::ustring& name); + + /** This is for convenience. + * It allows for a shorter syntax with less repetition. For instance: + * @code + * Gtk::Table* pTable = 0; + * refXml->get_widget("mytable", pTable); + * @endcode + * This method prints a warning message to the console if the widget + * doesn't exist or has the wrong type, so you don't need to check that + * manually. + * @param name The name of the widget. + * @retval widget A pointer to the widget, or 0 on failure. + * @return The value of @a widget. + */ + template inline + T_Widget* get_widget(const Glib::ustring& name, T_Widget*& widget) + { + // The dynamic_cast<> should never fail if get_widget_checked() succeeded. + widget = dynamic_cast(this->get_widget_checked(name, T_Widget::get_base_type())); + + if(!widget) + g_critical("Gnome::Glade::Xml::get_widget(): dynamic_cast<> failed."); + + return widget; + } + + /** This provides a pointer to a widget whose details are specified in the Glade file, but which is implemented + * by your own derived class. Your class must have a constructor like so: + * @code + * DerivedDialog::DerivedDialog(BaseObjectType* cobject, const Glib::RefPtr& refGlade) + * : Gtk::Dialog(cobject) //Calls the base class constructor + * @endcode + * + * For instance: + * @code + * Gtk::DerivedBox* pBox = 0; + * refXml->get_widget_derived("mybox", pBox); + * @endcode + * + * @param name The name of the widget. + * @retval widget A pointer to the widget, or 0 on failure. + * @return The value of @a widget. + */ + template inline + T_Widget* get_widget_derived(const Glib::ustring& name, T_Widget*& widget) + { + // initialize input parameter + widget = 0; + + // Get the widget from the glade file. + typedef typename T_Widget::BaseObjectType cwidget_type; + cwidget_type* pCWidget = (cwidget_type*)get_cwidget(name); + + //The error was already reported by get_cwidget(). + if(!pCWidget) + return 0; + + //Check whether there is already a C++ wrapper instance associated with this C instance: + Glib::ObjectBase* pObjectBase = ObjectBase::_get_current_wrapper((GObject*)pCWidget); + + //If there is already a C++ instance, then return it again: + if(pObjectBase) + { + widget = dynamic_cast( Glib::wrap((GtkWidget*)pCWidget) ); + //Newer, more spec-complaint, versions of g++ not resolve a specific wrap() function in a template. + + //The dynamic cast checks that it is of the correct type. + //Somebody might be trying to call get_widget_derived() after already calling get_widget(), + //or after already calling get_widget_derived() with a different derived C++ type. + if(!widget) + g_critical("Gnome::Glade::Xml::get_widget_derived(): dynamic_cast<> failed. An existing C++ instance, of a different type, seems to exist."); + } + else + { + //Create a new C++ instance to wrap the existing C instance: + + //Set the output variable. We needed to do this because we can not template the return type. + Glib::RefPtr refThis(this); + refThis->reference(); //take a copy. + widget = new T_Widget(pCWidget, refThis); + } + + //We return it as well (we need the parameter as well, because C++ can not just template the return type.) + return widget; + } + + + Glib::ListHandle get_widget_prefix(const Glib::ustring& name); + + ///Take the widget from the glade-generated container and put it in another container. + void reparent_widget(const Glib::ustring& name, Gtk::Container& container); + + + std::string relative_file(const std::string& filename) const; + + + static Glib::ustring get_widget_name(Gtk::Widget& widget); + + static Glib::RefPtr get_widget_tree(Gtk::Widget& widget); + + + /** Connect a Gtk::Button's clicked signal or a Gtk::MenuItem's activated signal to a slot. + * + * For instance: + * @code + * refXml->connect_button("button", sigc::mem_fun(*this, &ExampleWindow::on_button_clicked) ); + * @endcode + * + * @param name The name of the widget. + * @param pslot The slot to connect to. + */ + void connect_clicked(const Glib::ustring& name, const sigc::slot& slot_); + + +///* interface for changing the custom widget handling */ +//typedef GtkWidget *(* GladeXMLCustomWidgetHandler) (GladeXML *xml, +// gchar *func_name, +// gchar *name, +// gchar *string1, +// gchar *string2, +// gint int1, +// gint int2, +// gpointer user_data); + +//void glade_set_custom_handler(GladeXMLCustomWidgetHandler handler, +// gpointer user_data); + + +protected: + + + virtual GType lookup_type_vfunc(const Glib::ustring& classname); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} // namespace Glade +} // namespace Gnome + + +namespace Glib +{ + /** @relates Gnome::Glade::Xml + * @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(GladeXML* object, bool take_copy = false); +} + + +#endif /* _LIBGLADEMM_XML_H */ + diff --git a/libs/libglademm/libglademmconfig.h b/libs/libglademm/libglademmconfig.h new file mode 100644 index 0000000000..9285bfc4f3 --- /dev/null +++ b/libs/libglademm/libglademmconfig.h @@ -0,0 +1,15 @@ +/* libglade/libglademmconfig.h. Generated by configure. */ +#ifndef _LIBGLADEMM_CONFIG_H +#define _LIBGLADEMM_CONFIG_H 1 + +#include "gtkmmconfig.h" + +/* version numbers */ +#define LIBGLADEMM_MAJOR_VERSION 2 +#define LIBGLADEMM_MINOR_VERSION 6 +#define LIBGLADEMM_MICRO_VERSION 1 +#define LIBGLADEMM_VERSION "2.6.1" +#define LIBGLADE_VERSION_NEEDED_QUOTED "2.3.6" + +#endif /* _LIBGLADEMM_CONFIG_H */ + -- cgit v1.2.3