android: Update app-specific/MIME type icons
[LibreOffice.git] / slideshow / source / engine / slideoverlaybutton.hxx
blobdb733a2b2cd48bfcfc4d54c8c85b86eb34b4986f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <sal/config.h>
24 #include <eventmultiplexer.hxx>
25 #include <mouseeventhandler.hxx>
26 #include <screenupdater.hxx>
27 #include <unoview.hxx>
28 #include <vieweventhandler.hxx>
30 #include <basegfx/point/b2dpoint.hxx>
31 #include <cppcanvas/sprite.hxx>
33 #include <com/sun/star/rendering/XBitmap.hpp>
34 #include <com/sun/star/awt/Point.hpp>
36 #include <functional>
37 #include <memory>
38 #include <vector>
40 namespace slideshow::internal
42 class EventMultiplexer;
43 typedef std::shared_ptr<class SlideOverlayButton> SlideOverlayButtonSharedPtr;
45 class SlideOverlayButton : public ViewEventHandler, public MouseEventHandler
47 public:
48 SlideOverlayButton(const SlideOverlayButton&) = delete;
49 SlideOverlayButton& operator=(const SlideOverlayButton&) = delete;
51 static SlideOverlayButtonSharedPtr
52 create(const css::uno::Reference<css::rendering::XBitmap>& xIconBitmap,
53 css::awt::Point pPosition, std::function<void(basegfx::B2DPoint)> clickHandler,
54 ScreenUpdater& rScreenUpdater, EventMultiplexer& rEventMultiplexer,
55 const UnoViewContainer& rViewContainer);
57 /** Shows button icon.
59 void show() { setVisible(true); }
61 /** Hides button icon.
63 void hide() { setVisible(false); }
65 css::geometry::IntegerSize2D getSize() const;
66 basegfx::B2DPoint calcSpritePos(UnoViewSharedPtr const& rView) const;
68 private:
69 SlideOverlayButton(css::uno::Reference<css::rendering::XBitmap> xIconBitmap,
70 css::awt::Point pPosition,
71 std::function<void(basegfx::B2DPoint)> clickHandler,
72 ScreenUpdater& rScreenUpdater, EventMultiplexer& rEventMultiplexer,
73 const UnoViewContainer& rViewContainer);
75 // ViewEventHandler
76 virtual void viewAdded(const UnoViewSharedPtr& rView) override;
77 virtual void viewRemoved(const UnoViewSharedPtr& rView) override;
78 virtual void viewChanged(const UnoViewSharedPtr& rView) override;
79 virtual void viewsChanged() override;
81 // MouseEventHandler
82 virtual bool handleMousePressed(const css::awt::MouseEvent& e) override;
83 virtual bool handleMouseReleased(const css::awt::MouseEvent& e) override;
84 virtual bool handleMouseDragged(const css::awt::MouseEvent& e) override;
85 virtual bool handleMouseMoved(const css::awt::MouseEvent& e) override;
87 void setVisible(const bool bVisible);
89 typedef std::vector<std::pair<UnoViewSharedPtr, cppcanvas::CustomSpriteSharedPtr>> ViewsVecT;
91 css::uno::Reference<css::rendering::XBitmap> mxIconBitmap;
92 EventMultiplexer& mrEventMultiplexer;
93 css::awt::Point mpPosition;
94 std::function<void(basegfx::B2DPoint)> mClickHandler;
96 ViewsVecT maViews;
97 ScreenUpdater& mrScreenUpdater;
98 bool mbVisible = false;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */