Commit Graph

256 Commits

Author SHA1 Message Date
Sébastien Granjoux
af5ecd77e3 button: Clear highlight when a button is removed from a container
A button is highlighted if the private variable in_button is TRUE.
This variable is set when the pointer is over the button and cleared when
it left the button. When a button is hidden while there is the pointer over
it, GTK generates a leave notification event, in_button is set to FALSE.
But when a button is removed from a container but not destroyed, it is
unrealized and loose its window. It cannot receive the leave notification
event and in_button stay TRUE. So when the button get a new parent it is still
highlighted.

https://bugzilla.gnome.org/show_bug.cgi?id=676890
2012-09-16 23:28:02 -04:00
Ryan Lortie
694be447e3 port GtkButton to GtkActionHelper 2012-08-20 13:11:02 -04:00
William Jon McCann
346b933a85 Provide a way to force showing icons in buttons
https://bugzilla.gnome.org/show_bug.cgi?id=676429
2012-05-21 13:57:18 -04:00
Benjamin Otte
8b1385804e button: Remove _gtk_button_paint()
All buttons use the same paint function these days. States are managed
correctly so this was just leftovers from GTK 1 or GTK 2.
2012-04-17 08:59:23 +02:00
Benjamin Otte
1d54e4e867 widget: Set .default class when widget is default
Don't just conditionally set it on buttons.
2012-04-17 08:59:22 +02:00
Carlos Garnacho
2ccf29f6b3 button: Handle touch events
Touch events don't generate crossing events themselves, so
do not rely on these to determine whether the button release
happened within the event window.
2012-03-01 16:25:25 -05:00
Cosimo Cecchi
5495152e30 button: don't be active when holding the mouse button outside the bounds
GtkButton currently draws itself as active (pressed down) in case we're
pressing and holding the mouse pointer outside its bounds; this is
misleading though, since we won't activate the button unless the mouse
is released inside the button itself.
Fix this by only setting the ACTIVE state flag when the button is
actually pressed down.

https://bugzilla.gnome.org/show_bug.cgi?id=668141
2012-03-01 15:57:55 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Murray Cumming
842d3ac53d GtkButton: Small documentation improvements 2012-02-13 09:18:07 +01:00
Carlos Garcia Campos
e796f3a4e7 gtkbutton: Use symbolic names for button numbers 2012-01-27 09:47:42 +01:00
Ryan Lortie
b7a28de755 GtkButton: don't do string compare on property set
Just set the property unconditionally.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-11 00:26:56 -05:00
Ryan Lortie
ab91527032 Rename gtk_application_window_get_observer
This should have been called _create_observer

https://bugzilla.gnome.org/show_bug.cgi?id=667394

Fixup switch
2012-01-11 00:26:47 -05:00
Rui Matos
a1f72eb06c Revert "button: Stop setting state flags on the style context for drawing"
Setting state flags is actually needed here since this function is called by
GtkButton subclasses which add their specific state flags as a parameter.

This reverts commit e868b8d6ea.
2012-01-09 16:45:44 +00:00
Ryan Lortie
cf2590d673 GtkButton: do not allow both types of actions
Only allow one of 'action-name' or 'related-action' to be set.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-09 15:02:10 +01:00
Ryan Lortie
88ec007b98 Add new GtkActionable interface
This is the interface for GtkWidgets that can be associated with an
action on a GtkAppicationWindow or associated GtkApplication.

It essentially features 'action-name' and 'action-target' properties
with some associated convenience API.

This interface is implemented by GtkButton and GtkToolButton.

https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-09 15:02:06 +01:00
Cosimo Cecchi
2827cd4518 button: deprecate the inner-border style property
Since we allocate the standard CSS border to the button now, and center
the child accordingly, there's no need for an additional inner-border
style property. Deprecate it and ignore its values.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi
0021ef19fa button: add CSS borders to the size request
And allocate the button children according to it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi
fe59c5f954 button: add a border param to gtk_button_get_props()
We'll use it later to compute the child offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Rui Matos
e868b8d6ea button: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00:00
Benjamin Otte
9aa7e9f050 button: Don't call deprecated functions 2011-11-08 21:14:05 +01:00
Matthias Clasen
5ff8fe6971 Documentation fixes
Mostly making sure that return values and varargs don't loose
their docs.
2011-09-25 21:04:49 -04:00
Matthias Clasen
383127cd0b Clean up unneeded includes 2011-08-28 01:40:10 -04:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Matthias Clasen
8432ea3574 Convert GailButton to GtkButtonAccessible
This drops the AtkText implementation, and also strips handling
of children out. Instead of listening for enter/leave/press/released,
just listen for state changes on the widget.
2011-07-05 16:08:57 -04:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Benjamin Otte
c1b2cbcf50 button: Remove unused variables 2011-05-27 16:11:10 +02:00
Cosimo Cecchi
c8a59a6f92 all: avoid boxed structs copying where possible
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=650420
2011-05-18 10:27:21 -04:00
Carlos Garnacho
52452236bc button: Fix typo in keyboard grab's evmask
https://bugzilla.gnome.org/show_bug.cgi?id=650382, spotted
by Alexander Larsson.
2011-05-17 13:17:25 +02:00
Cosimo Cecchi
b1d08fe0e9 button: don't use the border values for padding
It's wrong, and makes it impossible to theme the button properly.

