Commit Graph

80 Commits

Author SHA1 Message Date
Benjamin Otte
dd6931d1ba sizegroup: Use _gtk_widget_compute_size_for_orientation()
With this function now available, we can do size computation in 2
ways:
(1) Compute size with size groups
(2) Compute size without size groups

And have (1) use (2) instead of setting flags on widgets. This patch
does exactly that.
2012-11-04 15:28:43 +01:00
Benjamin Otte
be1bde9111 sizegroups: Use is_visible() instead of get_mapped() for visibility
The current approach of using gtk_widget_get_mapped() is broken:
The usual steps taken when showing a window are:
(1) request the sizes
(2) allocate the sizes
(3) show the window in the allocated size

Showing the window with a random size between steps (1) and (2) would of
course
result in extra work and potential flickering when the widgets get
resized to
their proper sizes.

However, as GtkSizeGroup::ignore-hidden uses gtk_widget_get_mapped() to
determine visibility for a widget, the following will happen:
(1) the widget will request a 0 size
(2) the widget will be allocated a 0 size
(3) the widget will be too small when it is shown

gtk_widget_get_visible() however is set in advance. Note that toggling
visibility also causes a gtk-widget_queue_resize() call already so we
take care of changes in here automatically.
2012-11-04 15:24:17 +01:00
Benjamin Otte
9f6067a804 sizegroup: Handle hfw in size groups 2012-11-04 15:24:17 +01:00
Benjamin Otte
c8f2328337 sizegroup: Add a function for clarity
... and restructure code to accomodate that function.
2012-11-04 15:24:17 +01:00
Benjamin Otte
dbbdefe4e0 sizegroup: Don't keep groups around everywhere
The code is only interested in the actual widgets that belong together,
not in the groups. So just don't return the groups.
2012-11-04 15:24:17 +01:00
Benjamin Otte
dfea266e1f sizegroup: Check ignore_hidden flag when adding groups
Instead of only checking the ignore_hidden flag when getting the
preferred sizes, respect it already when constructing the list of
widgets. This way, widgets don't queue resizes for groups they're
ignored in anyway.
2012-11-04 15:24:17 +01:00
Benjamin Otte
a1f6887f17 sizegroup: Use for loops
For loops to loop over lists look nicer and actually do the right thing
with "break" and "continue" statements. So they are vastly preferred to
while loops.
2012-11-04 15:24:17 +01:00
Benjamin Otte
8796fe6d1c sizegroups: Restructure code
This way, we do the checks at the start of the effected function, not
before calling it.
2012-11-04 15:24:16 +01:00
Benjamin Otte
8710d97945 sizegroup: Don't cache the sizes anymore
This simplifies code and because sizes are cached by the widgets
themselves, it's not a large performance problem (unless people use huge
amounts of widgets in a single size group, but who does that?
2012-11-04 15:24:16 +01:00
Benjamin Otte
0306278145 sizegroup: Always at least use widget's size
When widgets were hidden, they were otherwise assigned a 0 size.
2012-11-01 20:22:35 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
b0a7db76fb Replace some references to the GtkTable, use GtkGrid instead 2011-09-29 12:38:49 +01:00
Javier Jardón
7b0d77def5 gtkcontainer: Move private functions to private header
https://bugzilla.gnome.org/show_bug.cgi?id=651707
2011-06-06 12:10:29 +01:00
Javier Jardón
5ff0fb6bbd Move documentation to inline comments: GtkSizeGroup 2011-04-18 02:08:37 +01:00
Tristan Van Berkom
1c20c93423 Optimize queue_resize_on_widget()
Optimized GtkSizeGroup code that is invoked for every queued resize
and every request that is not previously cached by trading qdata on
widgets for 3 extra bitfields on the GtkWidgetPrivate structure.
2011-02-08 00:39:51 +09:00
Matthias Clasen
6cdb6255af More documentation fixes 2011-01-06 09:44:08 -05:00
Matthias Clasen
16877b4d7b Reduce includes of gtktypeutils.h to a minimum 2011-01-04 12:05:05 -05:00
Emmanuele Bassi
2cc059a0e7 Split off gtkprivate.h
The gtkprivate.h header contains GtkWidget-specific private symbols that
are not useful except in a handful of cases. Basically everything
includes gtkprivate.h for the GTK_PARAM_* macros.

https://bugzilla.gnome.org/show_bug.cgi?id=632539
2010-10-20 10:34:26 +01:00
Owen W. Taylor
88cf547029 Fix handling of the geometry widget
The geometry widget feature of gtk_window_set_geometry_hints() has
never really worked right because the calculation that GTK+ did to
compute the base size of the window only worked when the geometry
widget had a larger minimum size than anything else in the window.

Setup:
* Move the GtkSizeGroup private functions to a new private header
  gtksizegroup-private.h
* Add the possibilty to pass flags to _gtk_size_group_queue_resize(),
  with the flag GTK_QUEUE_RESIZE_INVALIDATE_ONLY to suppress adding
  the widget's toplevel to the resize queue.
* _gtk_container_resize_invalidate() is added to implement that feature
* _gtk_widget_override_size_request()/_gtk_widget_restore_size_request()
  allow temporarily forcing a large minimum size on the geometry
  widget without creating resize loops.

GtkWindow:
* Compute the extra width/height around the geometry widget
  correctly; print a warning if the computation fails.
* Always make the minimum size at least the natural minimum
  size of the toplevel; GTK+ now fails badly with underallocation.
* Always set the base size hint; we were failing to set it
  properly when the specified minimum size was overriden, but
  it's harmless to always set it.

Tests:
* New test 'testgeometry' that replaces the 'gridded geometry' test
  from testgtk. The new test is roughly similar but creates a bunch
  of windows showing different possibilities.
* The testgtk test is removed. No need to have both.

https://bugzilla.gnome.org/show_bug.cgi?id=68668
2010-10-11 14:05:29 -04:00
Matthias Clasen
f53ad33994 Remove GtkObject completely 2010-09-26 22:18:19 -04:00
Benjamin Otte
d9c9259861 Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.

Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.

So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
  gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
  gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.

The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
2010-09-26 15:11:45 +02:00
Tristan Van Berkom
8bfb1e0ab8 Fixed GtkSizeGroups to adjust both minimum and natural requisitions
Originally the GtkSizeRequestIface patches left GtkSizeGroup working
only by bumping the minimum sizes - this commit fixes size groups to take
both minimum and natural requests into account.
2010-09-15 04:04:02 +09:00
Havoc Pennington
cd2a19a68d GtkWidget: add adjust_size_request adjust_size_allocation virtual funcs
Use these new methods to handle set_size_request (aka aux_info)
inside gtkwidget.c, instead of having external code mess with it.

The virtual functions can be used for other purposes in the
future. For example, GtkContainer::border_width could be
automatically implemented for all container subclasses.
2010-09-12 21:47:10 -04:00
Tristan Van Berkom
9934007420 Completely removed requisition cache from GtkWidget instance structure.
Since we have a new mechanism for requesting sizes: GtkSizeRequestIface;
it makes no sense to maintain this cache on the GtkWidget structure...
removing the requisition cache however does not break the old "size-request"
signal which is there for backwards compatability reasons.

In any case widget->requisition should not have been accessed,
gtk_widget_get_child_requisition() would have been the correct way
to consult the cache.

This commit also deprecates the newly added gtk_widget_get_requisition()
API and makes it fallback on gtk_size_request_get_size().
2010-09-08 18:50:24 +02:00
Javier Jardón
1e5d7c0225 Use GtkFooPrivate instead GtkFooPriv 2010-08-27 04:48:23 +02:00
Javier Jardón
804ad0dd88 gtk/gtksizegroup.c: use accessor functions to access GtkWidget 2010-08-22 21:25:25 +02:00
Javier Jardón
d5c3fb5231 gtksizegroup: Move public members to private structure 2010-07-13 19:40:50 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Tristan Van Berkom
edd57602b8 Mass api change from GtkExtendedLayout --> GtkSizeRequest
This commit makes a few massive changes to the extended layout
code:
  a.) gtkextendedlayout.c --> gtksizerequest.c
  b.) _is_height_for_width --> get_request_mode()
  c.) get_desired_size(), get_desired_width(), get_desired_height() -->
      get_size(), get_width(), get_height()

This is the first partial commit and only effects portions
of the tree that have already been merged in master (in order to
easily cherry pick this commit).

