Commit Graph

134 Commits

Author SHA1 Message Date
Matthias Clasen
9ac80c2510 checkbutton: stop saving cairo state
GtkBuiltinIcon now does this on its own.
2015-12-20 01:04:13 -05:00
Matthias Clasen
c0683d9267 checkbutton: Fix regression from builtin icon
The leaking of cairo transforms from builtin icon drawing
was causing the label to be drawn at the wrong position.
2015-12-19 23:23:09 -05:00
Benjamin Otte
36653bea41 checkbutton: Use a builtin icon
Also, add support to uiltin icons to look up the default size from a
style property.
2015-12-16 19:55:50 +01:00
Matthias Clasen
0291978acc check button: Deprecate indicator-size
CSS min-width/min-height can do just the same. We still fall
back to the indicator-size style property if the CSS properties
are not set.
2015-12-16 13:11:24 -05:00
Matthias Clasen
bb67a06bd6 check button: Deprecate and ignore ::indicator-spacing
This can be done just as well with CSS margins, so
do that instead for Adwaita.
2015-12-16 12:27:53 -05:00
Matthias Clasen
2f544655f9 Revise CSS node documentation
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00
Matthias Clasen
d891bb815b checkbutton: Remove dead code 2015-12-15 08:41:16 -05:00
Matthias Clasen
a52c3a3db9 radiobutton: Port radio buttons to gadgets
This was already mostly done by inheritance from GtkCheckButton.
To complete it, stop using the draw_indicator vfunc for radio
buttons, and instead make the indicator gadget draw either a
check or radio.
2015-12-15 08:41:16 -05:00
Matthias Clasen
233179d374 check button: Convert to gadgets
Use a gadget for the button, and for the indicator.
A complication here is that GtkCheckButton (and
GtkRadioButton) have a totally different appearance
depending on the ::draw-indicator property. If an
indicator is not required, we just reuse the
GtkButton gadget.
This mostly works; some minor sizing issues left, e.g. cranking
up the indicator-size causes the checkbutton grid in testgtk
to overlap.
2015-12-15 08:41:16 -05:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Matthias Clasen
67b739b58a button: Add diagrams to CSS node docs for buttons 2015-11-03 10:17:41 -05:00
Matthias Clasen
ac553d7e44 check button: Match documented behavior
We were not actually adding the style classes that the
documentation is talking about, for the !draw-indicator case.
Fix that.
2015-11-02 23:06:57 -05:00
Matthias Clasen
c631656f0c toggle button: Convert to css nodes
Convert GtkToggleButton and its subclasses to CSS nodes.
Keep the button element name for when we want to render
these button-like (but with .toggle, .check and .radio
style classes for differentiation).

When we want to render them with an indicator, use distinct
element names checkbutton and radiobutton, and add a subnode
for the indicator with name check or radio.
2015-10-30 00:40:50 -04:00
Benjamin Otte
d3c147a62d stylecontext: Split render functions out into gtkrender.[ch] 2014-10-03 06:18:05 +02:00
Benjamin Otte
442353fa9d checkbutton: Fix redraw issues
This is a hack to get around the optimizations done by the CSS engine.

The CSS engine will notice that no CSS properties changed on the
widget itself when going from one state to another and not queue
a redraw.
And the reason for no properties changing will be that only the
checkmark itself changes, but that is hidden behind a
gtk_style_context_save()/_restore() pair, so it won't be caught.
2014-08-17 06:25:29 +02:00
Benjamin Otte
d36bba293d checkbutton: Don't redundantly update states
States are set properly by GtkButton, there is no need to set them
manually.
2014-08-17 03:19:59 +02:00
Benjamin Otte
c1a063e1a4 checkbutton: Draw background unconditionally
We want to draw backgrounds always, not just on prelight. Themes can
decide to only set a background during prelight themselves.
2014-08-17 00:58:04 +02:00
Benjamin Otte
db1ab7ddf8 button: Handle :inconsistent in GtkToggleButton 2014-08-16 16:34:15 +02:00
Benjamin Otte
cd349dcd48 button: Handle :checked in gtktogglebutton.c
Don't try to handle it elsewhere.
2014-08-16 16:34:15 +02:00
Benjamin Otte
1abe923740 css: Do inconsistent checked states right
In HTML5, both pseudoclasses apply. So we do the same thing in our
widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=733967
2014-08-16 16:34:14 +02:00
Benjamin Otte
4e077d4638 gtk: Use new :checked state
on:
- GtkToggleButton
- GtkCheckButton
- GtkRadioButton
- GtkModelButton
- GtkCellRendererToggle
- GtkCheckMenuItem

