st: Add StPolicyType enum
In order to replace GTK+'s GtkPolicyType. It's bit-compatible with it, too. All callers have been updated to use it. This is a purely accessory change in terms of X11 Display usage cleanup, but helps see better what is left. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/317
This commit is contained in:
parent
0f799ae313
commit
a977c1388a
@ -161,8 +161,8 @@ Signals.addSignalMethods(UserListItem.prototype);
|
|||||||
var UserList = class {
|
var UserList = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
|
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
|
||||||
this.actor.set_policy(Gtk.PolicyType.NEVER,
|
this.actor.set_policy(St.PolicyType.NEVER,
|
||||||
Gtk.PolicyType.AUTOMATIC);
|
St.PolicyType.AUTOMATIC);
|
||||||
|
|
||||||
this._box = new St.BoxLayout({ vertical: true,
|
this._box = new St.BoxLayout({ vertical: true,
|
||||||
style_class: 'login-dialog-user-list',
|
style_class: 'login-dialog-user-list',
|
||||||
@ -473,8 +473,8 @@ var LoginDialog = GObject.registerClass({
|
|||||||
|
|
||||||
this._bannerView = new St.ScrollView({ style_class: 'login-dialog-banner-view',
|
this._bannerView = new St.ScrollView({ style_class: 'login-dialog-banner-view',
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
|
vscrollbar_policy: St.PolicyType.AUTOMATIC,
|
||||||
hscrollbar_policy: Gtk.PolicyType.NEVER });
|
hscrollbar_policy: St.PolicyType.NEVER });
|
||||||
this.add_child(this._bannerView);
|
this.add_child(this._bannerView);
|
||||||
|
|
||||||
let bannerBox = new St.BoxLayout({ vertical: true });
|
let bannerBox = new St.BoxLayout({ vertical: true });
|
||||||
|
@ -370,8 +370,8 @@ var AllView = class AllView extends BaseAppView {
|
|||||||
x_expand:true, y_expand:true });
|
x_expand:true, y_expand:true });
|
||||||
this.actor.add_actor(this._scrollView);
|
this.actor.add_actor(this._scrollView);
|
||||||
|
|
||||||
this._scrollView.set_policy(Gtk.PolicyType.NEVER,
|
this._scrollView.set_policy(St.PolicyType.NEVER,
|
||||||
Gtk.PolicyType.EXTERNAL);
|
St.PolicyType.EXTERNAL);
|
||||||
this._adjustment = this._scrollView.vscroll.adjustment;
|
this._adjustment = this._scrollView.vscroll.adjustment;
|
||||||
|
|
||||||
this._pageIndicators = new PageIndicators();
|
this._pageIndicators = new PageIndicators();
|
||||||
@ -1124,7 +1124,7 @@ var FolderView = class FolderView extends BaseAppView {
|
|||||||
this._grid.x_expand = true;
|
this._grid.x_expand = true;
|
||||||
|
|
||||||
this.actor = new St.ScrollView({ overlay_scrollbars: true });
|
this.actor = new St.ScrollView({ overlay_scrollbars: true });
|
||||||
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this.actor.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
||||||
let scrollableContainer = new St.BoxLayout({ vertical: true, reactive: true });
|
let scrollableContainer = new St.BoxLayout({ vertical: true, reactive: true });
|
||||||
scrollableContainer.add_actor(this._grid);
|
scrollableContainer.add_actor(this._grid);
|
||||||
this.actor.add_actor(scrollableContainer);
|
this.actor.add_actor(scrollableContainer);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
@ -1083,7 +1082,7 @@ var CalendarMessageList = class CalendarMessageList {
|
|||||||
overlay_scrollbars: true,
|
overlay_scrollbars: true,
|
||||||
x_expand: true, y_expand: true,
|
x_expand: true, y_expand: true,
|
||||||
x_fill: true, y_fill: true });
|
x_fill: true, y_fill: true });
|
||||||
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
||||||
box.add_actor(this._scrollView);
|
box.add_actor(this._scrollView);
|
||||||
|
|
||||||
this._clearButton = new St.Button({ style_class: 'message-list-clear-button button',
|
this._clearButton = new St.Button({ style_class: 'message-list-clear-button button',
|
||||||
|
@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
|
|||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const GObject = imports.gi.GObject;
|
const GObject = imports.gi.GObject;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
@ -821,8 +820,8 @@ var ChatNotificationBanner = class extends MessageTray.NotificationBanner {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
|
this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
|
||||||
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
|
vscrollbar_policy: St.PolicyType.AUTOMATIC,
|
||||||
hscrollbar_policy: Gtk.PolicyType.NEVER,
|
hscrollbar_policy: St.PolicyType.NEVER,
|
||||||
visible: this.expanded });
|
visible: this.expanded });
|
||||||
this._contentArea = new St.BoxLayout({ style_class: 'chat-body',
|
this._contentArea = new St.BoxLayout({ style_class: 'chat-body',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
@ -4,7 +4,6 @@ const GLib = imports.gi.GLib;
|
|||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GnomeDesktop = imports.gi.GnomeDesktop;
|
const GnomeDesktop = imports.gi.GnomeDesktop;
|
||||||
const GObject = imports.gi.GObject;
|
const GObject = imports.gi.GObject;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const GWeather = imports.gi.GWeather;
|
const GWeather = imports.gi.GWeather;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
@ -515,7 +514,7 @@ class DateMenuButton extends PanelMenu.Button {
|
|||||||
this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade',
|
this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade',
|
||||||
x_expand: true, x_fill: true,
|
x_expand: true, x_fill: true,
|
||||||
overlay_scrollbars: true });
|
overlay_scrollbars: true });
|
||||||
this._displaysSection.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this._displaysSection.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
||||||
vbox.add_actor(this._displaysSection);
|
vbox.add_actor(this._displaysSection);
|
||||||
|
|
||||||
let displaysBox = new St.BoxLayout({ vertical: true,
|
let displaysBox = new St.BoxLayout({ vertical: true,
|
||||||
|
@ -22,7 +22,6 @@ const AccountsService = imports.gi.AccountsService;
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
const Polkit = imports.gi.Polkit;
|
const Polkit = imports.gi.Polkit;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
@ -320,7 +319,7 @@ var EndSessionDialog = class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
messageLayout.add(this._batteryWarning);
|
messageLayout.add(this._batteryWarning);
|
||||||
|
|
||||||
this._scrollView = new St.ScrollView({ style_class: 'end-session-dialog-list' });
|
this._scrollView = new St.ScrollView({ style_class: 'end-session-dialog-list' });
|
||||||
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
||||||
this.contentLayout.add(this._scrollView,
|
this.contentLayout.add(this._scrollView,
|
||||||
{ x_fill: true,
|
{ x_fill: true,
|
||||||
y_fill: true });
|
y_fill: true });
|
||||||
|
@ -914,8 +914,8 @@ var PopupSubMenu = class extends PopupMenuBase {
|
|||||||
// with long content, we make it scrollable - the scrollbar will only take
|
// with long content, we make it scrollable - the scrollbar will only take
|
||||||
// effect if a CSS max-height is set on the top menu.
|
// effect if a CSS max-height is set on the top menu.
|
||||||
this.actor = new St.ScrollView({ style_class: 'popup-sub-menu',
|
this.actor = new St.ScrollView({ style_class: 'popup-sub-menu',
|
||||||
hscrollbar_policy: Gtk.PolicyType.NEVER,
|
hscrollbar_policy: St.PolicyType.NEVER,
|
||||||
vscrollbar_policy: Gtk.PolicyType.NEVER });
|
vscrollbar_policy: St.PolicyType.NEVER });
|
||||||
|
|
||||||
this.actor.add_actor(this.box);
|
this.actor.add_actor(this.box);
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
@ -957,7 +957,7 @@ var PopupSubMenu = class extends PopupMenuBase {
|
|||||||
// when we *don't* need it, so turn off the scrollbar when that's true.
|
// when we *don't* need it, so turn off the scrollbar when that's true.
|
||||||
// Dynamic changes in whether we need it aren't handled properly.
|
// Dynamic changes in whether we need it aren't handled properly.
|
||||||
this.actor.vscrollbar_policy =
|
this.actor.vscrollbar_policy =
|
||||||
needsScrollbar ? Gtk.PolicyType.AUTOMATIC : Gtk.PolicyType.NEVER;
|
needsScrollbar ? St.PolicyType.AUTOMATIC : St.PolicyType.NEVER;
|
||||||
|
|
||||||
if (needsScrollbar)
|
if (needsScrollbar)
|
||||||
this.actor.add_style_pseudo_class('scrolled');
|
this.actor.add_style_pseudo_class('scrolled');
|
||||||
|
@ -101,7 +101,7 @@ var NotificationsBox = class {
|
|||||||
style_class: 'screen-shield-notifications-container' });
|
style_class: 'screen-shield-notifications-container' });
|
||||||
|
|
||||||
this._scrollView = new St.ScrollView({ x_fill: false, x_align: St.Align.START,
|
this._scrollView = new St.ScrollView({ x_fill: false, x_align: St.Align.START,
|
||||||
hscrollbar_policy: Gtk.PolicyType.NEVER });
|
hscrollbar_policy: St.PolicyType.NEVER });
|
||||||
this._notificationBox = new St.BoxLayout({ vertical: true,
|
this._notificationBox = new St.BoxLayout({ vertical: true,
|
||||||
style_class: 'screen-shield-notifications-container' });
|
style_class: 'screen-shield-notifications-container' });
|
||||||
this._scrollView.add_actor(this._notificationBox);
|
this._scrollView.add_actor(this._notificationBox);
|
||||||
@ -258,7 +258,7 @@ var NotificationsBox = class {
|
|||||||
// block scrollbars while animating, if they're not needed now
|
// block scrollbars while animating, if they're not needed now
|
||||||
let boxHeight = this._notificationBox.height;
|
let boxHeight = this._notificationBox.height;
|
||||||
if (this._scrollView.height >= boxHeight)
|
if (this._scrollView.height >= boxHeight)
|
||||||
this._scrollView.vscrollbar_policy = Gtk.PolicyType.NEVER;
|
this._scrollView.vscrollbar_policy = St.PolicyType.NEVER;
|
||||||
|
|
||||||
let widget = obj.sourceBox;
|
let widget = obj.sourceBox;
|
||||||
let [, natHeight] = widget.get_preferred_height(-1);
|
let [, natHeight] = widget.get_preferred_height(-1);
|
||||||
@ -268,7 +268,7 @@ var NotificationsBox = class {
|
|||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
time: 0.25,
|
time: 0.25,
|
||||||
onComplete() {
|
onComplete() {
|
||||||
this._scrollView.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
|
this._scrollView.vscrollbar_policy = St.PolicyType.AUTOMATIC;
|
||||||
widget.set_height(-1);
|
widget.set_height(-1);
|
||||||
},
|
},
|
||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
|
@ -402,7 +402,7 @@ var SearchResults = class {
|
|||||||
y_fill: false,
|
y_fill: false,
|
||||||
overlay_scrollbars: true,
|
overlay_scrollbars: true,
|
||||||
style_class: 'search-display vfade' });
|
style_class: 'search-display vfade' });
|
||||||
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
|
this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
||||||
this._scrollView.add_actor(scrollChild);
|
this._scrollView.add_actor(scrollChild);
|
||||||
let action = new Clutter.PanAction({ interpolate: true });
|
let action = new Clutter.PanAction({ interpolate: true });
|
||||||
action.connect('pan', this._onPan.bind(this));
|
action.connect('pan', this._onPan.bind(this));
|
||||||
|
@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
|
|||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
@ -371,8 +370,8 @@ var ShellProcessesDialog = class extends ModalDialog.ModalDialog {
|
|||||||
this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
|
this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
|
||||||
|
|
||||||
let scrollView = new St.ScrollView({ style_class: 'mount-dialog-app-list'});
|
let scrollView = new St.ScrollView({ style_class: 'mount-dialog-app-list'});
|
||||||
scrollView.set_policy(Gtk.PolicyType.NEVER,
|
scrollView.set_policy(St.PolicyType.NEVER,
|
||||||
Gtk.PolicyType.AUTOMATIC);
|
St.PolicyType.AUTOMATIC);
|
||||||
this.contentLayout.add(scrollView,
|
this.contentLayout.add(scrollView,
|
||||||
{ x_fill: true,
|
{ x_fill: true,
|
||||||
y_fill: true });
|
y_fill: true });
|
||||||
|
@ -3,7 +3,6 @@ const Clutter = imports.gi.Clutter;
|
|||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const GObject = imports.gi.GObject;
|
const GObject = imports.gi.GObject;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const NM = imports.gi.NM;
|
const NM = imports.gi.NM;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
@ -846,8 +845,8 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
|
|||||||
this._scrollView = new St.ScrollView({ style_class: 'nm-dialog-scroll-view' });
|
this._scrollView = new St.ScrollView({ style_class: 'nm-dialog-scroll-view' });
|
||||||
this._scrollView.set_x_expand(true);
|
this._scrollView.set_x_expand(true);
|
||||||
this._scrollView.set_y_expand(true);
|
this._scrollView.set_y_expand(true);
|
||||||
this._scrollView.set_policy(Gtk.PolicyType.NEVER,
|
this._scrollView.set_policy(St.PolicyType.NEVER,
|
||||||
Gtk.PolicyType.AUTOMATIC);
|
St.PolicyType.AUTOMATIC);
|
||||||
this._scrollView.add_actor(this._itemBox);
|
this._scrollView.add_actor(this._itemBox);
|
||||||
this._stack.add_child(this._scrollView);
|
this._stack.add_child(this._scrollView);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const GObject = imports.gi.GObject;
|
const GObject = imports.gi.GObject;
|
||||||
const Gtk = imports.gi.Gtk;
|
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
@ -365,7 +364,7 @@ var SwitcherList = GObject.registerClass({
|
|||||||
|
|
||||||
this._scrollView = new St.ScrollView({ style_class: 'hfade',
|
this._scrollView = new St.ScrollView({ style_class: 'hfade',
|
||||||
enable_mouse_scrolling: false });
|
enable_mouse_scrolling: false });
|
||||||
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
|
this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.NEVER);
|
||||||
|
|
||||||
this._scrollView.add_actor(this._list);
|
this._scrollView.add_actor(this._list);
|
||||||
this.add_actor(this._scrollView);
|
this.add_actor(this._scrollView);
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
* detailed description of the considerations involved.
|
* detailed description of the considerations involved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "st-enum-types.h"
|
||||||
#include "st-scroll-view.h"
|
#include "st-scroll-view.h"
|
||||||
#include "st-scroll-bar.h"
|
#include "st-scroll-bar.h"
|
||||||
#include "st-scrollable.h"
|
#include "st-scrollable.h"
|
||||||
@ -82,8 +83,8 @@ struct _StScrollViewPrivate
|
|||||||
StAdjustment *vadjustment;
|
StAdjustment *vadjustment;
|
||||||
ClutterActor *vscroll;
|
ClutterActor *vscroll;
|
||||||
|
|
||||||
GtkPolicyType hscrollbar_policy;
|
StPolicyType hscrollbar_policy;
|
||||||
GtkPolicyType vscrollbar_policy;
|
StPolicyType vscrollbar_policy;
|
||||||
|
|
||||||
gfloat row_size;
|
gfloat row_size;
|
||||||
gfloat column_size;
|
gfloat column_size;
|
||||||
@ -372,12 +373,12 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
|
|||||||
|
|
||||||
switch (priv->hscrollbar_policy)
|
switch (priv->hscrollbar_policy)
|
||||||
{
|
{
|
||||||
case GTK_POLICY_NEVER:
|
case ST_POLICY_NEVER:
|
||||||
min_width = child_min_width;
|
min_width = child_min_width;
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_ALWAYS:
|
case ST_POLICY_ALWAYS:
|
||||||
case GTK_POLICY_AUTOMATIC:
|
case ST_POLICY_AUTOMATIC:
|
||||||
case GTK_POLICY_EXTERNAL:
|
case ST_POLICY_EXTERNAL:
|
||||||
/* Should theoretically use the min width of the hscrollbar,
|
/* Should theoretically use the min width of the hscrollbar,
|
||||||
* but that's not cleanly defined at the moment */
|
* but that's not cleanly defined at the moment */
|
||||||
min_width = 0;
|
min_width = 0;
|
||||||
@ -389,14 +390,14 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
|
|||||||
|
|
||||||
switch (priv->vscrollbar_policy)
|
switch (priv->vscrollbar_policy)
|
||||||
{
|
{
|
||||||
case GTK_POLICY_NEVER:
|
case ST_POLICY_NEVER:
|
||||||
case GTK_POLICY_EXTERNAL:
|
case ST_POLICY_EXTERNAL:
|
||||||
account_for_vscrollbar = FALSE;
|
account_for_vscrollbar = FALSE;
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_ALWAYS:
|
case ST_POLICY_ALWAYS:
|
||||||
account_for_vscrollbar = !priv->overlay_scrollbars;
|
account_for_vscrollbar = !priv->overlay_scrollbars;
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_AUTOMATIC:
|
case ST_POLICY_AUTOMATIC:
|
||||||
/* For automatic scrollbars, we always request space for the vertical
|
/* For automatic scrollbars, we always request space for the vertical
|
||||||
* scrollbar; we won't know whether we actually need one until our
|
* scrollbar; we won't know whether we actually need one until our
|
||||||
* height is assigned in allocate().
|
* height is assigned in allocate().
|
||||||
@ -454,11 +455,11 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
|
|||||||
|
|
||||||
switch (priv->vscrollbar_policy)
|
switch (priv->vscrollbar_policy)
|
||||||
{
|
{
|
||||||
case GTK_POLICY_NEVER:
|
case ST_POLICY_NEVER:
|
||||||
case GTK_POLICY_EXTERNAL:
|
case ST_POLICY_EXTERNAL:
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_ALWAYS:
|
case ST_POLICY_ALWAYS:
|
||||||
case GTK_POLICY_AUTOMATIC:
|
case ST_POLICY_AUTOMATIC:
|
||||||
/* We've requested space for the scrollbar, subtract it back out */
|
/* We've requested space for the scrollbar, subtract it back out */
|
||||||
for_width -= sb_width;
|
for_width -= sb_width;
|
||||||
break;
|
break;
|
||||||
@ -469,14 +470,14 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
|
|||||||
|
|
||||||
switch (priv->hscrollbar_policy)
|
switch (priv->hscrollbar_policy)
|
||||||
{
|
{
|
||||||
case GTK_POLICY_NEVER:
|
case ST_POLICY_NEVER:
|
||||||
case GTK_POLICY_EXTERNAL:
|
case ST_POLICY_EXTERNAL:
|
||||||
account_for_hscrollbar = FALSE;
|
account_for_hscrollbar = FALSE;
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_ALWAYS:
|
case ST_POLICY_ALWAYS:
|
||||||
account_for_hscrollbar = !priv->overlay_scrollbars;
|
account_for_hscrollbar = !priv->overlay_scrollbars;
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_AUTOMATIC:
|
case ST_POLICY_AUTOMATIC:
|
||||||
/* For automatic scrollbars, we always request space for the horizontal
|
/* For automatic scrollbars, we always request space for the horizontal
|
||||||
* scrollbar; we won't know whether we actually need one until our
|
* scrollbar; we won't know whether we actually need one until our
|
||||||
* width is assigned in allocate().
|
* width is assigned in allocate().
|
||||||
@ -495,12 +496,12 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
|
|||||||
|
|
||||||
switch (priv->vscrollbar_policy)
|
switch (priv->vscrollbar_policy)
|
||||||
{
|
{
|
||||||
case GTK_POLICY_NEVER:
|
case ST_POLICY_NEVER:
|
||||||
min_height = child_min_height;
|
min_height = child_min_height;
|
||||||
break;
|
break;
|
||||||
case GTK_POLICY_ALWAYS:
|
case ST_POLICY_ALWAYS:
|
||||||
case GTK_POLICY_AUTOMATIC:
|
case ST_POLICY_AUTOMATIC:
|
||||||
case GTK_POLICY_EXTERNAL:
|
case ST_POLICY_EXTERNAL:
|
||||||
/* Should theoretically use the min height of the vscrollbar,
|
/* Should theoretically use the min height of the vscrollbar,
|
||||||
* but that's not cleanly defined at the moment */
|
* but that's not cleanly defined at the moment */
|
||||||
min_height = 0;
|
min_height = 0;
|
||||||
@ -571,9 +572,9 @@ st_scroll_view_allocate (ClutterActor *actor,
|
|||||||
clutter_actor_get_preferred_width (priv->child, -1,
|
clutter_actor_get_preferred_width (priv->child, -1,
|
||||||
&child_min_width, NULL);
|
&child_min_width, NULL);
|
||||||
|
|
||||||
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->vscrollbar_policy == ST_POLICY_AUTOMATIC)
|
||||||
{
|
{
|
||||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->hscrollbar_policy == ST_POLICY_AUTOMATIC)
|
||||||
{
|
{
|
||||||
/* Pass one, try without a vertical scrollbar */
|
/* Pass one, try without a vertical scrollbar */
|
||||||
clutter_actor_get_preferred_height (priv->child, avail_width, &child_min_height, NULL);
|
clutter_actor_get_preferred_height (priv->child, avail_width, &child_min_height, NULL);
|
||||||
@ -591,7 +592,7 @@ st_scroll_view_allocate (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hscrollbar_visible = priv->hscrollbar_policy == GTK_POLICY_ALWAYS;
|
hscrollbar_visible = priv->hscrollbar_policy == ST_POLICY_ALWAYS;
|
||||||
|
|
||||||
/* try without a vertical scrollbar */
|
/* try without a vertical scrollbar */
|
||||||
clutter_actor_get_preferred_height (priv->child, avail_width, &child_min_height, NULL);
|
clutter_actor_get_preferred_height (priv->child, avail_width, &child_min_height, NULL);
|
||||||
@ -600,20 +601,20 @@ st_scroll_view_allocate (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vscrollbar_visible = priv->vscrollbar_policy == GTK_POLICY_ALWAYS;
|
vscrollbar_visible = priv->vscrollbar_policy == ST_POLICY_ALWAYS;
|
||||||
|
|
||||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
if (priv->hscrollbar_policy == ST_POLICY_AUTOMATIC)
|
||||||
hscrollbar_visible = child_min_width > avail_height - (vscrollbar_visible ? 0 : sb_width);
|
hscrollbar_visible = child_min_width > avail_height - (vscrollbar_visible ? 0 : sb_width);
|
||||||
else
|
else
|
||||||
hscrollbar_visible = priv->hscrollbar_policy == GTK_POLICY_ALWAYS;
|
hscrollbar_visible = priv->hscrollbar_policy == ST_POLICY_ALWAYS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hscrollbar_visible = priv->hscrollbar_policy != GTK_POLICY_NEVER &&
|
hscrollbar_visible = priv->hscrollbar_policy != ST_POLICY_NEVER &&
|
||||||
priv->hscrollbar_policy != GTK_POLICY_EXTERNAL;
|
priv->hscrollbar_policy != ST_POLICY_EXTERNAL;
|
||||||
vscrollbar_visible = priv->vscrollbar_policy != GTK_POLICY_NEVER &&
|
vscrollbar_visible = priv->vscrollbar_policy != ST_POLICY_NEVER &&
|
||||||
priv->vscrollbar_policy != GTK_POLICY_EXTERNAL;
|
priv->vscrollbar_policy != ST_POLICY_EXTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Whether or not we show the scrollbars, if the scrollbars are visible
|
/* Whether or not we show the scrollbars, if the scrollbars are visible
|
||||||
@ -661,12 +662,12 @@ st_scroll_view_allocate (ClutterActor *actor,
|
|||||||
* Fold this into the scrollbar sizes to simplify the rest of the
|
* Fold this into the scrollbar sizes to simplify the rest of the
|
||||||
* computations.
|
* computations.
|
||||||
*/
|
*/
|
||||||
if (priv->hscrollbar_policy == GTK_POLICY_NEVER ||
|
if (priv->hscrollbar_policy == ST_POLICY_NEVER ||
|
||||||
priv->hscrollbar_policy == GTK_POLICY_EXTERNAL ||
|
priv->hscrollbar_policy == ST_POLICY_EXTERNAL ||
|
||||||
priv->overlay_scrollbars)
|
priv->overlay_scrollbars)
|
||||||
sb_height = 0;
|
sb_height = 0;
|
||||||
if (priv->vscrollbar_policy == GTK_POLICY_NEVER ||
|
if (priv->vscrollbar_policy == ST_POLICY_NEVER ||
|
||||||
priv->vscrollbar_policy == GTK_POLICY_EXTERNAL ||
|
priv->vscrollbar_policy == ST_POLICY_EXTERNAL ||
|
||||||
priv->overlay_scrollbars)
|
priv->overlay_scrollbars)
|
||||||
sb_width = 0;
|
sb_width = 0;
|
||||||
|
|
||||||
@ -828,16 +829,16 @@ st_scroll_view_class_init (StScrollViewClass *klass)
|
|||||||
pspec = g_param_spec_enum ("vscrollbar-policy",
|
pspec = g_param_spec_enum ("vscrollbar-policy",
|
||||||
"Vertical Scrollbar Policy",
|
"Vertical Scrollbar Policy",
|
||||||
"When the vertical scrollbar is displayed",
|
"When the vertical scrollbar is displayed",
|
||||||
GTK_TYPE_POLICY_TYPE,
|
ST_TYPE_POLICY_TYPE,
|
||||||
GTK_POLICY_AUTOMATIC,
|
ST_POLICY_AUTOMATIC,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (object_class, PROP_VSCROLLBAR_POLICY, pspec);
|
g_object_class_install_property (object_class, PROP_VSCROLLBAR_POLICY, pspec);
|
||||||
|
|
||||||
pspec = g_param_spec_enum ("hscrollbar-policy",
|
pspec = g_param_spec_enum ("hscrollbar-policy",
|
||||||
"Horizontal Scrollbar Policy",
|
"Horizontal Scrollbar Policy",
|
||||||
"When the horizontal scrollbar is displayed",
|
"When the horizontal scrollbar is displayed",
|
||||||
GTK_TYPE_POLICY_TYPE,
|
ST_TYPE_POLICY_TYPE,
|
||||||
GTK_POLICY_AUTOMATIC,
|
ST_POLICY_AUTOMATIC,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (object_class, PROP_HSCROLLBAR_POLICY, pspec);
|
g_object_class_install_property (object_class, PROP_HSCROLLBAR_POLICY, pspec);
|
||||||
|
|
||||||
@ -879,8 +880,8 @@ st_scroll_view_init (StScrollView *self)
|
|||||||
{
|
{
|
||||||
StScrollViewPrivate *priv = self->priv = st_scroll_view_get_instance_private (self);
|
StScrollViewPrivate *priv = self->priv = st_scroll_view_get_instance_private (self);
|
||||||
|
|
||||||
priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
|
priv->hscrollbar_policy = ST_POLICY_AUTOMATIC;
|
||||||
priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
|
priv->vscrollbar_policy = ST_POLICY_AUTOMATIC;
|
||||||
|
|
||||||
priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
|
priv->hadjustment = g_object_new (ST_TYPE_ADJUSTMENT, NULL);
|
||||||
priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR,
|
priv->hscroll = g_object_new (ST_TYPE_SCROLL_BAR,
|
||||||
@ -1187,8 +1188,8 @@ st_scroll_view_get_overlay_scrollbars (StScrollView *scroll)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
st_scroll_view_set_policy (StScrollView *scroll,
|
st_scroll_view_set_policy (StScrollView *scroll,
|
||||||
GtkPolicyType hscroll,
|
StPolicyType hscroll,
|
||||||
GtkPolicyType vscroll)
|
StPolicyType vscroll)
|
||||||
{
|
{
|
||||||
StScrollViewPrivate *priv;
|
StScrollViewPrivate *priv;
|
||||||
|
|
||||||
|
@ -34,6 +34,14 @@ G_BEGIN_DECLS
|
|||||||
#define ST_TYPE_SCROLL_VIEW (st_scroll_view_get_type())
|
#define ST_TYPE_SCROLL_VIEW (st_scroll_view_get_type())
|
||||||
G_DECLARE_FINAL_TYPE (StScrollView, st_scroll_view, ST, SCROLL_VIEW, StBin)
|
G_DECLARE_FINAL_TYPE (StScrollView, st_scroll_view, ST, SCROLL_VIEW, StBin)
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ST_POLICY_ALWAYS,
|
||||||
|
ST_POLICY_AUTOMATIC,
|
||||||
|
ST_POLICY_NEVER,
|
||||||
|
ST_POLICY_EXTERNAL,
|
||||||
|
} StPolicyType;
|
||||||
|
|
||||||
typedef struct _StScrollViewPrivate StScrollViewPrivate;
|
typedef struct _StScrollViewPrivate StScrollViewPrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,8 +80,8 @@ void st_scroll_view_set_overlay_scrollbars (StScrollView *scroll,
|
|||||||
gboolean st_scroll_view_get_overlay_scrollbars (StScrollView *scroll);
|
gboolean st_scroll_view_get_overlay_scrollbars (StScrollView *scroll);
|
||||||
|
|
||||||
void st_scroll_view_set_policy (StScrollView *scroll,
|
void st_scroll_view_set_policy (StScrollView *scroll,
|
||||||
GtkPolicyType hscroll,
|
StPolicyType hscroll,
|
||||||
GtkPolicyType vscroll);
|
StPolicyType vscroll);
|
||||||
void st_scroll_view_update_fade_effect (StScrollView *scroll,
|
void st_scroll_view_update_fade_effect (StScrollView *scroll,
|
||||||
float vfade_offset,
|
float vfade_offset,
|
||||||
float hfade_offset);
|
float hfade_offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user