Commit Graph

79 Commits

Author SHA1 Message Date
Murray Cumming
d1829ecd74 GtkWidget/GtkContainer: Slight fixes to geometry-management docs.
Replace it's with its in several places.
Replace some , with .
Replace some ; with .
Fix some plurals.
Other minor corrections.
2010-11-04 16:37:54 +01:00
Matthias Clasen
9ff207bd25 Avoid exporting an extra symbol 2010-11-01 09:17:21 -04:00
Tristan Van Berkom
c41ec57fb0 Fire a warning if there are any handlers connected to the deprecated "size-request" signal. 2010-10-28 16:00:19 +09:00
Tristan Van Berkom
18f46adb7d Added a runtime warning if any class is implementing the ->size_request() vfunc. 2010-10-28 15:41:00 +09:00
Matthias Clasen
b69232e51b Stop calling GtkWidget parameters 'request'
There were at least a few places where we were using GTK_WIDGET()
on something that was already a GtkWidget*, just because it was
named wrong.
2010-10-26 10:53:46 -04:00
Tristan Van Berkom
ed63ae2bd3 Fixed push/pop_recursion_check() to not fire warnings for expected code.
I.e. Since we are now calling get_preferred_width() to ensure a good 'for_size'
for get_height_for_width() we need to avoid warning about this internal expected
recursion.
2010-10-23 20:03:41 +09:00
Tristan Van Berkom
d26ac6421b Fixed problems with combination of height-for-width apis and
alignment/margin vfuncs adjust_size_request/allocation

Now get_height_for_width() will internally update the for_width
before passing it to the real height_for_width() vfunc, allowing
margins and extra space for alignments to be stripped, thus requesting
sufficient height for greater than natural widths (and also accounting
for margins properly). Test case adjusted in testadjustsize to ensure
proper behavior.
2010-10-23 00:11:37 +09: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
Tristan Van Berkom
5a7cfa7fb9 Migrated old GtkSizeRequestIface documentation to GtkWidget and added notes to gtk_widget_get_preferred_size(). 2010-10-08 23:18:05 +09:00
Matthias Clasen
e3957f559d GTK docs: Update width-for-height docs
Some places did not get updated after the recent rename-and-GtkWidget-merge.
2010-10-01 13:10:35 -04:00
Tristan Van Berkom
de0428fe52 Fixing documentation of gtk_widget_get_request_mode() 2010-09-27 15:11:27 +09: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
c9ca4beb35 Fixed gtk_distribute_natural_allocation() to place the g_newa *after* g_return_if_fail() guards. 2010-09-22 16:06:42 +09:00
Tristan Van Berkom
ca251cf1d4 Reduced overall SizeRequestCache size
This patch changes the 'age' counting previous approach taken
verbatim from clutter and changes it for a counter of validated
caches and an index to the last cached value which we use to
round-robin through the cache if ever a widget is requested
for more than 3 contextual sizes (cache is reduced by 3 * sizeof (int)
per widget private data).
2010-09-21 12:57:27 +09:00
Matthias Clasen
2f78aa3024 Rename h/v-align to h/valign
And adjust the getters and setters to match. Also include some
documentation by Havoc Pennington about adjustment of size requests
and allocations.
2010-09-15 20:14:56 -04: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
Havoc Pennington
8960d64cc6 Warn about recursively calling size req wrappers on the same object and orientation
We are not re-entrant and there is no reason for widgets to
do this, most likely they'll just get unexpected bugs because
the wrappers may modify the request.

Computing the request should logically rely only on the
widget itself, not on any adjustments caused by set_size_request,
size groups, and so forth.

https://bugzilla.gnome.org/show_bug.cgi?id=628829
2010-09-12 21:47:09 -04:00
Tristan Van Berkom
843be48572 Moved GtkSizeRequest cache to GtkWidget->priv
Now that we have a private data installed directly on
the GtkWidget instance it makes no sense to cache the size
requests on widget qdata. This change will generally make
GTK+ memory less fragmented as well as significantly speed
up the size request process.
2010-09-09 17:19:18 +09: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
Havoc Pennington
88a90b8abb Warn if a widget requests minimum size > natural size
Since this makes no sense and there's no reason we should
have to check for it elsewhere just in case some widget is
busted.

https://bugzilla.gnome.org/show_bug.cgi?id=628808
2010-09-05 21:46:22 -04:00
Javier Jardón
1b77e36a59 gtk/gtksizerequest.c: Use G_DEFINE_INTERFACE macro 2010-08-26 00:33:56 +02:00
Tristan Van Berkom
8c14bf009d Added return_if_fail guard to gtk_distribute_natural_allocation() 2010-08-18 20:01:27 -04:00
Tristan Van Berkom
6c76243f46 Added gtk_distribute_allocation()
Added a convenience api for containers to use when allocating
children (used to distribute space evenly to children).
2010-08-05 12:50:25 -04: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
5f4309be96 Fixed some typos in new docs that are about GtkSizeRequest (not GtkSizeGroup) 2010-06-18 00:32:09 -04: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