New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize toolbar on OSX #23614
base: master
Are you sure you want to change the base?
Customize toolbar on OSX #23614
Conversation
Temporary fix the compilation error on MSW to satisfy the test build
Fix the parameter name typo
Fix GTK build (for now)
Fix error about assigning the variable to itself
Fix Universal build
Fixing Universal build
I have 2 comments about this:
|
Fix GTK bujild
I don't have clang installed anywhere but on OSX, so I can't test it under this compiler. How do I unmark it from that? Should I just click on the "work-needed" link?
OK, thx. Thx as always. |
@vadz, It would be nice if Stefan also could take a look. Thx. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check if this can be made to work elsewhere. Providing at least a generic implementation would be a good way to ensure we can do it, as long as this is only supported under Mac I'm not sure if we can use such API.
void MarkAvailable(bool available) { m_available = available; } | ||
bool IsAvailable() const { return m_available; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need to add functions that only make sense for toolbar tools to base wxControl
class. You will have to change the code to use them in wxToolBatTool
only.
@@ -724,6 +724,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMBOBOX, wxCommandEvent); | |||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_RCLICKED, wxCommandEvent); | |||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_DROPDOWN, wxCommandEvent); | |||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOL_ENTER, wxCommandEvent); | |||
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TB_CUSTOMIZE, wxCommandEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just TB
is really not clear enough without any context.
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TB_CUSTOMIZE, wxCommandEvent); | |
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TOOLBAR_CUSTOMIZE, wxCommandEvent); |
virtual wxToolBarToolBase *CreateTool(wxControl *control, | ||
const wxString& label) override; | ||
|
||
void *GetMacToolbar() { return m_macToolbar; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prevailing convention is to use OSX
prefix, i.e.
void *GetMacToolbar() { return m_macToolbar; }; | |
void *OSXGetToolbar() { return m_macToolbar; }; |
@@ -89,9 +89,11 @@ class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase | |||
wxObject *clientData = nullptr, | |||
const wxString& shortHelp = wxEmptyString, | |||
const wxString& longHelp = wxEmptyString) override; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to avoid whitespace-only changes (even if you make them accidentally, nothing prevents you from looking at the diff and removing them afterwards).
@@ -314,7 +319,7 @@ class WXDLLIMPEXP_CORE wxToolBarBase : public wxControl | |||
const wxString& shortHelp = wxEmptyString, | |||
wxItemKind kind = wxITEM_NORMAL) | |||
{ | |||
return AddTool(toolid, label, bitmap, wxBitmapBundle(), kind, shortHelp); | |||
return AddTool(toolid, label, bitmap, wxBitmapBundle(), kind, shortHelp, wxEmptyString, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
@@ -159,6 +159,19 @@ class wxToolBarToolBase : public wxObject | |||
|
|||
void SetDropdownMenu(wxMenu *menu); | |||
wxMenu *GetDropdownMenu() const; | |||
|
|||
/** | |||
Mark the tool to be not visible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty misleading for a function called like this. You should say it may be used to mark the tool as being not currently visible if @c available is @false
or something like that.
bool IsAvailable() const; | ||
|
||
/** | ||
Calling this function with the parameter set to false will not add the tool to the toolbar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this function with the parameter set to false will not add the tool to the toolbar | |
Calling this function with the parameter set to false prevents the tool from being added to the toolbar. |
@@ -470,6 +470,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar) | |||
combo->Append("combobox with extremely, extremely, extremely, extremely long label"); | |||
combo->Append("in a"); | |||
combo->Append("toolbar"); | |||
combo->MarkAvailable( false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create another initially unavailable control instead of hiding this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is not changed at all...
Process a @c wxEVT_TB_CUSTOMIZE event. Under MSW and OSX | ||
it will display native customization dialogs. On GTK it will | ||
be generic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be true, there is no implementation at all for MSW and just a stub for GTK. This is not necessarily a problem, but the documentation shouldn't like and you should check that the API you propose is at least in principle implementable under the other platforms.
@vadz ,
On MSW it is possible to customize toolbar. GTK does not support that and apparently the devs there are objecting to make it work. And of course generic implementation we can do whatever we want, |
Also, I started with OSX, because I am not very familiar with OSX. I will follow you review and apply where appropriate. However, I'd like to ask you - if this will become mergeable will it be easier to do the MSW here or merge it and then change MSW? Let me know. Thx. |
This is an attempt to introduce the toolbar customization functionality into the library.
However, I have couple of questions:
Please review and give me your thoughts. Only OSX implementation is here - it is supported natively by OS.
MSW will follow and then GTK.
On OSX it is available with the right click and context menu selection.
On MSW it will be available thru the double click.
On GTK I'm thinking to follow OSX way as the GtkToolbar have a "context-menu" signal. And in GTK4 it probably can be done the same way on the GtkBox.
(This PR is not ready to be applied, unless you want it to get some testing on OSX first).
Thank you.