Customising the appearance of GTK widgets - widget

I wish to create custom widgets using GTK+. For example I would like to create a checkbox that instead of a tick it displays an icon or gtk image that i have created. I have read the styling documentation, but it doesn't seem to allow you to change the widget.
Is it best to create a new widget or can i just customise the GTKCheckButton style?

A GtkCssProvider allows basic styling of widgets, if you need anything fancy (like special shaped windows) you will need to implement / derive your own.

Related

How can I hide widgets in a Slate document?

In Slate, I want to be able to toggle and show/hide widgets on a page (i.e. Containers widgets full of widgets or specific widgets based on a user interaction like clicking a toggle).
It's unclear to me how to do this. Is it possible with CSS?
Also, can I do this based on which user views the page?
You can definitely do this with CSS. Slate widgets have an "Additional CSS Classes" section that can conditionally apply any CSS class that you've created.
To do this, you would need to create a CSS class that hides your widget appropriately (i.e. hidden), and conditionally apply it based off of the state of the toggle.
For example:
{{#if w_toggle.on}} hidden {{/if}}
To do this based off of which user is on the page would be similar. You would just need a way to determine if the specified user is okay to view the page or not, which can be done in a function or something similar.
NOTE: Hiding widgets based off of CSS is NOT SECURE. Anything that can be done with CSS can be undone with CSS. If you choose to hide widgets using CSS, please be advised that CSS-savvy users can un-hide the widget if they so choose.
For other patterns related to showing and hiding or conditionally styling widgets, check out the section on UX/UI Considerations in the Slate Development Best Practices guide in the Foundry documentation.

How to transfer design from Adobe XD to Bootstrap

I created webapp design in Adobe XD.
Now I want to create that design in Webstorm using Bootstrap framework and HTML.
Is there tool, which can recognize items from .xd files?
Or at least where I can create items in GUI, which translates my item into HTML (for example blue square button with text inside which changes opacity when having mouse arrow on it)?
Some tools make it easier to convert the design to code, but you'll (probably) won't get around writing code to get a good website.
First of all, there is no real way to directly "convert" prototypes to websites. There are now some plugins to make things like this easier (e.g. "Lightning Storm CC"), but in all honesty, that doesn't get you around writing code yourself.
Also, it could be challenging to implement a custom design with Bootstrap (or did you use a Bootstrap UI Kit for Adobe XD?), since Bootstrap itself makes it quite tricky to achieve custom designs.
All in all, I think the solution you're looking for doesn't exist. Some tools are making it more comfortable, but you won't get around writing code when implementing a custom design. I think the truth is that there are two options: Implement a custom design (with code!) or don't care about the design aspects and use framework X (here Bootstrap).
I think easiest way is to export the design from xd using any tools to html, here is another tool might be useful "web export"
after that you just have to implement bootstrap and start adding classes to your components button,input...etc
but as mr pklaschka said it's hard to do custom without getting your hand dirty with some codes
good luck
Is there tool, which can recognize items from .xd files?
Or at least where I can create items in GUI, which translates my item into HTML (for example blue square button with text inside which changes opacity when having mouse arrow on it)?
You can use Desech Studio to import your xd file and then you need to adjust some margins and sizes. This will convert it to vanilla html/css, not bootstrap.
After that you can switch to Webstorm and code your website there, or you can stay synced with Desech Studio and integrate with react, angular, vue etc.

Is there a way to implement emoticon packs into HTML?

I am making a social networking site and would like emoticons to be available to users to click, and view a whole range of standard emoticons. I have seen around the web, and have not come up with any concrete information whether this can be done, and how.
The way I imagine the emoticons to be is similar to what WhatsApp have adopted. An emoticon icon, which, on click, displays a whole range of icons. Just wondering whether it is possible and if so, how?
It can be done, you would need a java-script widget for it though and depending on the rest of your framework it could be fully integrated or it would require some additional files.
Here is one example of such a widget, not sure if it is precisely what you need but you can get the idea there:
https://www.npmjs.com/package/emoticons-js
Umm, you can have a set of icons what you can display?
Or use the unicode entry points for the emojis?
http://apps.timwhitlock.info/emoji/tables/unicode
Then you need one element with some onclick handler in Javascript which opens up a floating div showing a selection of emojis.

AngularJS directive vs HTML styles with classes

I'm writing a single page web application using AngularJS framework with angular-ui extension.
I want to create my own look and feel for all kind of GUI components like DropdownList, DatePicker and other custom components.
When should I write custom directives and when should I use HTML tags like div, and span whith css classes (borders, background, additional buttons when hovering and more) in order to accomplish that?
Is it better or worse to create custom directives or html tags with classes?
What do you think?
Thanks
Directives are used for DOM manipulation - if you can achieve what you want with only a class, then do it. If you need to use different HTML elements / alter the functionality of the elements, apply a directive.

Styling form elements (select, checkbox, radio, etc)?

Styling form elements using css can be problematic since every browser render tag in different way (just like when safari render checkbox).
Okay lets ignore safari for a while, skinning input and button are rather easy but how to completely skin select, checkbox, radio, etc.
See this pages:
Checkbox skinning
Select skinning
Radio skinning
I've heard some JS framework such as EXTJS or MooTools can do that, but i don't want a large scale framework solution, just independent JS and we can modify the skin as we like, please no JQuery solution, since i don't use it.
Any idea to do that without using some specific framework?
If you want complete control, then you generally have to replace the browser controls completely and fake them with other elements, stylesheets and scripting.
If you don't want to use a framework, then it basically comes down to DIY.
That said, the whole concept have a couple of problems.
Trying to get the controls to behave how the user expects (given input from clicking, double clicking, triple clicking, right clicking, dragging, arrow keys, the control key, etc, etc, etc) is hard.
The controls might not look as the user expects.
Personally, I'd generally try to let form controls stick to the system defaults and not try to deviate from them. Give users what they expect.
Today there are quite many javascript solutions which allow a wide range of customization for form elements styling. A quick google came up with a few nice ones:
Perhaps the best known is the Bootstrap CSS framework:
https://getbootstrap.com/docs/4.0/components/forms
https://www.psd2html.com/js-custom-forms (jQuery plugin)
https://purecss.io/forms
https://github.com/select2/select2
https://github.com/harvesthq/chosen
Checkboxes/Radios:
https://codepen.io/vsync/pen/aBOOZB
https://codepen.io/vsync/pen/wKkuz
https://codepen.io/manabox/pen/raQmpL
Today you can find many kinds of form element styling on Codepen.com
Old answer (from May 16 '09):
yes, it is quite easy.
you can use niceforms, which is independet script for making
nice looking forms, then you can modify the graphics images /
CSS as your wish.
The idea is, coding something that looks the same with same
funcionality but different design, then you need to "give it
life" with some javascript magic :)
then, you have to have ilsteners all over the place, to check
what the user clicked, than you need to reflect that same value
to the pre-hidden form element the corresponds to the "fake"
one. means, to manipulate it. then when you send the form, the
right values are places via JS.