1 /*
2  * Copyright (C) 2016 Alberts Muktupāvels
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef META_THEME_IMPL_PRIVATE_H
19 #define META_THEME_IMPL_PRIVATE_H
20 
21 #include "meta-button-layout-private.h"
22 #include "meta-frame-borders.h"
23 #include "meta-frame-enums.h"
24 #include "meta-frame-style-private.h"
25 #include "meta-style-info-private.h"
26 
27 G_BEGIN_DECLS
28 
29 typedef struct _MetaFrameGeometry MetaFrameGeometry;
30 
31 G_GNUC_INTERNAL
32 #define META_TYPE_THEME_IMPL meta_theme_impl_get_type ()
33 G_DECLARE_DERIVABLE_TYPE (MetaThemeImpl, meta_theme_impl,
34                           META, THEME_IMPL, GObject)
35 
36 struct _MetaThemeImplClass
37 {
38   GObjectClass parent_class;
39 
40   gboolean         (* load)              (MetaThemeImpl            *impl,
41                                           const gchar              *name,
42                                           GError                  **error);
43 
44   MetaFrameStyle * (* get_frame_style)   (MetaThemeImpl            *impl,
45                                           MetaFrameType             type,
46                                           MetaFrameFlags            flags);
47 
48   void             (* get_frame_borders) (MetaThemeImpl            *impl,
49                                           MetaFrameLayout          *layout,
50                                           MetaStyleInfo            *style_info,
51                                           gint                      text_height,
52                                           MetaFrameFlags            flags,
53                                           MetaFrameType             type,
54                                           MetaFrameBorders         *borders);
55 
56   void             (* calc_geometry)     (MetaThemeImpl            *impl,
57                                           MetaFrameLayout          *layout,
58                                           MetaStyleInfo            *style_info,
59                                           gint                      text_height,
60                                           MetaFrameFlags            flags,
61                                           gint                      client_width,
62                                           gint                      client_height,
63                                           MetaButtonLayout         *button_layout,
64                                           MetaFrameType             type,
65                                           MetaFrameGeometry        *fgeom);
66 
67   void             (* draw_frame)        (MetaThemeImpl            *impl,
68                                           MetaFrameStyle           *style,
69                                           MetaStyleInfo            *style_info,
70                                           cairo_t                  *cr,
71                                           const MetaFrameGeometry  *fgeom,
72                                           PangoLayout              *title_layout,
73                                           MetaFrameFlags            flags,
74                                           const MetaButtonLayout   *button_layout,
75                                           GdkPixbuf                *mini_icon,
76                                           GdkPixbuf                *icon);
77 };
78 
79 G_GNUC_INTERNAL
80 void               meta_theme_impl_set_composited (MetaThemeImpl           *impl,
81                                                    gboolean                 composited);
82 
83 G_GNUC_INTERNAL
84 gboolean           meta_theme_impl_get_composited (MetaThemeImpl           *impl);
85 
86 G_GNUC_INTERNAL
87 void               meta_theme_impl_set_scale      (MetaThemeImpl           *impl,
88                                                    gint                     scale);
89 
90 G_GNUC_INTERNAL
91 gint               meta_theme_impl_get_scale      (MetaThemeImpl           *impl);
92 
93 G_GNUC_INTERNAL
94 void               scale_border                   (GtkBorder               *border,
95                                                    double                   factor);
96 
97 G_GNUC_INTERNAL
98 gboolean           is_button_visible              (MetaButton              *button,
99                                                    MetaFrameFlags           flags);
100 
101 G_GNUC_INTERNAL
102 gboolean           strip_button                   (MetaButton              *buttons,
103                                                    gint                     n_buttons,
104                                                    MetaButtonType           type);
105 
106 G_GNUC_INTERNAL
107 gboolean           strip_buttons                  (MetaButtonLayout        *layout,
108                                                    gint                    *n_left,
109                                                    gint                    *n_right);
110 
111 G_END_DECLS
112 
113 #endif
114