12.07.2015 Views

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating New <strong>Widget</strong>s(Subclassing)In the class record declaration and initialization, the only field that is different fromthe Template is the expose procedure:/* ARGSUSED */static void Redisplay(w, event, region)<strong>Widget</strong> w;XEvent *event; /* unused */Region region;{XtCallCallbacks(w, XtNexposeCallback, (XtPointer)region);}WindowClassRec windowClassRec = {.../* expose */ Redisplay,The "Window<strong>Widget</strong>" will also declare three public procedures to return the drawingcolors and the font id, saving the application the effort of constructing an argumentlist for a call to XtGetValues :Pixel WindowColor1(w)<strong>Widget</strong> w;{return ((Window<strong>Widget</strong>)w)->window.color_1;}Pixel WindowColor2(w)<strong>Widget</strong> w;{return ((Window<strong>Widget</strong>)w)->window.color_2;}Font WindowFont(w)<strong>Widget</strong> w;{return ((Window<strong>Widget</strong>)w)->window.font->fid;}The "Window<strong>Widget</strong>" is now complete. The application can retrieve the two drawingcolors from the widget instance by calling either XtGetValues , or the WindowColorfunctions. The actual window created for the "Window<strong>Widget</strong>" is available by callingthe XtWindow function.134

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!