LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::configGTKDialog Class Reference

widget for the statistics dialog More...

#include <ltiGtkWidget.h>

Inheritance diagram for lti::configGTKDialog:
Inheritance graph
[legend]
Collaboration diagram for lti::configGTKDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 configGTKDialog ()
virtual ~configGTKDialog ()
void buildDialog ()
void show ()
void hide ()
virtual bool useParameters (viewerBase::parameters &theParam)
void whereToCallBack (mainGTKWindow *obj)
Virtual members to be reimplemented

Following members should be reimplemented in your derived class if you add new dialog options.



virtual void insertFrames ()
virtual bool getDialogData ()
virtual bool setDialogData ()
virtual configGTKDialognewInstance () const

Protected Member Functions

GtkWidget * buildCommonFrame ()
void newStrCopy (char *&dest, const char *src)
std::string toString (const double &value, const int &dec=4)
std::string toString (const point &pt)
std::string toString (const rgbPixel &px)
std::string toString (const trgbPixel< float > &px, const int dec=4)
double fromString (const char *value)
void appendFrame (GtkWidget *pw)
virtual void redrawMainWindow ()

Static Protected Member Functions

GTK+ Callbacks

Callback functions created by Glade



static void on_fileselector_ok (GtkButton *button, gpointer user_data)
static void on_browse_clicked (GtkButton *button, gpointer user_data)
static void on_save_button_clicked (GtkButton *button, gpointer user_data)
static void on_ok_button_clicked (GtkButton *button, gpointer user_data)
static void on_apply_button_clicked (GtkButton *button, gpointer user_data)
static void on_cancel_button_clicked (GtkButton *button, gpointer user_data)
static gint delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)

Protected Attributes

mainGTKWindowtheMainWindow
viewerBase::parametersparam
GTK+ Objects

GTK Widgets



GtkWidget * configGTKWidget
GtkWidget * dialogBox
GtkWidget * ConfigFrame
GtkWidget * savingFrame
GtkWidget * filename
GtkWidget * browse
GtkWidget * save_button
GtkWidget * buttonsFrame
GtkWidget * ok_button
GtkWidget * apply_button
GtkWidget * cancel_button
GtkTooltips * tooltips
GtkWidget * filew
colorDialogcolorSelector

Detailed Description

widget for the statistics dialog


Constructor & Destructor Documentation

lti::configGTKDialog::configGTKDialog (  ) 

create dialog

virtual lti::configGTKDialog::~configGTKDialog (  )  [virtual]

destroy the dialog


Member Function Documentation

void lti::configGTKDialog::appendFrame ( GtkWidget *  pw  )  [protected]

append a page in the pages list.

GtkWidget* lti::configGTKDialog::buildCommonFrame (  )  [protected]

Build a page in the main settings dialog.

Returns:
a GtkWidget for the common settings.
void lti::configGTKDialog::buildDialog (  ) 

Build the Dialog's GTK+ Widget Tree.

You won't need to reimplement this methode, but insertWidget() if you inherit from this class to provide more options.

static gint lti::configGTKDialog::delete_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
) [static, protected]

called when the user selects the "close window" button on the window

double lti::configGTKDialog::fromString ( const char *  value  )  [protected]

convert an ascii string into a double value

virtual bool lti::configGTKDialog::getDialogData (  )  [virtual]

copy the contents of the dialog in the parameters object.

This method should read all data from the GTK-Widget and write them in the parameter object. Do not forget to check first if the parameter pointer is valid or not.

Returns:
true if successful, false otherwise.

Reimplemented in lti::viewer::configDialog.

void lti::configGTKDialog::hide (  ) 

hide the dialog

virtual void lti::configGTKDialog::insertFrames (  )  [virtual]

Inserts all pages in the main settings dialog.

You will usually want to overload this member. Here you will usually want to call appendFrame(buildCommonFrame()) followed by all methods where you build your pages.

The default implementation will just add the common page, with the image type and size. You could call the parent class method to do this, but is usually not done to avoid dealing with a MS VC++ bug.

If you want to add some pages, you will need to create the desired GTK Widget and append it to the current dialog frames using appendFrame().

The best way doing so is implementing methods buildABCFrame, where ABC should be replaced with a meaningful name. These methods should return an GTKWidget pointer, that can be appended to the pages list. Following example illustrates this concept:

 class myViewer : public viewerBase {
   // ... implementation of parameters, etc. ...
   class configDialog : public configGTKDialog {
   public:
     // default constructor
     configDialog() : configGTKDialog() {};

     // build my page
     GTKWidget* buildMyFrame() {
       GtkWidget* w;        // this object will be returned

       // create the GTK widget
       w = gtk_vbox_new (FALSE, 0);
       // ...

       return w;
     };

     // insert frames
     virtual void insertFrames() {
       // append first the common dialog (from the parent class)
       appendFrame(buildCommonFrame());
       // append my page
       appendFrame(buildMyFrame());
     }
   }
 };

This method will insert the pages in an internal list, that will be read in the buildDialog() method.

Reimplemented in lti::viewer::configDialog, lti::viewer::configChannelFixed, lti::viewer::configChannelFloat, lti::viewer::configImage, and lti::viewer::configVector.

virtual configGTKDialog* lti::configGTKDialog::newInstance (  )  const [virtual]
void lti::configGTKDialog::newStrCopy ( char *&  dest,
const char *  src 
) [protected]

copy src to dest and allocates memory for dest

static void lti::configGTKDialog::on_apply_button_clicked ( GtkButton *  button,
gpointer  user_data 
) [static, protected]

called when the user selects the "close window" button on the window

static void lti::configGTKDialog::on_browse_clicked ( GtkButton *  button,
gpointer  user_data 
) [static, protected]

called when the user selects the "close window" button on the window

static void lti::configGTKDialog::on_cancel_button_clicked ( GtkButton *  button,
gpointer  user_data 
) [static, protected]

called when the user selects the "close window" button on the window

static void lti::configGTKDialog::on_fileselector_ok ( GtkButton *  button,
gpointer  user_data 
) [static, protected]

called when the user selects the "close window" button on the window

static void lti::configGTKDialog::on_ok_button_clicked ( GtkButton *  button,
gpointer  user_data 
) [static, protected]

called when the user selects the "close window" button on the window

static void lti::configGTKDialog::on_save_button_clicked ( GtkButton *  button,
gpointer  user_data 
) [static, protected]

called when the user selects the "close window" button on the window

virtual void lti::configGTKDialog::redrawMainWindow (  )  [protected, virtual]

copy the parameters to the mainWindow and calls redraw method

virtual bool lti::configGTKDialog::setDialogData (  )  [virtual]

copy the contents of the parameters object into the dialog entries

This method should write all data given in the parameters into the GTK-Widget. Do not forget to check first if the parameter pointer is valid or not.

Returns:
true if successful, false otherwise.

Reimplemented in lti::viewer::configDialog, lti::viewer::configChannelFixed, lti::viewer::configChannelFloat, lti::viewer::configImage, and lti::viewer::configVector.

void lti::configGTKDialog::show (  ) 

show the dialog

std::string lti::configGTKDialog::toString ( const trgbPixel< float > &  px,
const int  dec = 4 
) [protected]

especial case of toString from rgbPixel

std::string lti::configGTKDialog::toString ( const rgbPixel px  )  [protected]

especial case of toString from rgbPixel

std::string lti::configGTKDialog::toString ( const point pt  )  [protected]

especial case of toString from points

std::string lti::configGTKDialog::toString ( const double &  value,
const int &  dec = 4 
) [protected]

convert a double in an ascii string

virtual bool lti::configGTKDialog::useParameters ( viewerBase::parameters theParam  )  [virtual]

Indicate which parameters object should be used.

This class will not administrate the memory management of the object. It will just keep a reference to it. If deleted externally an error will occur.

You should also ensure that this method is called before showing the dialog for the first time, or all data will be uninitialized!

Returns:
true if successful, false otherwise.
void lti::configGTKDialog::whereToCallBack ( mainGTKWindow obj  ) 

set the parent of this dialog to tell it when everything is done!


Member Data Documentation

GtkWidget* lti::configGTKDialog::apply_button [protected]

Apply button.

GtkWidget* lti::configGTKDialog::browse [protected]

Browse button.

GtkWidget* lti::configGTKDialog::buttonsFrame [protected]

Box containing all usual buttons (OK, Cancel, Apply).

GtkWidget* lti::configGTKDialog::cancel_button [protected]

Cancel button.

color selection dialog

GtkWidget* lti::configGTKDialog::ConfigFrame [protected]

The box with the boxes for configuration (pages will be inserted here.

GtkWidget* lti::configGTKDialog::configGTKWidget [protected]

The dialog widget.

GtkWidget* lti::configGTKDialog::dialogBox [protected]

The box containing everything.

GtkWidget* lti::configGTKDialog::filename [protected]

Editbox with the filename.

GtkWidget* lti::configGTKDialog::filew [protected]

file selector

GtkWidget* lti::configGTKDialog::ok_button [protected]

Ok button.

pointer to the used viewer parameters.

This class should NEVER delete or create this object, because is just a reference to external data.

The methods should check if it points to valid data, i.e. if the pointer points to the right type (check it with dynamic_cast), or if the pointer is null.

GtkWidget* lti::configGTKDialog::save_button [protected]

Save button.

GtkWidget* lti::configGTKDialog::savingFrame [protected]

Box containing filename, browse and save buttons.

Pointer to the parent mainWindow.

GtkTooltips* lti::configGTKDialog::tooltips [protected]

Help messages (tool-tips).


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:28:54 2010 for LTI-Lib by Doxygen 1.6.1