home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
g
/
gina15.zip
/
demos
/
perf.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-27
|
4KB
|
133 lines
#include <Gina/GnObject.h>
#include <Gina/GnToolkit.h>
#include <Gina/GnApplicationShell.h>
#include <Gina/GnCascadeButtonG.h>
#include <Gina/GnFileSelectD.h>
#include <Gina/GnMainWindow.h>
#include <Gina/GnMenuBar.h>
#include <Gina/GnPulldownMenuPane.h>
#include <Gina/GnPushButton.h>
#include <Gina/GnPushButtonG.h>
#include <Gina/GnRowColumn.h>
#include <Gina/GnTimer.h>
void update_counter(void *client_data_1, void *client_data_2,
caddr_t /* call_data */)
{
GnPushButton *button = (GnPushButton *)client_data_1;
int *timer_counter = (int *)client_data_2;
char counter_string [10];
(*timer_counter)++;
sprintf(counter_string, "%d", *timer_counter);
button->setR_labelString(counter_string);
button->SetValues();
}
void quit_app(caddr_t /* call_data */)
{
exit(1);
}
/* Callback handler for testing GpathSelectionDialogs */
void test_file_select(void *client_data, caddr_t /* call_data */)
{
GnPathname *out_path;
GnWidget *widget = (GnWidget *)client_data;
if( select_new_file(*widget, &out_path) == OK )
Gina_Debug_NL(out_path->abs_namestring());
if( select_old_file(*widget, &out_path,
"dummy", "?*.C", "/home/baecker/gina-c++/src") == OK )
Gina_Debug_NL(out_path->abs_namestring());
if( select_old_or_new_file(*widget, &out_path,
"dummy", "?*.C",
"/home/baecker/gina-c++/src") == OK )
Gina_Debug_NL(out_path->abs_namestring());
}
//int ext_res_def = 2;
int ext_res = 2;
XtResource ExtRes[] = {
{ "extres", "Extres", XtRInt, sizeof(int), (Cardinal)&ext_res,
XtRInt, (XtPointer)&ext_res},
};
int main(Cardinal argc, char **argv)
{
GnToolkit toolkit("Perf");
GnRowColumn *row;
GnMainWindow *main_window;
GnMenuBar *menu_bar;
GnCascadeButton *file_cascade;
GnPulldownMenuPane *file_pane;
GnPushButton *file_button, *button;
int i;
char w_name[10];
GnTimer *timer;
if( ! toolkit.AppInitialize(&argc, argv) )
abort();
////XtGetApplicationResources(toolkit.AppShell().get_widget_id(),
//(XtPointer)0,
//ExtRes,
//1,
//(ArgList)0,
//0);
cout << "\n\n" << ext_res << "\n\n" ; cout.flush();
toolkit.set_xt_error_handler((XtErrorHandler)abort);
toolkit.set_xt_warning_handler((XtErrorHandler)abort);
toolkit.AppShell().setR_allowShellResize(True);
toolkit.AppShell().setR_deleteResponse(XmDO_NOTHING);
toolkit.AppShell().SetValues();
toolkit.AppShell().add_wm_closed_callback(SIMPLE_CALLBACK(quit_app));
main_window = new GnMainWindow;
main_window->create(toolkit.AppShell(), "main_window");
menu_bar = new GnMenuBar;
menu_bar->create(main_window, "menu_bar");
file_pane = new GnPulldownMenuPane;
file_pane->create(menu_bar, "filePane");
file_cascade = new GnCascadeButton("File", file_pane);
file_cascade->create(menu_bar, "fileCascade");
file_button = new GnPushButton("New");
file_button->create(file_pane, "fileButton");
file_button->add_activateCallback(SIMPLE_CALLBACK1(test_file_select,
GnWidget *,
main_window));
row = new GnRowColumn;
row->setR_packing(XmPACK_COLUMN);
row->setR_numColumns(3);
row->setR_traversalOn(False);
row->create(main_window, "row");
main_window->set_areas(menu_bar, 0, 0, 0, row);
for( i = 0; i < 6; i++ ) {
button = new GnPushButtonGadget;
sprintf(w_name, "%3d", i);
button->create(row, w_name);
}
toolkit.AppShell().realize();
int timer_counter = 0;
timer = new GnTimer(1000, SIMPLE_CALLBACK2(update_counter,
GnPushButton *, button,
int *, &timer_counter));
timer->start();
toolkit.AppMainLoop();
}