Introduction to CLX
Charlie Calvert
Overview
- What is CLX?
- What is Qt?
- Why Qt?
- How does X Windows work?
- What is in and out?
- Events and signals
What Is CLX?
- CLX is a set of platform independent components
- CLX is divided into several parts
- BaseCLX - base CLX, system, SysUtils, classes, etc.
- VisualCLX visual components - based on Qt
- DataCLX database components - based on dbExpress and MIDAS
- NetCLX WebBroker, InternetExpress,
What is CLX?
- What Is Qt?
- A platform independent C++ class library built to run under windows and X Windows
- The C++ class library that is most prevalent under Linux and is used for KDE, the most popular desktop
- Qt licensing models
- No license for Delphi based CLX projects
- Open source for open source projects
- Qt under Linux is Open Source for Open Source projects.
- For more information go to www.trolltech.com
Why use Qt instead of GTK, etc.
- Qt was closer to Windows style of development than GTK
- Qt graphics model was closer to VCL graphics model
- Painter (similar to Canvas), Font, Pen, Brush objects
- Qt supported KDE better than GTK
- We felt using Qt would be quicker than adapting GTK to VCL
- Had to adapt to Qts C++ API
- Utilities create Delphi bindings from Qt header files
- MOC (meta object compiler) generates RTTI for Qt
- VisualCLX Handles and Hooks
How Do I Get Qt?
- Qt free edition - a QPL version is available for download at www.Trolltech.Com
- Documentation is also available at www.trolltech.com
What Makes Qt Special?
- Qt classes look very much like VCL components
- Properties appear as get/set method pairs (e.g. caption/setCaption).
- Events appear as signals
- Events are user created
- Signals are component created
- VCL merges the two
- Qt introduces many standard controls Called widgets
- Qt handles the message loop
What Makes Qt Special?
- Qt uses the X Window library
- Windows are X handles
- Graphics contexts are X graphic handles
- Qt uses the windows API under windows
- Very good C++ class library
- Some classes not wrapped
- Dictionaries, lists, maps,
- Classes are very component like
How X Differs From Windows
- X separates an application into
- The client (the code you write)
- The server (the display)
- Physical separation of UI from application
- Separation introduces performance issues
- All display commands go through TCP/IP
- X11 Architecture
What Is New to VisualCLX
- VisualCLX will use Qt for 80% of its widget implementation
- VisualCLX uses handles and hooks
- VisualCLX will introduce styles
- A new way of doing owner draw
- You can create your own styles
- Ties into Linux themes
Events and Signals
- Events are translations of X user events (key press, mouse move, paint, etc).
- Signals are component defined events, corresponding to VCL events (OnClick, OnChange, etc).
- Hooking Events requires a special hook object
Porting to CLX
- What Components are you using
- Use VCL Scanner
- Check with 3rd Party component vendors for availability
- Examine custom components
- Examine your application for Windows dependencies
- Windows API
- File case sensitivity, etc.
- Determine API availability
Porting custom components to CLX
- Expect more differences
- Look for Windows API calls
- Use VCL wrappers
- TCanvas, TBitmap, etc.
- MouseDown, MouseMove, etc.
- Create your own abstractions
- Start changing the components today
- Rule of thumb: If the API came from Microsoft, it probably will not be on Linux
What is out?
- Messages and message directive (Still supported by the compiler)
- WinAPI (Windows.pas etc.)
- COM/ActiveX/OLE
- Use dynamic methods
- Recreate window handle logic (not needed)
- Setting some windows attributes when window handle existed
- Out of the first release
- Docking (in the first release)
- Docking not in 1st version
- BiDi (bi-directional mode) not in 1st version?
- IME (input method editor) not in 1st version?
What is different?
- Many messages are now dynamics
- Broadcasts parent font may keep messages
- Unit names, locations of some classes
- Class names and hierarchy mostly unchanged
- Q(unit name) QControls, QComCtrls
- Property editors mostly unchanged
- Owner draw and Styles
- .dfm extension will change for CLX
- .dfm for windows, .xfm? for Linux
- Format will be the same (text and binary)
- This is done to help to create single source applications
What is the same?
- TCanvas
- The class hierarchy
- TControl, TWidgetControl (rename of TWinControl) TForm, TScrollingWidget (rename of TScrollingWinControl).
- MouseDown, MouseMove, KeyDown, etc.
- BaseCLX (Classes, etc.)
Events and Signals
Events are translations of X user events (key press, mouse move, paint, etc).
Signals are
Component defined "events"
Corresponding to VCL events (OnClick, OnChange, etc).
Hooking events requires a special hook object because of Qt C++isms.
Hook object is transparent to the developer
Demos
Questions and (Hopefully) Answers