also update themes:
- Adwaita
- Raleigh
but not the win32 theme.

The new :checked state replaces :active for the actual checkedness of
the widgets and :active is now used exclusively while the button is being
pressed.

https://bugzilla.gnome.org/show_bug.cgi?id=733967
2014-08-16 16:34:14 +02:00
Matthias Clasen
f6af96723c GtkButton: Deprecated setters and getters as well
gtk_button_set/get_alignment should be deprecated together
with the properties they are setters/getters for.
2014-05-13 22:19:30 -04:00
Cosimo Cecchi
a32260660b checkbutton: don't use focus-line-width 2014-05-09 11:02:45 -07:00
Cosimo Cecchi
c20e8b0b49 checkbutton: support CSS paddings and borders
We need this since we just removed focus-padding.
2014-05-09 11:02:42 -07:00
Cosimo Cecchi
99f0776f19 checkbutton: don't use focus padding 2014-05-09 11:02:42 -07:00
Cosimo Cecchi
21e32f1989 checkbutton: always use interior focus 2014-05-09 11:02:41 -07:00
Benjamin Otte
a0aa367458 checkbutton: Implement height-for-width 2013-05-07 14:06:11 +02:00
Benjamin Otte
4ea26b619b checkbutton: Split out a common function
Makes size request / allocation code easier to understand.
2013-05-07 14:06:11 +02:00
Alexander Larsson
1df8d18ad2 GtkCheckButton and GtkRadioButton: Implement baseline alignment 2013-04-23 05:58:07 +02:00
William Jon McCann
515e211d0b Don't left align label in check buttons when they have no indicator
Because they should be normal buttons in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=681617
2012-08-21 07:09:14 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Rui Matos
c9bbfb5e9b checkbutton: Use the widget state flags as a base for drawing the indicator
Instead of building a set of state flags specifically for drawing the
indicator, base it on the underlying widget state flags.
2011-12-19 19:21:15 +00:00
Rui Matos
dae2675441 checkbutton: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00: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
Benjamin Otte
7edf79de26 checkbutton: Remove redundant call
The call is done by GtkButton already, no need to override it.
2011-09-05 18:56:23 +02: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
Benjamin Otte
d5ef8448bb checkbutton: Use gtk_widget_class_set_accessible_role() 2011-07-18 18:30:51 +02:00
Javier Jardón
7b2113fd32 Move documentation to inline comments: GtkCheckButton 2011-04-13 12:25:06 +01:00
Cosimo Cecchi
64aac9624c Use 16 as default size for checkbutton indicator
So that 16x16 icons can be used from themes such as Adwaita in their
natural size.
2011-03-03 17:48:25 -05:00
Tristan Van Berkom
c234313a25 Make GtkCheckButton's label left aligned by default.
Since we no longer limit the label's allocation to the minimum, now
we take a saner approach to left aligning the label.
2010-12-29 18:20:32 +09:00
Tristan Van Berkom
a6a97ad442 Fixed unused variable in GtkCheckButton. 2010-12-29 16:30:38 +09:00
Tristan Van Berkom
f519da41cf Make GtkCheckButton allocate all remaining space to it's child instead
of limiting it to it's minimum size.

This fixes height-for-width labels inside a GtkCheckButton, for some
reason GtkCheckButton was limiting the child allocation to the child's
minimum request, probably for the sake of virtual left-alignment of
the child label to be beside the checkmark. This should be done by
other means if nescesarry.
2010-12-29 16:19:48 +09:00
Carlos Garnacho
2f0b5d8a9d GtkCheckButton: Look active when the pointer button is pressed and hovering 2010-12-04 15:39:41 +01:00
Carlos Garnacho
756e20f58c Make "button" class depend on mode for GtkToggleButtons 2010-12-04 15:39:20 +01:00
Carlos Garnacho
7478a77b04 GtkCheckButton: Use GtkStyleContext for rendering. 2010-12-04 15:39:19 +01:00
Matthias Clasen
016a656923 Fix prelighting of inconsistent radio and check buttons 2010-12-04 15:39:15 +01:00
Javier Jardón
dec57f8ce9 Create a private header to access some GtkButton variables 2010-11-19 06:15:26 +01:00
Matthias Clasen
3bb3dc72e3 Remove size_request from GtkCheckButton 2010-10-26 21:29:58 -04:00
Javier Jardón
f5615022a7 Use accessor functions to access GtkButton 2010-10-26 06:07:42 +02:00