This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

1. Overview

Scrolled windows are used whenever content does not fit on the screen. This can be a ../GtkTreeView, ../GtkTextView or just some widgets. It uses a ../GtkScrollBar for the horizontal and vertical direction.

screenshot.png

2. Style Properties

Name

Type

Default

Nick

Description

misc

scrollbar-spacing

int

DEFAULT_SCROLLBAR_SPACING

Scrollbar spacing

Number of pixels between the scrollbars and the scrolled window

Min: 0; Max: G_MAXINT

scrollbars-within-bevel

boolean

FALSE

Scrollbars within bevel

Place scrollbars within the scrolled window's bevel

3. Geometry

The scrollbars-within-bevel style property controls where the shadow is drawn. Here are images for both cases.

3.1. Scrollbars within bevel

scrollbars-within-bevel.png

3.2. Scrollbars outside of the bevel

scrollbars-outside-bevel.png

3.3. No shadow

The scrolled window may not have a shadow at all if the application chooses so. In this case the widget will not allocate any space based on the xthickness and ythickness.

4. Drawing

The ../GtkScrolledWindow just draws a shadow around the content. The shadow is drawn with a state of NORMAL and the detail string is "scrolled_window". The shadow type can be set by the application, it defaults to NONE, which means that no shadow will be drawn unless the application chooses it.

The content has its own X window (often multiple nested).

5. GTK+ API Documentation

http://library.gnome.org/devel/gtk/stable/GtkScrolledWindow.html


How to add enclosing border to a GtkScrolledWindow:

style "my-scrolledwindow"
{
    xthickness = 10
    ythickness = 10
    GtkScrolledWindow ::scrollbars-within-bevel = 1
    GtkScrolledWindow ::scrollbar-spacing = 10
    engine "pixmap"
    {
          image
          {
                function = SHADOW
                file = "background.png"
                border = {10, 10, 10, 10}
                detail = "scrolled_window"
          }
    }
}
 
class "GtkScrolledWindow" style "my-scrolledwindow"

2024-10-23 10:58