Skip to content

iwasz/gtkforms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Check out this project: https://github.com/iwasz/gtkforms-demo if you want some sort of "documentation" on GtkForms.

What is this "GtkForms" all about?

GtkForms is a C++ library which acts as a frontend to GTK+ UI library but in slightly different fashion than GTKmm does. It is not another C++ warapper over GTK+ but rather a simple MVC framework which lets one to separate application into M-V-C tiers and acts as a glue code which lets the tiers to interact with each other. It uses my another library called Tiliae which provides relection, simple EL-like language, simple state machine and IoC container. The idea comes from Java MVC frameworks such as Spring MVC, Struts etc. which simplifies development of rich user interfaces to simply implementing only model (domain specific classes with no, or simple logic - only to carry data), view (to present this data) and controller (to perform additional operations like service calls and so). So like in mentioned Java solutions, the programmer (at least in theory) is required to provide only a view, which he builds using Glade interface designer, name the widgets accordingly, connect signals to handlers using EL-like language (for instance "$controller.onClick('myButton')"), provide a controller which can be a simple C++ class with no GTK+ dependencies (only Tiliae-reflections annotations are neede), and the model class (but this is not required). The rest is meant to be done by GtkForms glue code itself. It will interchange data between M, V and C, call signal handlers etc. Your custom logic (not tied to GTK+) is encapsulated in the controller which can be easily unit-tested and maintained. In cases, where no advanced UI functionality is required, one can write a C++ app which behind the scenes uses pure GTK+ without a single line of GTK+ code.
[edit] How doest it work?

Simply put it works like Java apps do :) On the bottom of the library stack there is forementioned reflection library. C++ does not provide reflection for itself, only simple RTTI is available, which lets you to query type of polymorphic types. But only thing C++ provides is simple type_info type which lets you to check if two types are the same and get mangled string representation of that type. Tiliae reflection library, on the other hand, uses those type_info-s as a keys in map of meta-objects which holds more elaborate information such as real class name, its methods, constructors and base classes. Of course methods and constructors can be queried by name and called. So, as you can see, having this ability to call (almost any) method of (almost any) object by simply providing its name as a string, lets one to implement some sort of scripting language. And this is where Tiliae.BeanWrapper and Tiliae.K202 comes in. Both of them are higher levels of abstraction over reflection library and lets one to make more advanced queries on object properties, methods etc. OK, so having that tools lets put them together with GTK+ views, model and controller objects so we could get/set their properties and interchange them. Then lets make some simple finite state machine which will control the sequence of actions (data from V to M and back again) and you'll get GtkForms lib.
[edit] So lets build a calculator

It is relatively simple app, so I figured out it would be a good start for people who (I hope) would like to try out the library. 

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published