Add public wxDocManager::GetAnyUsableView().
This method tries to find the current view harder than GetCurrentView() and always returns a non-NULL view if there are any open documents at all. This is used by wxDocManager internally to find the view to apply the user commands to and will also be needed in the upcoming changes outside of wxDocManager, so just make this method public, as it seems that it could be useful in user code too, especially if we could use some better fallback than the first opened document (e.g. the last document the user interacted with would be better). This also clarifies the confusion between GetCurrentView() and GetActiveView(), see #13296. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -557,6 +557,18 @@ public:
|
||||
*/
|
||||
virtual wxDocTemplate* FindTemplateForPath(const wxString& path);
|
||||
|
||||
/**
|
||||
Returns the view to apply a user command to.
|
||||
|
||||
This method tries to find the view that the user wants to interact
|
||||
with. It returns the same view as GetCurrentDocument() if there is any
|
||||
currently active view but falls back to the first view of the first
|
||||
document if there is no active view.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
wxView* GetAnyUsableView() const;
|
||||
|
||||
/**
|
||||
Returns the document associated with the currently active view (if
|
||||
any).
|
||||
@@ -564,7 +576,11 @@ public:
|
||||
wxDocument* GetCurrentDocument() const;
|
||||
|
||||
/**
|
||||
Returns the currently active view
|
||||
Returns the currently active view.
|
||||
|
||||
This method can return @NULL if no view is currently active.
|
||||
|
||||
@see GetAnyUsableView()
|
||||
*/
|
||||
virtual wxView* GetCurrentView() const;
|
||||
|
||||
|
Reference in New Issue
Block a user