Kamal123 wrote:Hello everyone,
I am having trouble regarding low level GUI widgets implementation. I have somehow implemented some basic GUI widgets, but I want to study it that how it should work and its practical implementations before implementing. Is there any standard books or pdf's related to low level GUI widgets implementation ?
You could do worse than study
https://tkdocs.com/tutorial/index.html, which contains many of the concepts you'd want to copy in a GUI toolkit:
- Windows/Widgets/Controls.
- Widget hierarchies.
- Event loops.
- Callbacks on events.
- Layout and geometry management.
So, being rather presumptuous, I am assuming you've done some rendering, and now need to put in some behaviour behind the images. So you'll want to study up on how GUI applications send and receive events in an event loop, with GUI components consuming those events to implement their behaviour.
For example, a simple button widget will consume mouse button click/release events, and respond to such events by redrawing the button in the clicked/released state, and generate further events that indicate a user has actioned (pressed and released) a button. A dialog box, for example, might complete and close when the "Ok" button is actioned. Said button might also consume keyboard events, to implement hot-keys (such as Return to action the button.)
As well as event handling, you'll also perhaps want to look at layout management. This is using container widgets into which other widgets can be grouped and have their size and position automatically managed according to simple rules, meaning your client code only has to define the layout rules, and not the details of the size and position of every widget, making GUIs easier to write and maintain.
If you're looking for code to implement all the above, Tk is complicated by being cross platform, so platform specifics are spread among different directories, but can be found at
https://github.com/tcltk/tk and is implemented in C.