From: Martin Sevior (msevior@physics.unimelb.edu.au)
Date: Sat Sep 21 2002 - 08:09:58 EDT
From Joaquin,
I'll get this in on Monday my time if no one else beats me to
it.
I haven't looked at the code yet but knowing Joaquin I'm sure it works
exactly as he says it does.
This widget copies the MS Word/ WordPerfect insert table control which
allows you to insert a table of the size want by dragging the mouse across
a little table.
Cheers
Martin
---------- Forwarded message ----------
Date: 21 Sep 2002 13:47:59 +0200
From: "[ISO-8859-1] Joaquín Cuenca Abela" <cuenca@pacaterie.u-psud.fr>
To: Martin Sevior <msevior@physics.unimelb.edu.au>
Subject: insert table widget
Martin, sorry for not giving you any news for so long.
Here you have the promised "insert table widget". I've called it
AbiTable.
It still has some problems:
* It don't ears GtkToolbar style changes.
* If you just click on the icon, the table window appears and disappears
instantly, instead of sticking (like in Word).
* I did the icon before looking at the recent Dom mail, so you can just
change my icon by Jimmac one :)
* It needs some little cosmetics changes here and there.
But except for that, it works well imo. And I'm pretty sure I can fix
these two problems without changing the API, so it should not be a
problem if we integrate it with abiword right now and fix these latter.
I've provided you a complete example to use it. It's in main.c (mainly
borrowed from demo-gtk :).
In short, to put it in a toolbar you should:
GtkWidget* abi_table = abi_table_new ();
g_signal_connect_object (abi_table, "selected",
G_CALLBACK (new_table_cb), NULL, 0);
abi_table_embed_on_toolbar(ABI_TABLE(abi_table), GTK_TOOLBAR(toolbar));
It's not strickly necessary to use abi_table_embed_on_toolbar to put the
widget in the toolbar. AbiTable inherits from GtkButton, and thus you
can just insert it in the toolbar with gtk_toolbar_insert_widget, but
that way the AbiTable widget will hide or show the label or/and the icon
in function of the toolbar style. And to fix the first problem I should
just add a bit of code to this function, so if you just use
embed_on_toolbar, it will be easier in the future to integrate a new
version.
new_table_cb should be a function with the signature:
static void new_table (GtkWidget *table, int rows, int cols, gpointer*
data);
where table is our AbiTable, rows and cols are the selected rows and
cols by the user, and data is the typical user_data of connect_object.
This signal will fire when the user creates a new table with the widget.
I've enclosed the interesting code in main.c between <MARTIN> ...
</MARTIN> tags.
Attached you have a little screenshot of the widget.
Cheers,
P.S.: I know that it kind of sucks to ask you to do "my" work, but I'm
sure that this way it will be done much faster :)
-- Joaquín Cuenca Abela cuencai@pacaterie.u-psud.fr
This archive was generated by hypermail 2.1.4 : Sat Sep 21 2002 - 08:14:23 EDT