Kennung für das Versionskontroll-System:
char *rcs = ''$Id: xwidget.c,v 1.113 1996/07/10 11:26:25 heuler$'';
Lokale Definitionen:
Struktur für die Pendel Fensterklasse:
PendulumClassRec pendulumClassRec = {
{
/* core_class fields */
/* superclass */ (WidgetClass) &widgetClassRec,
/* class_name */ "Pendulum",
/* widget_size */ sizeof(PendulumRec),
/* class_initialize */ NULL,
/* class_part_initialize */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ XtInheritRealize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ NULL,
/* num_resources */ 0,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave */ TRUE,
/* visible_interest */ FALSE,
/* destroy */ Destroy,
/* resize */ Resize,
/* expose */ Redisplay,
/* set_values */ NULL,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ NULL,
/* query_geometry */ NULL,
};
WidgetClass pendulumWidgetClass = (WidgetClass) & pendulumClassRec; static GC gc, xgc; /* display gcs */ static Pixmap penpixmap; /* pendulum pixmap */ static Display *display; /* display variable */ static int screen; /* screen number of display */ static int cdepth; /* color depth of display */ static Colormap cmap; /* default colormap */ static int pixel_pen; /* pixel color of pendulum */ static int pixel_mot; /* pixel color of motor */ static int pixel_mech; /* pixel color of mechanic */ static int pixel_back; /* pixel color of background */ static int pixel_nail; /* pixel color of nail in circle */ static double oxmotorw; /* old angle of motor */ static double oxpendelw; /* old angle of pendulum */ static int cwidth; /* width of circle */ static int motlen; /* length of motor */ static int penlen; /* length of pendulum */ static int rwidth; /* width of rectangle */ static int xpos; /* xpos of pendulum */ static int ypos; /* ypos of pendulum */
Berechnet die Größe der einzelnen Parameter des Pendels abhängig
von der Fenstergröße:
void CalculatePenParam(PendulumWidget w);
Zeichnet den Motorteil des Pendelsystems:
XPoint DrawMotor(Window window, Boolean draw);
Zeichnet den Pendelteil des Pendelsystems:
void DrawPendulum(Window window, int xpos, int ypos, Boolean draw);
Löscht das Pendelsystem an der alten Position und zeichnet es an
der neuen:
void DisplayPendulum(PendulumWidget w, Window window);
Callback - Wird bei der Initialisierung der Fensterklasse
aufgerufen:
void Initialize(Widget treq, Widget xw, ArgList args, Cardinal *num_args);
Callback - Wird bei einer Größenänderung des Pendelfensters
aufgerufen:
void Resize(Widget xw);
Callback - Wird beim Schließen des Pendelfensters aufgerufen:
void Destroy(Widget w);
Callback - Wird aufgerufen, wenn das Pendelfenster neu
gezeichnet werden muß:
void Redisplay(Widget xw, XExposeEvent *event);