/* Function Name: _FindWidget
* Description: Finds a widget in the tree and shows it to the user.
* Arguments: w - any widget in the application.
* Returns: none.
*/
void
_FindWidget(w)
Widget w;
{
char msg[BUFSIZ];
WNode * node;
Window win, GetClientWindow();
int x, y; /* location of event in root coordinates. */
/* Function Name: FindWidgetFromWindow
* Description: finds a widget in the current tree given its window id.
* Arguments: tree_info - information about this tree.
* win - window to search for.
* Returns: node - the node corrosponding to this widget.
*/
/* Function Name: FindWidgetFromWindowGivenNode
* Description: finds a widget in the current tree given its window id.
* Arguments: node - current node.
* win - window to search for.
* Returns: node - the node corrosponding to this widget.
*/
for (i = 0; i < node->num_children; i++) {
ret_node = FindWidgetFromWindowGivenNode(node->children[i], win);
if (ret_node != NULL)
return(ret_node);
}
return(NULL);
}
/* Function Name: DisplayChild
* Description: Displays the child node returned by the client
* Arguments: event - the event from the client.
* Returns: none.
*/
/* Function Name: _FlashActiveWidgets
* Description: Highlights all active widgets in the tree.
* Arguments: tree_info - information about the current tree.
* Returns: none.
*/
/* Function Name: HandleFlashWidget
* Description: Is called when client has returned geometry of all widget
* to flash.
* Arguments: event - the event containing the client info.
* Returns: none.
*/
for (i = 0; i < (int)geom_event->num_entries; i++)
AddToFlashList(global_tree_info, geom_event->info + i, &errors);
FlashWidgets(global_tree_info);
return(errors);
}
/* Function Name: AddWidgetToFlashList
* Description: Adds a widget to the list of widget to flash.
* Arguments: tree_info - info about this tree.
* geom_info - the info from the client about this widget.
* errors - a string containing the errors.
* Returns: none
*/
/* Function Name: _AddToFlashList
* Description: adds the window to the current client's flash list.
* Arguments: errors - a string to stuff any errors encountered.
* node - the node associated with this object.
* x, y - location of the flash widget in root coords.
* width, height - size of the flash widget.
* Returns: none.
*/
if (window == EDITRES_IS_OBJECT)
window = node->parent->window;
if (window == EDITRES_IS_UNREALIZED) {
char buf[BUFSIZ];
if (node->window == EDITRES_IS_OBJECT)
sprintf(buf, "%s(0x%lx) - This object's parent is unrealized\n",
node->name, node->id);
else
sprintf(buf, "%s(0x%lx) - This widget is unrealized\n",
node->name, node->id);
XSync(dpy, FALSE);
XSetErrorHandler(global_old_error_handler);
if (global_error_code == NO_WINDOW) {
char buf[BUFSIZ];
sprintf(buf, "%s(0x%lx) - This widget's window no longer exists.\n",
node->name, node->id);
AddString(errors, buf);
return;
}
if (attrs.map_state != IsViewable) {
char buf[BUFSIZ];
sprintf(buf, "%s(0x%lx) - This widget is not mapped.\n",
node->name, node->id);
AddString(errors, buf);
return;
}
CreateFlashWidget(tree_info, x, y, width, height);
}
/* Function Name: CreateFlashWidget
* Description: Creates a widget of the size specified that
* will flash on the display, and adds it to the list
* of widgets to flash.
* Arguments: tree_info - the tree information structure.
* x,y,width, height - size and location of the flash widget.
* Returns: none.
*/
#define MORE_FLASH_WIDGETS 5
static void
CreateFlashWidget(tree_info, x, y, width, height)
TreeInfo * tree_info;
int x, y;
unsigned int width, height;
{
Widget shell;
Arg args[3];
Cardinal num = 0;
Dimension bw;
/* Function Name: FlashWidgets
* Description: Starts the widgets flashing.
* Arguments: tree_info - the info about the tree (contains flash list)
* Returns: none
*/
static void
FlashWidgets(tree_info)
TreeInfo * tree_info;
{
int i;
unsigned long wait, half_flash;
XtAppContext ac = XtWidgetToApplicationContext(tree_info->tree_widget);
if (tree_info->flash_widgets == NULL) /* no widgets to flash. */
return;
wait = half_flash = global_resources.flash_time/2;
for (i = 1; i < global_resources.num_flashes; i++) {
XtAppAddTimeOut(ac, wait, FlashWidgetsOff,(XtPointer)tree_info);
wait += half_flash;
XtAppAddTimeOut(ac, wait, FlashWidgetsOn,(XtPointer)tree_info);
wait += half_flash;
}
/* Function Name: FlashWidgetsOn
* Description: Turns on all the Flash Widgets.
* Arguments: info_ptr - pointer to the tree info.
* id - *** UNUSED ***.
* Returns: none
*/
int i;
TreeInfo * tree_info = (TreeInfo *) info_ptr;
for (i = 0; i < tree_info->num_flash_widgets; i++) {
XtRealizeWidget(tree_info->flash_widgets[i]);
XMapRaised(XtDisplay(tree_info->flash_widgets[i]),
XtWindow(tree_info->flash_widgets[i]));
}
}
/* Function Name: FlashWidgetsOff
* Description: Turns off all the Flash Widgets.
* Arguments: info_ptr - pointer to the tree info.
* id - *** UNUSED ***.
* Returns: none
*/
for (i = 0; i < tree_info->num_flash_widgets; i++)
XtUnmapWidget(tree_info->flash_widgets[i]);
}
/* Function Name: FlashWidgetsCleanup
* Description: Destroys all the Flash Widgets.
* Arguments: info_ptr - pointer to the tree info.
* id - *** UNUSED ***.
* Returns: none
*/