Conflicts:

	gtk/Makefile.am
	gtk/gtk.h
	gtk/gtk.symbols
	gtk/gtkextendedlayout.h
2010-06-18 00:11:26 -04:00
Matthias Clasen
201635a203 Fix doc typos 2010-05-01 21:40:43 -04:00
Tristan Van Berkom
3783a0a54f Fixed computation of sizegroups when no explicit request is set.
My previous commit to GtkSizeGroup made sure that when
gtk_widget_set_size_request() is set on a widget, it will be
taken into account when computing the widget's own request,
this commit fixes the case where there is no explicit size
request.
2010-04-19 14:46:28 -04:00
Tristan Van Berkom
4c1fa76520 Fixed _gtk_size_group_bump_requisition() to properly handle values specified by gtk_widget_set_size_request() 2010-04-18 20:45:42 -04:00
Tristan Van Berkom
caba7992b8 Refactored GtkSizeGroup for GtkExtendedLayout
Removed _gtk_size_group_compute_requisition and
_gtk_size_group_get_child_requisition in favor of
_gtk_size_group_bump_requisition() which does an orientation
contextual computation of the size group and returns the
collective value in one pass.
2010-04-17 01:46:59 -04:00
Tristan Van Berkom
8432f54c51 Added _gtk_size_group_bump_requisition()
Added a function to update sizegroups in multiple passes, this
way the width and height can be updated in the sizegroups after
querying the extended layout implementor for these.

Implemented this in GtkExtendedLayout, sizegroups should be working reasonably now.
2010-04-14 18:07:27 -04:00
Tristan Van Berkom
d2c35ec62a Mega commit to change ->get_desired_size() for ->get_desired_width/height().
This commit changes gtk_extended_layout_get_desired_size() for
per dimension variants. Furthermore this commit reverts the actions
done in size-groups for now as it needs a different approach.

The natural width/height parameters added to aux_info have been changed
for a per width cache for heights and a per height cache for widths.

gtk-demo is still working, currently sizegroups are not taken
into account as mentioned above - size groups need to be alerted both
when the widths and heights are updated independantly and then that
information needs to repropagate also to other extended layout implementors.
2010-04-12 22:21:46 -04:00
Tristan Van Berkom
b3303727ad Fixed regression in GtkImage size requests
Fixed gtksizegroup.c:do_size_request() to never force an initial requisition
as some widgets expect it to remain unchanged across resizes (GtkImage
with pixbufs/filenames assigned is one of these cases).
2010-04-08 22:05:36 -04:00
Tristan Van Berkom
1706608de3 Simplified code in GtkSizeGroup, fixes minimum natural size.
collapse get_fast_child_requisition && get_fast_natural_size into
a single get_fast_size() function which uses the possibly hard coded
minimum request as a minimum value for the returned desired size
(this fixes cases where widgets unwarily return height-for-width
with minimum size > natural size).
2010-04-08 18:49:34 -04:00
Tristan Van Berkom
ef32192329 Call the ->get_desired_size() method directly on the vtable
This commit is a mistake, it should have been included with the last
commit.
2010-04-06 02:53:51 -04:00
Tristan Van Berkom
eb537a6773 Fixed do_size_request() to start with a 0 base requisition instead of -1 2010-04-05 17:57:06 -04:00
Tristan Van Berkom
4b1315cedc Changed initial values for requisition from -1 to 0.
When doing size-requests and get_natural_size() calls, use 0 as
the base value instead of -1, because size_request code assumes
that widget->requesition is initialized at 0.
2010-04-04 16:38:36 -04:00
Tristan Van Berkom
5d83f5eba5 Fixed internal native layout algorythm wrt size-request singals/implementations.
Because "size-request" signal can be handled by signal connections as well
as by third party derived classes it is necessary to always fire the
"size-request" signal for every recalculation of the widget requisition,
now gtksizegroup.c:do_size_request() fires the signal first and allows it
to overflow the minimum/natural sizes returned by extended layout
implementations.

