mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-09-08 00:02:20 -04:00
Made changes for changed files.
* src/Makefile.am, po/POTFILES.in: Made changes for changed files. * src/glade-fixed.[ch]: The new GladeWidget derived free form placement support object. * src/glade-fixed-manager.[ch]: Removed. * doc/catalogintro.sgml: made mention of new 'fixed' property on 'glade-widget-class' tag * doc/gladeui-sections.txt, doc/Makefile.am, doc/tmpl/*, doc/gladeui.types: Updated for file changes. * src/glade-app.c, src/glade-command.c, src/glade-gnome.c, src/glade.h: Changed for new apis in glade-widget and glade-fixed. * src/glade-gtk.c: o Changed for new apis in glade-widget and glade-fixed. o Restructured, now *all* class supports are listed class by class * src/glade-property-class.h: Fixed docs. * src/glade-widget-class.[ch]: o Added glade_widget_class_query () o Added glade_widget_class_create_widget () o Added glade_widget_class_create_internal () * src/glade-widget.[ch]: API is stablizing now... lots of cleanup done, added construct properties used in the constructor to create properties and runtime instances. * widgets/gtk+.xml.in: o Toolbars expand=False by default in GtkVBoxes o GtkPaned now works a little stabler o GtkFixed/GtkLayout marked 'fixed'.
This commit is contained in:
parent
6902e0f83b
commit
16743369c6
39
ChangeLog
39
ChangeLog
@ -1,3 +1,42 @@
|
||||
2006-06-09 Tristan Van Berkom <tvb@gnome.org>
|
||||
|
||||
* src/Makefile.am, po/POTFILES.in: Made changes for changed files.
|
||||
|
||||
* src/glade-fixed.[ch]: The new GladeWidget derived free form placement
|
||||
support object.
|
||||
|
||||
* src/glade-fixed-manager.[ch]: Removed.
|
||||
|
||||
* doc/catalogintro.sgml: made mention of new 'fixed' property on
|
||||
'glade-widget-class' tag
|
||||
|
||||
* doc/gladeui-sections.txt, doc/Makefile.am,
|
||||
doc/tmpl/*, doc/gladeui.types: Updated for file changes.
|
||||
|
||||
* src/glade-app.c, src/glade-command.c, src/glade-gnome.c, src/glade.h:
|
||||
Changed for new apis in glade-widget and glade-fixed.
|
||||
|
||||
* src/glade-gtk.c:
|
||||
o Changed for new apis in glade-widget and glade-fixed.
|
||||
o Restructured, now *all* class supports are listed class
|
||||
by class
|
||||
|
||||
* src/glade-property-class.h: Fixed docs.
|
||||
|
||||
* src/glade-widget-class.[ch]:
|
||||
o Added glade_widget_class_query ()
|
||||
o Added glade_widget_class_create_widget ()
|
||||
o Added glade_widget_class_create_internal ()
|
||||
|
||||
* src/glade-widget.[ch]: API is stablizing now... lots of cleanup done,
|
||||
added construct properties used in the constructor to create properties and
|
||||
runtime instances.
|
||||
|
||||
* widgets/gtk+.xml.in:
|
||||
o Toolbars expand=False by default in GtkVBoxes
|
||||
o GtkPaned now works a little stabler
|
||||
o GtkFixed/GtkLayout marked 'fixed'.
|
||||
|
||||
2006-06-07 Tristan Van Berkom <tvb@gnome.org>
|
||||
|
||||
* src/glade-gtk.c, widgets/gtk+.xml.in:
|
||||
|
@ -61,7 +61,8 @@ IGNORE_HFILES=\
|
||||
glade.h \
|
||||
glade-xml-utils.h \
|
||||
glade-popup.h \
|
||||
glade-devhelp.h
|
||||
glade-devhelp.h \
|
||||
glade-gtk.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||
|
@ -82,6 +82,7 @@ require it and to manage inter catalog dependancies.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>library</term>
|
||||
<listitem>
|
||||
@ -91,6 +92,7 @@ be dlopen'd from <literal>$prefix/lib/glade-3/modules/</literal>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>depends</term>
|
||||
<listitem>
|
||||
@ -103,6 +105,7 @@ declare: 'depends="gtk+"' for your plugin.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>domain</term>
|
||||
<listitem>
|
||||
@ -126,6 +129,16 @@ The 'book' property is used to specify a namespace to search devhelp docs librar
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>fixed</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The 'fixed' property used to mark a #GladeWidgetClass for free form placement capacitied
|
||||
to be handled with a #GladeFixed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>init-function</term>
|
||||
<listitem>
|
||||
|
@ -11,7 +11,6 @@
|
||||
<!ENTITY GladeClipboard SYSTEM "xml/glade-clipboard.xml">
|
||||
<!ENTITY GladeEditorProperty SYSTEM "xml/glade-editor-property.xml">
|
||||
<!ENTITY GladeEditor SYSTEM "xml/glade-editor.xml">
|
||||
<!ENTITY GladeFixedManager SYSTEM "xml/glade-fixed-manager.xml">
|
||||
<!ENTITY GladePalette SYSTEM "xml/glade-palette.xml">
|
||||
<!ENTITY GladeParameter SYSTEM "xml/glade-parameter.xml">
|
||||
<!ENTITY GladePlaceholder SYSTEM "xml/glade-placeholder.xml">
|
||||
@ -23,6 +22,7 @@
|
||||
<!ENTITY GladeUtils SYSTEM "xml/glade-utils.xml">
|
||||
<!ENTITY GladeWidgetClass SYSTEM "xml/glade-widget-class.xml">
|
||||
<!ENTITY GladeWidget SYSTEM "xml/glade-widget.xml">
|
||||
<!ENTITY GladeFixed SYSTEM "xml/glade-fixed.xml">
|
||||
<!ENTITY version SYSTEM "version.xml">
|
||||
]>
|
||||
<book id="index">
|
||||
@ -59,6 +59,7 @@
|
||||
&GladeApp;
|
||||
&GladeProject;
|
||||
&GladeWidget;
|
||||
&GladeFixed;
|
||||
&GladeProperty;
|
||||
&GladeWidgetClass;
|
||||
&GladePropertyClass;
|
||||
@ -78,7 +79,6 @@
|
||||
|
||||
<part id="misc">
|
||||
<title>Miscalanious utilities</title>
|
||||
&GladeFixedManager;
|
||||
&GladePlaceholder;
|
||||
&GladeParameter;
|
||||
&GladeUtils;
|
||||
|
@ -18,6 +18,7 @@ glade_app_set_project
|
||||
glade_app_get_project
|
||||
glade_app_add_project
|
||||
glade_app_remove_project
|
||||
glade_app_get_project_by_path
|
||||
glade_app_get_projects
|
||||
glade_app_get_config
|
||||
glade_app_is_project_loaded
|
||||
@ -181,23 +182,18 @@ GladeEditorTable
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>glade-fixed-manager</FILE>
|
||||
<TITLE>GladeFixedManager</TITLE>
|
||||
GladeFixedManager
|
||||
glade_fixed_manager_new
|
||||
glade_fixed_manager_create_child
|
||||
glade_fixed_manager_add_child
|
||||
glade_fixed_manager_remove_child
|
||||
glade_fixed_manager_post_mouse
|
||||
<FILE>glade-fixed</FILE>
|
||||
<TITLE>GladeFixed</TITLE>
|
||||
GladeFixed
|
||||
<SUBSECTION Standard>
|
||||
GLADE_FIXED_MANAGER
|
||||
GLADE_IS_FIXED_MANAGER
|
||||
GLADE_TYPE_FIXED_MANAGER
|
||||
glade_fixed_manager_get_type
|
||||
GLADE_FIXED_MANAGER_CLASS
|
||||
GLADE_IS_FIXED_MANAGER_CLASS
|
||||
GLADE_FIXED_MANAGER_GET_CLASS
|
||||
GladeFixedManagerClass
|
||||
glade_fixed_get_type
|
||||
GLADE_TYPE_FIXED
|
||||
GLADE_FIXED_GET_CLASS
|
||||
GLADE_IS_FIXED
|
||||
GLADE_IS_FIXED_CLASS
|
||||
GLADE_FIXED_CLASS
|
||||
GLADE_FIXED
|
||||
GladeFixedClass
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@ -302,7 +298,7 @@ GladeProjectClass
|
||||
<FILE>glade-property-class</FILE>
|
||||
<TITLE>GladePropertyClass</TITLE>
|
||||
GladePropertyClass
|
||||
GPCAtkType
|
||||
GPCType
|
||||
GladeVerifyPropertyFunc
|
||||
GladeGetPropertyFunc
|
||||
GladeSetPropertyFunc
|
||||
@ -325,6 +321,7 @@ glade_property_class_match
|
||||
glade_property_class_void_value
|
||||
glade_property_class_atk_realname
|
||||
glade_property_class_list_atk_relations
|
||||
glade_property_class_accel_property
|
||||
<SUBSECTION Private>
|
||||
GPC_PROPERTY_NAMELEN
|
||||
<SUBSECTION Standard>
|
||||
@ -407,6 +404,7 @@ GLADE_IS_SIGNAL
|
||||
<FILE>glade-widget-class</FILE>
|
||||
<TITLE>GladeWidgetClass</TITLE>
|
||||
GladeWidgetClass
|
||||
GladeSignalClass
|
||||
GladeCreateReason
|
||||
GladePostCreateFunc
|
||||
GladeChildSetPropertyFunc
|
||||
@ -421,6 +419,11 @@ glade_widget_class_new
|
||||
glade_widget_class_free
|
||||
glade_widget_class_get_by_name
|
||||
glade_widget_class_get_by_type
|
||||
glade_widget_class_from_pclass
|
||||
glade_widget_class_create_widget
|
||||
glade_widget_class_create_internal
|
||||
glade_widget_class_default_params
|
||||
glade_widget_class_query
|
||||
glade_widget_class_get_derived_types
|
||||
glade_widget_class_dump_param_specs
|
||||
glade_widget_class_get_property_class
|
||||
@ -439,18 +442,18 @@ glade_widget_class_get_type
|
||||
GLADE_WIDGET_CLASS
|
||||
GLADE_IS_WIDGET_CLASS
|
||||
<SUBSECTION Private>
|
||||
glade_widget_class_create_widget_real
|
||||
GPC_OBJECT_DELIMITER
|
||||
GLADE_VALID_CREATE_REASON
|
||||
GladeSupportedChild
|
||||
GladeWidgetClassSignal
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>glade-widget</FILE>
|
||||
<TITLE>GladeWidget</TITLE>
|
||||
GladeWidget
|
||||
glade_widget_new
|
||||
glade_widget_new_for_internal_child
|
||||
glade_widget_add_child
|
||||
glade_widget_remove_child
|
||||
glade_widget_set_name
|
||||
glade_widget_set_internal
|
||||
glade_widget_set_object
|
||||
@ -481,7 +484,6 @@ glade_widget_property_set_sensitive
|
||||
glade_widget_pack_property_set_sensitive
|
||||
glade_widget_property_set_enabled
|
||||
glade_widget_pack_property_set_enabled
|
||||
glade_widget_retrieve_from_position
|
||||
glade_widget_has_decendant
|
||||
glade_widget_replace
|
||||
glade_widget_rebuild
|
||||
@ -584,10 +586,8 @@ glade_util_copy_file
|
||||
glade_util_file_is_writeable
|
||||
glade_util_load_library
|
||||
glade_util_class_implements_interface
|
||||
glade_util_load_devhelp
|
||||
glade_util_have_devhelp
|
||||
glade_util_search_devhelp
|
||||
glade_util_get_devhelp_hbuttons
|
||||
</SECTION>
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ glade_clipboard_view_get_type
|
||||
glade_command_get_type
|
||||
glade_editor_get_type
|
||||
glade_editor_property_get_type
|
||||
glade_fixed_manager_get_type
|
||||
glade_fixed_get_type
|
||||
glade_palette_get_type
|
||||
glade_placeholder_get_type
|
||||
glade_project_get_type
|
||||
|
@ -173,6 +173,15 @@ to initialize the Glade core.
|
||||
@app:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_app_get_project_by_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@project_path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_app_get_projects ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1,159 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GladeFixedManager
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A mechanism to handle free from widget placement containers
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
This object provides a flexable layer that allows plugins to
|
||||
implement free-form placement of child widgets.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GladeFixedManager ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::add-child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::child-created ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::configure-begin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::configure-child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::configure-end ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::create-child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GladeFixedManager::remove-child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gladefixedmanager: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### ARG GladeFixedManager:height-prop ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeFixedManager:width-prop ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeFixedManager:x-prop ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeFixedManager:y-prop ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION glade_fixed_manager_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@gtkcontainer:
|
||||
@x_prop:
|
||||
@y_prop:
|
||||
@width_prop:
|
||||
@height_prop:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_fixed_manager_create_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@manager:
|
||||
@wclass:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_fixed_manager_add_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@manager:
|
||||
@child:
|
||||
@at_mouse:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_fixed_manager_remove_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@manager:
|
||||
@child:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_fixed_manager_post_mouse ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@manager:
|
||||
@x:
|
||||
@y:
|
||||
|
||||
|
@ -25,6 +25,8 @@ va_lists etc (back and forth).
|
||||
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@handle:
|
||||
@pspec:
|
||||
@id:
|
||||
@name:
|
||||
@ -40,7 +42,6 @@ va_lists etc (back and forth).
|
||||
@construct_only:
|
||||
@common:
|
||||
@packing:
|
||||
@atk_type:
|
||||
@translatable:
|
||||
@visible_lines:
|
||||
@save:
|
||||
@ -52,15 +53,16 @@ va_lists etc (back and forth).
|
||||
@set_function:
|
||||
@get_function:
|
||||
|
||||
<!-- ##### ENUM GPCAtkType ##### -->
|
||||
<!-- ##### ENUM GPCType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GPC_ATK_NONE:
|
||||
@GPC_NORMAL:
|
||||
@GPC_ATK_PROPERTY:
|
||||
@GPC_ATK_RELATION:
|
||||
@GPC_ATK_ACTION:
|
||||
@GPC_ACCEL_PROPERTY:
|
||||
|
||||
<!-- ##### USER_FUNCTION GladeVerifyPropertyFunc ##### -->
|
||||
<para>
|
||||
@ -95,6 +97,7 @@ va_lists etc (back and forth).
|
||||
|
||||
</para>
|
||||
|
||||
@handle:
|
||||
@Returns:
|
||||
|
||||
|
||||
@ -103,6 +106,7 @@ va_lists etc (back and forth).
|
||||
|
||||
</para>
|
||||
|
||||
@handle:
|
||||
@spec:
|
||||
@Returns:
|
||||
|
||||
@ -271,6 +275,17 @@ va_lists etc (back and forth).
|
||||
|
||||
</para>
|
||||
|
||||
@handle:
|
||||
@owner_type:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_property_class_accel_property ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@handle:
|
||||
@owner_type:
|
||||
@Returns:
|
||||
|
||||
|
@ -372,14 +372,6 @@ This is where all of that really usefull miscalanious stuff lands up.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_util_load_devhelp ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_util_have_devhelp ##### -->
|
||||
<para>
|
||||
|
||||
@ -393,18 +385,10 @@ This is where all of that really usefull miscalanious stuff lands up.
|
||||
|
||||
</para>
|
||||
|
||||
@devhelp:
|
||||
@book:
|
||||
@page:
|
||||
@search:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_util_get_devhelp_hbuttons ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- # Unused Parameters # -->
|
||||
@devhelp:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@ classes; it also provides an abstraction later to container apis.
|
||||
@catalog:
|
||||
@book:
|
||||
@icon:
|
||||
@fixed:
|
||||
@generic_name:
|
||||
@palette_name:
|
||||
@properties:
|
||||
@ -40,6 +41,15 @@ classes; it also provides an abstraction later to container apis.
|
||||
@get_internal_child:
|
||||
@launch_editor:
|
||||
|
||||
<!-- ##### STRUCT GladeSignalClass ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@query:
|
||||
@name:
|
||||
@type:
|
||||
|
||||
<!-- ##### ENUM GladeCreateReason ##### -->
|
||||
<para>
|
||||
|
||||
@ -176,6 +186,58 @@ classes; it also provides an abstraction later to container apis.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO glade_widget_class_from_pclass ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pclass:
|
||||
|
||||
|
||||
<!-- ##### MACRO glade_widget_class_create_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@class:
|
||||
@query:
|
||||
@...:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_class_create_internal ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@parent:
|
||||
@internal_object:
|
||||
@internal_name:
|
||||
@parent_name:
|
||||
@anarchist:
|
||||
@reason:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_class_default_params ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@class:
|
||||
@construct:
|
||||
@n_params:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_class_query ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@class:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_class_get_derived_types ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -60,11 +60,21 @@ convenience api for getting and setting properties (mostly from the plugin).
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeWidget:info ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeWidget:internal ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeWidget:internal-name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeWidget:name ##### -->
|
||||
<para>
|
||||
|
||||
@ -90,32 +100,33 @@ convenience api for getting and setting properties (mostly from the plugin).
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_new ##### -->
|
||||
<!-- ##### ARG GladeWidget:reason ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GladeWidget:template ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_add_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@parent:
|
||||
@klass:
|
||||
@project:
|
||||
@query:
|
||||
@Returns:
|
||||
@child:
|
||||
@at_mouse:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_new_for_internal_child ##### -->
|
||||
<!-- ##### FUNCTION glade_widget_remove_child ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@parent:
|
||||
@internal_object:
|
||||
@internal_name:
|
||||
@parent_name:
|
||||
@anarchist:
|
||||
@reason:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@project:
|
||||
@child:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_set_name ##### -->
|
||||
@ -410,17 +421,6 @@ convenience api for getting and setting properties (mostly from the plugin).
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_retrieve_from_position ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@base:
|
||||
@x:
|
||||
@y:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_has_decendant ##### -->
|
||||
<para>
|
||||
|
||||
@ -454,8 +454,10 @@ convenience api for getting and setting properties (mostly from the plugin).
|
||||
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@template:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION glade_widget_add_signal_handler ##### -->
|
||||
|
@ -17,7 +17,7 @@ src/glade-cursor.c
|
||||
src/glade-debug.c
|
||||
src/glade-editor-property.c
|
||||
src/glade-editor.c
|
||||
src/glade-fixed-manager.c
|
||||
src/glade-fixed.c
|
||||
src/glade-palette.c
|
||||
src/glade-parameter.c
|
||||
src/glade-parser.c
|
||||
|
@ -80,9 +80,9 @@ libgladeui_1_la_SOURCES = \
|
||||
glade-accumulators.c \
|
||||
glade-parser.c \
|
||||
glade-builtins.c \
|
||||
glade-fixed-manager.c \
|
||||
glade-app.c \
|
||||
glade-keysyms.c
|
||||
glade-keysyms.c \
|
||||
glade-fixed.c
|
||||
|
||||
libgladeui_1_la_CFLAGS = \
|
||||
-DINSIDE_LIBGLADEUI \
|
||||
@ -126,7 +126,7 @@ libgladeuiinclude_HEADERS = \
|
||||
glade-parser.h \
|
||||
glade-app.h \
|
||||
glade-builtins.h \
|
||||
glade-fixed-manager.h \
|
||||
glade-fixed.h \
|
||||
fixed_bg.xpm \
|
||||
atk.xpm
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "glade-catalog.h"
|
||||
#include "glade-app.h"
|
||||
#include "glade-paths.h"
|
||||
#include "glade-fixed.h"
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtkstock.h>
|
||||
@ -1178,9 +1179,10 @@ glade_app_command_paste (void)
|
||||
|
||||
g_assert (widget);
|
||||
|
||||
/* Check that GladeFixedManager will cope */
|
||||
/* Check that GladeFixed will cope...
|
||||
*/
|
||||
if (GTK_WIDGET_TOPLEVEL (widget->object) == FALSE &&
|
||||
parent && parent->manager != NULL &&
|
||||
parent && GLADE_IS_FIXED (parent) &&
|
||||
gtkcontainer_relations != 1)
|
||||
{
|
||||
glade_util_ui_message (glade_app_get_window (),
|
||||
@ -1191,7 +1193,7 @@ glade_app_command_paste (void)
|
||||
}
|
||||
|
||||
/* Check that enough placeholders are available */
|
||||
if (parent && parent->manager == NULL &&
|
||||
if (parent && GLADE_IS_FIXED (parent) == FALSE &&
|
||||
glade_util_count_placeholders (parent) < gtkcontainer_relations)
|
||||
{
|
||||
glade_util_ui_message (glade_app_get_window (),
|
||||
|
@ -41,8 +41,7 @@
|
||||
#include "glade-clipboard.h"
|
||||
#include "glade-signal.h"
|
||||
#include "glade-app.h"
|
||||
#include "glade-fixed-manager.h"
|
||||
|
||||
#include "glade-fixed.h"
|
||||
|
||||
/* Concerning placeholders: we do not hold any reference to placeholders,
|
||||
* placeholders that are supplied by the backend are not reffed, placeholders
|
||||
@ -841,26 +840,12 @@ glade_command_create_execute (GladeCommandCreateDelete *me)
|
||||
if (cdata->parent)
|
||||
{
|
||||
if (cdata->placeholder)
|
||||
{
|
||||
glade_widget_replace
|
||||
(cdata->parent,
|
||||
G_OBJECT (cdata->placeholder),
|
||||
cdata->widget->object);
|
||||
}
|
||||
else if (cdata->parent->manager != NULL)
|
||||
{
|
||||
glade_fixed_manager_add_child
|
||||
(cdata->parent->manager, cdata->widget, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
glade_widget_class_container_add
|
||||
(cdata->parent->widget_class,
|
||||
cdata->parent->object,
|
||||
cdata->widget->object);
|
||||
|
||||
glade_widget_set_parent (cdata->widget, cdata->parent);
|
||||
}
|
||||
glade_widget_add_child (cdata->parent, cdata->widget, FALSE);
|
||||
|
||||
/* Now that we've added, apply any packing props if nescisary. */
|
||||
for (l = cdata->pack_props; l; l = l->next)
|
||||
@ -942,13 +927,8 @@ glade_command_delete_execute (GladeCommandCreateDelete *me)
|
||||
glade_widget_replace
|
||||
(cdata->parent, cdata->widget->object,
|
||||
G_OBJECT (cdata->placeholder));
|
||||
else if (cdata->parent->manager != NULL)
|
||||
glade_fixed_manager_remove_child
|
||||
(cdata->parent->manager, cdata->widget);
|
||||
else
|
||||
glade_widget_class_container_remove (cdata->parent->widget_class,
|
||||
cdata->parent->object,
|
||||
cdata->widget->object);
|
||||
glade_widget_remove_child (cdata->parent, cdata->widget);
|
||||
}
|
||||
|
||||
if (me->from_clipboard != FALSE)
|
||||
@ -1079,9 +1059,9 @@ glade_command_delete (GList *widgets)
|
||||
if (widget->internal)
|
||||
g_critical ("Internal widget in Delete");
|
||||
|
||||
/* !manager here */
|
||||
/* !fixed here */
|
||||
if (cdata->parent != NULL &&
|
||||
cdata->parent->manager == NULL &&
|
||||
GLADE_IS_FIXED (cdata->parent) == FALSE &&
|
||||
glade_util_gtkcontainer_relation
|
||||
(cdata->parent, cdata->widget))
|
||||
{
|
||||
@ -1161,10 +1141,10 @@ glade_command_create (GladeWidgetClass *class,
|
||||
|
||||
me->widgets = g_list_append (me->widgets, cdata);
|
||||
|
||||
if (parent && parent->manager != NULL)
|
||||
widget = glade_fixed_manager_create_child (parent->manager, class);
|
||||
else
|
||||
widget = glade_widget_new (parent, class, project, TRUE);
|
||||
widget = glade_widget_class_create_widget (class, TRUE,
|
||||
"parent", parent,
|
||||
"project", project,
|
||||
NULL);
|
||||
|
||||
/* widget may be null, e.g. the user clicked cancel on a query */
|
||||
if ((cdata->widget = widget) == NULL)
|
||||
@ -1250,24 +1230,11 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
|
||||
G_OBJECT (cdata->placeholder),
|
||||
cdata->widget->object);
|
||||
}
|
||||
else if (cdata->parent->manager != NULL)
|
||||
/* Paste at mouse position only once */
|
||||
glade_fixed_manager_add_child (cdata->parent->manager, cdata->widget,
|
||||
cdata->props_recorded == FALSE);
|
||||
else
|
||||
{
|
||||
/* glade_widget_set_parent (cdata->widget, */
|
||||
/* cdata->parent); */
|
||||
|
||||
glade_widget_class_container_add
|
||||
(cdata->parent->widget_class,
|
||||
cdata->parent->object,
|
||||
cdata->widget->object);
|
||||
|
||||
glade_widget_set_parent (cdata->widget,
|
||||
cdata->parent);
|
||||
|
||||
/* glade_widget_set_packing_properties (cdata->widget, cdata->parent); */
|
||||
glade_widget_add_child (cdata->parent,
|
||||
cdata->widget,
|
||||
cdata->props_recorded == FALSE);
|
||||
}
|
||||
|
||||
/* Now that we've added, apply any packing props if nescisary. */
|
||||
@ -1355,14 +1322,8 @@ glade_command_cut_execute (GladeCommandCutCopyPaste *me)
|
||||
(cdata->parent,
|
||||
cdata->widget->object,
|
||||
G_OBJECT (cdata->placeholder));
|
||||
else if (cdata->parent->manager != NULL)
|
||||
glade_fixed_manager_remove_child
|
||||
(cdata->parent->manager, cdata->widget);
|
||||
else
|
||||
glade_widget_class_container_remove
|
||||
(cdata->parent->widget_class,
|
||||
cdata->parent->object,
|
||||
cdata->widget->object);
|
||||
glade_widget_remove_child (cdata->parent, cdata->widget);
|
||||
}
|
||||
|
||||
glade_widget_hide (cdata->widget);
|
||||
@ -1581,7 +1542,7 @@ glade_command_cut_copy_paste_common (GList *widgets,
|
||||
/* Placeholder */
|
||||
if (type == GLADE_CUT)
|
||||
{
|
||||
if (cdata->parent && cdata->parent->manager == NULL &&
|
||||
if (cdata->parent && GLADE_IS_FIXED (cdata->parent) == FALSE &&
|
||||
glade_util_gtkcontainer_relation
|
||||
(cdata->parent, cdata->widget))
|
||||
{
|
||||
@ -1597,7 +1558,7 @@ glade_command_cut_copy_paste_common (GList *widgets,
|
||||
glade_command_placeholder_connect (cdata, placeholder);
|
||||
}
|
||||
else if (type == GLADE_PASTE && cdata->parent &&
|
||||
cdata->parent->manager == NULL &&
|
||||
GLADE_IS_FIXED (cdata->parent) == FALSE &&
|
||||
glade_util_gtkcontainer_relation (cdata->parent, widget))
|
||||
{
|
||||
if ((children = glade_widget_class_container_get_children
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
#ifndef __GLADE_FIXED_MANAGER_H__
|
||||
#define __GLADE_FIXED_MANAGER_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "glade-widget.h"
|
||||
#include "glade-cursor.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_FIXED_MANAGER (glade_fixed_manager_get_type())
|
||||
#define GLADE_FIXED_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_FIXED_MANAGER, GladeFixedManager))
|
||||
#define GLADE_FIXED_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_FIXED_MANAGER, GladeFixedManagerClass))
|
||||
#define GLADE_IS_FIXED_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_FIXED_MANAGER))
|
||||
#define GLADE_IS_FIXED_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_FIXED_MANAGER))
|
||||
#define GLADE_FIXED_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_FIXED_MANAGER, GladeFixedManagerClass))
|
||||
|
||||
|
||||
typedef struct _GladeFixedManager GladeFixedManager;
|
||||
typedef struct _GladeFixedManagerClass GladeFixedManagerClass;
|
||||
|
||||
struct _GladeFixedManager {
|
||||
GObject parent_instance;
|
||||
|
||||
GladeWidget *container;
|
||||
|
||||
gchar *x_prop; // packing property names (on child widgets) used
|
||||
gchar *y_prop; // to obtain & configure widget coordinates
|
||||
gchar *width_prop; // property names (on child widgets) used to obtain
|
||||
gchar *height_prop; // & configure widget dimentions.
|
||||
|
||||
gint pointer_x_origin;
|
||||
gint pointer_y_origin;
|
||||
gint pointer_x_child_origin;
|
||||
gint pointer_y_child_origin;
|
||||
gint child_x_origin;
|
||||
gint child_y_origin;
|
||||
gint child_width_origin;
|
||||
gint child_height_origin;
|
||||
|
||||
GladeWidget *configuring;
|
||||
GladeCursorType operation;
|
||||
gboolean creating;
|
||||
gint create_x;
|
||||
gint create_y;
|
||||
gint mouse_x;
|
||||
gint mouse_y;
|
||||
};
|
||||
|
||||
struct _GladeFixedManagerClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
GladeWidget *(* create_child) (GladeFixedManager *, GladeWidgetClass *);
|
||||
void (* child_created) (GladeFixedManager *, GladeWidget *);
|
||||
gboolean (* add_child) (GladeFixedManager *, GladeWidget *);
|
||||
gboolean (* remove_child) (GladeFixedManager *, GladeWidget *);
|
||||
gboolean (* configure_child) (GladeFixedManager *, GladeWidget *, GdkRectangle *);
|
||||
void (* configure_begin) (GladeFixedManager *, GladeWidget *);
|
||||
void (* configure_end) (GladeFixedManager *, GladeWidget *);
|
||||
|
||||
/* Signal handler for `GTK_CONTAINER (manager->container->object)' and
|
||||
* child widgets
|
||||
*/
|
||||
gint (* event) (GtkWidget *, GdkEvent *, GladeFixedManager *);
|
||||
gint (* child_event) (GtkWidget *, GdkEvent *, GladeFixedManager *);
|
||||
|
||||
};
|
||||
|
||||
LIBGLADEUI_API
|
||||
GType glade_fixed_manager_get_type (void);
|
||||
LIBGLADEUI_API
|
||||
GladeFixedManager *glade_fixed_manager_new (GladeWidget *gtkcontainer,
|
||||
const gchar *x_prop,
|
||||
const gchar *y_prop,
|
||||
const gchar *width_prop,
|
||||
const gchar *height_prop);
|
||||
LIBGLADEUI_API
|
||||
GladeWidget *glade_fixed_manager_create_child (GladeFixedManager *manager,
|
||||
GladeWidgetClass *wclass);
|
||||
LIBGLADEUI_API
|
||||
void glade_fixed_manager_add_child (GladeFixedManager *manager,
|
||||
GladeWidget *child,
|
||||
gboolean at_mouse);
|
||||
LIBGLADEUI_API
|
||||
void glade_fixed_manager_remove_child (GladeFixedManager *manager,
|
||||
GladeWidget *child);
|
||||
LIBGLADEUI_API
|
||||
void glade_fixed_manager_post_mouse (GladeFixedManager *manager,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_FIXED_MANAGER_H__ */
|
976
src/glade-fixed.c
Normal file
976
src/glade-fixed.c
Normal file
@ -0,0 +1,976 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* glade-fixed.c - A GladeWidget derivative object wrapper designed to
|
||||
* handle free-form child placement for containers such as
|
||||
* GtkFixed and GtkLayout.
|
||||
*
|
||||
* Copyright (C) 2006 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-accumulators.h"
|
||||
#include "glade-marshallers.h"
|
||||
#include "glade-popup.h"
|
||||
#include "glade-fixed.h"
|
||||
|
||||
/* properties */
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_X_PROP,
|
||||
PROP_Y_PROP,
|
||||
PROP_WIDTH_PROP,
|
||||
PROP_HEIGHT_PROP
|
||||
};
|
||||
|
||||
/* signals */
|
||||
enum {
|
||||
CONFIGURE_CHILD,
|
||||
CONFIGURE_BEGIN,
|
||||
CONFIGURE_END,
|
||||
FIXED_SIGNALS
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
gulong press_id;
|
||||
gulong release_id;
|
||||
gulong motion_id;
|
||||
gulong enter_id;
|
||||
} GFSigData;
|
||||
|
||||
/* Convenience macros used in pointer events.
|
||||
*/
|
||||
#define GLADE_FIXED_CURSOR_TOP(type) \
|
||||
((type) == GLADE_CURSOR_RESIZE_TOP_RIGHT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_TOP_LEFT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_TOP)
|
||||
|
||||
#define GLADE_FIXED_CURSOR_BOTTOM(type) \
|
||||
((type) == GLADE_CURSOR_RESIZE_BOTTOM_RIGHT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_BOTTOM_LEFT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_BOTTOM)
|
||||
|
||||
#define GLADE_FIXED_CURSOR_RIGHT(type) \
|
||||
((type) == GLADE_CURSOR_RESIZE_TOP_RIGHT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_BOTTOM_RIGHT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_RIGHT)
|
||||
|
||||
#define GLADE_FIXED_CURSOR_LEFT(type) \
|
||||
((type) == GLADE_CURSOR_RESIZE_TOP_LEFT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_BOTTOM_LEFT || \
|
||||
(type) == GLADE_CURSOR_RESIZE_LEFT)
|
||||
|
||||
#define CHILD_WIDTH_MIN 20
|
||||
#define CHILD_HEIGHT_MIN 20
|
||||
#define CHILD_WIDTH_DEF 100
|
||||
#define CHILD_HEIGHT_DEF 80
|
||||
|
||||
#define GRAB_BORDER_WIDTH 10
|
||||
#define GRAB_CORNER_WIDTH 10
|
||||
|
||||
static GObjectClass *parent_class;
|
||||
static guint glade_fixed_signals[FIXED_SIGNALS];
|
||||
|
||||
/*******************************************************************************
|
||||
Static helper routines
|
||||
*******************************************************************************/
|
||||
static GladeCursorType
|
||||
glade_fixed_get_operation (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GladeCursorType operation = GLADE_CURSOR_DRAG;
|
||||
|
||||
if (x < GRAB_BORDER_WIDTH) {
|
||||
if (y < GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_TOP_LEFT;
|
||||
else if (y > widget->allocation.height - GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_BOTTOM_LEFT;
|
||||
else
|
||||
operation = GLADE_CURSOR_RESIZE_LEFT;
|
||||
} else if (x > widget->allocation.width - GRAB_BORDER_WIDTH) {
|
||||
if (y < GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_TOP_RIGHT;
|
||||
else if (y > widget->allocation.height - GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_BOTTOM_RIGHT;
|
||||
else
|
||||
operation = GLADE_CURSOR_RESIZE_RIGHT;
|
||||
} else if (y < GRAB_BORDER_WIDTH) {
|
||||
if (x < GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_TOP_LEFT;
|
||||
else if (x > widget->allocation.width - GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_TOP_RIGHT;
|
||||
else
|
||||
operation = GLADE_CURSOR_RESIZE_TOP;
|
||||
} else if (y > widget->allocation.height - GRAB_BORDER_WIDTH) {
|
||||
if (x < GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_BOTTOM_LEFT;
|
||||
else if (x > widget->allocation.width - GRAB_BORDER_WIDTH)
|
||||
operation = GLADE_CURSOR_RESIZE_BOTTOM_RIGHT;
|
||||
else
|
||||
operation = GLADE_CURSOR_RESIZE_BOTTOM;
|
||||
}
|
||||
return operation;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_save_state (GladeFixed *fixed,
|
||||
GladeWidget *child)
|
||||
{
|
||||
gdk_window_get_pointer (GTK_WIDGET
|
||||
(GLADE_WIDGET (fixed)->object)->window,
|
||||
&fixed->pointer_x_origin, &fixed->pointer_y_origin, NULL);
|
||||
|
||||
glade_widget_pack_property_get (child, fixed->x_prop, &(fixed->child_x_origin));
|
||||
glade_widget_pack_property_get (child, fixed->y_prop, &(fixed->child_y_origin));
|
||||
glade_widget_property_get (child, fixed->width_prop, &(fixed->child_width_origin));
|
||||
glade_widget_property_get (child, fixed->height_prop, &(fixed->child_height_origin));
|
||||
|
||||
fixed->pointer_x_child_origin =
|
||||
fixed->pointer_x_origin - fixed->child_x_origin;
|
||||
fixed->pointer_y_child_origin =
|
||||
fixed->pointer_y_origin - fixed->child_y_origin;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glade_fixed_filter_event (GladeFixed *fixed,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint left,
|
||||
gint right,
|
||||
gint top,
|
||||
gint bottom)
|
||||
{
|
||||
gint cont_width, cont_height;
|
||||
|
||||
g_return_if_fail (x && y);
|
||||
|
||||
cont_width = GTK_WIDGET (GLADE_WIDGET (fixed)->object)->allocation.width;
|
||||
cont_height = GTK_WIDGET (GLADE_WIDGET (fixed)->object)->allocation.height;
|
||||
|
||||
/* Clip out mouse events that are outside the window.
|
||||
*/
|
||||
if ((left || fixed->operation == GLADE_CURSOR_DRAG) &&
|
||||
*x - fixed->pointer_x_child_origin < 0)
|
||||
*x = fixed->pointer_x_child_origin;
|
||||
if ((top || fixed->operation == GLADE_CURSOR_DRAG) &&
|
||||
*y - fixed->pointer_y_child_origin < 0)
|
||||
*y = fixed->pointer_y_child_origin;
|
||||
|
||||
if ((right || fixed->operation == GLADE_CURSOR_DRAG) &&
|
||||
*x + (fixed->child_width_origin -
|
||||
fixed->pointer_x_child_origin) > cont_width)
|
||||
*x = cont_width - (fixed->child_width_origin -
|
||||
fixed->pointer_x_child_origin);
|
||||
if ((bottom || fixed->operation == GLADE_CURSOR_DRAG) &&
|
||||
*y + (fixed->child_height_origin -
|
||||
fixed->pointer_y_child_origin) > cont_height)
|
||||
*y = cont_height - (fixed->child_height_origin -
|
||||
fixed->pointer_y_child_origin);
|
||||
|
||||
/* Clip out mouse events that mean shrinking to less than 0.
|
||||
*/
|
||||
if (left &&
|
||||
(*x - fixed->pointer_x_child_origin) >
|
||||
(fixed->child_x_origin + (fixed->child_width_origin - CHILD_WIDTH_MIN))) {
|
||||
*x = (fixed->child_x_origin + (fixed->child_width_origin - CHILD_WIDTH_MIN)) -
|
||||
fixed->pointer_x_child_origin;
|
||||
} else if (right &&
|
||||
(*x - fixed->pointer_x_child_origin) <
|
||||
fixed->child_x_origin - (fixed->child_width_origin + CHILD_WIDTH_MIN)) {
|
||||
*x = (fixed->child_x_origin - (fixed->child_width_origin + CHILD_WIDTH_MIN)) +
|
||||
fixed->pointer_x_child_origin;
|
||||
}
|
||||
|
||||
|
||||
if (top &&
|
||||
(*y - fixed->pointer_y_child_origin) >
|
||||
(fixed->child_y_origin + (fixed->child_height_origin - CHILD_HEIGHT_MIN))) {
|
||||
*y = (fixed->child_y_origin + (fixed->child_height_origin - CHILD_HEIGHT_MIN)) -
|
||||
fixed->pointer_y_child_origin;
|
||||
} else if (bottom &&
|
||||
(*y - fixed->pointer_y_child_origin) <
|
||||
fixed->child_y_origin - (fixed->child_height_origin + CHILD_HEIGHT_MIN)) {
|
||||
*y = (fixed->child_y_origin - (fixed->child_height_origin + CHILD_HEIGHT_MIN)) +
|
||||
fixed->pointer_y_child_origin;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_configure_widget (GladeFixed *fixed,
|
||||
GladeWidget *child)
|
||||
{
|
||||
GladeWidget *gwidget = GLADE_WIDGET (fixed);
|
||||
GdkRectangle new_area;
|
||||
gboolean handled, right, left, top, bottom;
|
||||
gint x, y;
|
||||
|
||||
gdk_window_get_pointer
|
||||
(GTK_WIDGET (gwidget->object)->window, &x, &y, NULL);
|
||||
|
||||
/* I think its safe here to skip the glade-property API */
|
||||
new_area.x = GTK_WIDGET (child->object)->allocation.x;
|
||||
new_area.y = GTK_WIDGET (child->object)->allocation.y;
|
||||
new_area.width = GTK_WIDGET (child->object)->allocation.width;
|
||||
new_area.height = GTK_WIDGET (child->object)->allocation.height;
|
||||
|
||||
right = GLADE_FIXED_CURSOR_RIGHT (fixed->operation);
|
||||
left = GLADE_FIXED_CURSOR_LEFT (fixed->operation);
|
||||
top = GLADE_FIXED_CURSOR_TOP (fixed->operation);
|
||||
bottom = GLADE_FIXED_CURSOR_BOTTOM (fixed->operation);
|
||||
|
||||
/* Filter out events that make your widget go out of bounds */
|
||||
glade_fixed_filter_event (fixed, &x, &y, left, right, top, bottom);
|
||||
|
||||
/* Modify current size.
|
||||
*/
|
||||
if (fixed->operation == GLADE_CURSOR_DRAG)
|
||||
{
|
||||
/* Move widget */
|
||||
new_area.x = fixed->child_x_origin +
|
||||
x - fixed->pointer_x_origin;
|
||||
new_area.y = fixed->child_y_origin +
|
||||
y - fixed->pointer_y_origin;
|
||||
} else {
|
||||
|
||||
if (bottom)
|
||||
{
|
||||
new_area.height =
|
||||
fixed->child_height_origin +
|
||||
(y - fixed->pointer_y_origin);
|
||||
} else if (top)
|
||||
{
|
||||
|
||||
new_area.height =
|
||||
fixed->child_height_origin -
|
||||
(y - fixed->pointer_y_origin);
|
||||
new_area.y =
|
||||
fixed->child_y_origin +
|
||||
(y - fixed->pointer_y_origin);
|
||||
}
|
||||
|
||||
if (right)
|
||||
{
|
||||
new_area.width =
|
||||
fixed->child_width_origin +
|
||||
(x - fixed->pointer_x_origin);
|
||||
} else if (left)
|
||||
{
|
||||
new_area.width =
|
||||
fixed->child_width_origin -
|
||||
(x - fixed->pointer_x_origin);
|
||||
new_area.x =
|
||||
fixed->child_x_origin +
|
||||
(x - fixed->pointer_x_origin);
|
||||
}
|
||||
}
|
||||
|
||||
/* Trim */
|
||||
if (new_area.width < CHILD_WIDTH_MIN)
|
||||
new_area.width = CHILD_WIDTH_MIN;
|
||||
if (new_area.height < CHILD_WIDTH_MIN)
|
||||
new_area.height = CHILD_HEIGHT_MIN;
|
||||
|
||||
/* Apply new rectangle to the object */
|
||||
g_signal_emit (G_OBJECT (fixed),
|
||||
glade_fixed_signals[CONFIGURE_CHILD],
|
||||
0, child, &new_area, &handled);
|
||||
|
||||
/* Correct glitches when some widgets are draged over others */
|
||||
gtk_widget_queue_draw (GTK_WIDGET (GLADE_WIDGET (fixed)->object));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_disconnect_child (GladeFixed *fixed,
|
||||
GladeWidget *child)
|
||||
{
|
||||
GFSigData *data;
|
||||
|
||||
if ((data = g_object_get_data (G_OBJECT (child), "glade-fixed-signal-data")) != NULL)
|
||||
{
|
||||
g_signal_handler_disconnect (child->object, data->press_id);
|
||||
g_signal_handler_disconnect (child->object, data->release_id);
|
||||
g_signal_handler_disconnect (child->object, data->enter_id);
|
||||
g_signal_handler_disconnect (child->object, data->motion_id);
|
||||
|
||||
g_object_set_data (G_OBJECT (child), "glade-fixed-signal-data", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_connect_child (GladeFixed *fixed,
|
||||
GladeWidget *child)
|
||||
{
|
||||
GFSigData *data;
|
||||
|
||||
if ((data = g_object_get_data (G_OBJECT (child), "glade-fixed-signal-data")) != NULL)
|
||||
glade_fixed_disconnect_child (fixed, child);
|
||||
|
||||
data = g_new (GFSigData, 1);
|
||||
|
||||
data->press_id =
|
||||
g_signal_connect
|
||||
(child->object, "button-press-event", G_CALLBACK
|
||||
(GLADE_FIXED_GET_CLASS(fixed)->child_event), fixed);
|
||||
data->release_id =
|
||||
g_signal_connect
|
||||
(child->object, "button-release-event", G_CALLBACK
|
||||
(GLADE_FIXED_GET_CLASS(fixed)->child_event), fixed);
|
||||
data->enter_id =
|
||||
g_signal_connect
|
||||
(child->object, "enter-notify-event", G_CALLBACK
|
||||
(GLADE_FIXED_GET_CLASS(fixed)->child_event), fixed);
|
||||
data->motion_id =
|
||||
g_signal_connect
|
||||
(child->object, "motion-notify-event", G_CALLBACK
|
||||
(GLADE_FIXED_GET_CLASS(fixed)->child_event), fixed);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (child), "glade-fixed-signal-data",
|
||||
data, g_free);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
GladeFixedClass
|
||||
*******************************************************************************/
|
||||
static gboolean
|
||||
glade_fixed_configure_child_impl (GladeFixed *fixed,
|
||||
GladeWidget *child,
|
||||
GdkRectangle *rect)
|
||||
{
|
||||
glade_widget_pack_property_set (child, fixed->x_prop, rect->x);
|
||||
glade_widget_pack_property_set (child, fixed->y_prop, rect->y);
|
||||
glade_widget_property_set (child, fixed->width_prop, rect->width);
|
||||
glade_widget_property_set (child, fixed->height_prop, rect->height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glade_fixed_configure_end_impl (GladeFixed *fixed,
|
||||
GladeWidget *child)
|
||||
{
|
||||
GValue x_value = { 0, };
|
||||
GValue y_value = { 0, };
|
||||
GValue width_value = { 0, };
|
||||
GValue height_value = { 0, };
|
||||
GValue new_x_value = { 0, };
|
||||
GValue new_y_value = { 0, };
|
||||
GValue new_width_value = { 0, };
|
||||
GValue new_height_value = { 0, };
|
||||
GladeProperty *x_prop, *y_prop, *width_prop, *height_prop;
|
||||
|
||||
/* XXX Well... this can be simplified now ... heh */
|
||||
x_prop = glade_widget_get_pack_property (child, fixed->x_prop);
|
||||
y_prop = glade_widget_get_pack_property (child, fixed->y_prop);
|
||||
width_prop = glade_widget_get_property (child, fixed->width_prop);
|
||||
height_prop = glade_widget_get_property (child, fixed->height_prop);
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROPERTY (x_prop));
|
||||
g_return_if_fail (GLADE_IS_PROPERTY (y_prop));
|
||||
g_return_if_fail (GLADE_IS_PROPERTY (width_prop));
|
||||
g_return_if_fail (GLADE_IS_PROPERTY (height_prop));
|
||||
|
||||
g_value_init (&x_value, G_TYPE_INT);
|
||||
g_value_init (&y_value, G_TYPE_INT);
|
||||
g_value_init (&width_value, G_TYPE_INT);
|
||||
g_value_init (&height_value, G_TYPE_INT);
|
||||
|
||||
glade_property_get_value (x_prop, &new_x_value);
|
||||
glade_property_get_value (y_prop, &new_y_value);
|
||||
glade_property_get_value (width_prop, &new_width_value);
|
||||
glade_property_get_value (height_prop, &new_height_value);
|
||||
|
||||
g_value_set_int (&x_value, fixed->child_x_origin);
|
||||
g_value_set_int (&y_value, fixed->child_y_origin);
|
||||
g_value_set_int (&width_value, fixed->child_width_origin);
|
||||
g_value_set_int (&height_value, fixed->child_height_origin);
|
||||
|
||||
/* whew, all that for this call !
|
||||
*/
|
||||
glade_command_set_properties (x_prop, &x_value, &new_x_value,
|
||||
y_prop, &y_value, &new_y_value,
|
||||
width_prop, &width_value, &new_width_value,
|
||||
height_prop, &height_value, &new_height_value,
|
||||
NULL);
|
||||
g_value_unset (&x_value);
|
||||
g_value_unset (&y_value);
|
||||
g_value_unset (&width_value);
|
||||
g_value_unset (&height_value);
|
||||
g_value_unset (&new_x_value);
|
||||
g_value_unset (&new_y_value);
|
||||
g_value_unset (&new_width_value);
|
||||
g_value_unset (&new_height_value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_fixed_handle_child_event (GladeFixed *fixed,
|
||||
GladeWidget *child,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GladeWidget *gwidget = GLADE_WIDGET (fixed);
|
||||
gboolean handled = FALSE;
|
||||
gint parent_x, parent_y, child_x, child_y, x, y;
|
||||
GladeCursorType operation;
|
||||
|
||||
gdk_window_get_pointer (GTK_WIDGET (gwidget->object)->window,
|
||||
&parent_x, &parent_y, NULL);
|
||||
|
||||
glade_widget_pack_property_get (child, fixed->x_prop, &child_x);
|
||||
glade_widget_pack_property_get (child, fixed->y_prop, &child_y);
|
||||
|
||||
x = parent_x - child_x;
|
||||
y = parent_y - child_y;
|
||||
|
||||
operation = glade_fixed_get_operation (GTK_WIDGET (child->object), x, y);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_MOTION_NOTIFY:
|
||||
if (fixed->configuring == NULL)
|
||||
{
|
||||
/* GTK_NO_WINDOW widgets still have a pointer to the parent window */
|
||||
if (glade_project_is_selected (child->project,
|
||||
child->object))
|
||||
{
|
||||
glade_cursor_set (((GdkEventAny *)event)->window,
|
||||
operation);
|
||||
}
|
||||
} else if (event->type == GDK_MOTION_NOTIFY)
|
||||
{
|
||||
glade_fixed_configure_widget (fixed, child);
|
||||
handled = TRUE;
|
||||
}
|
||||
gdk_window_get_pointer (GTK_WIDGET (child->object)->window, NULL, NULL, NULL);
|
||||
break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
if (((GdkEventButton *)event)->button == 1)
|
||||
{
|
||||
fixed->configuring = child;
|
||||
/* Save widget allocation and pointer pos */
|
||||
glade_fixed_save_state (fixed, child);
|
||||
|
||||
fixed->operation = operation;
|
||||
glade_cursor_set (((GdkEventAny *)event)->window, fixed->operation);
|
||||
|
||||
g_signal_emit (G_OBJECT (fixed),
|
||||
glade_fixed_signals[CONFIGURE_BEGIN],
|
||||
0, child);
|
||||
|
||||
handled = TRUE;
|
||||
}
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
if (((GdkEventButton *)event)->button == 1 &&
|
||||
fixed->configuring)
|
||||
{
|
||||
// cancel drag stuff
|
||||
fixed->operation = operation;
|
||||
glade_cursor_set (((GdkEventAny *)event)->window, fixed->operation);
|
||||
|
||||
g_signal_emit (G_OBJECT (fixed),
|
||||
glade_fixed_signals[CONFIGURE_END],
|
||||
0, child);
|
||||
|
||||
fixed->configuring = NULL;
|
||||
handled = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_debug ("Unhandled event");
|
||||
break;
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
static gint
|
||||
glade_fixed_child_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GladeFixed *fixed)
|
||||
{
|
||||
GladeWidget *gwidget =
|
||||
glade_widget_get_from_gobject (widget);
|
||||
return glade_fixed_handle_child_event (fixed, gwidget, event);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
GladeWidgetClass
|
||||
*******************************************************************************/
|
||||
static void
|
||||
glade_fixed_add_child_impl (GladeWidget *gwidget_fixed,
|
||||
GladeWidget *child,
|
||||
gboolean at_mouse)
|
||||
{
|
||||
GladeFixed *fixed = GLADE_FIXED (gwidget_fixed);
|
||||
GdkRectangle rect;
|
||||
gboolean handled;
|
||||
|
||||
g_return_if_fail (GLADE_IS_FIXED (fixed));
|
||||
g_return_if_fail (GLADE_IS_WIDGET (child));
|
||||
|
||||
/* Chain up for the basic parenting */
|
||||
GLADE_WIDGET_KLASS (parent_class)->add_child
|
||||
(GLADE_WIDGET (fixed), child, at_mouse);
|
||||
|
||||
/* Could be a delagate object that is not a widget or a special
|
||||
* relationship like menushell->menuitem
|
||||
*/
|
||||
if (!glade_util_gtkcontainer_relation (GLADE_WIDGET (fixed), child))
|
||||
return;
|
||||
|
||||
gtk_widget_add_events (GTK_WIDGET (child->object),
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK);
|
||||
|
||||
glade_fixed_connect_child (fixed, child);
|
||||
|
||||
/* Make sure we can modify these properties */
|
||||
glade_widget_pack_property_set_enabled (child, fixed->x_prop, TRUE);
|
||||
glade_widget_pack_property_set_enabled (child, fixed->y_prop, TRUE);
|
||||
glade_widget_property_set_enabled (child, fixed->width_prop, TRUE);
|
||||
glade_widget_property_set_enabled (child, fixed->height_prop, TRUE);
|
||||
|
||||
/* Setup rect and send configure
|
||||
*/
|
||||
if (fixed->creating)
|
||||
{
|
||||
rect.x = fixed->create_x;
|
||||
rect.y = fixed->create_y;
|
||||
rect.width = CHILD_WIDTH_DEF;
|
||||
rect.height = CHILD_HEIGHT_DEF;
|
||||
|
||||
} else if (at_mouse)
|
||||
{
|
||||
rect.x = fixed->mouse_x;
|
||||
rect.y = fixed->mouse_y;
|
||||
|
||||
glade_widget_property_get (child, fixed->width_prop, &rect.width);
|
||||
glade_widget_property_get (child, fixed->height_prop, &rect.height);
|
||||
|
||||
if (rect.width <= 0)
|
||||
rect.width = CHILD_WIDTH_DEF;
|
||||
|
||||
if (rect.height <= 0)
|
||||
rect.height = CHILD_HEIGHT_DEF;
|
||||
}
|
||||
g_signal_emit (G_OBJECT (fixed),
|
||||
glade_fixed_signals[CONFIGURE_CHILD],
|
||||
0, child, &rect, &handled);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_fixed_popup_menu (GtkWidget *widget, gpointer unused_data)
|
||||
{
|
||||
GladeWidget *glade_widget;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
glade_widget = glade_widget_get_from_gobject (widget);
|
||||
glade_popup_widget_pop (glade_widget, NULL, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_setup_events (GladeWidget *gwidget,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_add_events (widget,
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK);
|
||||
|
||||
g_signal_connect (G_OBJECT (widget), "popup_menu",
|
||||
G_CALLBACK (glade_fixed_popup_menu), NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
glade_fixed_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GladeWidget *gwidget_fixed)
|
||||
{
|
||||
GladeFixed *fixed = GLADE_FIXED (gwidget_fixed);
|
||||
GladeWidgetClass *add_class, *alt_class;
|
||||
gboolean handled = FALSE;
|
||||
GladeWidget *glade_fixed_widget;
|
||||
GladeWidget *gwidget, *search;
|
||||
gdouble x, y;
|
||||
|
||||
add_class = glade_app_get_add_class ();
|
||||
alt_class = glade_app_get_alt_class ();
|
||||
|
||||
if (GLADE_WIDGET_KLASS (parent_class)->event (widget, event, gwidget_fixed))
|
||||
{
|
||||
if (add_class == NULL)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gdk_window_get_pointer (widget->window, NULL, NULL, NULL);
|
||||
glade_fixed_widget = glade_widget_get_from_gobject (widget);
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
gwidget =
|
||||
GLADE_WIDGET_GET_KLASS (fixed)->retrieve_from_position
|
||||
(widget, (int) (x + 0.5), (int) (y + 0.5));
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET (gwidget), FALSE);
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET (glade_fixed_widget), FALSE);
|
||||
|
||||
/* make sure to grab focus, since we may stop default handlers */
|
||||
if (GTK_WIDGET_CAN_FOCUS (widget) && !GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
|
||||
if (fixed->configuring)
|
||||
{
|
||||
return glade_fixed_handle_child_event (fixed, fixed->configuring, event);
|
||||
}
|
||||
else if (glade_fixed_widget != gwidget)
|
||||
{
|
||||
|
||||
/* Get the gwidget that is a direct child of 'fixed' */
|
||||
for (search = gwidget;
|
||||
search && search->parent != GLADE_WIDGET (fixed);
|
||||
search = search->parent);
|
||||
|
||||
if (search)
|
||||
return glade_fixed_handle_child_event (fixed, gwidget, event);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (glade_fixed_widget != gwidget)
|
||||
return FALSE;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS: // add widget
|
||||
if (((GdkEventButton *)event)->button == 1)
|
||||
{
|
||||
|
||||
if ((add_class != NULL) ||
|
||||
((((GdkEventButton *)event)->state & GDK_SHIFT_MASK) &&
|
||||
alt_class != NULL))
|
||||
{
|
||||
/* A widget type is selected in the palette.
|
||||
* Add a new widget of that type.
|
||||
*/
|
||||
fixed->creating = TRUE;
|
||||
gdk_window_get_pointer (GTK_WIDGET
|
||||
(GLADE_WIDGET (fixed)->object)->window,
|
||||
&fixed->create_x, &fixed->create_y, NULL);
|
||||
glade_command_create
|
||||
(add_class ? add_class : alt_class,
|
||||
GLADE_WIDGET (fixed), NULL,
|
||||
GLADE_WIDGET (fixed)->project);
|
||||
fixed->creating = FALSE;
|
||||
|
||||
/* reset the palette */
|
||||
glade_palette_unselect_widget
|
||||
(glade_app_get_palette ());
|
||||
handled = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_MOTION_NOTIFY:
|
||||
if (glade_app_get_add_class ())
|
||||
glade_cursor_set (((GdkEventAny *)event)->window,
|
||||
GLADE_CURSOR_ADD_WIDGET);
|
||||
else
|
||||
glade_cursor_set (((GdkEventAny *)event)->window,
|
||||
GLADE_CURSOR_SELECTOR);
|
||||
handled = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
GObjectClass
|
||||
*******************************************************************************/
|
||||
static GObject *
|
||||
glade_fixed_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_properties)
|
||||
{
|
||||
GObject *obj;
|
||||
GladeWidget *gwidget;
|
||||
|
||||
obj = G_OBJECT_CLASS (parent_class)->constructor
|
||||
(type, n_construct_properties, construct_properties);
|
||||
|
||||
gwidget = GLADE_WIDGET (obj);
|
||||
|
||||
/* This is needed at least to set a backing pixmaps
|
||||
* and handle events more consistantly (lets hope all
|
||||
* free-form containers support being created this way).
|
||||
*/
|
||||
GTK_WIDGET_UNSET_FLAGS(gwidget->object, GTK_NO_WINDOW);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_finalize (GObject *object)
|
||||
{
|
||||
GladeFixed *fixed = GLADE_FIXED (object);
|
||||
|
||||
/* A GladeFixed should be finalized as a result of its
|
||||
* GtkContainer being destroyed, so we shouldn't need to bother
|
||||
* about disconnecting all the child signals.
|
||||
*/
|
||||
g_free (fixed->x_prop);
|
||||
g_free (fixed->y_prop);
|
||||
g_free (fixed->width_prop);
|
||||
g_free (fixed->height_prop);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeFixed *fixed = GLADE_FIXED (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_PROP:
|
||||
g_free (fixed->x_prop);
|
||||
fixed->x_prop = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_Y_PROP:
|
||||
g_free (fixed->y_prop);
|
||||
fixed->y_prop = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_WIDTH_PROP:
|
||||
g_free (fixed->width_prop);
|
||||
fixed->width_prop = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_HEIGHT_PROP:
|
||||
g_free (fixed->height_prop);
|
||||
fixed->height_prop = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeFixed *fixed = GLADE_FIXED (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_X_PROP: g_value_set_string (value, fixed->x_prop); break;
|
||||
case PROP_Y_PROP: g_value_set_string (value, fixed->y_prop); break;
|
||||
case PROP_WIDTH_PROP: g_value_set_string (value, fixed->width_prop); break;
|
||||
case PROP_HEIGHT_PROP: g_value_set_string (value, fixed->height_prop); break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_init (GladeFixed *fixed)
|
||||
{
|
||||
/* Set defaults */
|
||||
fixed->x_prop = g_strdup ("x");
|
||||
fixed->y_prop = g_strdup ("y");
|
||||
fixed->width_prop = g_strdup ("width");
|
||||
fixed->height_prop = g_strdup ("height");
|
||||
}
|
||||
|
||||
static void
|
||||
glade_fixed_class_init (GladeFixedClass *fixed_class)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (fixed_class);
|
||||
GladeWidgetKlass *gwidget_class = GLADE_WIDGET_KLASS (fixed_class);
|
||||
|
||||
parent_class =
|
||||
G_OBJECT_CLASS
|
||||
(g_type_class_peek_parent (gobject_class));
|
||||
|
||||
gobject_class->constructor = glade_fixed_constructor;
|
||||
gobject_class->finalize = glade_fixed_finalize;
|
||||
gobject_class->set_property = glade_fixed_set_property;
|
||||
gobject_class->get_property = glade_fixed_get_property;
|
||||
|
||||
gwidget_class->setup_events = glade_fixed_setup_events;
|
||||
gwidget_class->event = glade_fixed_event;
|
||||
gwidget_class->add_child = glade_fixed_add_child_impl;
|
||||
|
||||
fixed_class->configure_child = glade_fixed_configure_child_impl;
|
||||
fixed_class->configure_begin = NULL;
|
||||
fixed_class->configure_end = glade_fixed_configure_end_impl;
|
||||
fixed_class->child_event = glade_fixed_child_event;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_X_PROP,
|
||||
g_param_spec_string
|
||||
("x_prop", _("X position property"),
|
||||
_("The property used to set the X position of a child object"),
|
||||
"x", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_Y_PROP,
|
||||
g_param_spec_string
|
||||
("y_prop", _("Y position property"),
|
||||
_("The property used to set the Y position of a child object"),
|
||||
"y", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_WIDTH_PROP,
|
||||
g_param_spec_string
|
||||
("width_prop", _("Width property"),
|
||||
_("The property used to set the width of a child object"),
|
||||
"width-request", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class, PROP_HEIGHT_PROP,
|
||||
g_param_spec_string
|
||||
("height_prop", _("Height property"),
|
||||
_("The property used to set the height of a child object"),
|
||||
"height-request", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/**
|
||||
* GladeFixed::configure-child:
|
||||
* @gladewidget: the #GladeFixed which received the signal.
|
||||
* @arg1: the child #GladeWidget
|
||||
* @arg2: a pointer to a #GdkRectange describing the new size.
|
||||
*
|
||||
* Delegates the Drag/Resize job.
|
||||
*
|
||||
* Returns: %TRUE means you have handled the event and cancels the
|
||||
* default handler from being triggered.
|
||||
*/
|
||||
glade_fixed_signals[CONFIGURE_CHILD] =
|
||||
g_signal_new ("configure-child",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET
|
||||
(GladeFixedClass, configure_child),
|
||||
glade_boolean_handled_accumulator, NULL,
|
||||
glade_marshal_BOOLEAN__OBJECT_POINTER,
|
||||
G_TYPE_BOOLEAN, 2, G_TYPE_OBJECT, G_TYPE_POINTER);
|
||||
|
||||
/**
|
||||
* GladeFixed::configure-begin:
|
||||
* @gladewidget: the #GladeFixed which received the signal.
|
||||
* @arg1: the child #GladeWidget
|
||||
*
|
||||
* Signals the beginning of a Drag/Resize
|
||||
*/
|
||||
glade_fixed_signals[CONFIGURE_BEGIN] =
|
||||
g_signal_new ("configure-begin",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET
|
||||
(GladeFixedClass, configure_begin),
|
||||
NULL, NULL,
|
||||
glade_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
/**
|
||||
* GladeFixed::configure-end:
|
||||
* @gladewidget: the #GladeFixed which received the signal.
|
||||
* @arg1: the child #GladeWidget
|
||||
*
|
||||
* Signals the end of a Drag/Resize
|
||||
*/
|
||||
glade_fixed_signals[CONFIGURE_END] =
|
||||
g_signal_new ("configure-end",
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET
|
||||
(GladeFixedClass, configure_end),
|
||||
NULL, NULL,
|
||||
glade_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
API
|
||||
*******************************************************************************/
|
||||
|
||||
GType
|
||||
glade_fixed_get_type (void)
|
||||
{
|
||||
static GType fixed_type = 0;
|
||||
|
||||
if (!fixed_type)
|
||||
{
|
||||
static const GTypeInfo fixed_info =
|
||||
{
|
||||
sizeof (GladeFixedClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) glade_fixed_class_init,
|
||||
(GClassFinalizeFunc) NULL,
|
||||
NULL, /* class_data */
|
||||
sizeof (GladeFixed),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) glade_fixed_init,
|
||||
};
|
||||
fixed_type =
|
||||
g_type_register_static (GLADE_TYPE_WIDGET,
|
||||
"GladeFixed",
|
||||
&fixed_info, 0);
|
||||
}
|
||||
return fixed_type;
|
||||
}
|
72
src/glade-fixed.h
Normal file
72
src/glade-fixed.h
Normal file
@ -0,0 +1,72 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
#ifndef __GLADE_FIXED_H__
|
||||
#define __GLADE_FIXED_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "glade-widget.h"
|
||||
#include "glade-cursor.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_FIXED (glade_fixed_get_type())
|
||||
#define GLADE_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_FIXED, GladeFixed))
|
||||
#define GLADE_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_FIXED, GladeFixedClass))
|
||||
#define GLADE_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_FIXED))
|
||||
#define GLADE_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_FIXED))
|
||||
#define GLADE_FIXED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_FIXED, GladeFixedClass))
|
||||
|
||||
|
||||
typedef struct _GladeFixed GladeFixed;
|
||||
typedef struct _GladeFixedClass GladeFixedClass;
|
||||
|
||||
struct _GladeFixed {
|
||||
GladeWidget parent_instance;
|
||||
|
||||
gchar *x_prop; /* packing property names (on child widgets) used */
|
||||
gchar *y_prop; /* to obtain & configure widget coordinates */
|
||||
gchar *width_prop; /* property names (on child widgets) used to obtain */
|
||||
gchar *height_prop; /* & configure widget dimentions. */
|
||||
|
||||
|
||||
/* State machine used to commit properties at the end
|
||||
* of a drag or a resize (i.e. a "configure").
|
||||
*/
|
||||
gint pointer_x_origin;
|
||||
gint pointer_y_origin;
|
||||
gint pointer_x_child_origin;
|
||||
gint pointer_y_child_origin;
|
||||
gint child_x_origin;
|
||||
gint child_y_origin;
|
||||
gint child_width_origin;
|
||||
gint child_height_origin;
|
||||
|
||||
GladeWidget *configuring;
|
||||
GladeCursorType operation;
|
||||
gboolean creating;
|
||||
gint create_x;
|
||||
gint create_y;
|
||||
gint mouse_x;
|
||||
gint mouse_y;
|
||||
};
|
||||
|
||||
struct _GladeFixedClass {
|
||||
GladeWidgetKlass parent_class;
|
||||
|
||||
gboolean (* configure_child) (GladeFixed *, GladeWidget *, GdkRectangle *);
|
||||
void (* configure_begin) (GladeFixed *, GladeWidget *);
|
||||
void (* configure_end) (GladeFixed *, GladeWidget *);
|
||||
|
||||
/* Signal handler for child widgets
|
||||
*/
|
||||
gint (* child_event) (GtkWidget *, GdkEvent *, GladeFixed *);
|
||||
|
||||
};
|
||||
|
||||
LIBGLADEUI_API
|
||||
GType glade_fixed_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_FIXED_H__ */
|
@ -70,12 +70,12 @@ glade_gnome_app_post_create (GObject *object, GladeCreateReason reason)
|
||||
project = glade_widget_get_project (gapp);
|
||||
|
||||
/* Add BonoboDock */
|
||||
gdock = glade_widget_new_for_internal_child (gapp,
|
||||
G_OBJECT (app->dock),
|
||||
"dock",
|
||||
glade_widget_get_name (gapp),
|
||||
FALSE,
|
||||
GLADE_CREATE_LOAD);
|
||||
gdock = glade_widget_class_create_internal
|
||||
(gapp, G_OBJECT (app->dock),
|
||||
"dock",
|
||||
glade_widget_get_name (gapp),
|
||||
FALSE,
|
||||
GLADE_CREATE_LOAD);
|
||||
|
||||
if (reason != GLADE_CREATE_USER) return;
|
||||
|
||||
@ -87,7 +87,9 @@ glade_gnome_app_post_create (GObject *object, GladeCreateReason reason)
|
||||
}
|
||||
|
||||
/* DockItem */
|
||||
gdock_item = glade_widget_new (gdock, dock_item_class, project, FALSE);
|
||||
gdock_item = glade_widget_class_create_widget (dock_item_class, FALSE,
|
||||
"parent", gdock,
|
||||
"project", project, NULL);
|
||||
glade_widget_class_container_add (glade_widget_get_class (gdock),
|
||||
glade_widget_get_object (gdock),
|
||||
glade_widget_get_object (gdock_item));
|
||||
@ -97,7 +99,10 @@ glade_gnome_app_post_create (GObject *object, GladeCreateReason reason)
|
||||
BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL |
|
||||
BONOBO_DOCK_ITEM_BEH_LOCKED);
|
||||
/* MenuBar */
|
||||
gmenubar = glade_widget_new (gdock_item, menubar_class, project, FALSE);
|
||||
gmenubar = glade_widget_class_create_widget (menubar_class, FALSE,
|
||||
"parent", gdock_item,
|
||||
"project", project, NULL);
|
||||
|
||||
glade_widget_class_container_add (glade_widget_get_class (gdock_item),
|
||||
glade_widget_get_object (gdock_item),
|
||||
glade_widget_get_object (gmenubar));
|
||||
@ -214,10 +219,10 @@ glade_gnome_app_set_has_statusbar (GObject *object, GValue *value)
|
||||
|
||||
gnome_app_set_statusbar (app, bar);
|
||||
|
||||
gbar = glade_widget_new_for_internal_child (gapp,
|
||||
G_OBJECT (bar), "appbar",
|
||||
glade_widget_get_name (gapp),
|
||||
FALSE, GLADE_CREATE_USER);
|
||||
gbar = glade_widget_class_create_internal
|
||||
(gapp, G_OBJECT (bar), "appbar",
|
||||
glade_widget_get_name (gapp),
|
||||
FALSE, GLADE_CREATE_USER);
|
||||
|
||||
glade_widget_set_parent (gbar, gapp);
|
||||
glade_widget_pack_property_set (gbar, "expand", FALSE);
|
||||
@ -264,10 +269,10 @@ glade_gnome_druid_add_page (GladeWidget *gdruid, gboolean edge)
|
||||
dpe_class = glade_widget_class_get_by_type (GNOME_TYPE_DRUID_PAGE_EDGE);
|
||||
}
|
||||
|
||||
gpage = glade_widget_new (gdruid,
|
||||
(edge) ? dpe_class : dps_class,
|
||||
project,
|
||||
FALSE);
|
||||
gpage = glade_widget_class_create_widget (edge ? dpe_class : dps_class, FALSE,
|
||||
"parent", gdruid,
|
||||
"project", project, NULL);
|
||||
|
||||
glade_widget_class_container_add (glade_widget_get_class (gdruid),
|
||||
glade_widget_get_object (gdruid),
|
||||
glade_widget_get_object (gpage));
|
||||
@ -477,9 +482,9 @@ glade_gnome_dps_post_create (GObject *object, GladeCreateReason reason)
|
||||
|
||||
gpage = glade_widget_get_from_gobject (object);
|
||||
vbox = G_OBJECT (GNOME_DRUID_PAGE_STANDARD (object)->vbox);
|
||||
gvbox = glade_widget_new_for_internal_child (gpage, vbox, "vbox",
|
||||
glade_widget_get_name (gpage),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
gvbox = glade_widget_class_create_internal (gpage, vbox, "vbox",
|
||||
glade_widget_get_name (gpage),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
|
||||
if (reason == GLADE_CREATE_USER)
|
||||
glade_widget_property_set (gvbox, "size", 1);
|
||||
@ -799,7 +804,9 @@ glade_gnome_dialog_add_button (GladeWidget *gaction_area,
|
||||
if (button_class == NULL)
|
||||
button_class = glade_widget_class_get_by_type (GTK_TYPE_BUTTON);
|
||||
|
||||
gbutton = glade_widget_new (gaction_area, button_class, project, FALSE);
|
||||
gbutton = glade_widget_class_create_widget (button_class, FALSE,
|
||||
"parent", gaction_area,
|
||||
"project", project, FALSE);
|
||||
|
||||
eclass = g_type_class_ref (glade_standard_stock_get_type ());
|
||||
if ((eval = g_enum_get_value_by_nick (eclass, stock)) != NULL)
|
||||
@ -831,20 +838,20 @@ glade_gnome_dialog_post_create (GObject *object, GladeCreateReason reason)
|
||||
{
|
||||
GnomePropertyBox *pbox = GNOME_PROPERTY_BOX (object);
|
||||
|
||||
gaction_area = glade_widget_new_for_internal_child (gdialog,
|
||||
G_OBJECT (pbox->notebook), "notebook",
|
||||
glade_widget_get_name (gdialog),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
gaction_area = glade_widget_class_create_internal
|
||||
(gdialog, G_OBJECT (pbox->notebook), "notebook",
|
||||
glade_widget_get_name (gdialog),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
if (reason == GLADE_CREATE_USER)
|
||||
glade_widget_property_set (gaction_area, "pages", 3);
|
||||
return;
|
||||
}
|
||||
|
||||
/* vbox internal child */
|
||||
gvbox = glade_widget_new_for_internal_child (gdialog,
|
||||
G_OBJECT (dialog->vbox), "vbox",
|
||||
glade_widget_get_name (gdialog),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
gvbox = glade_widget_class_create_internal
|
||||
(gdialog, G_OBJECT (dialog->vbox), "vbox",
|
||||
glade_widget_get_name (gdialog),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
|
||||
glade_widget_property_set (gvbox, "size", 0);
|
||||
|
||||
@ -864,11 +871,12 @@ glade_gnome_dialog_post_create (GObject *object, GladeCreateReason reason)
|
||||
gtk_widget_show (separator);
|
||||
|
||||
/* action area internal child */
|
||||
gaction_area = glade_widget_new_for_internal_child (gvbox,
|
||||
G_OBJECT (dialog->action_area),
|
||||
"action_area",
|
||||
glade_widget_get_name (gvbox),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
gaction_area =
|
||||
glade_widget_class_create_internal (gvbox,
|
||||
G_OBJECT (dialog->action_area),
|
||||
"action_area",
|
||||
glade_widget_get_name (gvbox),
|
||||
FALSE, GLADE_CREATE_LOAD);
|
||||
|
||||
glade_widget_property_set (gaction_area, "size", 0);
|
||||
|
||||
@ -1111,10 +1119,10 @@ glade_gnome_entry_post_create (GObject *object, GladeCreateReason reason)
|
||||
glade_gnome_entry_get_internal_child (object, "entry", &child);
|
||||
|
||||
gentry = glade_widget_get_from_gobject (object);
|
||||
glade_widget_new_for_internal_child (gentry,
|
||||
child, "entry",
|
||||
glade_widget_get_name (gentry),
|
||||
FALSE, reason);
|
||||
glade_widget_class_create_internal (gentry,
|
||||
child, "entry",
|
||||
glade_widget_get_name (gentry),
|
||||
FALSE, reason);
|
||||
}
|
||||
|
||||
GList * GLADEGNOME_API
|
||||
|
4487
src/glade-gtk.c
4487
src/glade-gtk.c
File diff suppressed because it is too large
Load Diff
@ -3,5 +3,6 @@ VOID:STRING,ULONG,UINT,STRING
|
||||
OBJECT:POINTER
|
||||
BOOLEAN:OBJECT
|
||||
BOOLEAN:OBJECT,POINTER
|
||||
BOOLEAN:OBJECT,BOOLEAN
|
||||
VOID:OBJECT
|
||||
VOID:STRING,STRING,STRING
|
||||
|
@ -18,10 +18,11 @@ typedef struct _GladePropertyClass GladePropertyClass;
|
||||
|
||||
/**
|
||||
* GPCType:
|
||||
* @GPC_ATK_NONE: is not an atk property
|
||||
* @GPC_NORMAL: is not an atk property
|
||||
* @GPC_ATK_PROPERTY: is a property of an #AtkImplementor object
|
||||
* @GPC_ATK_RELATION: is an atk relation set property
|
||||
* @GPC_ATK_ACTION: is an atk action property
|
||||
* @GPC_ACCEL_PROPERTY: is an accelerator key property
|
||||
*/
|
||||
typedef enum {
|
||||
GPC_NORMAL,
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "glade-signal.h"
|
||||
#include "glade-parameter.h"
|
||||
#include "glade-debug.h"
|
||||
#include "glade-fixed.h"
|
||||
|
||||
/* hash table that will contain all the GtkWidgetClass'es created, indexed by its name */
|
||||
static GHashTable *widget_classes = NULL;
|
||||
@ -580,6 +581,9 @@ glade_widget_class_extend_with_node (GladeWidgetClass *widget_class,
|
||||
(void **)
|
||||
&widget_class->launch_editor);
|
||||
}
|
||||
widget_class->fixed =
|
||||
glade_xml_get_property_boolean (node, GLADE_TAG_FIXED, widget_class->fixed);
|
||||
|
||||
|
||||
/* if we found a <properties> tag on the xml file, we add the properties
|
||||
* that we read from the xml file to the class.
|
||||
@ -1267,12 +1271,6 @@ glade_widget_class_default_params (GladeWidgetClass *class,
|
||||
pclass->orig_def) == 0)
|
||||
continue;
|
||||
|
||||
#if 0
|
||||
if (glade_property_class_void_value (pclass, pclass->def))
|
||||
continue;
|
||||
|
||||
#endif
|
||||
|
||||
parameter.name = pspec[i]->name; /* These are not copied/freed */
|
||||
g_value_init (¶meter.value, pspec[i]->value_type);
|
||||
g_value_copy (pclass->def, ¶meter.value);
|
||||
@ -1537,3 +1535,153 @@ glade_widget_class_get_packing_default (GladeWidgetClass *child_class,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_widget_class_query:
|
||||
* @class: A #GladeWidgetClass
|
||||
*
|
||||
* Returns: whether the user needs to be queried for
|
||||
* certain properties upon creation of this class.
|
||||
*/
|
||||
gboolean
|
||||
glade_widget_class_query (GladeWidgetClass *class)
|
||||
{
|
||||
GladePropertyClass *pclass;
|
||||
GList *l;
|
||||
|
||||
for (l = class->properties; l; l = l->next)
|
||||
{
|
||||
pclass = l->data;
|
||||
|
||||
if (pclass->query)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_widget_class_create_widget:
|
||||
* @class: a #GladeWidgetClass
|
||||
* @query: whether to display query dialogs if
|
||||
* applicable to the class
|
||||
* @...: a %NULL terminated list of string/value pairs of #GladeWidget
|
||||
* properties
|
||||
*
|
||||
*
|
||||
* This factory function returns a new #GladeWidget of the correct type/class
|
||||
* with the properties defined in @... and queries the user if nescisary.
|
||||
*
|
||||
* The resulting object will have all default properties applied to it
|
||||
* including the overrides specified in the catalog, unless the catalog
|
||||
* has specified 'ignore' for that property.
|
||||
*
|
||||
* Note that the widget class must be fed twice; once as the
|
||||
* leading arg... and also as the property for the #GladeWidget
|
||||
*
|
||||
* this macro returns the newly created #GladeWidget
|
||||
*/
|
||||
GladeWidget *
|
||||
glade_widget_class_create_widget_real (gboolean query,
|
||||
const gchar *first_property,
|
||||
...)
|
||||
{
|
||||
GladeWidgetClass *widget_class;
|
||||
GType gwidget_type;
|
||||
GladeWidget *gwidget;
|
||||
va_list vl, vl_copy;
|
||||
|
||||
g_return_val_if_fail (strcmp (first_property, "class") == 0, NULL);
|
||||
|
||||
va_start (vl, first_property);
|
||||
va_copy (vl_copy, vl);
|
||||
|
||||
widget_class = va_arg (vl, GladeWidgetClass *);
|
||||
|
||||
va_end (vl);
|
||||
|
||||
if (GLADE_IS_WIDGET_CLASS (widget_class) == FALSE)
|
||||
{
|
||||
g_critical ("No class found in glade_widget_class_create_widget_real args");
|
||||
va_end (vl_copy);
|
||||
}
|
||||
|
||||
if (widget_class->fixed)
|
||||
gwidget_type = GLADE_TYPE_FIXED;
|
||||
else
|
||||
gwidget_type = GLADE_TYPE_WIDGET;
|
||||
|
||||
|
||||
gwidget = g_object_new_valist (gwidget_type,
|
||||
first_property,
|
||||
(va_list) vl_copy);
|
||||
va_end (vl_copy);
|
||||
|
||||
if (query && glade_widget_class_query (widget_class))
|
||||
{
|
||||
GladeEditor *editor = glade_app_get_editor ();
|
||||
|
||||
/* If user pressed cancel on query popup. */
|
||||
if (!glade_editor_query_dialog (editor, gwidget))
|
||||
{
|
||||
g_object_unref (G_OBJECT (gwidget));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return gwidget;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* glade_widget_class_create_internal:
|
||||
* @parent: The parent #GladeWidget, or %NULL for children
|
||||
* outside of the hierarchy.
|
||||
* @internal_object: the #GObject
|
||||
* @internal_name: a string identifier for this internal widget.
|
||||
* @anarchist: Whether or not this widget is a widget outside
|
||||
* of the parent's hierarchy (like a popup window)
|
||||
* @reason: The #GladeCreateReason for which this internal widget
|
||||
* was created (usually just pass the reason from the post_create
|
||||
* function; note also this is used only by the plugin code so
|
||||
* pass something usefull here).
|
||||
*
|
||||
* A convenienve function to create a #GladeWidget of the prescribed type
|
||||
* for internal widgets.
|
||||
*
|
||||
* Returns: a freshly created #GladeWidget wrapper object for the
|
||||
* @internal_object of name @internal_name
|
||||
*/
|
||||
GladeWidget *
|
||||
glade_widget_class_create_internal (GladeWidget *parent,
|
||||
GObject *internal_object,
|
||||
const gchar *internal_name,
|
||||
const gchar *parent_name,
|
||||
gboolean anarchist,
|
||||
GladeCreateReason reason)
|
||||
{
|
||||
GladeWidgetClass *class;
|
||||
GladeProject *project;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET (parent), NULL);
|
||||
project = glade_widget_get_project (parent);
|
||||
|
||||
if ((class = glade_widget_class_get_by_name
|
||||
(G_OBJECT_TYPE_NAME (internal_object))) == NULL)
|
||||
{
|
||||
g_critical ("Unable to find widget class for type %s",
|
||||
G_OBJECT_TYPE_NAME (internal_object));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return glade_widget_class_create_widget (class, FALSE,
|
||||
"anarchist", anarchist,
|
||||
"parent", parent,
|
||||
"project", project,
|
||||
"internal", internal_name,
|
||||
"internal-name", parent_name,
|
||||
"reason", reason,
|
||||
"object", internal_object,
|
||||
NULL);
|
||||
}
|
||||
|
@ -171,6 +171,10 @@ struct _GladeWidgetClass
|
||||
|
||||
GdkPixbuf *icon; /* The GdkPixbuf icon for the widget */
|
||||
|
||||
gboolean fixed; /* If this is a GtkContainer, use free-form
|
||||
* placement with drag/resize/paste at mouse...
|
||||
*/
|
||||
|
||||
gchar *generic_name; /* Use to generate names of new widgets, for
|
||||
* example "button" so that we generate button1,
|
||||
* button2, buttonX ..
|
||||
@ -257,11 +261,14 @@ struct _GladeSignalClass
|
||||
{
|
||||
GSignalQuery query;
|
||||
|
||||
gchar *name; /* Name of the signal, eg clicked */
|
||||
gchar *type; /* Name of the object class that this signal belongs to
|
||||
* eg GtkButton */
|
||||
const gchar *name; /* Name of the signal, eg clicked */
|
||||
gchar *type; /* Name of the object class that this signal belongs to
|
||||
* eg GtkButton */
|
||||
|
||||
};
|
||||
|
||||
#define glade_widget_class_create_widget(class, query, ...) \
|
||||
(glade_widget_class_create_widget_real (query, "class", class, __VA_ARGS__));
|
||||
|
||||
LIBGLADEUI_API
|
||||
GladeWidgetClass *glade_widget_class_new (GladeXmlNode *class_node,
|
||||
@ -269,6 +276,17 @@ GladeWidgetClass *glade_widget_class_new (GladeXmlNode *cl
|
||||
const gchar *library,
|
||||
const gchar *domain,
|
||||
const gchar *book);
|
||||
LIBGLADEUI_API
|
||||
GladeWidget *glade_widget_class_create_internal (GladeWidget *parent,
|
||||
GObject *internal_object,
|
||||
const gchar *internal_name,
|
||||
const gchar *parent_name,
|
||||
gboolean anarchist,
|
||||
GladeCreateReason reason);
|
||||
LIBGLADEUI_API
|
||||
GladeWidget *glade_widget_class_create_widget_real (gboolean query,
|
||||
const gchar *first_property,
|
||||
...);
|
||||
LIBGLADEUI_API
|
||||
void glade_widget_class_free (GladeWidgetClass *widget_class);
|
||||
LIBGLADEUI_API
|
||||
@ -325,7 +343,8 @@ void glade_widget_class_container_replace_child (GladeWidgetC
|
||||
GObject *new);
|
||||
LIBGLADEUI_API
|
||||
gboolean glade_widget_class_contains_extra (GladeWidgetClass *class);
|
||||
|
||||
LIBGLADEUI_API
|
||||
gboolean glade_widget_class_query (GladeWidgetClass *class);
|
||||
LIBGLADEUI_API
|
||||
GladePackingDefault *glade_widget_class_get_packing_default (GladeWidgetClass *child_class,
|
||||
GladeWidgetClass *container_class,
|
||||
|
1009
src/glade-widget.c
1009
src/glade-widget.c
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,6 @@
|
||||
#include "glade-widget-class.h"
|
||||
#include "glade-signal.h"
|
||||
#include "glade-property.h"
|
||||
#include "glade-fixed-manager.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -70,18 +69,10 @@ struct _GladeWidget
|
||||
* See also child_properties of
|
||||
* GladeWidgetClass.
|
||||
*/
|
||||
|
||||
gboolean query_user; /* Whether the user should be prompted for some initial
|
||||
* values with a dialog popup upon creation.
|
||||
*/
|
||||
|
||||
GHashTable *signals; /* A table with a GPtrArray of GladeSignals (signal handlers),
|
||||
* indexed by its name */
|
||||
|
||||
GladeFixedManager *manager; /* If this is a GtkContainer with a fixed coordinate system,
|
||||
* this is the add/remove/create management code.
|
||||
*/
|
||||
|
||||
gboolean visible; /* Local copy of widget visibility, we need to keep track of this
|
||||
* since the objects copy may be invalid due to a rebuild.
|
||||
*/
|
||||
@ -97,20 +88,29 @@ struct _GladeWidget
|
||||
gint save_x;
|
||||
gint save_y;
|
||||
gboolean pos_saved;
|
||||
|
||||
|
||||
/* Construct parameters: */
|
||||
GladeWidget *construct_template;
|
||||
GladeWidgetInfo *construct_info;
|
||||
GladeCreateReason construct_reason;
|
||||
gchar *construct_internal;
|
||||
};
|
||||
|
||||
struct _GladeWidgetKlass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (*add_child) (GladeWidget *, GladeWidget *);
|
||||
gboolean (*remove_child) (GladeWidget *, GladeWidget *);
|
||||
void (*add_child) (GladeWidget *, GladeWidget *, gboolean);
|
||||
void (*remove_child) (GladeWidget *, GladeWidget *);
|
||||
|
||||
void (*add_signal_handler) (GladeWidget *, GladeSignal *);
|
||||
void (*remove_signal_handler) (GladeWidget *, GladeSignal *);
|
||||
void (*change_signal_handler) (GladeWidget *, GladeSignal *, GladeSignal *);
|
||||
|
||||
gboolean (*button_press_event) (GtkWidget *, GdkEventButton *, GladeWidget *);
|
||||
void (*setup_events) (GladeWidget *, GtkWidget *);
|
||||
gboolean (*event) (GtkWidget *, GdkEvent *, GladeWidget *);
|
||||
|
||||
GladeWidget *(*retrieve_from_position) (GtkWidget *, int, int);
|
||||
|
||||
};
|
||||
@ -120,22 +120,10 @@ struct _GladeWidgetKlass
|
||||
*******************************************************************************/
|
||||
LIBGLADEUI_API
|
||||
GType glade_widget_get_type (void);
|
||||
|
||||
LIBGLADEUI_API
|
||||
GladeWidget * glade_widget_new (GladeWidget *parent,
|
||||
GladeWidgetClass *klass,
|
||||
GladeProject *project,
|
||||
gboolean query);
|
||||
LIBGLADEUI_API
|
||||
GladeWidget * glade_widget_new_for_internal_child (GladeWidget *parent,
|
||||
GObject *internal_object,
|
||||
const gchar *internal_name,
|
||||
const gchar *parent_name,
|
||||
gboolean anarchist,
|
||||
GladeCreateReason reason);
|
||||
LIBGLADEUI_API
|
||||
void glade_widget_add_child (GladeWidget *parent,
|
||||
GladeWidget *child);
|
||||
GladeWidget *child,
|
||||
gboolean at_mouse);
|
||||
LIBGLADEUI_API
|
||||
void glade_widget_remove_child (GladeWidget *parent,
|
||||
GladeWidget *child);
|
||||
@ -152,7 +140,7 @@ void glade_widget_replace (GladeWidget *p
|
||||
LIBGLADEUI_API
|
||||
void glade_widget_rebuild (GladeWidget *glade_widget);
|
||||
LIBGLADEUI_API
|
||||
GladeWidget *glade_widget_dup (GladeWidget *widget);
|
||||
GladeWidget *glade_widget_dup (GladeWidget *template);
|
||||
LIBGLADEUI_API
|
||||
gboolean glade_widget_is_dupping (void);
|
||||
LIBGLADEUI_API
|
||||
@ -190,9 +178,6 @@ gboolean glade_widget_has_launcher (GladeWidget *w
|
||||
LIBGLADEUI_API
|
||||
void glade_widget_launch_editor (GladeWidget *widget);
|
||||
|
||||
LIBGLADEUI_API
|
||||
GladeWidget *glade_widget_retrieve_from_position (GtkWidget *base, int x, int y);
|
||||
|
||||
LIBGLADEUI_API
|
||||
gboolean glade_widget_has_decendant (GladeWidget *widget,
|
||||
GType type);
|
||||
|
@ -41,7 +41,6 @@ typedef struct _GladeProject GladeProject;
|
||||
#include "glade-clipboard.h"
|
||||
#include "glade-project-view.h"
|
||||
#include "glade-placeholder.h"
|
||||
#include "glade-fixed-manager.h"
|
||||
#include "glade-utils.h"
|
||||
#include "glade-builtins.h"
|
||||
#include "glade-xml-utils.h"
|
||||
@ -133,6 +132,7 @@ typedef struct _GladeProject GladeProject;
|
||||
#define GLADE_TAG_INIT_FUNCTION "init-function"
|
||||
#define GLADE_TAG_ATK_ACTION "atk-action"
|
||||
#define GLADE_TAG_ATK_PROPERTY "atk-property"
|
||||
#define GLADE_TAG_FIXED "fixed"
|
||||
|
||||
#define GLADE_NUMERICAL_STEP_INCREMENT 1
|
||||
#define GLADE_FLOATING_STEP_INCREMENT 0.01F
|
||||
|
@ -125,10 +125,6 @@
|
||||
</children>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkPaned" _title="Paned">
|
||||
<post-create-function>glade_gtk_paned_post_create</post-create-function>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkWindow" generic-name="window" _title="Window">
|
||||
<post-create-function>glade_gtk_window_post_create</post-create-function>
|
||||
|
||||
@ -343,6 +339,12 @@
|
||||
</properties>
|
||||
</child>
|
||||
</children>
|
||||
|
||||
<packing-defaults>
|
||||
<parent-class name="GtkVBox">
|
||||
<child-property id="expand" default="false"/>
|
||||
</parent-class>
|
||||
</packing-defaults>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkToolItem" generic-name="toolitem" title="GtkToolItem">
|
||||
@ -798,6 +800,17 @@
|
||||
</children>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkPaned" _title="Paned">
|
||||
<post-create-function>glade_gtk_paned_post_create</post-create-function>
|
||||
<children>
|
||||
<child>
|
||||
<type>GtkWidget</type>
|
||||
<add-child-function>glade_gtk_paned_add_child</add-child-function>
|
||||
<remove-child-function>glade_gtk_paned_remove_child</remove-child-function>
|
||||
</child>
|
||||
</children>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkHPaned" generic-name="hpaned" _title="Horizontal Panes"/>
|
||||
|
||||
<glade-widget-class name="GtkVPaned" generic-name="vpaned" _title="Vertical Panes"/>
|
||||
@ -983,7 +996,7 @@
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkLayout" generic-name="layout" _title="Layout">
|
||||
<glade-widget-class name="GtkLayout" generic-name="layout" _title="Layout" fixed="True">
|
||||
<post-create-function>glade_gtk_fixed_layout_post_create</post-create-function>
|
||||
<properties>
|
||||
<property id="hadjustment" disabled="True"/>
|
||||
@ -999,7 +1012,7 @@
|
||||
</children>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="GtkFixed" generic-name="fixed" _title="Fixed">
|
||||
<glade-widget-class name="GtkFixed" generic-name="fixed" _title="Fixed" fixed="True">
|
||||
<post-create-function>glade_gtk_fixed_layout_post_create</post-create-function>
|
||||
<children>
|
||||
<!-- This will unset any custom handler defined in the plugin for _add() -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user