home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
g
/
gina15.zip
/
sample
/
ibtestappl.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-27
|
3KB
|
107 lines
/* @(#)ibtestappl.C 1.1 11/15/91 */
#include <Gina/Gina.h>
// Include IB files (specification + implementation)
#include "ib-test.h"
#include "ib-test.C"
// Define an alias for the new dialog class
#define DIALOG_CLASS GnDemoDocumentShell
#define IS_DOC_SHELL
// NO CHANGES AFTER HERE !!
// ============================================================================
class IbTestApplication : public GnApplication {
public:
virtual GnDocument *create_document ();
char * app_class () { return "IbTest" ; }
char * app_signature() { return "ibtest" ; }
char * app_file_type() { return ".ibtest" ; }
};
class IbTestDocument : public GnDocument {
public:
virtual void create_windows(int new_width = 0, int new_height = 0);
#ifndef IS_DOC_SHELL
protected:
DIALOG_CLASS *dialog;
#endif
protected:
void CallManage(GnWidget *w, caddr_t);
void CallPopup(GnTopLevelToolDialogBox *w, caddr_t);
};
GnDocument *IbTestApplication ::
create_document()
{
return new IbTestDocument;
}
void IbTestDocument ::
create_windows(int new_width, int new_height)
{
#ifdef IS_DOC_SHELL
main_shell = new DIALOG_CLASS(this, new_width, new_height);
main_shell->create(APPLICATION->get_application_shell(), "main_shell");
#else
GnDocument::create_windows(new_width, new_height);
dialog = new DIALOG_CLASS(this);
dialog->create(main_shell, "dialog");
main_shell->add_menu_command("Dialog", "Manage Dialog",
CALLBACK1(IbTestDocument, CallManage, this,
GnWidget *, dialog));
#endif
GnToolDialogBox *tool = new GnToolDialogBox;
tool->create(main_shell, "bla");
GnLabel *lbllbl = new GnLabel("I'm a GnToolDialogBox");
lbllbl->setR_topAttachment(XmATTACH_WIDGET);
lbllbl->setR_topWidget(tool->GetMainMenu());
lbllbl->create(tool, "lbllbl");
main_shell->add_menu_command("Dialog", "Manage Tool-Dialog",
CALLBACK1(IbTestDocument, CallManage, this,
GnWidget *, tool));
GnTopLevelToolDialogBox *top_tool = new GnTopLevelToolDialogBox;
top_tool->setR_title("Class => GnTopLevelToolDialogBox");
top_tool->create(main_shell, "bla");
GnLabel *lbllbllbl = new GnLabel("I'm a GnTopLevelToolDialogBox");
lbllbllbl->setR_topAttachment(XmATTACH_WIDGET);
lbllbllbl->setR_topWidget(top_tool->GetMainMenu());
lbllbllbl->create(top_tool->GetForm(), "lbllbllbl");
main_shell->add_menu_command("Dialog", "GnTopLevelToolDialogBox ...",
CALLBACK1(IbTestDocument, CallPopup, this,
GnTopLevelToolDialogBox*, top_tool));
}
void IbTestDocument::
CallManage(GnWidget *w, caddr_t)
{
w->manage();
}
void IbTestDocument::
CallPopup(GnTopLevelToolDialogBox *w, caddr_t)
{
w->pop_up();
}
int main (unsigned int argc, char ** argv)
{
IbTestApplication app;
app.run ( argc, argv );
}