GtkWidget->get_natural_size() is now left assigning default -1 values to
ensure they both get overridden by the size-request handling.
2010-04-03 20:59:28 -04:00
Javier Jardón
e53efb120a Deprecate widget flag: GTK_WIDGET_MAPPED
Use gtk_widget_get_mapped() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=69872
2010-04-03 20:58:58 -04:00
Christian Dywan
fc2cbf960c Deprecate flag macros for toplevel, state, no window and composite child
Deprecate widget flag macros GTK_WIDGET_STATE, GTK_WIDGET_SAVED_STATE,
GTK_WIDGET_FLAGS, GTK_WIDGET_TOPLEVEL, GTK_WIDGET_NO_WINDOW and
GTK_WIDGET_COMPOSITE_CHILD.

Also deprecate the type macros GTK_WIDGET_TYPE, GTK_OBJECT_TYPE_NAME and
GTK_OBJECT_TYPE which have become redundant.

Instances of GTK_WIDGET_TOPLEVEL are replaced with gtk_widget_is_toplevel,
GTK_WIDGET_TYPE is replaced with G_OBJECT_TYPE, GTK_WIDGET_COMPOSITE_CHILD
is replaced with use of the "composite-child" property and uses of
GTK_WIDGET_NO_WINDOW are adjusted to use gtk_widget_get_has_window.

Uses of GTK_WIDGET_SAVED_STATE and GTK_WIDGET_FLAGS inside GtkWidget are
changed to direct flag usage.

Documentation is updated to refer to gtk_widget_set_has_window and
gtk_widget_get_has_window.

Gail and tests are updated as well.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=69872
2010-04-03 20:55:07 -04:00
Colin Walters
fcbbd763cd [introspection] Merge in Gtk-custom.c annotations
The Gtk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GTK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.
2010-04-03 20:51:53 -04:00
Johannes Schmmid
e08d04b561 native-layout: Introduce GtkExtendedLayout interface. 2009-12-14 15:32:49 +01:00
Davyd Madeley
44adf811ea [GtkSizeGroup] don't recurse into yourself 2009-08-30 10:47:52 +10:00
Matthias Clasen
50e94e86a0 Use g_quark_from_static_string where possible
svn path=/trunk/; revision=21146
2008-08-18 00:14:17 +00:00
Sven Neumann
b699ac5853 gtk/gtkaccellabel.c gtk/gtkaction.c gtk/gtkclist.c gtk/gtkcolorbutton.c
2008-08-12  Sven Neumann  <sven@gimp.org>

	* gtk/gtkaccellabel.c
	* gtk/gtkaction.c
	* gtk/gtkclist.c
	* gtk/gtkcolorbutton.c
	* gtk/gtkctree.c
	* gtk/gtkdialog.c
	* gtk/gtkdnd-quartz.c
	* gtk/gtkdnd.c
	* gtk/gtkentry.c
	* gtk/gtkfilechooserdefault.c
	* gtk/gtkfilesel.c
	* gtk/gtkgamma.c
	* gtk/gtkiconview.c
	* gtk/gtkkeyhash.c
	* gtk/gtklabel.c
	* gtk/gtkmenu.c
	* gtk/gtkmenubar.c
	* gtk/gtkpaned.c
	* gtk/gtkrecentchooserdialog.c
	* gtk/gtkrecentchooserutils.c
	* gtk/gtkselection.c
	* gtk/gtksizegroup.c
	* gtk/gtktextbtree.c
	* gtk/gtktextbuffer.c
	* gtk/gtktextview.c
	* gtk/gtktoolbar.c
	* gtk/gtktreemodel.c
	* gtk/gtkuimanager.c
	* gtk/gtkwindow-decorate.c
	* gtk/gtkwindow.c: use canonical signal names in some more places
	that I missed earlier. Also changed this in the documentation and
	comments.


svn path=/trunk/; revision=21094
2008-08-12 14:37:03 +00:00
Cody Russell
57223c9a05 Revert name change
svn path=/trunk/; revision=20724
2008-07-01 22:57:50 +00:00
Cody Russell
fce9c8b7d4 Practically everything changed.
2008-06-30  Cody Russell  <bratsche@gnome.org>

        * Practically everything changed.

        Change	all references	of GIMP	Toolkit	(and variations	of it)
        to GTK+	Toolkit, showing no mercy at all to our	beloved
	ancestry. (#540529)


svn path=/trunk/; revision=20709
2008-06-30 23:01:56 +00:00