summaryrefslogtreecommitdiff
path: root/plugins/gtk+/glade-fixed.h
blob: d29d581c32bb454b891bd361be1afe9a55cc2c85 (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
#ifndef __GLADE_FIXED_H__
#define __GLADE_FIXED_H__

#include <glib-object.h>
#include <gtk/gtk.h>

#include <gladeui/glade.h>

G_BEGIN_DECLS

#define GLADE_TYPE_FIXED            (glade_fixed_get_type())
#define GLADE_FIXED(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_FIXED, GladeFixed))
#define GLADE_FIXED_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_FIXED, GladeFixedClass))
#define GLADE_IS_FIXED(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_FIXED))
#define GLADE_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_FIXED))
#define GLADE_FIXED_GET_CLASS(o)    (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_FIXED, GladeFixedClass))

/* Convenience macros used in pointer events.
 */
#define GLADE_FIXED_CURSOR_TOP(type)                      \
        ((type) == GLADE_CURSOR_RESIZE_TOP_RIGHT ||       \
         (type) == GLADE_CURSOR_RESIZE_TOP_LEFT  ||       \
         (type) == GLADE_CURSOR_RESIZE_TOP)

#define GLADE_FIXED_CURSOR_BOTTOM(type)                   \
        ((type) == GLADE_CURSOR_RESIZE_BOTTOM_RIGHT ||    \
         (type) == GLADE_CURSOR_RESIZE_BOTTOM_LEFT  ||    \
         (type) == GLADE_CURSOR_RESIZE_BOTTOM)

#define GLADE_FIXED_CURSOR_RIGHT(type)                    \
        ((type) == GLADE_CURSOR_RESIZE_TOP_RIGHT    ||    \
         (type) == GLADE_CURSOR_RESIZE_BOTTOM_RIGHT ||    \
         (type) == GLADE_CURSOR_RESIZE_RIGHT)

#define GLADE_FIXED_CURSOR_LEFT(type)                    \
        ((type) == GLADE_CURSOR_RESIZE_TOP_LEFT    ||    \
         (type) == GLADE_CURSOR_RESIZE_BOTTOM_LEFT ||    \
         (type) == GLADE_CURSOR_RESIZE_LEFT)

typedef struct _GladeFixed        GladeFixed;
typedef struct _GladeFixedClass   GladeFixedClass;

struct _GladeFixed {
  GladeWidget       parent_instance;

  gchar            *x_prop;      /* packing property names (on child widgets) used */
  gchar            *y_prop;      /* to obtain & configure widget coordinates */
  gchar            *width_prop;  /* property names (on child widgets) used to obtain */
  gchar            *height_prop; /* & configure widget dimentions. */

  gboolean          can_resize; /* whether the container supports child resizes or only
                                 * drags.
                                 */

  /* State machine used to commit properties at the end
   * of a drag or a resize (i.e. a "configure").
   */
  gint              pointer_x_origin;
  gint              pointer_y_origin;
  gint              pointer_x_child_origin;
  gint              pointer_y_child_origin;
  gint              child_x_origin;
  gint              child_y_origin;
  gint              child_width_origin;
  gint              child_height_origin;

  GladeWidget      *configuring;
  GladeCursorType   operation;
  gboolean          creating;
  gint              mouse_x;
  gint              mouse_y;
};

struct _GladeFixedClass {
  GladeWidgetClass   parent_class;

  gboolean     (* configure_child) (GladeFixed *, GladeWidget *, GdkRectangle *);
  gboolean     (* configure_begin) (GladeFixed *, GladeWidget *);
  gboolean     (* configure_end)   (GladeFixed *, GladeWidget *);

  /* Signal handler for child widgets
   */
  gint         (* child_event)     (GladeWidget *, GdkEvent *, GladeFixed *);

};

GType              glade_fixed_get_type     (void);

G_END_DECLS

#endif   /* __GLADE_FIXED_H__ */