[uim-commit] r1175 - trunk/gtk
tkng at freedesktop.org
tkng at freedesktop.org
Wed Aug 10 08:05:26 EST 2005
Author: tkng
Date: 2005-08-09 15:05:23 -0700 (Tue, 09 Aug 2005)
New Revision: 1175
Modified:
trunk/gtk/caret-state-indicator.c
Log:
* gtk/caret-state-indicator.c: Improved the appearance of state-indicator.
-(caret_state_indicator_paint_window): New callback function to paint
to dwaw square frame.
-(caret_state_indicator_new): Connect above callback function.
Modified: trunk/gtk/caret-state-indicator.c
===================================================================
--- trunk/gtk/caret-state-indicator.c 2005-08-09 16:06:48 UTC (rev 1174)
+++ trunk/gtk/caret-state-indicator.c 2005-08-09 22:05:23 UTC (rev 1175)
@@ -42,9 +42,34 @@
* caret state indicator is a state indicator nearby the caret.
*/
+#define DEFAULT_WINDOW_WIDTH 20
+#define DEFAULT_WINDOW_HEIGHT 20
+
static gint
caret_state_indicator_timeout(gpointer data);
+static gint
+caret_state_indicator_timeout(gpointer data)
+{
+ GtkWidget *window = GTK_WIDGET(data);
+ gtk_widget_hide(window);
+ return 0;
+}
+
+static gint
+caret_state_indicator_paint_window (GtkWidget *window)
+{
+ GtkRequisition req;
+
+ gtk_widget_size_request (window, &req);
+ gtk_paint_flat_box (window->style, window->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+ NULL, GTK_WIDGET(window), "tooltip",
+ 0, 0, DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
+
+ return FALSE;
+}
+
GtkWidget *
caret_state_indicator_new(void)
{
@@ -55,9 +80,19 @@
label = gtk_label_new("");
gtk_container_add(GTK_CONTAINER(window), label);
- gtk_window_set_default_size(GTK_WINDOW(window), 20, 20);
+ gtk_window_set_default_size(GTK_WINDOW(window),
+ DEFAULT_WINDOW_WIDTH,
+ DEFAULT_WINDOW_HEIGHT);
+ gtk_widget_set_app_paintable (window, TRUE);
+ g_signal_connect(window, "expose_event",
+ G_CALLBACK (caret_state_indicator_paint_window),
+ NULL);
+
+ gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
+
g_object_set_data(G_OBJECT(window), "label", label);
+
return window;
}
@@ -94,11 +129,3 @@
{
g_timeout_add(timeout, caret_state_indicator_timeout, (gpointer)window);
}
-
-static gint
-caret_state_indicator_timeout(gpointer data)
-{
- GtkWidget *window = GTK_WIDGET(data);
- gtk_widget_hide(window);
- return 0;
-}
More information about the uim-commit
mailing list