Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages
Be careful with global objects, because most probably they will not get the global parameters (which are also global objects).
There is a set of tutorials available along with examples, which could be located at "examples" directory. If you are new to OpenGl start from the first lesson, if you just want to get a button into your application you can go directly to Lesson 4.
- Lesson 1 teaches how to get started from scratch.
- Lesson 2 teaches how to draw what you want.
- Lesson 3 teaches how to animate your graphics.
- Lesson 4 teaches how to use predefined widgets, like push buttons, checkboxes, etc...
- Lesson 5 teaches how to handle user input (keyboard and mouse).
- Lesson 6 teaches how to use dialogs and position your widgets properly.
- Lesson 7 teaches how to create custom widgets.
- Lesson 8 teaches how to use different windowing libraries.
Organization of classes
For user there are two types of classes you are going to use: common and template classes (sjgui::CLabel,sjgui::CButton, sjgui::CDlg, etc...). You will be using common ceases in your programs. But time to time you will want to have different behavior, for example you will override some functions of CButton and you would want your version of button to be used in sjgui::CDlg. There is a template class behind each common class, so you should use sjgui::CDlgTmpl<CYourButton> instead of sjgui::CDlg. As you can notice the convention is simple, just add Tmpl (template) to the end of the common class name. Common classes are wrappers for template classes with default parameters. You will notice that each template class is based on another template class with CtrlTmpl part in the name, these class have all the functionality corresponding to the control. You should not inherit these classes, use classes with Tmpl at the end NOT CtrlTmpl.
For those who would like to know more about how it is done inside, I provide an overview. Usually users do not require even now about that. Five types of classes: helper classes, base ceases, control classes, style ceases and extra classes; common classes as described above are just typedef wrappers for style classes.
Helper classes are used to wrap some specific functionality (sjgui::CKeys, sjgui::CFont, sjgui::CPointTmpl, sjgui::CSizeTmpl, sjgui::CRectTmpl)
Base classes are used to provide basic functionality for controls. There are two base classes: sjgui::CWnd - base class for custom widgets and sjgui::CWndCtrlBase - for gui interface widgets.
Control classes are base classes of widgets for the gui, they provide functionality of the widgets. (sjgui::CSliderCtrlTmpl, sjgui::CDlgWndCtrlTmpl, sjgui::CButtonCtrlTmpl, sjgui::CPanelCtrlTmpl, etc...). Control classes have CtrlTmpl at the end of the name. They do not have drawing methods, in the sense that they do not draw anything on the screen, but control they could control drawing (example: sjgui::CPanelCtrlTmpl - which does not allow child windows to be drawn outside its area). Right now sjgui::CLabelCtrlTmpl and sjgui::CTextCtrlTmpl are exception classes, because they are responsible for the drawing of the text so it is implemented in the base control classes, so if you have style which does not do anything you will still see text, which is using default colors. Look at own_style.cpp for example
Style classes are adding drawing methods to control classes. They are collected within a namespace of a style (example: sjgui::classic). These classes change CtrlTmpl ending of the control classes to Tmpl. They are used by wrappers: common classes like: (sjgui::classic::CEdit, sjgui::classic::CButton, etc...). "sjgui::modern" is automatically used by sjgui. See also Widget Styles.
Extra classes are the set of additional widgets added for convenience (like sjgui::extra::CFPSLabel). These classes are located at the namespace sjgui::extra. Extra classes are accessed when header file <sjgui/extra.h> is included.
This is the description of compile directives, that modify the compilation behavior of the library (see Lesson 8 for details):
- SJGUI_USE_WIN32_API - use win32 api instead of glut.
- SJGUI_NO_WRAPPERS - Does not compile default windowing system. You are expected to provide your own.
- SJGUI_USE_STYLE - defines used style (it does not affect compilation), default is (sjgui::classic)
All classes are documented, so if you want to find out some specific information use quick index at the top of the page to browse through the documentation. Templates screw up documentation a lot, because it is not clear what is the base class for it :) But this is the price we should pay. I hope names of the template parameters will help you to understand what is underlying template class is supposed to be used, when I do not mention it in description for the class.