Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gtk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,148
Issues
1,148
List
Boards
Labels
Service Desk
Milestones
Merge Requests
141
Merge Requests
141
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gtk
Commits
0b0d4765
Commit
0b0d4765
authored
May 29, 2016
by
Timm Bäder
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GtkStackAccessible
Show only the currently visible child to a11y.
parent
5029e114
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
205 additions
and
0 deletions
+205
-0
gtk/a11y/Makefile.inc
gtk/a11y/Makefile.inc
+3
-0
gtk/a11y/gtkstackaccessible.c
gtk/a11y/gtkstackaccessible.c
+109
-0
gtk/a11y/gtkstackaccessible.h
gtk/a11y/gtkstackaccessible.h
+54
-0
gtk/a11y/gtkstackaccessibleprivate.h
gtk/a11y/gtkstackaccessibleprivate.h
+32
-0
gtk/gtkstack.c
gtk/gtkstack.c
+7
-0
No files found.
gtk/a11y/Makefile.inc
View file @
0b0d4765
...
...
@@ -42,6 +42,8 @@ a11y_h_sources = \
a11y/gtkspinbuttonaccessible.h
\
a11y/gtkspinneraccessible.h
\
a11y/gtkstatusbaraccessible.h
\
a11y/gtkstackaccessible.h
\
a11y/gtkstackaccessibleprivate.h
\
a11y/gtkswitchaccessible.h
\
a11y/gtktextcellaccessible.h
\
a11y/gtktextviewaccessible.h
\
...
...
@@ -114,6 +116,7 @@ a11y_c_sources = \
a11y/gtkspinbuttonaccessible.c
\
a11y/gtkspinneraccessible.c
\
a11y/gtkstatusbaraccessible.c
\
a11y/gtkstackaccessible.c
\
a11y/gtkswitchaccessible.c
\
a11y/gtktextcellaccessible.c
\
a11y/gtktextviewaccessible.c
\
...
...
gtk/a11y/gtkstackaccessible.c
0 → 100644
View file @
0b0d4765
/* GTK+ - accessibility implementations
* Copyright (C) 2016 Timm Bäder <mail@baedert.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "gtkstackaccessible.h"
#include "gtkwidgetprivate.h"
G_DEFINE_TYPE
(
GtkStackAccessible
,
gtk_stack_accessible
,
GTK_TYPE_CONTAINER_ACCESSIBLE
)
static
AtkObject
*
gtk_stack_accessible_ref_child
(
AtkObject
*
obj
,
int
i
)
{
GtkWidget
*
stack
=
gtk_accessible_get_widget
(
GTK_ACCESSIBLE
(
obj
));
GtkWidget
*
visible_child
;
if
(
stack
==
NULL
)
return
NULL
;
if
(
i
!=
0
)
return
NULL
;
visible_child
=
gtk_stack_get_visible_child
(
GTK_STACK
(
stack
));
if
(
visible_child
==
NULL
)
return
NULL
;
return
g_object_ref
(
gtk_widget_get_accessible
(
visible_child
));
}
static
int
gtk_stack_accessible_get_n_children
(
AtkObject
*
obj
)
{
GtkWidget
*
stack
=
gtk_accessible_get_widget
(
GTK_ACCESSIBLE
(
obj
));
if
(
stack
==
NULL
)
return
0
;
if
(
gtk_stack_get_visible_child
(
GTK_STACK
(
stack
)))
return
1
;
return
0
;
}
static
void
gtk_stack_accessible_class_init
(
GtkStackAccessibleClass
*
klass
)
{
AtkObjectClass
*
class
=
ATK_OBJECT_CLASS
(
klass
);
GtkContainerAccessibleClass
*
container_class
=
(
GtkContainerAccessibleClass
*
)
klass
;
class
->
get_n_children
=
gtk_stack_accessible_get_n_children
;
class
->
ref_child
=
gtk_stack_accessible_ref_child
;
/*
* As we report the stack as having only the visible child,
* we are not interested in add and remove signals
*/
container_class
->
add_gtk
=
NULL
;
container_class
->
remove_gtk
=
NULL
;
}
static
void
gtk_stack_accessible_init
(
GtkStackAccessible
*
bar
)
{}
void
gtk_stack_accessible_update_visible_child
(
GtkStack
*
stack
,
GtkWidget
*
old_visible_child
,
GtkWidget
*
new_visible_child
)
{
AtkObject
*
stack_accessible
=
_gtk_widget_peek_accessible
(
GTK_WIDGET
(
stack
));
if
(
stack_accessible
==
NULL
)
return
;
if
(
old_visible_child
)
{
AtkObject
*
accessible
=
gtk_widget_get_accessible
(
old_visible_child
);
g_object_notify
(
G_OBJECT
(
accessible
),
"accessible-parent"
);
g_signal_emit_by_name
(
stack_accessible
,
"children-changed::remove"
,
0
,
accessible
,
NULL
);
}
if
(
new_visible_child
)
{
AtkObject
*
accessible
=
gtk_widget_get_accessible
(
new_visible_child
);
g_object_notify
(
G_OBJECT
(
accessible
),
"accessible-parent"
);
g_signal_emit_by_name
(
stack_accessible
,
"children-changed::add"
,
0
,
accessible
,
NULL
);
}
}
gtk/a11y/gtkstackaccessible.h
0 → 100644
View file @
0b0d4765
/* GTK+ - accessibility implementations
* Copyright (C) 2016 Timm Bäder <mail@baedert.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_STACK_ACCESSIBLE_H__
#define __GTK_STACK_ACCESSIBLE_H__
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk-a11y.h> can be included directly."
#endif
#include <gtk/a11y/gtkcontaineraccessible.h>
G_BEGIN_DECLS
#define GTK_TYPE_STACK_ACCESSIBLE (gtk_stack_accessible_get_type ())
#define GTK_STACK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STACK_ACCESSIBLE, GtkStackAccessible))
#define GTK_STACK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STACK_ACCESSIBLE, GtkStackAccessibleClass))
#define GTK_IS_STACK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STACK_ACCESSIBLE))
#define GTK_IS_STACK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STACK_ACCESSIBLE))
#define GTK_STACK_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STACK_ACCESSIBLE, GtkStackAccessibleClass))
typedef
struct
_GtkStackAccessible
GtkStackAccessible
;
typedef
struct
_GtkStackAccessibleClass
GtkStackAccessibleClass
;
struct
_GtkStackAccessible
{
GtkContainerAccessible
parent
;
};
struct
_GtkStackAccessibleClass
{
GtkContainerAccessibleClass
parent_class
;
};
GDK_AVAILABLE_IN_3_22
GType
gtk_stack_accessible_get_type
(
void
);
G_END_DECLS
#endif
gtk/a11y/gtkstackaccessibleprivate.h
0 → 100644
View file @
0b0d4765
/* GTK+ - accessibility implementations
* Copyright (C) 2016 Timm Bäder <mail@baedert.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_STACK_ACCESSIBLE_PRIVATE_H__
#define __GTK_STACK_ACCESSIBLE_PRIVATE_H__
#include <gtk/a11y/gtkcontaineraccessible.h>
G_BEGIN_DECLS
void
gtk_stack_accessible_update_visible_child
(
GtkStack
*
stack
,
GtkWidget
*
old_visible_child
,
GtkWidget
*
new_visible_child
);
G_END_DECLS
#endif
/* __GTK_STACK_ACCESSIBLE_PRIVATE_H__ */
gtk/gtkstack.c
View file @
0b0d4765
...
...
@@ -30,6 +30,8 @@
#include "gtkprogresstrackerprivate.h"
#include "gtksettingsprivate.h"
#include "gtkwidgetprivate.h"
#include "a11y/gtkstackaccessible.h"
#include "a11y/gtkstackaccessibleprivate.h"
#include <math.h>
#include <string.h>
...
...
@@ -557,6 +559,7 @@ gtk_stack_class_init (GtkStackClass *klass)
gtk_container_class_install_child_properties
(
container_class
,
LAST_CHILD_PROP
,
stack_child_props
);
gtk_widget_class_set_accessible_type
(
widget_class
,
GTK_TYPE_STACK_ACCESSIBLE
);
gtk_widget_class_set_css_name
(
widget_class
,
"stack"
);
}
...
...
@@ -1116,6 +1119,10 @@ set_visible_child (GtkStack *stack,
}
}
gtk_stack_accessible_update_visible_child
(
stack
,
priv
->
visible_child
?
priv
->
visible_child
->
widget
:
NULL
,
child_info
?
child_info
->
widget
:
NULL
);
priv
->
visible_child
=
child_info
;
if
(
child_info
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment