removed the need for RTTI/runtime type checking/dynamic_cast in glui. It is unnecessary to overhaul the build systems just for this feature. Replaced by upcasting virtual methods
if ( !dynamic_cast<GLUI_Rollout*>(this) && becomes if ( !this->dynamicCastGLUI_Rollout() && etc.
This commit is contained in:
@@ -315,6 +315,13 @@ private:
|
|||||||
/************************************************************/
|
/************************************************************/
|
||||||
|
|
||||||
class GLUI_Control;
|
class GLUI_Control;
|
||||||
|
class GLUI_Column;
|
||||||
|
class GLUI_Panel;
|
||||||
|
class GLUI_FileBrowser;
|
||||||
|
class GLUI_Scrollbar;
|
||||||
|
class GLUI_Listbox;
|
||||||
|
class GLUI_List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
GLUI_Node is a node in a sort of tree of GLUI controls.
|
GLUI_Node is a node in a sort of tree of GLUI controls.
|
||||||
@@ -354,6 +361,56 @@ public:
|
|||||||
|
|
||||||
void dump( FILE *out, const char *name );
|
void dump( FILE *out, const char *name );
|
||||||
|
|
||||||
|
virtual GLUI_Panel* dynamicCastGLUI_Panel()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_Column* dynamicCastGLUI_Column()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
virtual GLUI_EditText* dynamicCastGLUI_EditText()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
virtual GLUI_Rollout* dynamicCastGLUI_Rollout()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_Tree* dynamicCastGLUI_Tree()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_List* dynamicCastGLUI_List()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_FileBrowser* dynamicCastGLUI_FileBrowser()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_Scrollbar* dynamicCastGLUI_Scrollbar()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_Listbox* dynamicCastGLUI_Listbox()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual GLUI_TreePanel* dynamicCastGLUI_TreePanel()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void add_child_to_control(GLUI_Node *parent,GLUI_Control *child);
|
static void add_child_to_control(GLUI_Node *parent,GLUI_Control *child);
|
||||||
GLUI_Node *parent_node;
|
GLUI_Node *parent_node;
|
||||||
@@ -745,6 +802,9 @@ public:
|
|||||||
/* */
|
/* */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
|
|
||||||
|
//get rid of the dynamic_cast/RTTI requirements, just do a virtual function
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
All the GUI objects inherit from GLUI_Control: buttons,
|
All the GUI objects inherit from GLUI_Control: buttons,
|
||||||
checkboxes, labels, edit boxes, scrollbars, etc.
|
checkboxes, labels, edit boxes, scrollbars, etc.
|
||||||
@@ -843,6 +903,7 @@ public:
|
|||||||
void hide_internal( int recurse );
|
void hide_internal( int recurse );
|
||||||
void unhide_internal( int recurse );
|
void unhide_internal( int recurse );
|
||||||
|
|
||||||
|
|
||||||
/** Return true if it currently makes sense to draw this class. */
|
/** Return true if it currently makes sense to draw this class. */
|
||||||
int can_draw( void ) { return (glui != NULL && hidden == false); }
|
int can_draw( void ) { return (glui != NULL && hidden == false); }
|
||||||
|
|
||||||
@@ -1073,6 +1134,10 @@ public:
|
|||||||
GLUI_Column( GLUI_Node *parent, int draw_bar = true );
|
GLUI_Column( GLUI_Node *parent, int draw_bar = true );
|
||||||
GLUI_Column( void ) { common_init(); }
|
GLUI_Column( void ) { common_init(); }
|
||||||
|
|
||||||
|
virtual GLUI_Column* dynamicCastGLUI_Column()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
void common_init() {
|
void common_init() {
|
||||||
w = 0;
|
w = 0;
|
||||||
@@ -1115,6 +1180,11 @@ public:
|
|||||||
|
|
||||||
void update_size( void );
|
void update_size( void );
|
||||||
|
|
||||||
|
virtual GLUI_Panel* dynamicCastGLUI_Panel()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void common_init( void ) {
|
void common_init( void ) {
|
||||||
w = 300;
|
w = 300;
|
||||||
@@ -1167,6 +1237,11 @@ public:
|
|||||||
const char* get_file() { return file.c_str(); }
|
const char* get_file() { return file.c_str(); }
|
||||||
void set_allow_change_dir(int c) { allow_change_dir = c; }
|
void set_allow_change_dir(int c) { allow_change_dir = c; }
|
||||||
|
|
||||||
|
virtual GLUI_FileBrowser* dynamicCastGLUI_FileBrowser()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void common_init()
|
void common_init()
|
||||||
{
|
{
|
||||||
@@ -1235,6 +1310,11 @@ public:
|
|||||||
|
|
||||||
void update_size( void );
|
void update_size( void );
|
||||||
|
|
||||||
|
virtual GLUI_Rollout* dynamicCastGLUI_Rollout()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void common_init() {
|
void common_init() {
|
||||||
currently_inside = false;
|
currently_inside = false;
|
||||||
@@ -1316,6 +1396,11 @@ public:
|
|||||||
green = g;
|
green = g;
|
||||||
blue = b;
|
blue = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual GLUI_Tree* dynamicCastGLUI_Tree()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
void common_init()
|
void common_init()
|
||||||
{
|
{
|
||||||
@@ -1403,6 +1488,10 @@ public:
|
|||||||
void update_all( void );
|
void update_all( void );
|
||||||
void initNode(GLUI_Tree *temp);
|
void initNode(GLUI_Tree *temp);
|
||||||
void formatNode(GLUI_Tree *temp);
|
void formatNode(GLUI_Tree *temp);
|
||||||
|
virtual GLUI_TreePanel* dynamicCastGLUI_TreePanel()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int uniqueID( void ) { next_id++; return next_id - 1; }
|
int uniqueID( void ) { next_id++; return next_id - 1; }
|
||||||
@@ -1660,6 +1749,12 @@ public:
|
|||||||
// Deprecated constructor, only called internally
|
// Deprecated constructor, only called internally
|
||||||
GLUI_EditText( void ) { common_init(); }
|
GLUI_EditText( void ) { common_init(); }
|
||||||
|
|
||||||
|
virtual GLUI_EditText* dynamicCastGLUI_EditText()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void common_init( void ) {
|
void common_init( void ) {
|
||||||
h = GLUI_EDITTEXT_HEIGHT;
|
h = GLUI_EDITTEXT_HEIGHT;
|
||||||
@@ -2161,6 +2256,11 @@ public:
|
|||||||
void set_object_callback(GLUI_CB cb=GLUI_CB(), GLUI_Control*obj=NULL)
|
void set_object_callback(GLUI_CB cb=GLUI_CB(), GLUI_Control*obj=NULL)
|
||||||
{ obj_cb=cb; associated_object=obj; }
|
{ obj_cb=cb; associated_object=obj; }
|
||||||
|
|
||||||
|
virtual GLUI_List* dynamicCastGLUI_List()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void common_init()
|
void common_init()
|
||||||
{
|
{
|
||||||
@@ -2288,6 +2388,11 @@ public:
|
|||||||
void set_object_callback(GLUI_CB cb=GLUI_CB(), GLUI_Control*obj=NULL)
|
void set_object_callback(GLUI_CB cb=GLUI_CB(), GLUI_Control*obj=NULL)
|
||||||
{ object_cb=cb; associated_object=obj; }
|
{ object_cb=cb; associated_object=obj; }
|
||||||
|
|
||||||
|
virtual GLUI_Scrollbar* dynamicCastGLUI_Scrollbar()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void common_init ( void );
|
void common_init ( void );
|
||||||
void common_construct(
|
void common_construct(
|
||||||
@@ -2358,6 +2463,11 @@ public:
|
|||||||
int id=-1, GLUI_CB callback=GLUI_CB() );
|
int id=-1, GLUI_CB callback=GLUI_CB() );
|
||||||
GLUI_Listbox( void ) { common_init(); }
|
GLUI_Listbox( void ) { common_init(); }
|
||||||
|
|
||||||
|
virtual GLUI_Listbox* dynamicCastGLUI_Listbox()
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Change w and return true if we need to be widened to fit the current item. */
|
/** Change w and return true if we need to be widened to fit the current item. */
|
||||||
bool recalculate_item_width( void );
|
bool recalculate_item_width( void );
|
||||||
|
|||||||
@@ -932,7 +932,7 @@ GLUI_Control *GLUI_Main::find_control( int x, int y )
|
|||||||
|
|
||||||
node = main_panel;
|
node = main_panel;
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
if ( !dynamic_cast<GLUI_Column*>(node) AND
|
if ( !node->dynamicCastGLUI_Column() AND
|
||||||
PT_IN_BOX( x, y,
|
PT_IN_BOX( x, y,
|
||||||
node->x_abs, node->x_abs + node->w,
|
node->x_abs, node->x_abs + node->w,
|
||||||
node->y_abs, node->y_abs + node->h )
|
node->y_abs, node->y_abs + node->h )
|
||||||
@@ -944,7 +944,7 @@ GLUI_Control *GLUI_Main::find_control( int x, int y )
|
|||||||
/*** SPECIAL CASE: for edittext boxes, we make sure click is
|
/*** SPECIAL CASE: for edittext boxes, we make sure click is
|
||||||
in box, and not on name string. This should be generalized
|
in box, and not on name string. This should be generalized
|
||||||
for all controls later... ***/
|
for all controls later... ***/
|
||||||
if ( dynamic_cast<GLUI_EditText*>(node) ) {
|
if ( node->dynamicCastGLUI_EditText() ) {
|
||||||
if ( x < node->x_abs + ((GLUI_EditText*)node)->text_x_offset )
|
if ( x < node->x_abs + ((GLUI_EditText*)node)->text_x_offset )
|
||||||
return (GLUI_Control*) node->parent();
|
return (GLUI_Control*) node->parent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ void GLUI_Control::draw_recursive( int x, int y )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( dynamic_cast<GLUI_Column*>(this) ) {
|
if ( this->dynamicCastGLUI_Column() ) {
|
||||||
/* printf( "%s w/h: %d/%d\n", (char*) name, w, h ); */
|
/* printf( "%s w/h: %d/%d\n", (char*) name, w, h ); */
|
||||||
/*w = 2; */
|
/*w = 2; */
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ void GLUI_Control::align()
|
|||||||
get_this_column_dims(&col_x, &col_y, &col_w, &col_h,
|
get_this_column_dims(&col_x, &col_y, &col_w, &col_h,
|
||||||
&col_x_off, &col_y_off);
|
&col_x_off, &col_y_off);
|
||||||
|
|
||||||
if ( dynamic_cast<GLUI_Column*>(this) ) {
|
if ( this->dynamicCastGLUI_Column() ) {
|
||||||
/* if ( this->prev() != NULL ) {
|
/* if ( this->prev() != NULL ) {
|
||||||
((GLUI_Control*)prev())->get_this_column_dims(&col_x, &col_y, &col_w, &col_h,
|
((GLUI_Control*)prev())->get_this_column_dims(&col_x, &col_y, &col_w, &col_h,
|
||||||
&col_x_off, &col_y_off);
|
&col_x_off, &col_y_off);
|
||||||
@@ -419,7 +419,7 @@ void GLUI_Control::align()
|
|||||||
|
|
||||||
node = (GLUI_Control*) this->first_child();
|
node = (GLUI_Control*) this->first_child();
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
if ( dynamic_cast<GLUI_Column*>(node) ) {
|
if ( node->dynamicCastGLUI_Column() ) {
|
||||||
node->x_abs += delta;
|
node->x_abs += delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,11 +461,11 @@ void GLUI_Control::pack_old(int x, int y)
|
|||||||
/*** Iterate over children, packing them first ***/
|
/*** Iterate over children, packing them first ***/
|
||||||
node = (GLUI_Control*) this->first_child();
|
node = (GLUI_Control*) this->first_child();
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
if ( dynamic_cast<GLUI_Panel*>(node) && !node->collapsible) {
|
if ( node->dynamicCastGLUI_Panel() && !node->collapsible) {
|
||||||
/* Pad some space above fixed size panels */
|
/* Pad some space above fixed size panels */
|
||||||
curr_y += GLUI_ITEMSPACING;
|
curr_y += GLUI_ITEMSPACING;
|
||||||
}
|
}
|
||||||
else if ( dynamic_cast<GLUI_Column*>(node)) {
|
else if ( node->dynamicCastGLUI_Column()) {
|
||||||
curr_column = (GLUI_Column*) node;
|
curr_column = (GLUI_Column*) node;
|
||||||
if ( 1 ) {
|
if ( 1 ) {
|
||||||
column_x += max_w + 2 * x_margin;
|
column_x += max_w + 2 * x_margin;
|
||||||
@@ -487,7 +487,7 @@ void GLUI_Control::pack_old(int x, int y)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
node->pack( curr_x, curr_y );
|
node->pack( curr_x, curr_y );
|
||||||
if ( dynamic_cast<GLUI_Panel*>(node) && !node->collapsible)
|
if ( node->dynamicCastGLUI_Panel() && !node->collapsible)
|
||||||
/* Pad some space below fixed size panels */
|
/* Pad some space below fixed size panels */
|
||||||
curr_y += GLUI_ITEMSPACING;
|
curr_y += GLUI_ITEMSPACING;
|
||||||
curr_y += node->h;
|
curr_y += node->h;
|
||||||
@@ -506,7 +506,7 @@ void GLUI_Control::pack_old(int x, int y)
|
|||||||
if ( this->is_container ) {
|
if ( this->is_container ) {
|
||||||
max_y += y_margin_bot; /*** Add bottom border inside box */
|
max_y += y_margin_bot; /*** Add bottom border inside box */
|
||||||
if ( this->first_child() ) {
|
if ( this->first_child() ) {
|
||||||
if ( dynamic_cast<GLUI_Rollout*>(this) ) {
|
if ( this->dynamicCastGLUI_Rollout() ) {
|
||||||
/** We don't want the rollout to shrink in width when it's
|
/** We don't want the rollout to shrink in width when it's
|
||||||
closed **/
|
closed **/
|
||||||
this->w = MAX(this->w, column_x + max_w + 2 * x_margin );
|
this->w = MAX(this->w, column_x + max_w + 2 * x_margin );
|
||||||
@@ -544,7 +544,7 @@ void GLUI_Control::get_this_column_dims( int *col_x, int *col_y,
|
|||||||
parent_h = parent_ptr->h;
|
parent_h = parent_ptr->h;
|
||||||
parent_y_abs = parent_ptr->y_abs;
|
parent_y_abs = parent_ptr->y_abs;
|
||||||
|
|
||||||
if ( dynamic_cast<GLUI_Panel*>(parent_ptr) AND
|
if ( parent_ptr->dynamicCastGLUI_Panel() AND
|
||||||
parent_ptr->int_val == GLUI_PANEL_EMBOSSED AND
|
parent_ptr->int_val == GLUI_PANEL_EMBOSSED AND
|
||||||
parent_ptr->name != "" ) {
|
parent_ptr->name != "" ) {
|
||||||
parent_h -= GLUI_PANEL_EMBOSS_TOP;
|
parent_h -= GLUI_PANEL_EMBOSS_TOP;
|
||||||
@@ -556,12 +556,12 @@ void GLUI_Control::get_this_column_dims( int *col_x, int *col_y,
|
|||||||
|
|
||||||
/** Look for first control in this column **/
|
/** Look for first control in this column **/
|
||||||
first = this;
|
first = this;
|
||||||
while (first->prev() AND !dynamic_cast<GLUI_Column*>(first->prev()) )
|
while (first->prev() AND !(first->prev())->dynamicCastGLUI_Column() )
|
||||||
first = first->prev();
|
first = first->prev();
|
||||||
|
|
||||||
/** Look for last control in this column **/
|
/** Look for last control in this column **/
|
||||||
last = this;
|
last = this;
|
||||||
while ( last->next() AND !dynamic_cast<GLUI_Column*>(first->next()) )
|
while ( last->next() AND !(first->next())->dynamicCastGLUI_Column() )
|
||||||
last = last->next();
|
last = last->next();
|
||||||
|
|
||||||
curr = first;
|
curr = first;
|
||||||
@@ -596,7 +596,7 @@ void GLUI_Control::get_this_column_dims( int *col_x, int *col_y,
|
|||||||
/*** Look for preceding column ***/
|
/*** Look for preceding column ***/
|
||||||
node = (GLUI_Control*) this->prev();
|
node = (GLUI_Control*) this->prev();
|
||||||
while( node ) {
|
while( node ) {
|
||||||
if ( dynamic_cast<GLUI_Column*>(node) ) {
|
if ( node->dynamicCastGLUI_Column() ) {
|
||||||
*col_x = node->x_abs;
|
*col_x = node->x_abs;
|
||||||
*col_y = parent_y_abs;
|
*col_y = parent_y_abs;
|
||||||
*col_w = node->w;
|
*col_w = node->w;
|
||||||
@@ -613,7 +613,7 @@ void GLUI_Control::get_this_column_dims( int *col_x, int *col_y,
|
|||||||
/*** Nope, Look for next column ***/
|
/*** Nope, Look for next column ***/
|
||||||
node = (GLUI_Control*) this->next();
|
node = (GLUI_Control*) this->next();
|
||||||
while( node ) {
|
while( node ) {
|
||||||
if ( dynamic_cast<GLUI_Column*>(node) ) {
|
if ( node->dynamicCastGLUI_Column() ) {
|
||||||
*col_x = parent_ptr->x_abs;
|
*col_x = parent_ptr->x_abs;
|
||||||
*col_y = parent_y_abs;
|
*col_y = parent_y_abs;
|
||||||
*col_w = node->x_abs - parent_ptr->x_abs;
|
*col_w = node->x_abs - parent_ptr->x_abs;
|
||||||
@@ -671,11 +671,11 @@ void GLUI_Control::pack( int x, int y )
|
|||||||
|
|
||||||
node = (GLUI_Control*) this->first_child();
|
node = (GLUI_Control*) this->first_child();
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
if ( dynamic_cast<GLUI_Panel*>(node) && !node->collapsible) {
|
if ( node->dynamicCastGLUI_Panel() && !node->collapsible) {
|
||||||
/* Pad some space above fixed-size panels */
|
/* Pad some space above fixed-size panels */
|
||||||
curr_y += GLUI_ITEMSPACING;
|
curr_y += GLUI_ITEMSPACING;
|
||||||
}
|
}
|
||||||
else if ( dynamic_cast<GLUI_Column*>(node) ) {
|
else if ( node->dynamicCastGLUI_Column() ) {
|
||||||
curr_column = (GLUI_Column*) node;
|
curr_column = (GLUI_Column*) node;
|
||||||
curr_x += max_w + 1 * x_margin;
|
curr_x += max_w + 1 * x_margin;
|
||||||
column_x = curr_x;
|
column_x = curr_x;
|
||||||
@@ -695,7 +695,7 @@ void GLUI_Control::pack( int x, int y )
|
|||||||
|
|
||||||
node->pack( curr_x, curr_y );
|
node->pack( curr_x, curr_y );
|
||||||
|
|
||||||
if ( dynamic_cast<GLUI_Panel*>(node) && !node->collapsible)
|
if ( node->dynamicCastGLUI_Panel() && !node->collapsible)
|
||||||
/* Pad some space below fixed-size panels */
|
/* Pad some space below fixed-size panels */
|
||||||
curr_y += GLUI_ITEMSPACING;
|
curr_y += GLUI_ITEMSPACING;
|
||||||
|
|
||||||
@@ -729,8 +729,8 @@ void GLUI_Control::pack( int x, int y )
|
|||||||
this->h = (max_y - y_in);
|
this->h = (max_y - y_in);
|
||||||
}
|
}
|
||||||
else { /* An empty container, so just assign default w & h */
|
else { /* An empty container, so just assign default w & h */
|
||||||
if ( !dynamic_cast<GLUI_Rollout*>(this) &&
|
if ( !this->dynamicCastGLUI_Rollout() &&
|
||||||
!dynamic_cast<GLUI_Tree*>(this) ) {
|
!this->dynamicCastGLUI_Tree() ) {
|
||||||
this->w = GLUI_DEFAULT_CONTROL_WIDTH;
|
this->w = GLUI_DEFAULT_CONTROL_WIDTH;
|
||||||
this->h = GLUI_DEFAULT_CONTROL_HEIGHT;
|
this->h = GLUI_DEFAULT_CONTROL_HEIGHT;
|
||||||
}
|
}
|
||||||
@@ -744,7 +744,7 @@ void GLUI_Control::pack( int x, int y )
|
|||||||
/*** Now we step through the GLUI_Columns, setting the 'h' ***/
|
/*** Now we step through the GLUI_Columns, setting the 'h' ***/
|
||||||
node = (GLUI_Control*) this->first_child();
|
node = (GLUI_Control*) this->first_child();
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
if ( dynamic_cast<GLUI_Column*>(node) ) {
|
if ( node->dynamicCastGLUI_Column() ) {
|
||||||
node->h = this->h - y_margin_bot - y_margin_top;
|
node->h = this->h - y_margin_bot - y_margin_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void GLUI_FileBrowser::dir_list_callback(GLUI_Control *glui_object) {
|
|||||||
GLUI_List *list = dynamic_cast<GLUI_List*>(glui_object);
|
GLUI_List *list = dynamic_cast<GLUI_List*>(glui_object);
|
||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
GLUI_FileBrowser* me = dynamic_cast<GLUI_FileBrowser*>(list->associated_object);
|
GLUI_FileBrowser* me = list->associated_object->dynamicCastGLUI_FileBrowser();
|
||||||
if (!me)
|
if (!me)
|
||||||
return;
|
return;
|
||||||
int this_item;
|
int this_item;
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ int GLUI_List::mouse_over( int state, int x, int y )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GLUI_List::scrollbar_callback(GLUI_Control *my_scrollbar) {
|
void GLUI_List::scrollbar_callback(GLUI_Control *my_scrollbar) {
|
||||||
GLUI_Scrollbar *sb = dynamic_cast<GLUI_Scrollbar*>(my_scrollbar);
|
GLUI_Scrollbar *sb = my_scrollbar->dynamicCastGLUI_Scrollbar();
|
||||||
if (!sb) return;
|
if (!sb) return;
|
||||||
GLUI_List* me = (GLUI_List*) sb->associated_object;
|
GLUI_List* me = (GLUI_List*) sb->associated_object;
|
||||||
if (me->scrollbar == NULL)
|
if (me->scrollbar == NULL)
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ static void listbox_callback( int i )
|
|||||||
int old_val;
|
int old_val;
|
||||||
|
|
||||||
if ( NOT GLUI_Master.curr_left_button_glut_menu OR
|
if ( NOT GLUI_Master.curr_left_button_glut_menu OR
|
||||||
!dynamic_cast<GLUI_Listbox*>(GLUI_Master.curr_left_button_glut_menu) )
|
!GLUI_Master.curr_left_button_glut_menu->dynamicCastGLUI_Listbox() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
old_val = ((GLUI_Listbox*)GLUI_Master.curr_left_button_glut_menu)->int_val;
|
old_val = ((GLUI_Listbox*)GLUI_Master.curr_left_button_glut_menu)->int_val;
|
||||||
|
|||||||
@@ -1092,7 +1092,7 @@ int GLUI_TextBox::mouse_over( int state, int x, int y )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GLUI_TextBox::scrollbar_callback(GLUI_Control *my_scrollbar) {
|
void GLUI_TextBox::scrollbar_callback(GLUI_Control *my_scrollbar) {
|
||||||
GLUI_Scrollbar *sb = dynamic_cast<GLUI_Scrollbar*>(my_scrollbar);
|
GLUI_Scrollbar *sb = my_scrollbar->dynamicCastGLUI_Scrollbar();
|
||||||
if (!sb) return;
|
if (!sb) return;
|
||||||
GLUI_TextBox* me = (GLUI_TextBox*) sb->associated_object;
|
GLUI_TextBox* me = (GLUI_TextBox*) sb->associated_object;
|
||||||
if (me->scrollbar == NULL)
|
if (me->scrollbar == NULL)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ GLUI_Tree *GLUI_TreePanel::ab(const char *name, GLUI_Tree *root)
|
|||||||
curr_root = temp;
|
curr_root = temp;
|
||||||
curr_branch = NULL; /* Currently at leaf */
|
curr_branch = NULL; /* Currently at leaf */
|
||||||
|
|
||||||
if (dynamic_cast<GLUI_Tree*>(temp))
|
if (temp->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)temp)->set_current(true);
|
((GLUI_Tree *)temp)->set_current(true);
|
||||||
//refresh();
|
//refresh();
|
||||||
// glui->deactivate_current_control();
|
// glui->deactivate_current_control();
|
||||||
@@ -86,7 +86,7 @@ void GLUI_TreePanel::fb(GLUI_Tree *branch)
|
|||||||
|
|
||||||
if (branch != NULL) {
|
if (branch != NULL) {
|
||||||
|
|
||||||
if ( dynamic_cast<GLUI_Tree*>(branch) )
|
if ( branch->dynamicCastGLUI_Tree() )
|
||||||
((GLUI_Tree *)branch)->set_current(false);
|
((GLUI_Tree *)branch)->set_current(false);
|
||||||
|
|
||||||
curr_branch = (GLUI_Tree *)branch->next();
|
curr_branch = (GLUI_Tree *)branch->next();
|
||||||
@@ -95,13 +95,14 @@ void GLUI_TreePanel::fb(GLUI_Tree *branch)
|
|||||||
if (curr_branch == NULL && (curr_root->collapsed_node).first_child() != NULL)
|
if (curr_branch == NULL && (curr_root->collapsed_node).first_child() != NULL)
|
||||||
curr_branch = (GLUI_Tree *)(curr_root->collapsed_node).first_child();
|
curr_branch = (GLUI_Tree *)(curr_root->collapsed_node).first_child();
|
||||||
|
|
||||||
if ( dynamic_cast<GLUI_Tree*>(curr_root) )
|
|
||||||
|
if ( curr_root->dynamicCastGLUI_Tree() )
|
||||||
((GLUI_Tree *)curr_root)->set_current(true);
|
((GLUI_Tree *)curr_root)->set_current(true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (curr_root != NULL) { /* up one parent */
|
if (curr_root != NULL) { /* up one parent */
|
||||||
|
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)curr_root)->set_current(false);
|
((GLUI_Tree *)curr_root)->set_current(false);
|
||||||
|
|
||||||
curr_branch = (GLUI_Tree *) curr_root->next();
|
curr_branch = (GLUI_Tree *) curr_root->next();
|
||||||
@@ -110,7 +111,7 @@ void GLUI_TreePanel::fb(GLUI_Tree *branch)
|
|||||||
if (curr_branch == NULL && (curr_root->collapsed_node).first_child() != NULL)
|
if (curr_branch == NULL && (curr_root->collapsed_node).first_child() != NULL)
|
||||||
curr_branch = (GLUI_Tree *)(curr_root->collapsed_node).first_child();
|
curr_branch = (GLUI_Tree *)(curr_root->collapsed_node).first_child();
|
||||||
|
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)curr_root)->set_current(true);
|
((GLUI_Tree *)curr_root)->set_current(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -139,15 +140,15 @@ void GLUI_TreePanel::initNode(GLUI_Tree *temp)
|
|||||||
int level = temp->get_level();
|
int level = temp->get_level();
|
||||||
int child_number = 1;
|
int child_number = 1;
|
||||||
|
|
||||||
GLUI_Tree *ptree = dynamic_cast<GLUI_Tree*>(temp->parent());
|
GLUI_Tree *ptree = temp->parent()->dynamicCastGLUI_Tree();
|
||||||
if (ptree) {
|
if (ptree) {
|
||||||
level = ptree->get_level() + 1;
|
level = ptree->get_level() + 1;
|
||||||
GLUI_Tree *prevTree = dynamic_cast<GLUI_Tree*>(temp->prev());
|
GLUI_Tree *prevTree = temp->prev()->dynamicCastGLUI_Tree();
|
||||||
if (prevTree) {
|
if (prevTree) {
|
||||||
child_number = prevTree->get_child_number() + 1;
|
child_number = prevTree->get_child_number() + 1;
|
||||||
}
|
}
|
||||||
} else if (dynamic_cast<GLUI_Tree*>(temp) &&
|
} else if (temp->dynamicCastGLUI_Tree() &&
|
||||||
dynamic_cast<GLUI_TreePanel*>(temp->parent())) {
|
temp->parent()->dynamicCastGLUI_TreePanel()) {
|
||||||
child_number = ++root_children;
|
child_number = ++root_children;
|
||||||
}
|
}
|
||||||
temp->set_id(uniqueID()); // -1 if unset
|
temp->set_id(uniqueID()); // -1 if unset
|
||||||
@@ -173,7 +174,7 @@ void GLUI_TreePanel::formatNode(GLUI_Tree *temp)
|
|||||||
glui_format_str(level_name, "%d", level);
|
glui_format_str(level_name, "%d", level);
|
||||||
}
|
}
|
||||||
if (format & GLUI_TREEPANEL_HIERARCHY_NUMERICDOT) {
|
if (format & GLUI_TREEPANEL_HIERARCHY_NUMERICDOT) {
|
||||||
if ( dynamic_cast<GLUI_Tree*>(temp->parent()) )
|
if ( temp->parent()->dynamicCastGLUI_Tree() )
|
||||||
glui_format_str(level_name, "%s.%d",
|
glui_format_str(level_name, "%s.%d",
|
||||||
((GLUI_Tree *)(temp->parent()))->level_name.c_str(),
|
((GLUI_Tree *)(temp->parent()))->level_name.c_str(),
|
||||||
child_number);
|
child_number);
|
||||||
@@ -206,12 +207,12 @@ void GLUI_TreePanel::formatNode(GLUI_Tree *temp)
|
|||||||
} else {
|
} else {
|
||||||
if (format & GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) {
|
if (format & GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) {
|
||||||
temp->disable_bar();
|
temp->disable_bar();
|
||||||
if ( dynamic_cast<GLUI_Tree*>(curr_root) )
|
if ( curr_root->dynamicCastGLUI_Tree() )
|
||||||
((GLUI_Tree *)curr_root)->enable_bar();
|
((GLUI_Tree *)curr_root)->enable_bar();
|
||||||
} else
|
} else
|
||||||
if (format & GLUI_TREEPANEL_CONNECT_CHILDREN_ONLY) {
|
if (format & GLUI_TREEPANEL_CONNECT_CHILDREN_ONLY) {
|
||||||
temp->disable_bar();
|
temp->disable_bar();
|
||||||
if (temp->prev() && dynamic_cast<GLUI_Tree*>(temp->prev()) )
|
if (temp->prev() && temp->prev()->dynamicCastGLUI_Tree() )
|
||||||
{
|
{
|
||||||
((GLUI_Tree *)temp->prev())->enable_bar();
|
((GLUI_Tree *)temp->prev())->enable_bar();
|
||||||
}
|
}
|
||||||
@@ -229,11 +230,11 @@ void GLUI_TreePanel::update_all()
|
|||||||
GLUI_Tree *saved_branch = curr_branch;
|
GLUI_Tree *saved_branch = curr_branch;
|
||||||
root_children = 0;
|
root_children = 0;
|
||||||
resetToRoot(this);
|
resetToRoot(this);
|
||||||
if (curr_branch && dynamic_cast<GLUI_Tree*>(curr_branch))
|
if (curr_branch && curr_branch->dynamicCastGLUI_Tree())
|
||||||
formatNode((GLUI_Tree *)curr_branch);
|
formatNode((GLUI_Tree *)curr_branch);
|
||||||
next();
|
next();
|
||||||
while (curr_root && curr_branch != this->first_child()) {
|
while (curr_root && curr_branch != this->first_child()) {
|
||||||
if (curr_branch && dynamic_cast<GLUI_Tree*>(curr_branch)) {
|
if (curr_branch && curr_branch->dynamicCastGLUI_Tree()) {
|
||||||
formatNode((GLUI_Tree *)curr_branch);
|
formatNode((GLUI_Tree *)curr_branch);
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
@@ -250,11 +251,11 @@ void GLUI_TreePanel::expand_all()
|
|||||||
GLUI_Tree *saved_branch = curr_branch;
|
GLUI_Tree *saved_branch = curr_branch;
|
||||||
|
|
||||||
resetToRoot(this);
|
resetToRoot(this);
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree*)curr_root)->open();
|
((GLUI_Tree*)curr_root)->open();
|
||||||
next();
|
next();
|
||||||
while (curr_root != NULL && curr_branch != this->first_child()) {
|
while (curr_root != NULL && curr_branch != this->first_child()) {
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree*)curr_root)->open();
|
((GLUI_Tree*)curr_root)->open();
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
@@ -273,7 +274,7 @@ void GLUI_TreePanel::collapse_all()
|
|||||||
resetToRoot(this);
|
resetToRoot(this);
|
||||||
next();
|
next();
|
||||||
while (curr_root != NULL && curr_branch != this->first_child()) {
|
while (curr_root != NULL && curr_branch != this->first_child()) {
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root) &&
|
if (curr_root->dynamicCastGLUI_Tree() &&
|
||||||
curr_branch == NULL) { /* we want to close everything leaf-first */
|
curr_branch == NULL) { /* we want to close everything leaf-first */
|
||||||
((GLUI_Tree*)curr_root)->close();
|
((GLUI_Tree*)curr_root)->close();
|
||||||
/* Rather than simply next(), we need to manually move the
|
/* Rather than simply next(), we need to manually move the
|
||||||
@@ -318,11 +319,11 @@ void GLUI_TreePanel::db(GLUI_Tree *root)
|
|||||||
delete curr_root;
|
delete curr_root;
|
||||||
curr_branch = (GLUI_Tree *) temp_branch;
|
curr_branch = (GLUI_Tree *) temp_branch;
|
||||||
curr_root = (GLUI_Panel *) temp_root;
|
curr_root = (GLUI_Panel *) temp_root;
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)curr_root)->open();
|
((GLUI_Tree *)curr_root)->open();
|
||||||
|
|
||||||
if ((format & GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) == GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) {
|
if ((format & GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) == GLUI_TREEPANEL_DISABLE_DEEPEST_BAR) {
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root) && ((GLUI_Tree *)curr_root->next()) == NULL)
|
if (curr_root->dynamicCastGLUI_Tree() && ((GLUI_Tree *)curr_root->next()) == NULL)
|
||||||
((GLUI_Tree *)curr_root)->disable_bar();
|
((GLUI_Tree *)curr_root)->disable_bar();
|
||||||
}
|
}
|
||||||
//refresh();
|
//refresh();
|
||||||
@@ -337,7 +338,7 @@ void GLUI_TreePanel::descendBranch(GLUI_Panel *root) {
|
|||||||
else
|
else
|
||||||
resetToRoot(curr_root);
|
resetToRoot(curr_root);
|
||||||
if (curr_branch != NULL && curr_branch != ((GLUI_Panel *)this)) {
|
if (curr_branch != NULL && curr_branch != ((GLUI_Panel *)this)) {
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)curr_root)->set_current(false);
|
((GLUI_Tree *)curr_root)->set_current(false);
|
||||||
descendBranch(curr_branch);
|
descendBranch(curr_branch);
|
||||||
}
|
}
|
||||||
@@ -355,7 +356,7 @@ void GLUI_TreePanel::next()
|
|||||||
|
|
||||||
|
|
||||||
if (curr_branch != NULL && curr_branch != ((GLUI_Panel *)this)) { /* Descend into branch */
|
if (curr_branch != NULL && curr_branch != ((GLUI_Panel *)this)) { /* Descend into branch */
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)curr_root)->set_current(false);
|
((GLUI_Tree *)curr_root)->set_current(false);
|
||||||
resetToRoot(curr_branch);
|
resetToRoot(curr_branch);
|
||||||
} else if (curr_branch == NULL) {
|
} else if (curr_branch == NULL) {
|
||||||
@@ -372,7 +373,7 @@ void GLUI_TreePanel::resetToRoot(GLUI_Panel *new_root)
|
|||||||
if (new_root != NULL)
|
if (new_root != NULL)
|
||||||
root = new_root;
|
root = new_root;
|
||||||
curr_root = root;
|
curr_root = root;
|
||||||
if (dynamic_cast<GLUI_Tree*>(curr_root))
|
if (curr_root->dynamicCastGLUI_Tree())
|
||||||
((GLUI_Tree *)curr_root)->set_current(true);
|
((GLUI_Tree *)curr_root)->set_current(true);
|
||||||
curr_branch = (GLUI_Tree *)root->first_child();
|
curr_branch = (GLUI_Tree *)root->first_child();
|
||||||
|
|
||||||
@@ -381,7 +382,7 @@ void GLUI_TreePanel::resetToRoot(GLUI_Panel *new_root)
|
|||||||
if (curr_branch == NULL && (root->collapsed_node).first_child() != NULL) {
|
if (curr_branch == NULL && (root->collapsed_node).first_child() != NULL) {
|
||||||
curr_branch = (GLUI_Tree *)(root->collapsed_node).first_child();
|
curr_branch = (GLUI_Tree *)(root->collapsed_node).first_child();
|
||||||
}
|
}
|
||||||
while (curr_branch && dynamic_cast<GLUI_Tree*>(curr_branch)) {
|
while (curr_branch && curr_branch->dynamicCastGLUI_Tree()) {
|
||||||
curr_branch=(GLUI_Tree *)curr_branch->next();
|
curr_branch=(GLUI_Tree *)curr_branch->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user