Commit abba6da2 authored by Elliot Lee's avatar Elliot Lee

hit undo button, hit undo button

parent c6d96267
#ifndef APPLET_LIB_H
#define APPLET_LIB_H
BEGIN_GNOME_DECLS
char *gnome_panel_prepare_and_transfer (GtkWidget *widget, char *path, int *id,
int panel, int pos);
int gnome_panel_applet_init_corba (int *argc, char ***argv);
void applet_corba_gtk_main (char *str);
END_GNOME_DECLS
#endif
#include <gtk/gtk.h>
#include <gnome.h>
#include "applet-widget.h"
static void applet_widget_class_init (AppletWidgetClass *klass);
static void applet_widget_init (AppletWidget *applet_widget);
static GdkCursor *fleur_cursor;
guint
applet_widget_get_type ()
{
static guint applet_widget_type = 0;
if (!applet_widget_type) {
GtkTypeInfo applet_widget_info = {
"AppletWidget",
sizeof (AppletWidget),
sizeof (AppletWidgetClass),
(GtkClassInitFunc) applet_widget_class_init,
(GtkObjectInitFunc) applet_widget_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
};
applet_widget_type = gtk_type_unique (gtk_window_get_type (),
&applet_widget_info);
}
return applet_widget_type;
}
static void
applet_widget_class_init (AppletWidgetClass *class)
{
}
static void
applet_widget_init (AppletWidget *applet_widget)
{
applet_widget->eb = gtk_event_box_new();
gtk_widget_show(applet_widget->eb);
GTK_WINDOW(applet_widget)->type = GTK_WINDOW_POPUP;
gtk_container_add(GTK_CONTAINER(applet_widget),applet_widget->eb);
gtk_window_set_policy (GTK_WINDOW (applet_widget), 1, 1, 1);
if(!fleur_cursor)
fleur_cursor = gdk_cursor_new(GDK_FLEUR);
}
GtkWidget*
applet_widget_new (void)
{
AppletWidget *applet;
applet = gtk_type_new(applet_widget_get_type());
return GTK_WIDGET(applet);
}
void
applet_widget_add (AppletWidget *applet, GtkWidget *widget)
{
g_return_if_fail(applet != NULL);
g_return_if_fail(widget != NULL);
gtk_container_add(GTK_CONTAINER(applet->eb),widget);
}
void
applet_widget_remove (AppletWidget *applet, GtkWidget *widget)
{
g_return_if_fail(applet != NULL);
g_return_if_fail(widget != NULL);
gtk_container_remove(GTK_CONTAINER(applet->eb),widget);
}
#define APPLET_EVENT_MASK (GDK_BUTTON_PRESS_MASK | \
GDK_BUTTON_RELEASE_MASK | \
GDK_POINTER_MOTION_MASK | \
GDK_POINTER_MOTION_HINT_MASK)
void
applet_widget_move_grab_add (AppletWidget *applet)
{
gtk_grab_add(GTK_WIDGET(applet));
gdk_pointer_grab(GTK_WIDGET(applet)->window,
TRUE,
APPLET_EVENT_MASK,
NULL,
fleur_cursor,
GDK_CURRENT_TIME);
}
void
applet_widget_move_grab_remove (AppletWidget *applet)
{
gdk_pointer_ungrab(GDK_CURRENT_TIME);
gtk_grab_remove(GTK_WIDGET(applet));
}
#ifndef __APPLET_WIDGET_H__
#define __APPLET_WIDGET_H__
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define APPLET_WIDGET(obj) GTK_CHECK_CAST (obj, applet_widget_get_type (), AppletWidget)
#define APPLET_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, applet_widget_get_type (), AppletWidgetClass)
#define IS_APPLET_WIDGET(obj) GTK_CHECK_TYPE (obj, applet_widget_get_type ())
typedef struct _AppletWidget AppletWidget;
typedef struct _AppletWidgetClass AppletWidgetClass;
struct _AppletWidget
{
GtkWindow window;
GtkWidget *eb;
};
struct _AppletWidgetClass
{
GtkWindowClass parent_class;
};
guint applet_widget_get_type (void);
GtkWidget* applet_widget_new (void);
/*add a widget to the applet*/
void applet_widget_add (AppletWidget *applet,
GtkWidget *widget);
/*remove a widget from the applet*/
void applet_widget_remove (AppletWidget *applet,
GtkWidget *widget);
void applet_widget_move_grab_add (AppletWidget *applet);
void applet_widget_move_grab_remove (AppletWidget *applet);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __APPLET_WIDGET_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment