latest version v1.9 - last update 10 Apr 2010 |
Widget for the main class of the histogram viewer. More...
#include <ltiViewerBase3D.h>
Public Member Functions | |
mainWindow (bool setConfigDlg=true) | |
mainWindow (const mainWindow &other) | |
~mainWindow () | |
void | init (void) |
virtual bool | useParameters (parameters &theParam) |
virtual void | redraw () |
void | drawData () |
void | hideData () |
void | createWindow () |
void | destroyWindow () |
const image & | getDisplayedData () const |
mainWindow & | copy (const mainWindow &other) |
mainWindow * | clone () const |
void | lock () |
void | unlock () |
Protected Member Functions | |
void | generateXbuffer (const image &img, GtkWidget *widget, GdkEventExpose *event) |
rgbPixel | intToRgb (const guint32 &rgb) const |
Members to be reimplemented | |
virtual void | dataToImage () |
virtual void | prepareParameters () |
virtual bool | validData (void) |
virtual void | indicateDataHide (void) |
Protected Attributes | |
parameters * | param |
configDialog * | options |
bool | showingBuffer |
bool | busy |
mutex | theLock |
semaphore | syncEnd |
bool | dataChanged |
guchar * | xbuffer |
int | xbuffer_rows |
int | xbuffer_cols |
std::string | winName |
point | winSize |
gint | timerTag |
Drawing Members. | |
draw3D< rgbPixel > | drawTool |
image | theImage |
Static Protected Attributes | |
static const point | borderWidth |
Tools and information flags | |
| |
int | mouseButtonPressed |
point | lastMousePos |
void | draw3DAxis (const double size, const bool auxBox=true) |
GTK+ Widgets | |
| |
GtkWidget * | window |
GtkWidget * | scrolledWindow |
GtkWidget * | statusBar |
guint | statusBarContextId |
GtkWidget * | darea |
GtkWidget * | eventBox |
guint32 | rgbToInt (const int &r, const int &g, const int &b) const |
GTK+ callback functions | |
| |
void | createWindowLocal () |
void | mouseMovedEventLocal (GtkWidget *widget, GdkEventMotion *event) |
virtual void | mouseMovedHandler (const int &button, const point &pos, const bool shift, const bool ctrl) |
virtual void | buttonPressedEventLocal (GtkWidget *widget, GdkEventButton *event) |
void | showCameraPosition () |
virtual gboolean | dareaExposeLocal (GtkWidget *widget, GdkEventExpose *event) |
static gint | delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) |
static gint | destroyWndTimeout (gpointer data) |
static void | destroy (GtkWidget *widget, gpointer data) |
static gint | show (gpointer data) |
static gint | hide (gpointer data) |
static gint | createWindowTimeout (gpointer data) |
static gint | mouseMovedEvent (GtkWidget *widget, GdkEventMotion *event, gpointer data) |
static gint | buttonPressedEvent (GtkWidget *widget, GdkEventButton *event, gpointer data) |
static gint | keyboardEvent (GtkWidget *widget, GdkEventKey *event, gpointer data) |
static gboolean | dareaExpose (GtkWidget *widget, GdkEventExpose *event, gpointer data) |
Widget for the main class of the histogram viewer.
This class administrates the real viewer window. It provides the interface with which the data will be drawn. For this task you will usually reimplement in your inherited class the methods dataToImage() and prepareParameters().
In your own classes, you should provide methods to set the data required in dataToImage(). These methods will be used in your myviewershow(const classtype& data) methods, to set the data that must be displayed.
lti::viewerBase3D::mainWindow::mainWindow | ( | bool | setConfigDlg = true |
) |
default constructor.
setConfigDlg | if true (default) the configuration dialog will be created and initialized. Otherwise it will be left empty |
lti::viewerBase3D::mainWindow::mainWindow | ( | const mainWindow & | other | ) |
copy constructor
Reimplemented in lti::histogramViewer::mainWindow, and lti::scene3DViewer::mainWindow.
lti::viewerBase3D::mainWindow::~mainWindow | ( | ) |
destructor
Reimplemented in lti::histogramViewer::mainWindow, and lti::scene3DViewer::mainWindow.
static gint lti::viewerBase3D::mainWindow::buttonPressedEvent | ( | GtkWidget * | widget, | |
GdkEventButton * | event, | |||
gpointer | data | |||
) | [static, protected] |
function called when any mouse button has been pressed.
virtual void lti::viewerBase3D::mainWindow::buttonPressedEventLocal | ( | GtkWidget * | widget, | |
GdkEventButton * | event | |||
) | [protected, virtual] |
called by buttonPressedEvent()
mainWindow* lti::viewerBase3D::mainWindow::clone | ( | ) | const |
clone this window
mainWindow& lti::viewerBase3D::mainWindow::copy | ( | const mainWindow & | other | ) |
copy this window (only the actual data will be copied.
The display queue will not be copied!
void lti::viewerBase3D::mainWindow::createWindow | ( | ) |
creates new window
void lti::viewerBase3D::mainWindow::createWindowLocal | ( | ) | [protected] |
called by createWindowTimeout to create a window
static gint lti::viewerBase3D::mainWindow::createWindowTimeout | ( | gpointer | data | ) | [static, protected] |
timeout gtk-callback function, called when the window must be created.
This function just calls createWindowLocal()
static gboolean lti::viewerBase3D::mainWindow::dareaExpose | ( | GtkWidget * | widget, | |
GdkEventExpose * | event, | |||
gpointer | data | |||
) | [static, protected] |
gtk-callback funtion to redraw the image been displayed.
This function just calls the dareaExposeLocal()
virtual gboolean lti::viewerBase3D::mainWindow::dareaExposeLocal | ( | GtkWidget * | widget, | |
GdkEventExpose * | event | |||
) | [protected, virtual] |
This function redraws the image been displayed.
virtual void lti::viewerBase3D::mainWindow::dataToImage | ( | ) | [protected, virtual] |
This method is the one where your data should be drawn.
When called, you can assume that the drawTool
attribute of this class has already been initialized with the proper parameters, the required canvas image has already been set with the proper size and cleaned with the proper background color.
Reimplemented in lti::histogramViewer::mainWindow, and lti::scene3DViewer::mainWindow.
static gint lti::viewerBase3D::mainWindow::delete_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) | [static, protected] |
called when the user selects the "close window" button on the window
static void lti::viewerBase3D::mainWindow::destroy | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static, protected] |
call-back funtion to indicate the end of the whole gtk-application.
This function will end the gtk main-event-loop!
void lti::viewerBase3D::mainWindow::destroyWindow | ( | ) |
destroy the window
static gint lti::viewerBase3D::mainWindow::destroyWndTimeout | ( | gpointer | data | ) | [static, protected] |
timeout gtk-callback function, called when the window must be destroyed.
This static function just call the instance member destroyWindow().
void lti::viewerBase3D::mainWindow::draw3DAxis | ( | const double | size, | |
const bool | auxBox = true | |||
) | [protected] |
draw the coordinate system and an auxiliary box of the given size
size | axis size | |
auxBox | if true, an auxiliary box will be drawn. |
void lti::viewerBase3D::mainWindow::drawData | ( | ) |
generate an event which will show the data
void lti::viewerBase3D::mainWindow::generateXbuffer | ( | const image & | img, | |
GtkWidget * | widget, | |||
GdkEventExpose * | event | |||
) | [protected] |
generate xbuffer from an image
const image& lti::viewerBase3D::mainWindow::getDisplayedData | ( | ) | const |
return a lti::image with the data being displayed.
Used by the save image routines!
static gint lti::viewerBase3D::mainWindow::hide | ( | gpointer | data | ) | [static, protected] |
timeout gtk-callback function, called when a new image must be hide!
void lti::viewerBase3D::mainWindow::hideData | ( | ) |
generate an event which will hide the data
virtual void lti::viewerBase3D::mainWindow::indicateDataHide | ( | void | ) | [protected, virtual] |
this method will be called to invalidate the data.
Usually will set a few pointers to NULL to indicate that the window has been hidden, and no valid data is keeped in this class any more.
Reimplemented in lti::histogramViewer::mainWindow.
void lti::viewerBase3D::mainWindow::init | ( | void | ) |
initialize values for the constructor
rgbPixel lti::viewerBase3D::mainWindow::intToRgb | ( | const guint32 & | rgb | ) | const [protected] |
unpack an gtk-integer into a rgb pixel
static gint lti::viewerBase3D::mainWindow::keyboardEvent | ( | GtkWidget * | widget, | |
GdkEventKey * | event, | |||
gpointer | data | |||
) | [static, protected] |
callback function called when a key is pressed or released
void lti::viewerBase3D::mainWindow::lock | ( | ) |
lock internal data
static gint lti::viewerBase3D::mainWindow::mouseMovedEvent | ( | GtkWidget * | widget, | |
GdkEventMotion * | event, | |||
gpointer | data | |||
) | [static, protected] |
callback function called when the mouse is moved and a mouse button has been pressed.
This function just calls the mouseMovedEventLocal()
void lti::viewerBase3D::mainWindow::mouseMovedEventLocal | ( | GtkWidget * | widget, | |
GdkEventMotion * | event | |||
) | [protected] |
function called by mouseMovedEvent() when the mouse has been moved.
This will show on the status bar the mouse pointer position and the value of the image at this position.
virtual void lti::viewerBase3D::mainWindow::mouseMovedHandler | ( | const int & | button, | |
const point & | pos, | |||
const bool | shift, | |||
const bool | ctrl | |||
) | [protected, virtual] |
this function is called when the right button is pressed and moved.
button | which button is pressed (0 means none, 1 left button, 3 right button) | |
pos | actual position of mouse pointer | |
shift | true if the shift-key has been pressed while moving the mouse. | |
ctrl | true if the control-key has been pressed while moving the mouse. |
Reimplemented in lti::histogramViewer::mainWindow.
virtual void lti::viewerBase3D::mainWindow::prepareParameters | ( | ) | [protected, virtual] |
Prepare the parameters before the settings dialog is started.
This member gets some information of the displayed data into the informational attributes of the parameters instance. It is called just before opening the settings dialog, and is the proper place to update the mentioned informational data.
Reimplemented in lti::histogramViewer::mainWindow, and lti::scene3DViewer::mainWindow.
virtual void lti::viewerBase3D::mainWindow::redraw | ( | ) | [virtual] |
guint32 lti::viewerBase3D::mainWindow::rgbToInt | ( | const int & | r, | |
const int & | g, | |||
const int & | b | |||
) | const [protected] |
convert the three color components red, green and blue in a guint32 used by the gtk-color maps.
r | red component (between 0 and 255) | |
g | green component (between 0 and 255) | |
b | blue component (between 0 and 255) |
static gint lti::viewerBase3D::mainWindow::show | ( | gpointer | data | ) | [static, protected] |
timeout gtk-callback function, called when a new image must be displayed!
This function will stop the timeout automatically, if there are no more images or objects to be displayed.
void lti::viewerBase3D::mainWindow::showCameraPosition | ( | ) | [protected] |
show the data in the status bar
void lti::viewerBase3D::mainWindow::unlock | ( | ) |
unlock internal data
virtual bool lti::viewerBase3D::mainWindow::useParameters | ( | parameters & | theParam | ) | [virtual] |
indicate which parameters instance should be used.
virtual bool lti::viewerBase3D::mainWindow::validData | ( | void | ) | [protected, virtual] |
Indicate if there are valid data to show.
This method must check if the provided data is ready to be shown, i.e. if the dataToImage() can be already be used to draw the data.
Reimplemented in lti::histogramViewer::mainWindow.
const point lti::viewerBase3D::mainWindow::borderWidth [static, protected] |
extra width needed for the scrollbars
bool lti::viewerBase3D::mainWindow::busy [protected] |
GtkWidget* lti::viewerBase3D::mainWindow::darea [protected] |
drawing area that holds the image
bool lti::viewerBase3D::mainWindow::dataChanged [protected] |
if the data has changed, this variable is true
draw3D<rgbPixel> lti::viewerBase3D::mainWindow::drawTool [protected] |
drawTool object
GtkWidget* lti::viewerBase3D::mainWindow::eventBox [protected] |
event box to capture mouse and button events
point lti::viewerBase3D::mainWindow::lastMousePos [protected] |
last position of the mouse in the window.
int lti::viewerBase3D::mainWindow::mouseButtonPressed [protected] |
mouse being pressed.
This attribute will contain always the status of the mouse buttons. The values will usually be:
Nothing : 0 Left button : 1 Middle button: 2 Right button : 3 Wheel Up : 4 Wheel Down : 5
configDialog* lti::viewerBase3D::mainWindow::options [protected] |
the statistics and displaying options dialog
parameters* lti::viewerBase3D::mainWindow::param [protected] |
the viewer parameters.
This is just a pointer to an external instance. This class will never delete or clone the pointed object
GtkWidget* lti::viewerBase3D::mainWindow::scrolledWindow [protected] |
the scrolled window
bool lti::viewerBase3D::mainWindow::showingBuffer [protected] |
if a image is being shown, this attribute is true
GtkWidget* lti::viewerBase3D::mainWindow::statusBar [protected] |
the status bar
guint lti::viewerBase3D::mainWindow::statusBarContextId [protected] |
context id of the status bar
semaphore lti::viewerBase3D::mainWindow::syncEnd [protected] |
semaphore used to synchronize destruction of the widgets
image lti::viewerBase3D::mainWindow::theImage [protected] |
the data which is been actually displayed.
This is the canvas used in the drawTool object.
mutex lti::viewerBase3D::mainWindow::theLock [protected] |
data lock.
Used to protect the data against parallel access
gint lti::viewerBase3D::mainWindow::timerTag [protected] |
GtkWidget* lti::viewerBase3D::mainWindow::window [protected] |
the main dialog window
std::string lti::viewerBase3D::mainWindow::winName [protected] |
name of this window!
point lti::viewerBase3D::mainWindow::winSize [protected] |
size of the window
guchar* lti::viewerBase3D::mainWindow::xbuffer [protected] |
buffer of image being displayed!
int lti::viewerBase3D::mainWindow::xbuffer_cols [protected] |
number of columns of the xbuffer
int lti::viewerBase3D::mainWindow::xbuffer_rows [protected] |
number of rows of the xbuffer