Re: Ideas of new widgets and critics, only for enhance gtk+.



1. The 3 states button.
-----------------------

The most important, the most easy to implement is the idea of a button which can take 3 different states.

I had this idea because I often have the need of something that I have called the triboolean logic.

Which consist of something like a boolean but instead of 0 or 1 as possible values you get 3 values:

-1, 0 and 1.

It's of course easy to create this type with **typedef**:

https://github.com/mrcyberfighter/mk-project/blob/master/mk-project-1.0.0/data/templates/C_Project/headers/tribool.h

But gtk+ don't have this kind of widget and I never try to D.I.Y a widget with gtk+.

ASCII Image of a 3 state button:
++++++++++++++++++++++++++++++++

```

+-----+-----+-----+
|  -  |  0  |  +  |
+-----+-----+-----+

```

You can create you own class and implement something quite similar yourself.  I suggest you to look at the 
"history action" buttons of the recent versions of evince.  By using the correct style context 
GTK_STYLE_CLASS_LINKED <https://developer.gnome.org/gtk3/stable/GtkStyleContext.htm>, the go-forward/go-back 
buttons are fused in one block and they look slick.  Look at the source code, it's quite simple to read : 
https://git.gnome.org/browse/evince/tree/shell/ev-history-action.c, 
https://git.gnome.org/browse/evince/tree/shell/ev-history-action.h
Then, it's only a matter of using three toggle buttons instead of two push buttons, and correctly handling 
the states between themselves.


-----------------------------------------------------
https://www.mail.be


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]