1 /*
2  * Copyright 2010-2011 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of either or both of the following licenses:
6  *
7  * 1) the GNU Lesser General Public License version 3, as published by the
8  * Free Software Foundation; and/or
9  * 2) the GNU Lesser General Public License version 2.1, as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranties of
14  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
15  * PURPOSE.  See the applicable version of the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of both the GNU Lesser General Public
19  * License version 3 and version 2.1 along with this program.  If not, see
20  * <http://www.gnu.org/licenses/>
21  *
22  * Authored by: Jason Smith <jason.smith@canonical.com>
23  *              Neil Jagdish Patel <neil.patel@canonical.com>
24  *              Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
25  *
26  */
27 
28 #ifndef _BAMF_WINDOW_H_
29 #define _BAMF_WINDOW_H_
30 
31 #include <time.h>
32 #include <glib-object.h>
33 #include <libbamf/bamf-view.h>
34 
35 G_BEGIN_DECLS
36 
37 #define BAMF_TYPE_WINDOW (bamf_window_get_type ())
38 
39 #define BAMF_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
40         BAMF_TYPE_WINDOW, BamfWindow))
41 
42 #define BAMF_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
43         BAMF_TYPE_WINDOW, BamfWindowClass))
44 
45 #define BAMF_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
46         BAMF_TYPE_WINDOW))
47 
48 #define BAMF_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
49         BAMF_TYPE_WINDOW))
50 
51 #define BAMF_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
52         BAMF_TYPE_WINDOW, BamfWindowClass))
53 
54 #define BAMF_WINDOW_SIGNAL_MONITOR_CHANGED   "monitor-changed"
55 #define BAMF_WINDOW_SIGNAL_MAXIMIZED_CHANGED "maximized-changed"
56 
57 typedef struct _BamfWindow        BamfWindow;
58 typedef struct _BamfWindowClass   BamfWindowClass;
59 typedef struct _BamfWindowPrivate BamfWindowPrivate;
60 
61 struct _BamfWindow
62 {
63   BamfView parent;
64 
65   BamfWindowPrivate *priv;
66 };
67 
68 typedef enum
69 {
70   BAMF_WINDOW_NORMAL,       /* document/app window */
71   BAMF_WINDOW_DESKTOP,      /* desktop background */
72   BAMF_WINDOW_DOCK,         /* panel */
73   BAMF_WINDOW_DIALOG,       /* dialog */
74   BAMF_WINDOW_TOOLBAR,      /* tearoff toolbar */
75   BAMF_WINDOW_MENU,         /* tearoff menu */
76   BAMF_WINDOW_UTILITY,      /* palette/toolbox window */
77   BAMF_WINDOW_SPLASHSCREEN, /* splash screen */
78   BAMF_WINDOW_UNKNOWN
79 } BamfWindowType;
80 
81 typedef enum
82 {
83   BAMF_WINDOW_FLOATING,              /* Floating window */
84   BAMF_WINDOW_HORIZONTAL_MAXIMIZED,  /* Horizontally maximized window */
85   BAMF_WINDOW_VERTICAL_MAXIMIZED,    /* Vertically maximized window */
86   BAMF_WINDOW_MAXIMIZED              /* Maximized window */
87 } BamfWindowMaximizationType;
88 
89 struct _BamfWindowClass
90 {
91   BamfViewClass parent_class;
92 
93   BamfWindow               * (*get_transient)      (BamfWindow *self);
94   BamfWindowType             (*get_window_type)    (BamfWindow *self);
95   guint32                    (*get_xid)            (BamfWindow *self);
96   guint32                    (*get_pid)            (BamfWindow *self);
97   gint                       (*get_monitor)        (BamfWindow *self);
98   gchar                    * (*get_utf8_prop)      (BamfWindow *self, const char* prop);
99   BamfWindowMaximizationType (*maximized)          (BamfWindow *self);
100   time_t                     (*last_active)        (BamfWindow *self);
101 
102   /*< signals >*/
103   void (*monitor_changed)   (BamfWindow *window, gint old_value, gint new_value);
104   void (*maximized_changed) (BamfWindow *window, gint old_value, gint new_value);
105 
106   /*< private >*/
107   void (*_window_padding1) (void);
108   void (*_window_padding2) (void);
109   void (*_window_padding3) (void);
110   void (*_window_padding4) (void);
111 };
112 
113 GType             bamf_window_get_type                  (void) G_GNUC_CONST;
114 
115 BamfWindow      * bamf_window_get_transient             (BamfWindow *self);
116 
117 BamfWindowType    bamf_window_get_window_type           (BamfWindow *self);
118 
119 guint32           bamf_window_get_xid                   (BamfWindow *self);
120 
121 guint32           bamf_window_get_pid                   (BamfWindow *self);
122 
123 gint              bamf_window_get_monitor               (BamfWindow *self);
124 
125 gchar           * bamf_window_get_utf8_prop             (BamfWindow *self, const char* prop);
126 BamfWindowMaximizationType bamf_window_maximized        (BamfWindow *self);
127 
128 time_t            bamf_window_last_active               (BamfWindow *self);
129 
130 G_END_DECLS
131 
132 #endif
133