diff --git a/gtkwindow.h b/gtkwindow.h new file mode 100644 index 0000000..bd73697 --- /dev/null +++ b/gtkwindow.h @@ -0,0 +1,502 @@ +/* GTK - The GIMP Toolkit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GTK_WINDOW_H__ +#define __GTK_WINDOW_H__ + + +#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include +#include + +G_BEGIN_DECLS + +#define GTK_TYPE_WINDOW (gtk_window_get_type ()) +#define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow)) +#define GTK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW, GtkWindowClass)) +#define GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW)) +#define GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW)) +#define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass)) + +typedef struct _GtkWindowPrivate GtkWindowPrivate; +typedef struct _GtkWindowClass GtkWindowClass; +typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo; +typedef struct _GtkWindowGroup GtkWindowGroup; +typedef struct _GtkWindowGroupClass GtkWindowGroupClass; +typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate; + +struct _GtkWindow +{ + GtkBin bin; + + GtkWindowPrivate *priv; +}; + +/** + * GtkWindowClass: + * @parent_class: The parent class. + * @set_focus: Sets child as the focus widget for the window. + * @activate_focus: Activates the current focused widget within the window. + * @activate_default: Activates the default widget for the window. + * @keys_changed: Signal gets emitted when the set of accelerators or + * mnemonics that are associated with window changes. + * @enable_debugging: Class handler for the #GtkWindow::enable-debugging + * keybinding signal. Since: 3.14 + */ +struct _GtkWindowClass +{ + GtkBinClass parent_class; + + /*< public >*/ + + void (* set_focus) (GtkWindow *window, + GtkWidget *focus); + + /* G_SIGNAL_ACTION signals for keybindings */ + + void (* activate_focus) (GtkWindow *window); + void (* activate_default) (GtkWindow *window); + void (* keys_changed) (GtkWindow *window); + gboolean (* enable_debugging) (GtkWindow *window, + gboolean toggle); + + /*< private >*/ + + /* Padding for future expansion */ + void (*_gtk_reserved1) (void); + void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); +}; + +/** + * GtkWindowType: + * @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog. + * @GTK_WINDOW_POPUP: A special window such as a tooltip. + * + * A #GtkWindow can be one of these types. Most things you’d consider a + * “window” should have type #GTK_WINDOW_TOPLEVEL; windows with this type + * are managed by the window manager and have a frame by default (call + * gtk_window_set_decorated() to toggle the frame). Windows with type + * #GTK_WINDOW_POPUP are ignored by the window manager; window manager + * keybindings won’t work on them, the window manager won’t decorate the + * window with a frame, many GTK+ features that rely on the window + * manager will not work (e.g. resize grips and + * maximization/minimization). #GTK_WINDOW_POPUP is used to implement + * widgets such as #GtkMenu or tooltips that you normally don’t think of + * as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL. + * In particular, do not use #GTK_WINDOW_POPUP just to turn off + * the window borders; use gtk_window_set_decorated() for that. + */ +typedef enum +{ + GTK_WINDOW_TOPLEVEL, + GTK_WINDOW_POPUP +} GtkWindowType; + +/** + * GtkWindowPosition: + * @GTK_WIN_POS_NONE: No influence is made on placement. + * @GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen. + * @GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position. + * @GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc. + * @GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient + * parent (see gtk_window_set_transient_for()). + * + * Window placement can be influenced using this enumeration. Note that + * using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea. + * It won’t necessarily work well with all window managers or on all windowing systems. + */ +typedef enum +{ + GTK_WIN_POS_NONE, + GTK_WIN_POS_CENTER, + GTK_WIN_POS_MOUSE, + GTK_WIN_POS_CENTER_ALWAYS, + GTK_WIN_POS_CENTER_ON_PARENT +} GtkWindowPosition; + + +GDK_AVAILABLE_IN_ALL +GType gtk_window_get_type (void) G_GNUC_CONST; +GDK_AVAILABLE_IN_ALL +GtkWidget* gtk_window_new (GtkWindowType type); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_title (GtkWindow *window, + const gchar *title); +GDK_AVAILABLE_IN_ALL +const gchar * gtk_window_get_title (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_wmclass (GtkWindow *window, + const gchar *wmclass_name, + const gchar *wmclass_class); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_role (GtkWindow *window, + const gchar *role); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_startup_id (GtkWindow *window, + const gchar *startup_id); +GDK_AVAILABLE_IN_ALL +const gchar * gtk_window_get_role (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_add_accel_group (GtkWindow *window, + GtkAccelGroup *accel_group); +GDK_AVAILABLE_IN_ALL +void gtk_window_remove_accel_group (GtkWindow *window, + GtkAccelGroup *accel_group); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_position (GtkWindow *window, + GtkWindowPosition position); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_activate_focus (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_focus (GtkWindow *window, + GtkWidget *focus); +GDK_AVAILABLE_IN_ALL +GtkWidget *gtk_window_get_focus (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_default (GtkWindow *window, + GtkWidget *default_widget); +GDK_AVAILABLE_IN_ALL +GtkWidget *gtk_window_get_default_widget (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_activate_default (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_transient_for (GtkWindow *window, + GtkWindow *parent); +GDK_AVAILABLE_IN_ALL +GtkWindow *gtk_window_get_transient_for (GtkWindow *window); +GDK_AVAILABLE_IN_3_4 +void gtk_window_set_attached_to (GtkWindow *window, + GtkWidget *attach_widget); +GDK_AVAILABLE_IN_3_4 +GtkWidget *gtk_window_get_attached_to (GtkWindow *window); +GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_set_opacity) +void gtk_window_set_opacity (GtkWindow *window, + gdouble opacity); +GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_get_opacity) +gdouble gtk_window_get_opacity (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_type_hint (GtkWindow *window, + GdkWindowTypeHint hint); +GDK_AVAILABLE_IN_ALL +GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_skip_taskbar_hint (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_skip_taskbar_hint (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_skip_pager_hint (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_skip_pager_hint (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_urgency_hint (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_urgency_hint (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_accept_focus (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_accept_focus (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_focus_on_map (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_focus_on_map (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_destroy_with_parent (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_destroy_with_parent (GtkWindow *window); +GDK_AVAILABLE_IN_3_4 +void gtk_window_set_hide_titlebar_when_maximized (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_3_4 +gboolean gtk_window_get_hide_titlebar_when_maximized (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_mnemonics_visible (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_mnemonics_visible (GtkWindow *window); +GDK_AVAILABLE_IN_3_2 +void gtk_window_set_focus_visible (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_3_2 +gboolean gtk_window_get_focus_visible (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_resizable (GtkWindow *window, + gboolean resizable); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_resizable (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_gravity (GtkWindow *window, + GdkGravity gravity); +GDK_AVAILABLE_IN_ALL +GdkGravity gtk_window_get_gravity (GtkWindow *window); + + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_geometry_hints (GtkWindow *window, + GtkWidget *geometry_widget, + GdkGeometry *geometry, + GdkWindowHints geom_mask); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_screen (GtkWindow *window, + GdkScreen *screen); +GDK_AVAILABLE_IN_ALL +GdkScreen* gtk_window_get_screen (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_is_active (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_has_toplevel_focus (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_decorated (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_decorated (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_deletable (GtkWindow *window, + gboolean setting); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_deletable (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_icon_list (GtkWindow *window, + GList *list); +GDK_AVAILABLE_IN_ALL +GList* gtk_window_get_icon_list (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_icon (GtkWindow *window, + GdkPixbuf *icon); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_icon_name (GtkWindow *window, + const gchar *name); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_set_icon_from_file (GtkWindow *window, + const gchar *filename, + GError **err); +GDK_AVAILABLE_IN_ALL +GdkPixbuf* gtk_window_get_icon (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +const gchar * gtk_window_get_icon_name (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_default_icon_list (GList *list); +GDK_AVAILABLE_IN_ALL +GList* gtk_window_get_default_icon_list (void); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_default_icon (GdkPixbuf *icon); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_default_icon_name (const gchar *name); +GDK_AVAILABLE_IN_ALL +const gchar * gtk_window_get_default_icon_name (void); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_set_default_icon_from_file (const gchar *filename, + GError **err); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_auto_startup_notification (gboolean setting); + +/* If window is set modal, input will be grabbed when show and released when hide */ +GDK_AVAILABLE_IN_ALL +void gtk_window_set_modal (GtkWindow *window, + gboolean modal); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_get_modal (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +GList* gtk_window_list_toplevels (void); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_has_user_ref_count (GtkWindow *window, + gboolean setting); + +GDK_AVAILABLE_IN_ALL +void gtk_window_add_mnemonic (GtkWindow *window, + guint keyval, + GtkWidget *target); +GDK_AVAILABLE_IN_ALL +void gtk_window_remove_mnemonic (GtkWindow *window, + guint keyval, + GtkWidget *target); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_mnemonic_activate (GtkWindow *window, + guint keyval, + GdkModifierType modifier); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_mnemonic_modifier (GtkWindow *window, + GdkModifierType modifier); +GDK_AVAILABLE_IN_ALL +GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_activate_key (GtkWindow *window, + GdkEventKey *event); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_propagate_key_event (GtkWindow *window, + GdkEventKey *event); + +GDK_AVAILABLE_IN_ALL +void gtk_window_present (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_present_with_time (GtkWindow *window, + guint32 timestamp); +GDK_AVAILABLE_IN_ALL +void gtk_window_iconify (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_deiconify (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_stick (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_unstick (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_maximize (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_unmaximize (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_fullscreen (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_unfullscreen (GtkWindow *window); +GDK_AVAILABLE_IN_3_18 +void gtk_window_fullscreen_on_monitor(GtkWindow *window, + GdkScreen *screen, + gint monitor); +GDK_AVAILABLE_IN_3_10 +void gtk_window_close (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_keep_above (GtkWindow *window, gboolean setting); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_keep_below (GtkWindow *window, gboolean setting); + +GDK_AVAILABLE_IN_ALL +void gtk_window_begin_resize_drag (GtkWindow *window, + GdkWindowEdge edge, + gint button, + gint root_x, + gint root_y, + guint32 timestamp); +GDK_AVAILABLE_IN_ALL +void gtk_window_begin_move_drag (GtkWindow *window, + gint button, + gint root_x, + gint root_y, + guint32 timestamp); + +/* Set initial default size of the window (does not constrain user + * resize operations) + */ +GDK_AVAILABLE_IN_ALL +void gtk_window_set_default_size (GtkWindow *window, + gint width, + gint height); +GDK_AVAILABLE_IN_ALL +void gtk_window_get_default_size (GtkWindow *window, + gint *width, + gint *height); +GDK_AVAILABLE_IN_ALL +void gtk_window_resize (GtkWindow *window, + gint width, + gint height); +GDK_AVAILABLE_IN_ALL +void gtk_window_get_size (GtkWindow *window, + gint *width, + gint *height); +GDK_AVAILABLE_IN_ALL +void gtk_window_move (GtkWindow *window, + gint x, + gint y); +GDK_AVAILABLE_IN_ALL +void gtk_window_get_position (GtkWindow *window, + gint *root_x, + gint *root_y); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_parse_geometry (GtkWindow *window, + const gchar *geometry); + +GDK_AVAILABLE_IN_ALL +void gtk_window_set_default_geometry (GtkWindow *window, + gint width, + gint height); +GDK_AVAILABLE_IN_ALL +void gtk_window_resize_to_geometry (GtkWindow *window, + gint width, + gint height); + +GDK_AVAILABLE_IN_ALL +GtkWindowGroup *gtk_window_get_group (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +gboolean gtk_window_has_group (GtkWindow *window); + +/* Ignore this unless you are writing a GUI builder */ +GDK_DEPRECATED_IN_3_10 +void gtk_window_reshow_with_initial_size (GtkWindow *window); + +GDK_AVAILABLE_IN_ALL +GtkWindowType gtk_window_get_window_type (GtkWindow *window); + + +GDK_AVAILABLE_IN_ALL +GtkApplication *gtk_window_get_application (GtkWindow *window); +GDK_AVAILABLE_IN_ALL +void gtk_window_set_application (GtkWindow *window, + GtkApplication *application); + + +/* Window grips + */ +GDK_DEPRECATED_IN_3_14 +void gtk_window_set_has_resize_grip (GtkWindow *window, + gboolean value); +GDK_DEPRECATED_IN_3_14 +gboolean gtk_window_get_has_resize_grip (GtkWindow *window); +GDK_DEPRECATED_IN_3_14 +gboolean gtk_window_resize_grip_is_visible (GtkWindow *window); +GDK_DEPRECATED_IN_3_14 +gboolean gtk_window_get_resize_grip_area (GtkWindow *window, + GdkRectangle *rect); + +GDK_AVAILABLE_IN_3_10 +void gtk_window_set_titlebar (GtkWindow *window, + GtkWidget *titlebar); +GDK_AVAILABLE_IN_3_16 +GtkWidget *gtk_window_get_titlebar (GtkWindow *window); + +GDK_AVAILABLE_IN_3_12 +gboolean gtk_window_is_maximized (GtkWindow *window); + +GDK_AVAILABLE_IN_3_14 +void gtk_window_set_interactive_debugging (gboolean enable); + +G_END_DECLS + +#endif /* __GTK_WINDOW_H__ */ diff --git a/gtkwindow.inc b/gtkwindow.inc new file mode 100644 index 0000000..19ae029 --- /dev/null +++ b/gtkwindow.inc @@ -0,0 +1,350 @@ +; GTK - The GIMP Toolkit +; Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald +; +; This library is free software; you can redistribute it and/or +; modify it under the terms of the GNU Lesser General Public +; License as published by the Free Software Foundation; either +; version 2 of the License, or (at your option) any later version. +; +; This library is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS A PARTICULAR PURPOSE. See the GNU +; Lesser General Public License for more details. +; +; You should have received a copy of the GNU Lesser General Public +; License along with this library. If not, see . + +; +; Modified by the GTK+ Team and others 1997-2000. See the AUTHORS +; file for a list of people on the GTK+ Team. See the ChangeLog +; files for a list of changes. These files are distributed with +; GTK+ at ftp://ftp.gtk.org/pub/gtk/. + +%ifndef __GTK_WINDOW_H__ +%define __GTK_WINDOW_H__ +%if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +%error "Only "gtk/gtk.inc" can be included directly." +%endif +%include "gtk/gtkapplication.inc" +%include "gtk/gtkaccelgroup.inc" +%include "gtk/gtkbin.inc" +%define GTK_TYPE_WINDOW (gtk_window_get_type ()) +%define GTK_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow)) +%define GTK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW, GtkWindowClass)) +%define GTK_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW)) +%define GTK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW)) +%define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass)) +; typedef struct _GtkWindowPrivate GtkWindowPrivate; +; typedef struct _GtkWindowClass GtkWindowClass; +; typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo; +; typedef struct _GtkWindowGroup GtkWindowGroup; +; typedef struct _GtkWindowGroupClass GtkWindowGroupClass; +; typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate; +; GtkWindowClass: +; @parent_class: The parent class. +; @set_focus: Sets child as the focus widget for the window. +; @activate_focus: Activates the current focused widget within the window. +; @activate_default: Activates the default widget for the window. +; @keys_changed: Signal gets emitted when the set of accelerators or +; mnemonics that are associated with window changes. +; @enable_debugging: Class handler for the #GtkWindow::enable-debugging +; keybinding signal. Since: 3.14 + +; G_SIGNAL_ACTION signals for keybindings +; Padding for future expansion +; GtkWindowType: +; @GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog. +; @GTK_WINDOW_POPUP: A special window such as a tooltip. +; +; A #GtkWindow can be one of these types. Most things you’d consider a +; “window” should have type #GTK_WINDOW_TOPLEVEL; windows with this type +; are managed by the window manager and have a frame by default (call +; gtk_window_set_decorated() to toggle the frame). Windows with type +; #GTK_WINDOW_POPUP are ignored by the window manager; window manager +; keybindings won’t work on them, the window manager won’t decorate the +; window with a frame, many GTK+ features that rely on the window +; manager will not work (e.g. resize grips and +; maximization/minimization). #GTK_WINDOW_POPUP is used to implement +; widgets such as #GtkMenu or tooltips that you normally don’t think of +; as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL. +; In particular, do not use #GTK_WINDOW_POPUP just to turn off +; the window borders; use gtk_window_set_decorated() for that. + +GTK_WINDOW_TOPLEVEL EQU 0 + +GTK_WINDOW_POPUP EQU 1 + +/** EQU 2 + +; GtkWindowPosition: +; @GTK_WIN_POS_NONE: No influence is made on placement. +; @GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen. +; @GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position. +; @GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc. +; @GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient +; parent (see gtk_window_set_transient_for()). +; +; Window placement can be influenced using this enumeration. Note that +; using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea. +; It won’t necessarily work well with all window managers or on all windowing systems. + +GTK_WIN_POS_NONE EQU 3 + +GTK_WIN_POS_CENTER EQU 4 + +GTK_WIN_POS_MOUSE EQU 5 + +GTK_WIN_POS_CENTER_ALWAYS EQU 6 + +GTK_WIN_POS_CENTER_ON_PARENT EQU 7 + +GDK_AVAILABLE_IN_ALL EQU 8 + +GDK_AVAILABLE_IN_ALL EQU 9 + +GDK_AVAILABLE_IN_ALL EQU 10 + +GDK_AVAILABLE_IN_ALL EQU 11 + +GDK_AVAILABLE_IN_ALL EQU 12 + +GDK_AVAILABLE_IN_ALL EQU 13 + +GDK_AVAILABLE_IN_ALL EQU 14 + +GDK_AVAILABLE_IN_ALL EQU 15 + +GDK_AVAILABLE_IN_ALL EQU 16 + +GDK_AVAILABLE_IN_ALL EQU 17 + +GDK_AVAILABLE_IN_ALL EQU 18 + +GDK_AVAILABLE_IN_ALL EQU 19 + +GDK_AVAILABLE_IN_ALL EQU 20 + +GDK_AVAILABLE_IN_ALL EQU 21 + +GDK_AVAILABLE_IN_ALL EQU 22 + +GDK_AVAILABLE_IN_ALL EQU 23 + +GDK_AVAILABLE_IN_ALL EQU 24 + +GDK_AVAILABLE_IN_ALL EQU 25 + +GDK_AVAILABLE_IN_ALL EQU 26 + +GDK_AVAILABLE_IN_3_4 EQU 27 + +GDK_AVAILABLE_IN_3_4 EQU 28 + +GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_set_opacity) EQU 29 + +GDK_DEPRECATED_IN_3_8_FOR(gtk_widget_get_opacity) EQU 30 + +GDK_AVAILABLE_IN_ALL EQU 31 + +GDK_AVAILABLE_IN_ALL EQU 32 + +GDK_AVAILABLE_IN_ALL EQU 33 + +GDK_AVAILABLE_IN_ALL EQU 34 + +GDK_AVAILABLE_IN_ALL EQU 35 + +GDK_AVAILABLE_IN_ALL EQU 36 + +GDK_AVAILABLE_IN_ALL EQU 37 + +GDK_AVAILABLE_IN_ALL EQU 38 + +GDK_AVAILABLE_IN_ALL EQU 39 + +GDK_AVAILABLE_IN_ALL EQU 40 + +GDK_AVAILABLE_IN_ALL EQU 41 + +GDK_AVAILABLE_IN_ALL EQU 42 + +GDK_AVAILABLE_IN_ALL EQU 43 + +GDK_AVAILABLE_IN_ALL EQU 44 + +GDK_AVAILABLE_IN_3_4 EQU 45 + +GDK_AVAILABLE_IN_3_4 EQU 46 + +GDK_AVAILABLE_IN_ALL EQU 47 + +GDK_AVAILABLE_IN_ALL EQU 48 + +GDK_AVAILABLE_IN_3_2 EQU 49 + +GDK_AVAILABLE_IN_3_2 EQU 50 + +GDK_AVAILABLE_IN_ALL EQU 51 + +GDK_AVAILABLE_IN_ALL EQU 52 + +GDK_AVAILABLE_IN_ALL EQU 53 + +GDK_AVAILABLE_IN_ALL EQU 54 + +GDK_AVAILABLE_IN_ALL EQU 55 + +GDK_AVAILABLE_IN_ALL EQU 56 + +GDK_AVAILABLE_IN_ALL EQU 57 + +GDK_AVAILABLE_IN_ALL EQU 58 + +GDK_AVAILABLE_IN_ALL EQU 59 + +GDK_AVAILABLE_IN_ALL EQU 60 + +GDK_AVAILABLE_IN_ALL EQU 61 + +GDK_AVAILABLE_IN_ALL EQU 62 + +GDK_AVAILABLE_IN_ALL EQU 63 + +GDK_AVAILABLE_IN_ALL EQU 64 + +GDK_AVAILABLE_IN_ALL EQU 65 + +GDK_AVAILABLE_IN_ALL EQU 66 + +GDK_AVAILABLE_IN_ALL EQU 67 + +GDK_AVAILABLE_IN_ALL EQU 68 + +GDK_AVAILABLE_IN_ALL EQU 69 + +GDK_AVAILABLE_IN_ALL EQU 70 + +GDK_AVAILABLE_IN_ALL EQU 71 + +GDK_AVAILABLE_IN_ALL EQU 72 + +GDK_AVAILABLE_IN_ALL EQU 73 + +GDK_AVAILABLE_IN_ALL EQU 74 + +GDK_AVAILABLE_IN_ALL EQU 75 + +GDK_AVAILABLE_IN_ALL EQU 76 + +GDK_AVAILABLE_IN_ALL EQU 77 + +; If window is set modal, input will be grabbed when show and released when hide +GDK_AVAILABLE_IN_ALL EQU 78 + +GDK_AVAILABLE_IN_ALL EQU 79 + +GDK_AVAILABLE_IN_ALL EQU 80 + +GDK_AVAILABLE_IN_ALL EQU 81 + +GDK_AVAILABLE_IN_ALL EQU 82 + +GDK_AVAILABLE_IN_ALL EQU 83 + +GDK_AVAILABLE_IN_ALL EQU 84 + +GDK_AVAILABLE_IN_ALL EQU 85 + +GDK_AVAILABLE_IN_ALL EQU 86 + +GDK_AVAILABLE_IN_ALL EQU 87 + +GDK_AVAILABLE_IN_ALL EQU 88 + +GDK_AVAILABLE_IN_ALL EQU 89 + +GDK_AVAILABLE_IN_ALL EQU 90 + +GDK_AVAILABLE_IN_ALL EQU 91 + +GDK_AVAILABLE_IN_ALL EQU 92 + +GDK_AVAILABLE_IN_ALL EQU 93 + +GDK_AVAILABLE_IN_ALL EQU 94 + +GDK_AVAILABLE_IN_ALL EQU 95 + +GDK_AVAILABLE_IN_ALL EQU 96 + +GDK_AVAILABLE_IN_ALL EQU 97 + +GDK_AVAILABLE_IN_ALL EQU 98 + +GDK_AVAILABLE_IN_3_18 EQU 99 + +GDK_AVAILABLE_IN_3_10 EQU 100 + +GDK_AVAILABLE_IN_ALL EQU 101 + +GDK_AVAILABLE_IN_ALL EQU 102 + +GDK_AVAILABLE_IN_ALL EQU 103 + +GDK_AVAILABLE_IN_ALL EQU 104 + +; Set initial default size of the window (does not constrain user +; resize operations) + +GDK_AVAILABLE_IN_ALL EQU 105 + +GDK_AVAILABLE_IN_ALL EQU 106 + +GDK_AVAILABLE_IN_ALL EQU 107 + +GDK_AVAILABLE_IN_ALL EQU 108 + +GDK_AVAILABLE_IN_ALL EQU 109 + +GDK_AVAILABLE_IN_ALL EQU 110 + +GDK_AVAILABLE_IN_ALL EQU 111 + +GDK_AVAILABLE_IN_ALL EQU 112 + +GDK_AVAILABLE_IN_ALL EQU 113 + +GDK_AVAILABLE_IN_ALL EQU 114 + +GDK_AVAILABLE_IN_ALL EQU 115 + +; Ignore this unless you are writing a GUI builder +GDK_DEPRECATED_IN_3_10 EQU 116 + +GDK_AVAILABLE_IN_ALL EQU 117 + +GDK_AVAILABLE_IN_ALL EQU 118 + +GDK_AVAILABLE_IN_ALL EQU 119 + +; Window grips + +GDK_DEPRECATED_IN_3_14 EQU 120 + +GDK_DEPRECATED_IN_3_14 EQU 121 + +GDK_DEPRECATED_IN_3_14 EQU 122 + +GDK_DEPRECATED_IN_3_14 EQU 123 + +GDK_AVAILABLE_IN_3_10 EQU 124 + +GDK_AVAILABLE_IN_3_16 EQU 125 + +GDK_AVAILABLE_IN_3_12 EQU 126 + +GDK_AVAILABLE_IN_3_14 EQU 127 + +G_END_DECLS EQU 128 + +%endif ; __GTK_WINDOW_H__ diff --git a/h2inc.py b/h2inc.py index bf7d7c0..30edc59 100644 --- a/h2inc.py +++ b/h2inc.py @@ -39,6 +39,10 @@ class H2INC: else: return False + def process_directory(self): + for f in self.filelist: + self.read_file(f) + def read_file(self, fn): parse = PARSER() outfile = '' @@ -103,10 +107,7 @@ if __name__ == "__main__": app = H2INC() if app.srcfilecnt(app.sourcedir) == True: print(app.filecnt) - #print(app.filelist) if app.srcfoldercnt(app.sourcedir) == True: print(app.foldercnt) - #print(app.folderlist) - #for f in app.filelist: - #app.read_file(f) - app.read_file("./gtk.h") #testfile for comments and header includes \ No newline at end of file + app.read_file("./gtkwindow.h") #testfile for comments and header includes + #app.process_directory() \ No newline at end of file diff --git a/parser.py b/parser.py index b258936..49b3aef 100644 --- a/parser.py +++ b/parser.py @@ -37,6 +37,8 @@ NASM_PREPROCESS_DIRECTIVES = {'#include' : '%include','#define' : '%define','#un '__DATE__' : '__DATE__','__TIME__' : '__TIME__','__TIMESTAMP__' : '__TIMESTAMP__', 'pragma' : 'pragma','#' : '#','##' : '##'} +NASM_ENUM = "EQU" + NASM_REGULAR = {'/*' : ';', '*' : ';', '*/' : ''} TOKENS += RESERVED.values() @@ -57,6 +59,9 @@ class PARSEOBJECT: self.parsefile = [] self._passes = count(0) self.inside_comment = False + self.inside_typedef = False + self.typedef_enum = False + self.enum_begin = False def inc_passes(self): self.passes = next(self._passes) @@ -107,7 +112,11 @@ class PARSEOBJECT: def parsetokens(self, fl): templine = [] tempfile = [] + enum_cnt = 0 + for l in fl: + templine = [] + tempstr = "" if len(l) == 0: templine.append("\n") continue @@ -115,10 +124,70 @@ class PARSEOBJECT: self.inside_comment = True tempfile.append(self.parse_comment(l)) continue + if l[0] == "TYPEDEF" or l[0] == "typedef": + self.parse_typedef(l) + if self.typedef_enum == False: + templine.append("; ") + for e in l: + templine.append(e) + tempfile.append(templine) + continue if l[0] == "TOKEN_PREPROCESS": tempfile.append(self.parse_preprocess(l)) + continue + if self.inside_typedef == True: + if self.typedef_enum == True: + if l[0] == "TOKEN_LBRACE" and len(l) == 2: + self.enum_begin = True + continue + if len(l) == 1: + if l[0].endswith(","): + tempstr = l[0] + templine.append(tempstr[:-1]+"\t") + templine.append("EQU\t") + templine.append(str(enum_cnt)+"\n") + tempfile.append(templine) + enum_cnt += 1 + continue + else: + templine.append(l[0]+"\t") + templine.append("EQU\t") + templine.append(str(enum_cnt)+"\n") + tempfile.append(templine) + enum_cnt += 1 + continue + continue + if len(l) == 3: + if l[0].endswith(","): + tempstr = l[0] + enum_cnt = l[2] + templine.append(tempstr[:-1]+"\t") + templine.append("EQU"+"\t") + templine.append(enum_cnt+"\n") + tempfile.append(templine) + continue + continue + if l[0] == "TOKEN_RBRACE" and len(l) == 3: + self.enum_begin = False + self.typedef_enum = False + self.inside_typedef = False + enum_cnt = 0 + continue + continue + continue return tempfile + def parse_typedef(self, l): + templine = [] + for w in l: + if w == "TYPEDEF" or w == "typedef": + self.inside_typedef = True + continue + if w == "ENUM" or w == "enum": + self.typedef_enum = True + continue + + def parse_comment(self, l): templine = [] for w in l: