1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #include "QtInstance.hxx"
13 #include <QtWidgets/QApplication>
14 #include <QtWidgets/QWidget>
15 #include <QtWidgets/QMessageBox>
16 #include "QtTools.hxx"
17 #include <vcl/weld.hxx>
18 #include <string_view>
19 #include <rtl/ustring.hxx>
20 #include <vcl/sysdata.hxx>
22 class QtInstanceWidget
: public QObject
, public virtual weld::Widget
29 QtInstanceWidget(QWidget
* pWidget
);
31 virtual QWidget
* getQWidget() const { return m_pWidget
; }
33 virtual void set_sensitive(bool bSensitive
) override
;
35 virtual bool get_sensitive() const override
;
37 virtual bool get_visible() const override
;
39 virtual bool is_visible() const override
;
41 virtual void set_can_focus(bool bCanFocus
) override
;
43 virtual void grab_focus() override
;
45 virtual bool has_focus() const override
;
47 virtual bool is_active() const override
;
49 virtual bool has_child_focus() const override
;
51 virtual void show() override
;
53 virtual void hide() override
;
55 virtual void set_size_request(int nWidth
, int nHeight
) override
;
57 virtual Size
get_size_request() const override
;
59 virtual Size
get_preferred_size() const override
;
61 virtual float get_approximate_digit_width() const override
;
63 virtual int get_text_height() const override
;
65 virtual Size
get_pixel_size(const OUString
&) const override
;
67 virtual vcl::Font
get_font() override
;
69 virtual OUString
get_buildable_name() const override
;
71 virtual void set_buildable_name(const OUString
&) override
;
73 virtual void set_help_id(const OUString
& rHelpId
) override
;
75 virtual OUString
get_help_id() const override
;
77 virtual void set_grid_left_attach(int) override
;
79 virtual int get_grid_left_attach() const override
;
81 virtual void set_grid_width(int) override
;
83 virtual void set_grid_top_attach(int) override
;
85 virtual int get_grid_top_attach() const override
;
87 virtual void set_hexpand(bool) override
;
89 virtual bool get_hexpand() const override
;
91 virtual void set_vexpand(bool) override
;
93 virtual bool get_vexpand() const override
;
95 virtual void set_margin_top(int) override
;
97 virtual void set_margin_bottom(int) override
;
99 virtual void set_margin_start(int) override
;
101 virtual void set_margin_end(int) override
;
103 virtual int get_margin_top() const override
;
105 virtual int get_margin_bottom() const override
;
107 virtual int get_margin_start() const override
;
109 virtual int get_margin_end() const override
;
111 virtual void set_accessible_name(const OUString
& rName
) override
;
113 virtual void set_accessible_description(const OUString
& rDescription
) override
;
115 virtual OUString
get_accessible_name() const override
;
117 virtual OUString
get_accessible_description() const override
;
119 virtual OUString
get_accessible_id() const override
;
121 virtual void set_accessible_relation_labeled_by(weld::Widget
*) override
;
123 virtual void set_tooltip_text(const OUString
& rTip
) override
;
125 virtual OUString
get_tooltip_text() const override
;
127 virtual void set_cursor_data(void*) override
;
129 virtual void grab_add() override
;
131 virtual bool has_grab() const override
;
133 virtual void grab_remove() override
;
135 virtual bool get_extents_relative_to(const Widget
& rRelative
, int& rX
, int& rY
, int& rWidth
,
136 int& rHeight
) const override
;
138 virtual bool get_direction() const override
;
140 virtual void set_direction(bool) override
;
142 virtual void freeze() override
;
144 virtual void thaw() override
;
146 virtual void set_busy_cursor(bool) override
;
148 virtual std::unique_ptr
<weld::Container
> weld_parent() const override
;
150 virtual void queue_resize() override
;
152 virtual void help_hierarchy_foreach(const std::function
<bool(const OUString
&)>&) override
;
154 virtual OUString
strip_mnemonic(const OUString
&) const override
;
156 virtual OUString
escape_ui_str(const OUString
& rLabel
) const override
;
158 virtual VclPtr
<VirtualDevice
> create_virtual_device() const override
;
160 virtual css::uno::Reference
<css::datatransfer::dnd::XDropTarget
> get_drop_target() override
;
162 virtual css::uno::Reference
<css::datatransfer::clipboard::XClipboard
>
163 get_clipboard() const override
;
165 virtual void connect_get_property_tree(const Link
<tools::JsonWriter
&, void>&) override
;
167 virtual void get_property_tree(tools::JsonWriter
&) override
;
169 virtual void call_attention_to() override
;
171 virtual void set_stack_background() override
;
173 virtual void set_title_background() override
;
175 virtual void set_toolbar_background() override
;
177 virtual void set_highlight_background() override
;
179 virtual void set_background(const Color
& rBackColor
) override
;
181 virtual void draw(OutputDevice
&, const Point
&, const Size
&) override
;
183 static void setHelpId(QWidget
& rWidget
, const OUString
& rHelpId
);
186 void applicationFocusChanged(QWidget
* pOldFocus
, QWidget
* pNewFocus
);
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */