00001 /*
00002 File: Forms.h
00003
00004 Function: Integrates the 'Forms' user interface kit for SGIs into
00005 the X window graphics system. (See XGraphicsSystem.h.)
00006
00007 Author(s): Andrew Willmott
00008
00009 Copyright: (c) 1997-2000, Andrew Willmott
00010 */
00011
00012 #ifndef __Forms__
00013 #define __Forms__
00014
00015 #include <forms.h>
00016 #include <iostream.h>
00017 #include <strstream.h>
00018 #include "gcl/XGraphicsSystem.h"
00019
00020
00021 // --- Forms Graphics System --------------------------------------------------
00022
00023
00024 class FormsGraphicsSystem : public XGraphicsSystem
00025 {
00026 public:
00027
00028 FormsGraphicsSystem(int argc, char **argv, char *name = 0);
00029
00030 Void CreateFormsPane(XEventPane *xpane, FL_OBJECT *object);
00031 Void CreateWindow(XEventPane *xpane, Char *title = "OpenGL window",
00032 Int width = 400, Int height = 400);
00033
00034 // overrides
00035
00036 Void GetMouse(XEventPane *pane, Int *x, Int *y, UInt *keyState);
00037 Void Spin();
00038 Void Run();
00039 Void SignalDone();
00040 };
00041
00042 // --- Form class -------------------------------------------------------------
00043
00044
00045 class Form
00046 {
00047 public:
00048 Form();
00049
00050 virtual Void Event(FL_OBJECT *object);
00051
00052 Void Show();
00053 Void Hide();
00054
00055 Void RegisterForm(FL_FORM *form);
00056 Void RegisterObj(FL_OBJECT *object);
00057
00058 Void SetTitle(const Char *title);
00059
00060 FL_FORM *form;
00061 const Char *title;
00062 };
00063
00064
00065 // --- The Field Class --------------------------------------------------------
00066
00067
00068 /*
00069 Allows you to use streams to set Forms fields, e.g.,
00070 Field(myField) << "Blah blah blah" << show;
00071 */
00072
00073 class Field : public ostrstream
00074 {
00075 public:
00076
00077 Field(FL_OBJECT *commentObj) : object(commentObj), ostrstream() {};
00078
00079 virtual Void Show();
00080
00081 String fieldString;
00082 FL_OBJECT *object;
00083 };
00084
00085 class InputField : public Field
00086 {
00087 public:
00088
00089 InputField(FL_OBJECT *commentObj) : Field(commentObj) {};
00090
00091 Void Show(); // override
00092 };
00093
00094 ostream &show(ostream &s);
00095
00096
00097 Void my_activate(FL_OBJECT *obj); // These versions do dimming of
00098 Void my_deactivate(FL_OBJECT *obj); // inactive controls. Kind of.
00099
00100 Void fl_deactivate_group(FL_OBJECT *obj);
00101 Void fl_activate_group(FL_OBJECT *obj);
00102
00103
00104 Void fl_set_menu_item_check(FL_OBJECT *obj, int item, Bool b);
00105 Bool fl_get_menu_item_check(FL_OBJECT *obj, int item);
00106
00107
00108 #endif