summaryrefslogtreecommitdiff
path: root/libmetacity/meta-frame-layout-private.h
blob: 584ee4bfbcec55a4cf2579b3e1d44cd6ddf948f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Copyright (C) 2001 Havoc Pennington
 * Copyright (C) 2016 Alberts Muktupāvels
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef META_FRAME_LAYOUT_PRIVATE_H
#define META_FRAME_LAYOUT_PRIVATE_H

#include <gtk/gtk.h>

G_BEGIN_DECLS

typedef struct _MetaFrameLayout MetaFrameLayout;

/**
 * Whether a button's size is calculated from the area around it (aspect
 * sizing) or is given as a fixed height and width in pixels (fixed sizing).
 *
 * \bug This could be done away with; see the comment at the top of
 * MetaFrameLayout.
 */
typedef enum
{
  META_BUTTON_SIZING_ASPECT,
  META_BUTTON_SIZING_FIXED,
  META_BUTTON_SIZING_LAST
} MetaButtonSizing;

/**
 * Various parameters used to calculate the geometry of a frame.
 * They are used inside a MetaFrameStyle.
 * This corresponds closely to the <frame_geometry> tag in a theme file.
 *
 * \bug button_sizing isn't really necessary, because we could easily say
 * that if button_aspect is zero, the height and width are fixed values.
 * This would also mean that MetaButtonSizing didn't need to exist, and
 * save code.
 **/
struct _MetaFrameLayout
{
  gint refcount;

  struct {
    /** Border/padding of the entire frame */
    GtkBorder frame_border;

    /** Shadow border used in invisible resize area */
    GtkBorder shadow_border;

    /** Border/padding of the titlebar region */
    GtkBorder titlebar_border;
    /** Border/padding of titlebar buttons */

    /** Size of images in buttons */
    guint icon_size;

    /** Space between titlebar elements */
    guint titlebar_spacing;

    /** Margin of title */
    GtkBorder title_margin;
    /** Margin of titlebar buttons */
    GtkBorder button_margin;

    /** Min size of titlebar region */
    GtkRequisition titlebar_min_size;
    /** Min size of titlebar buttons */
    GtkRequisition button_min_size;
  } gtk;

  struct {
    /** Size of left side */
    gint left_width;
    /** Size of right side */
    gint right_width;
    /** Size of bottom side */
    gint bottom_height;

    /** Border of blue title region
     * \bug (blue?!)
     **/
    GtkBorder title_border;

    /** Extra height for inside of title region, above the font height */
    int title_vertical_pad;

    /** Right indent of buttons from edges of frame */
    int right_titlebar_edge;
    /** Left indent of buttons from edges of frame */
    int left_titlebar_edge;

    /**
     * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
     * (in which case button_aspect will be honoured, and
     * button_width and button_height set from it), or
     * META_BUTTON_SIZING_FIXED (in which case we read the width
     * and height directly).
     */
    MetaButtonSizing button_sizing;

    /**
     * Ratio of height/width. Honoured only if
     * button_sizing==META_BUTTON_SIZING_ASPECT.
     * Otherwise we figure out the height from the button_border.
     */
    double button_aspect;

    /** Width of a button; set even when we are using aspect sizing */
    gint button_width;

    /** Height of a button; set even when we are using aspect sizing */
    gint button_height;
  } metacity;

  /** Invisible resize area border */
  GtkBorder invisible_resize_border;

  /** Space around buttons */
  GtkBorder button_border;

  /** scale factor for title text */
  double title_scale;

  /** Whether title text will be displayed */
  guint has_title : 1;

  /** Whether we should hide the buttons */
  guint hide_buttons : 1;

  /** Radius of the top left-hand corner; 0 if not rounded */
  guint top_left_corner_rounded_radius;
  /** Radius of the top right-hand corner; 0 if not rounded */
  guint top_right_corner_rounded_radius;
  /** Radius of the bottom left-hand corner; 0 if not rounded */
  guint bottom_left_corner_rounded_radius;
  /** Radius of the bottom right-hand corner; 0 if not rounded */
  guint bottom_right_corner_rounded_radius;
};

G_GNUC_INTERNAL
MetaFrameLayout *meta_frame_layout_new      (void);

G_GNUC_INTERNAL
MetaFrameLayout *meta_frame_layout_copy     (const MetaFrameLayout  *src);

G_GNUC_INTERNAL
void             meta_frame_layout_ref      (MetaFrameLayout        *layout);

G_GNUC_INTERNAL
void             meta_frame_layout_unref    (MetaFrameLayout        *layout);

G_GNUC_INTERNAL
gboolean         meta_frame_layout_validate (const MetaFrameLayout  *layout,
                                             GError                **error);

G_END_DECLS

#endif