From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- include/vcl/weld.hxx | 2388 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2388 insertions(+) create mode 100644 include/vcl/weld.hxx (limited to 'include/vcl/weld.hxx') diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx new file mode 100644 index 000000000..0d58711d1 --- /dev/null +++ b/include/vcl/weld.hxx @@ -0,0 +1,2388 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_WELD_HXX +#define INCLUDED_VCL_WELD_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace awt +{ +class XWindow; +} +namespace datatransfer +{ +namespace dnd +{ +class XDropTarget; +} +} +namespace graphic +{ +class XGraphic; +} +} +} +} + +typedef css::uno::Reference a11yref; +typedef css::uno::Reference a11yrelationset; + +enum class PointerStyle; +class CommandEvent; +class InputContext; +class KeyEvent; +class MouseEvent; +class SvNumberFormatter; +class TransferDataContainer; +class OutputDevice; +class VirtualDevice; +struct SystemEnvData; + +namespace vcl +{ +class ILibreOfficeKitNotifier; +typedef OutputDevice RenderContext; +} + +namespace weld +{ +class Container; +class DialogController; + +class VCL_DLLPUBLIC Widget +{ +protected: + Link m_aFocusInHdl; + Link m_aFocusOutHdl; + Link m_aMnemonicActivateHdl; + Link m_aSizeAllocateHdl; + Link m_aKeyPressHdl; + Link m_aKeyReleaseHdl; + Link m_aMousePressHdl; + Link m_aMouseMotionHdl; + Link m_aMouseReleaseHdl; + +public: + virtual void set_sensitive(bool sensitive) = 0; + virtual bool get_sensitive() const = 0; + virtual void show() = 0; + virtual void hide() = 0; + // This function simply calls show() or hide() but is convenient when the + // visibility depends on some condition + virtual void set_visible(bool visible) + { + if (visible) + show(); + else + hide(); + } + virtual bool get_visible() const = 0; //if this widget visibility is true + virtual bool is_visible() const = 0; //if this widget visibility and all parents is true + virtual void set_can_focus(bool bCanFocus) = 0; + virtual void grab_focus() = 0; + virtual bool has_focus() const = 0; + virtual bool is_active() const = 0; //if this widget has the focus within the active window + virtual void set_has_default(bool has_default) = 0; + virtual bool get_has_default() const = 0; + virtual void set_size_request(int nWidth, int nHeight) = 0; + virtual Size get_size_request() const = 0; + virtual Size get_preferred_size() const = 0; + virtual float get_approximate_digit_width() const = 0; + virtual int get_text_height() const = 0; + virtual Size get_pixel_size(const OUString& rText) const = 0; + virtual OString get_buildable_name() const = 0; + virtual void set_help_id(const OString& rName) = 0; + virtual OString get_help_id() const = 0; + + virtual void set_grid_left_attach(int nAttach) = 0; + virtual int get_grid_left_attach() const = 0; + virtual void set_grid_width(int nCols) = 0; + virtual void set_grid_top_attach(int nAttach) = 0; + virtual int get_grid_top_attach() const = 0; + + virtual void set_hexpand(bool bExpand) = 0; + virtual bool get_hexpand() const = 0; + virtual void set_vexpand(bool bExpand) = 0; + virtual bool get_vexpand() const = 0; + + virtual void set_secondary(bool bSecondary) = 0; + + virtual void set_margin_top(int nMargin) = 0; + virtual void set_margin_bottom(int nMargin) = 0; + virtual void set_margin_left(int nMargin) = 0; + virtual void set_margin_right(int nMargin) = 0; + + virtual int get_margin_top() const = 0; + virtual int get_margin_bottom() const = 0; + virtual int get_margin_left() const = 0; + virtual int get_margin_right() const = 0; + + /* + * Report the extents of this widget relative to the rRelative target widget. + * + * To succeed, both widgets must be realized, and must share a common toplevel. + * + * returns false if the relative extents could not be determined, e.g. if + * either widget was not realized, or there was no common ancestor. + * Otherwise true. + */ + virtual bool get_extents_relative_to(Widget& rRelative, int& x, int& y, int& width, int& height) + = 0; + + virtual void set_accessible_name(const OUString& rName) = 0; + virtual OUString get_accessible_name() const = 0; + + virtual OUString get_accessible_description() const = 0; + + virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) = 0; + virtual void set_accessible_relation_label_for(weld::Widget* pLabeled) = 0; + + virtual void set_tooltip_text(const OUString& rTip) = 0; + virtual OUString get_tooltip_text() const = 0; + + virtual void connect_focus_in(const Link& rLink) + { + assert(!m_aFocusInHdl.IsSet() || !rLink.IsSet()); + m_aFocusInHdl = rLink; + } + + virtual void connect_focus_out(const Link& rLink) + { + assert(!m_aFocusOutHdl.IsSet() || !rLink.IsSet()); + m_aFocusOutHdl = rLink; + } + + // rLink is called when the mnemonic for the Widget is called. + // If rLink returns true the Widget will not automatically gain + // focus as normally occurs + virtual void connect_mnemonic_activate(const Link& rLink) + { + assert(!m_aMnemonicActivateHdl.IsSet() || !rLink.IsSet()); + m_aMnemonicActivateHdl = rLink; + } + + virtual void connect_size_allocate(const Link& rLink) + { + assert(!m_aSizeAllocateHdl.IsSet() || !rLink.IsSet()); + m_aSizeAllocateHdl = rLink; + } + + virtual void connect_key_press(const Link& rLink) + { + assert(!m_aKeyPressHdl.IsSet() || !rLink.IsSet()); + m_aKeyPressHdl = rLink; + } + + virtual void connect_key_release(const Link& rLink) + { + assert(!m_aKeyReleaseHdl.IsSet() || !rLink.IsSet()); + m_aKeyReleaseHdl = rLink; + } + + virtual void connect_mouse_press(const Link& rLink) + { + assert(!m_aMousePressHdl.IsSet() || !rLink.IsSet()); + m_aMousePressHdl = rLink; + } + + virtual void connect_mouse_move(const Link& rLink) + { + assert(!m_aMouseMotionHdl.IsSet() || !rLink.IsSet()); + m_aMouseMotionHdl = rLink; + } + + virtual void connect_mouse_release(const Link& rLink) + { + assert(!m_aMouseReleaseHdl.IsSet() || !rLink.IsSet()); + m_aMouseReleaseHdl = rLink; + } + + virtual void grab_add() = 0; + virtual bool has_grab() const = 0; + virtual void grab_remove() = 0; + + // font size is in points, not pixels, e.g. see Window::[G]etPointFont + virtual vcl::Font get_font() = 0; + + //true for rtl, false otherwise + virtual bool get_direction() const = 0; + virtual void set_direction(bool bRTL) = 0; + + virtual void freeze() = 0; + virtual void thaw() = 0; + + virtual std::unique_ptr weld_parent() const = 0; + + //iterate upwards through the hierarchy starting at this widgets parent, + //calling func with their helpid until func returns true or we run out of + //parents + virtual void help_hierarchy_foreach(const std::function& func) = 0; + + virtual OUString strip_mnemonic(const OUString& rLabel) const = 0; + + virtual VclPtr create_virtual_device() const = 0; + + //make this widget look like a page in a notebook + virtual void set_stack_background() = 0; + //make this widget look like it has a highlighted background + virtual void set_highlight_background() = 0; + //make this widget suitable for use in a toolbar + virtual void set_toolbar_background() = 0; + + virtual css::uno::Reference get_drop_target() = 0; + + virtual void connect_get_property_tree(const Link& rLink) + = 0; + + // render the widget to an output device + virtual void draw(VirtualDevice& rOutput) = 0; + + virtual ~Widget() {} +}; + +class VCL_DLLPUBLIC Container : virtual public Widget +{ +public: + // remove and add in one go + virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) = 0; + // recursively unset has-default on any buttons in the widget hierarchy + virtual void recursively_unset_default_buttons() = 0; + // create an XWindow as a child of this container. The XWindow is + // suitable to contain css::awt::XControl items + virtual css::uno::Reference CreateChildFrame() = 0; +}; + +class VCL_DLLPUBLIC Box : virtual public Container +{ +public: + // Moves child to a new position in the list of children + virtual void reorder_child(weld::Widget* pWidget, int position) = 0; +}; + +class VCL_DLLPUBLIC Paned : virtual public Container +{ +public: + // set pixel position of divider + virtual void set_position(int nPos) = 0; + // get pixel position of divider + virtual int get_position() const = 0; +}; + +class VCL_DLLPUBLIC ScrolledWindow : virtual public Container +{ +protected: + Link m_aVChangeHdl; + Link m_aHChangeHdl; + + void signal_vadjustment_changed() { m_aVChangeHdl.Call(*this); } + void signal_hadjustment_changed() { m_aHChangeHdl.Call(*this); } + +public: + virtual void set_user_managed_scrolling() = 0; + + virtual void hadjustment_configure(int value, int lower, int upper, int step_increment, + int page_increment, int page_size) + = 0; + virtual int hadjustment_get_value() const = 0; + virtual void hadjustment_set_value(int value) = 0; + virtual int hadjustment_get_upper() const = 0; + virtual void hadjustment_set_upper(int upper) = 0; + virtual int hadjustment_get_page_size() const = 0; + virtual void hadjustment_set_page_size(int size) = 0; + virtual void hadjustment_set_page_increment(int size) = 0; + virtual void hadjustment_set_step_increment(int size) = 0; + virtual void set_hpolicy(VclPolicyType eHPolicy) = 0; + virtual VclPolicyType get_hpolicy() const = 0; + void connect_hadjustment_changed(const Link& rLink) + { + m_aHChangeHdl = rLink; + } + virtual int get_hscroll_height() const = 0; + + virtual void vadjustment_configure(int value, int lower, int upper, int step_increment, + int page_increment, int page_size) + = 0; + virtual int vadjustment_get_value() const = 0; + virtual void vadjustment_set_value(int value) = 0; + virtual int vadjustment_get_upper() const = 0; + virtual void vadjustment_set_upper(int upper) = 0; + virtual int vadjustment_get_page_size() const = 0; + virtual void vadjustment_set_page_size(int size) = 0; + virtual void vadjustment_set_page_increment(int size) = 0; + virtual void vadjustment_set_step_increment(int size) = 0; + virtual int vadjustment_get_lower() const = 0; + virtual void vadjustment_set_lower(int upper) = 0; + virtual void set_vpolicy(VclPolicyType eVPolicy) = 0; + virtual VclPolicyType get_vpolicy() const = 0; + void connect_vadjustment_changed(const Link& rLink) + { + m_aVChangeHdl = rLink; + } + virtual int get_vscroll_width() const = 0; +}; + +class Label; + +class VCL_DLLPUBLIC Frame : virtual public Container +{ +public: + virtual void set_label(const OUString& rText) = 0; + virtual OUString get_label() const = 0; + virtual std::unique_ptr