Hello,
We’re using Slate to write our IDE and one of the tasks that I’m currently stuck on is associating menu actions with icons like so:
For the common History and Edit actions, I’m using UE’s native implementation so I got the icons for free but I still don’t understand how/where the association lives.
What I know so far:
In CoreStyle.cpp, Style->Set("GenericCommands.Delete", new IMAGE_BRUSH("Icons/Edit/icon_Edit_Delete_16x", Icon16x16));
takes care of associating the icon with the FName “GenericCommands.Delete”.
But then a Find All search for this very FName returns very little results. It’s only used in STileLayerList.cpp to override the icon. Every instance of Delete
that I’ve found is being added using menu_builder.AddMenuEntry(FGenericCommands::Get().Delete);
without ever specifying the icon. I’ve tried it myself and that’s how I was able to build the menu above and it works.
I know that AddMenuEntry()
itself has an icon override param but the comment itself says the following:
“InIconOverride, Optional name of the slate brush to use for the tool bar image. If omitted, then the action’s icon will be used instead.” Where is this action’s icon specified?!
I obviously don’t want to use the override because then I’ll have to specify it each time and any time I make any icon or naming changes, I’ll have to update all instances.
Is it that “GenericCommands.Delete” denotes “ClassName.ActionName”? I noticed that the class is called GenericCommands where the Delete FUICommandInfo
is declared but I also tried following that logic with my own code and got nothing. FGenericCommands::RegisterCommands()
also doesn’t mention any icons so at this point I’m out of ideas and need help from the pro’s!
Thanks!
Shadi