Custom GUI with wxWidgets and other questions

This forum is reserved for everything you want to talk about. It could be about programming, opinions, open source programs, development in general, or just cool stuff to share!
Post Reply
Obelix
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jan 02, 2017 4:19 pm

Custom GUI with wxWidgets and other questions

Post by Obelix »

I am looking for gui library for c++ with customization - not native looking. I want create application with my custom graphics, that will be looks same on all OS. Able to resize it, and use svg graphics for display gui.

1. The main question is, it is possible create custom looking application, like Blender3D, Steam, Krita (graphic), Reaper (audio) with wxWidgets?
2. If 1. is yes, how hard it will be (I am learning c++, and I think, I am on level when I want use some gui)? Or is it better use other library? (I know Qt but I want avoid it)
3. It is possible connect to wxWidgets some library? Skia, AGG or SDL.

PS. sorry for my english.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Custom GUI with wxWidgets and other questions

Post by doublemax »

See my answer to a similar question here: viewtopic.php?p=174376#p174376
It is possible connect to wxWidgets some library? Skia, AGG or SDL.
Depends on what you mean with "connect to". It is possible to use any almost other library together with wxWidgets.
Use the source, Luke!
Obelix
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jan 02, 2017 4:19 pm

Re: Custom GUI with wxWidgets and other questions

Post by Obelix »

Thanks, I was read this answer when I searched for custom gui with wxWidgets. How hard it will be, for beginner, create completly custom gui (listboxes, choice controls, like something in topic with your answer and more) ? It will be ok, when I am still learning C++ ?
doublemax wrote:
It is possible connect to wxWidgets some library? Skia, AGG or SDL.
Depends on what you mean with "connect to". It is possible to use any almost other library together with wxWidgets.
I mean, create some widgets with own graphics rendered with Skia, AGG, or make window where will be graphics manipulations. And SDL for own keyboard input and sound.

Btw. I am not interest in to game creation. But more for audio applications or maybe graphics program.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Custom GUI with wxWidgets and other questions

Post by doublemax »

How hard it will be, for beginner, create completely custom gui (listboxes, choice controls, like something in topic with your answer and more) ? It will be ok, when I am still learning C++ ?
Hard to tell, it won't be easy when you're new to both C++ and wxWidgets. However, once you understood how to create custom controls in general, the principle is always the same: You have a blank canvas and everything that shall appear there, must be drawn by you with wxDC methods: http://docs.wxwidgets.org/trunk/classwx_d_c.html

Then you will have to react on mouse (and maybe keyboard) events to modify the control.

The real work is the logic of each control. E.g. if you wanted to write a text control from scratch, you'd not only have to draw the content - which would be easy - but you also have to deal with cursor movement, text selection and stuff like that.
create some widgets with own graphics rendered with Skia, AGG, or make window where will be graphics manipulations. And SDL for own keyboard input and sound.
I don't know Skia, but with AGG for example you could render into a RGBA buffer, convert that to a wxBitmap and display it. Regarding SDL, there was a SDL control for wxWidgets once, but i can't remember its exact name. When you google a bit, you may find it. OTOH handling mouse and keyboard events in SDL is a little difficult, because it will be fighting with wxWidgets for the events. But i don't know enough about SDL to say more about it.
Use the source, Luke!
Obelix
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jan 02, 2017 4:19 pm

Re: Custom GUI with wxWidgets and other questions

Post by Obelix »

Thanks for answer (better late as never :)). I hope I can open this old topic to continue ask few questions.

I start learning wxWidgets due problems with library I learned.
The real work is the logic of each control. E.g. if you wanted to write a text control from scratch, you'd not only have to draw the content - which would be easy - but you also have to deal with cursor movement, text selection and stuff like that.
It is possible create text control with custom graphic but logic will be inherited from text control? Same for checkBox, ListBox etc.. it is possible change graphics but logic will be same (inherited from base checkBox, ... class)?
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Custom GUI with wxWidgets and other questions

Post by doublemax »

It is possible create text control with custom graphic but logic will be inherited from text control? Same for checkBox, ListBox etc.. it is possible change graphics but logic will be same (inherited from base checkBox, ... class)?
No. That's exactly the problem i described in my post. While contols like buttons, checkboxes, radio buttons etc. are easy to implement, some other controls are harder. A text controls might even be one of the hardest, for a listbox you could use use wxVListBox as a base which would handle most of the logic for you.

The sources for the "Universal" port can always be a start for your own implementations. They are in <wxdir>/src/univ/
The source for the textctrl is by far the lagest at 146k. That shows how much logic it requires.

(In case you don't know, the wxUniversal port doesn't use any native controls, it draws everything itself. But it's not widely used these days.)
Use the source, Luke!
Obelix
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jan 02, 2017 4:19 pm

Re: Custom GUI with wxWidgets and other questions

Post by Obelix »

If I understand, the Universal mod is only wxWidgets with own widget display, something like this tutorial from http://zetcode.com/gui/wxwidgets/customwidgets/ ?

It is good start point Writing a Generic Widget from http://docs.wxwidgets.org/3.1/overview_ ... dgets.html to create own widgets ?
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Custom GUI with wxWidgets and other questions

Post by doublemax »

https://wiki.wxwidgets.org/Painting_your_custom_control

This also contains the mouse handling and may be a better start.
Use the source, Luke!
Obelix
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon Jan 02, 2017 4:19 pm

Re: Custom GUI with wxWidgets and other questions

Post by Obelix »

Thanks.
Post Reply