How to use images in GTK Stack Switcher - c++

I'm writing an application using C++ and gtkmm. I made a Gtk stack in it. Now I want to add images instead of text on stackswitcher's buttons. I assume that it's possible because something like this is made in gtk3-demo:
Unfortunatelly the example is made using UI file and I want to do it without UI designer. For now I found this answer:
But it's not very helpful to me. The answer was to use stack.child_set_property but I checked gtkmm documentation for stack and there isn't anything like this for C++. The closest match was Gtk::Stack::child_property_name with adnotation that it returns A ChildPropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes. I suppose this may be the thing i'm looking for, but due to lack of examples I have no idea how to use it.
To sum up: Is anyone able to tell me how to set an image as StackSwitcher's label?

Ok, it seems I've found an answer. I'll post it if anyone needs it in the future:
To change Stack Switcher's text label into image I just needed to do that:
stack->child_property_icon_name(ChildName) = "Icon Name";

Related

Static wxRichTextControl?

I want to create an Help page for my wxWidgets application, which consists of only text of various fonts, sizes and colors. I tried achieving that with wxStaticText's and sizers but I was having trouble so I switched to a wxRichTextCtrl, which I like to use. The problem is, the text should of course be non-modifiable. I know of the existance of the wxRE_READONLY flag, but it doesn't hide the caret that appears when I click on the text.
Isn't there some kind of wxRichStaticTextCtrl that works exactly like a wxRichTextCtrl, but is readonly by default and doesn't have this problem? I tried looking online, but to no avail.
The best solution for "rich" static text is wxHtmlWindow: this allows you to just define your help contents in terms of simple HTML which is usually more than enough.

IUIAutomationStylesPattern implementing issue

I am trying to use uiautomation to get a color of an element of paint application.
I can easily access their size and state etc but i cant seem to find a way to get their background color? lets say i want to retrieve the color of the "new" button how do i do that?
https://msdn.microsoft.com/en-us/library/windows/desktop/hh437282%28v=vs.85%29.aspx
Here they did provide a property to retrieve the currentfillcolor property but it says that client application do not implement IUIAutomationStylesPattern interface. But then why did they provide it in the "UI Automation Client Programmers" section?
I have tried it but there is no IUIAutomationStylesPattern type available for me.
Can anyone help me in finding a way to make it work or if there's another way of approaching it?

Qt - How to create extra roles for a QDialogButtonBox

I apologize in advance for not having more code to show, this is more of a conceptual question. I am working in Qt 4.7 and I have a QDialogButtonBox in my UI to which I need to add several custom buttons*. I set the buttons up like I normally would. For example, if I'm adding a Save button, I would create it like this:
QPushButton *myButton = new QPushButton(tr("Save"));
Usually I could just add this to my UI as is. However, I've found with the button box, it needs to have a "ButtonRole" attached, which are built-in to Qt. The only role that seems close to matching what I want is "ActionRole", but that's still sort of vague as to it's meaning when looking at it later in the code. I know theoretically any of the roles could be associated with this button, but it seems like really bad practice to me to attach an unrelated-named role like "RejectRole" or "HelpRole" to it just to make it work. My question is, how can I create a new role, something like "SaveRole", that I can use for this button? I tried putting a line like #define SaveRole (some int value) in my code and using that since the ButtonRoles are enumerators, but that gave me an error saying it couldn't convert the parameters. I know there's also NRoles in ButtonRole, and it seems like that can probably be used to create new Roles, but I've been searching for about a half hour and am finding it EXTREMELY difficult to find any information on how to use this. If anyone has suggestions it would be greatly appreciated. Thanks!
*For the record, I know how easy it would be to avoid this problem by using QPushButtons individually instead of a QDialogButtonBox, but my project head wants the button box used, so unfortunately I don't have that option.
EDIT: I forgot to mention before but it may be worth bringing up, this button box is pretty large, and all the built-in roles are already in use.

How to create combobox with images in Gtk?

Can anyone please tell me how to create a combobox like following with Gtk (on Linux)? (I already ask this question for win32 API).
A code example or tutorial will be very helpful. I have tried searching this over the internet, but unfortunately documentations/tutorials aren't that much rich for Gtk. Thank you very much.
Regards,
I know how to do this in C, but I'll try to wing it in C++. First of all, use a ComboBox to display your menu, which you will fill using a TreeModel.
Create a TreeModelColumnRecord following the example here; you will need just one Gdk::Pixbuf column to display your line images.
Pass the TreeModelColumnRecord to the constructor of ListStore. Fill your ListStore with Gdk::Pixbuf images of your line patterns, and pass that to the constructor of your ComboBox (ListStore inherits from TreeModel).

Win32Api - Window Name Property

Is there any way to get a control's name through win32api? (c++)
I'm talking about the property that in C# is 'Name', like 'frmMain', or 'btnNext'.
Is there any way to retrieve this data through the win32API?
I've tried GetWindowInfo() and stuff but I think I'm not heading in the right direction..
thanks
edit: I'm iterating with EnumChildWindows() and I got the correct HWND.. not sure if I can use it to print it's name.. (im a c++/win32 absolute noob)
Added 7/10/09
By the way I found this really good tool to operate win32 apps.
http://www.autoitscript.com/autoit3/
Check it out looks good and looks like it's freeware? :)
The name of a control is usually a private variable of the control and is not exposed to win32. You could try GetWindowText to get the title of some controls or GetWindowLong to get some properties, but I don't think you can get the name of most controls.
I seriously doubt that this information is even in the executable code, I would think that from the c# compilers point of view these symbols get reduced to object pointers or window identifiers values (the IDC_ mentioned above).
Having been faced with this type of problem before I chose to create hidden static text controls with identifying text on each window to provide this named window capability to an external process. Not very elegant but solved my problem at the time.
The name property is something added, AFAIK, by the compiler. Win32 does not, inttrinsicaly, support naming like this.
In C/C++ one uses the IDC_* value instead with the added bonus that integer comparisons are far faster than string comparison.
Edit: Btw Its possible to use the IDC values mentioned above to get child controls of a dialog by using the GetDlgItemInt( hDlgWnd, IDC_* ) to get an HWND to the control. Far easier then using EnumWindows ....