https://bugzilla.gnome.org/show_bug.cgi?id=646882
2011-04-12 17:14:31 -04:00
Cosimo Cecchi
f1a7be7f57 button: make gtk_button_get_props() return the padding too
https://bugzilla.gnome.org/show_bug.cgi?id=646882
2011-04-12 17:14:29 -04:00
Murray Cumming
f91c04e284 Minor documentation improvements
Mostly correcting it's to its and changing some , to .
2011-02-23 10:26:21 +01:00
Matthias Clasen
beb8c290d1 Always chain up in ::style-updated
This was not handled consistently, but the default handler
does useful things, so we should always chain up.
2011-02-07 07:30:37 -05:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Carlos Garnacho
a0e1fa9e77 Gtk(Toggle)Button: preserve untouched state flags when updating state.
Partly fixes bug #640282, noticed by Christian Persch. buttons were
clobbering the insensitive flag when updating their state.
2011-01-23 19:34:38 +01:00
Federico Mena Quintero
d07231cb7a bgo#626336 - Don't assume that GtkButton is activated only when a keyboard event is available
Buttons may also be activated at any time from gtk_widget_activate()
or related functions.  In that case, just do the 'show the button
as pushed for a short amount of time' trick, but don't actually
try to grab the keyboard device.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-01-21 15:48:39 -06:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Pavel Holejsovsky
a1c297a310 [GI] Cosmetic cleanups of annotations and doc comments
This change does not introduce any functionality change, mostly
cosmtic cleanups, like re-linebreak when introduced annotations messed
up indentation or whitespace errors fixes.
2011-01-18 17:31:59 +01:00
Carlos Garnacho
e0e36b621f Update _gtk_button_paint() arguments to GtkStyleContext
The detail strings weren't in use anymore, and the state
argument is now a GtkStateFlags. GtkToggleButton has been
updated as well.
2011-01-10 03:49:59 +01:00
Matthias Clasen
98440ad031 Remove gtktypeutils altogether
Based on patches by Javier Jardón.

https://bugzilla.gnome.org/show_bug.cgi?id=629955
2011-01-04 14:51:19 -05:00
Paolo Borelli
b36cb87df9 Use the new style context API in GtkButton
Mostly replaces gtk_widget_style_get with gtk_style_context_get_style
2010-12-05 23:12:32 +01:00
Carlos Garnacho
cf0bd12e6c GtkStyleProperties: Turn border-width into a GtkBorder property.
All current users of this CSS property have been updated to deal
with a GtkBorder.

Also a 0 border width has been set in the default CSS to ensure
GtkStyleContext and GtkThemingEngine always provide a non-NULL
pointer for this property.
2010-12-04 15:39:52 +01:00
Carlos Garnacho
9c0ef02ea5 GtkButton: Remove unneeded gtk_style_context_notify_state_change() calls
There is now code to handle this for one-item widgets (such as GtkButton)
in gtk_widget_set_state_flags()
2010-12-04 15:39:41 +01:00
Carlos Garnacho
4689b63739 GtkButton: Use GtkStyleContext for rendering. 2010-12-04 15:38:55 +01:00
Carlos Garnacho
401b655307 GtkButton: Set widget state as state flags. 2010-12-04 15:38:30 +01:00
Carlos Garnacho
5b11d14a49 GtkButton: Notify on prelight state change. 2010-12-04 15:38:17 +01:00
Carlos Garnacho
91904f6778 GtkButton: Notify on active state when (un)depressed 2010-12-04 15:38:09 +01:00
Michael Natterer
fb5dd9f72f Move all GdkDevice members to private and add one missing accessor 2010-11-23 20:25:13 +01:00
Javier Jardón
dec57f8ce9 Create a private header to access some GtkButton variables 2010-11-19 06:15:26 +01:00
Javier Jardón
c295ab0943 gtktbutton: Move public members to private structure 2010-11-19 06:15:26 +01:00
Javier Jardón
9e78176685 docs: Fix a typo in gtk_button_set_alignment() docs 2010-11-16 03:37:42 +01:00