These interfaces are used to implement panels and toolbars.
class window : public uie::extension_base
Interface for window service.
virtual const bool get_is_single_instance() const = 0
Gets whether the panel is single instance or not.
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”
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.
out – [out] receives the short name of the extension, e.g. “Order” instead of “Playback order”, or “Playlists” instead of “Playlist switcher”
true if the extension has a short name
inline virtual bool get_description(pfc::string_base &out) const
Gets the description of the extension.
out – [out] receives the description of the extension, e.g. “Drop-down list for displaying and changing the current playback order”
true if the extension has a description
virtual unsigned get_type() const = 0
Gets the type of the extension.
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.
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
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:
Set the parent window to to wnd_parent. I.e.
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.
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
May only be called if is_available() returned true.
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.
May only be called on hosted extensions.
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.
This function is reserved for future use. Handle WM_GETMINMAXINFO for now instead.
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.
guid – [in] GUID of a ui_extension
p_out – [out] Receives a pointer to the window.
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.
wnd_focus – [in] Window you want the next or previous window handle respective to.
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.
wp – [in] Key down message WPARAM value.
If a shortcut was executed.
- virtual const bool get_is_single_instance() const = 0
Service factory for multiple instance windows.
- Usage example
static window_factory< my_uie > foo_extension;