Re: [gtk-list] GUBI
- From: Tim Janik <timj psynet net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] GUBI
- Date: Thu, 21 Aug 1997 07:11:18 +0200 (CEST)
On Wed, 20 Aug 1997, Chris Evans wrote:
>
> Hi,
>
> Just checked out GUBI. Very nicely done that author ;-)
thank you.
> I find writing GTK code a bit repetitive, GUBI helps this along nicely. It
> seems to be missing GtkPixmap support though -- when this arrives I'll be
> able to whip up some seriously good-looking dialogues :)
why do you need gubi to create the pixmap for you? the only hand it can give
you on that, will be the creation and linkage to the parent, because you
have to call gdk_pixmap_create_*() and then gtk_pixmap_set() with
apropriate values in your app.
something gubi can certainly not do for you ;)
> I did find a lack of documentation though, so couldn't work out if there
> is support for menus or not.
nope, currently not, i'm testing a little bit with option menus at the moment,
but still have some problems.
> One thing I couldn't work out very well is signals. I have a
> GtkScrolledWindow, and need to know how to get a callback to fire off when
> the window is scrolled. I also need to know how to get at the data telling
> me the new positions of the scrollbars. I am also similarly clueless with
> regards to other siganls I will need to respond to such as resize windows
> and exposure event. Anyone got any useful pointers?
check out the widget editor "signals" page, the "Paste Signal" button
will show you all the signals a widget can emit.
take a look at hello_world.gbc to get an idea of the usage of signals.
as for your scrolling position problem...
here is a little *.gbc file for GUBI to create a scrolled window:
GB_WIDGET_WINDOW "" {
GB_WIDGET_SCROLLED_WINDOW "Scrolled_Window" {
GB_WIDGET_PROGRESS_BAR "" {
init_percentage 0.2
}
}
}
now produce the source from it and then add this function and its
signal connection to ufunc.c:
--- ufunc.c.orig Wed Aug 20 05:12:07 1997
+++ ufunc.c Thu Aug 21 06:53:50 1997
@@ -30,9 +30,28 @@
}
+static void sigh_adjustment_print_value_changed(GtkObject *adjustment,
+ gpointer func_data);
+void
+sigh_adjustment_print_value_changed(GtkObject *adjustment,
+ gpointer func_data)
+{
+ printf("scroll value: %f\n", GTK_ADJUSTMENT(adjustment)->value);
+}
+
+
void
ufunc_widgets_init (void)
{
+ GtkScrolledWindow *scrolled_window;
+ GtkAdjustment *adjustment;
+
+ scrolled_window=GTK_SCROLLED_WINDOW(Scrolled_Window->widget);
+ adjustment=gtk_scrolled_window_get_hadjustment(scrolled_window);
+ gtk_signal_connect(GTK_OBJECT(adjustment),
+ "value_changed",
+ GTK_SIGNAL_FUNC(sigh_adjustment_print_value_changed),
+ NULL);
}
if you type make && main, a window will pop up holding a scrolled window
where you can change the horizontal adjustment, and the values will
be printed out while you move it.
>
> Cheers,
> Chris
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]