Window¶
These interfaces are used to implement panels and toolbars.
Window¶
-
class window : public uie::extension_base¶
Interface for window service.
Subclassed by uie::container_ui_extension_t< W, T >, uie::container_uie_window_v3_t< Base >, uie::menu_window, uie::playlist_window, uie::splitter_window
Public Functions
-
virtual const bool get_is_single_instance() const = 0¶
Gets whether the panel is single instance or not.
Note
Do not explicitly override. The service factory implements this method.
-
virtual void get_category(pfc::string_base &out) const = 0¶
Gets the category of the extension.
Categories you may use are “Toolbars”, “Panels”, “Splitters”, “Playlist views” and “Visualisations”
- Parameters
out – [out] receives the category of the panel, utf-8 encoded
-
inline virtual bool get_short_name(pfc::string_base &out) const¶
Gets the short, presumably more user-friendly than the name returned by get_name, name of the panel.
- Parameters
out – [out] receives the short name of the extension, e.g. “Order” instead of “Playback order”, or “Playlists” instead of “Playlist switcher”
- Returns
true if the extension has a short name
-
inline virtual bool get_description(pfc::string_base &out) const¶
Gets the description of the extension.
- Parameters
out – [out] receives the description of the extension, e.g. “Drop-down list for displaying and changing the current playback order”
- Returns
true if the extension has a description
-
virtual unsigned get_type() const = 0¶
Gets the type of the extension.
See also
uie::window_type_t
- Returns
a combination of uie::type_* flags
-
inline virtual bool get_prefer_multiple_instances() const¶
Gets whther the panel prefers to be created in multiple instances.
For example, a spacer panel.
- Returns
true iff the panel prefers to be created in multiple instances
-
virtual bool is_available(const window_host_ptr &p_host) const = 0¶
Get availability of the extension.
This method is called before create_or_transfer() to test, if this call will be legal. If this instance is already hosted, it should check whether the given host’s GUID equals its current host’s GUID, and should return
false
, if it does. This is mostly important for single instance extensions.Extensions that support multiple instances can generally return
true
.- Returns
whether this instance can be created in or moved to the given host
-
virtual HWND create_or_transfer_window(HWND wnd_parent, const window_host_ptr &p_host, const ui_helpers::window_position_t &p_position = ui_helpers::window_position_null) = 0¶
Create or transfer extension window.
Create your window here.
In the case of single instance panels, if your window is already created, you must (in the same order):
Hide your window. i.e:
ShowWindow(wnd, SW_HIDE)
Set the parent window to to wnd_parent. I.e.
SetParent(get_wnd(), wnd_parent)
Move your window to the new window position. I.e.:
SetWindowPos(get_wnd(), NULL, p_position.x, p_position.y, p_position.cx, p_position.cy, SWP_NOZORDER);
Call relinquish_ownership() on your current host.
Other rules you should follow are:
Ensure you are using the correct window styles. The window MUST have the WS_CHILD window style. It MUST NOT have the WS_POPUP, WS_CAPTION styles.
The window must be created hidden.
Use WS_EX_CONTROLPARENT if you have child windows that receive keyboard input, and you want them to be included in tab operations in the host window.
Do not directly create a common control as your window. You must create a window to contain any common controls, and any other controls that communicate to the parent window via WM_COMMAND and WM_NOTIFY window messages.
Under NO CIRCUMSTANCES may you subclass the host window.
If you are not hosting any panels yourself, you may dialog manage your window if you wish.
The window MUST have a dialog item ID of 0.
- Parameters
wnd_parent – [in] Handle to the window to use as the parent for your window
p_host – [in] Pointer to the host that creates the extension. This parameter may not be NULL.
p_position – [in] Initial position of the window
- Pre
May only be called if is_available() returned true.
- Returns
Window handle of the panel window
-
virtual void destroy_window() = 0¶
Destroys the extension window.
-
virtual HWND get_wnd() const = 0¶
Gets extension window handle.
- Pre
May only be called on hosted extensions.
- Returns
Window handle of the extension window
-
inline virtual void get_size_limits(size_limit_t &p_out) const¶
Gets size limits of the window.
Override if you like, or just handle WM_GETMINMAXINFO.
Note
This function is reserved for future use. Handle WM_GETMINMAXINFO for now instead.
- Parameters
p_out – [out] Receives the size limits of the window.
Public Static Functions
-
static inline bool create_by_guid(const GUID &guid, window_ptr &p_out)¶
Creates extension by GUID.
- Parameters
guid – [in] GUID of a ui_extension
p_out – [out] Receives a pointer to the window.
- Returns
true if the window was found and instantiated. You may assume that if the method returns true, p_out is a valid pointer.
-
static HWND g_on_tab(HWND wnd_focus)¶
Helper function. Activates next or previous window.
- Parameters
wnd_focus – [in] Window you want the next or previous window handle respective to.
- Returns
The handle to the window that was activated, or NULL if none was.
-
static bool g_process_keydown_keyboard_shortcuts(WPARAM wp)¶
Helper function. Processes keyboard shortcuts using keyboard_shortcut_manager_v2::process_keydown_simple(). Requires foobar2000 >= 0.9.5.
- Parameters
wp – [in] Key down message WPARAM value.
- Returns
If a shortcut was executed.
-
virtual const bool get_is_single_instance() const = 0¶
Playlist view¶
-
class playlist_window : public uie::window¶
Subclass of uie::window for playlist views.
Public Functions
-
virtual void set_focus() = 0¶
Called by host to indicate you should focus your window.
- Pre
May only be called on hosted extensions.
-
FB2K_MAKE_SERVICE_INTERFACE(playlist_window, window)¶
-
virtual void set_focus() = 0¶