Journal Journal: Back Again
I don't know if anyone ever reads this journal.
Ah, the link is: http://www.digitalfanatics.org/projects/gt.
I don't know if anyone ever reads this journal.
Ah, the link is: http://www.digitalfanatics.org/projects/gt.
Ok, it was a while since I entered something into my journal (I think that the new verb is "blogged"). This is just a small update.
Gt has a moc, it works, but the exception handing (and thus the error feedback) is not good. It will be available from http://www.digitalfanatics.org/projects/gt/.
I've written (or rather, am writing) a Qt tutorial. I've had good feedback from it, please check it out at http://www.digitalfanatics.org/projects/qt_tutorial/.
Finally I'm working on my first large open source project. It is fractal related. I want to enter a competition with it, but as soon as I've submitted the first version I may (and will) publish the source. It, too, will be available from http://www.digitalfanatics.org.
After thinking alot about how to manage signals and slots in Gt I have decided to redo the project, but in a more Qt-like way.
The following issues have come up:
I intend to write a moc-like tool (with support for signals and slots) producing code with the same functionality as Qt's moc. This moc will be freely available and GPL'ed without any restrictions on the resulting files.
The moc will be easy to build if the following conditions are met:
I wonder if there are any legal risks in doing this. Trolltech might be pissed...
I've gotten some more time to fiddle with GObject/GWidget and to try getting the signal/slot mechanism to work properly.
Now it seems to work, you can test connections and actually call 'em. The pointer can be of another class, e.g. a GObject pointer can dispatch signals in a GWidget object without knowing of them.
It seems to be possible to automatically generate code that works with this. I've tried with the Bin, Container and Button classes and got it to work without too much tweaking.
Then there is just one point left: get people to use it!
--- HEADER ---
#ifndef GBUTTON_H
#define GBUTTON_H
#include "gtmain.h"
#include "gbin.h"
// The GButton class
// Wraps GtkButton
class GButton : public GBin
{
GOBJECT
GSLOT( activate )
GSLOT( clicked )
GSLOT( enter )
GSLOT( leave )
GSLOT( pressed )
GSLOT( released )
GEND
public:// Constructors
GButton( GWidget *parent=0, char *name=0 );
GButton( <typ> label, GWidget *parent=0, char *name=0 );
GButton( <typ> mnemonic, GWidget *parent=0, char *name=0 );
// Slots
virtual void activate( void );
virtual void clicked( void );
virtual void enter( void );
virtual void leave( void );
virtual void pressed( void );
virtual void released( void );
// Properties (first set, then get)
void setRelief( <typ> )
void setLabel( <typ> )
void setUse_stock( <typ> )
void setUse_underline( <typ> )
<typ> relief( void );
<typ> label( void );
<typ> use_stock( void );
<typ> use_underline( void );
};
#endif
--- BODY ---
#include "gbutton.h"
GSIGNALEMITTER( activate )
GSIGNALEMITTER( clicked )
GSIGNALEMITTER( enter )
GSIGNALEMITTER( leave )
GSIGNALEMITTER( pressed )
GSIGNALEMITTER( released )
GButton::GButton( GWidget *parent=0, char *name=0 )
{
this_widget = gtk_button_new();
}
GButton::GButton( <typ> label, GWidget *parent=0, char *name=0 )
{
this_widget = gtk_button_new_with_label( label );
}
GButton::GButton( <typ> mnemonic, GWidget *parent=0, char *name=0 )
{
this_widget = gtk_button_new_with_mnemonic( mnemonic );
}
virtual void GButton::activate( void )
{
}
virtual void GButton::clicked( void )
{
}
virtual void GButton::enter( void )
{
}
virtual void GButton::leave( void )
{
}
virtual void GButton::pressed( void )
{
}
virtual void GButton::released( void )
{
}
void GButton::setRelief( <typ> value )
{
gtk_button_set_relief( this_widget, value );
}
void GButton::setLabel( <typ> value )
{
gtk_button_set_label( this_widget, value );
}
void GButton::setUse_stock( <typ> value )
{
gtk_button_set_use_stock( this_widget, value );
}
void GButton::setUse_underline( <typ> value )
{
gtk_button_set_use_underline( this_widget, value );
}
<typ> GButton::relief( void )
{
return gtk_button_get_relief( this_widget );
}
<typ> GButton::label( void )
{
return gtk_button_get_label( this_widget );
}
<typ> GButton::use_stock( void )
{
return gtk_button_get_use_stock( this_widget );
}
<typ> GButton::use_underline( void )
{
return gtk_button_get_use_underline( this_widget );
}
If I want your opinion, I'll ask you to fill out the necessary form.