neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
splitter.hpp
Go to the documentation of this file.
1// spliter.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
24
25namespace neogfx
26{
27 enum class splitter_style : uint32_t
28 {
29 None = 0x00000000,
30 Horizontal = 0x00000001,
31 Vertical = 0x00000002,
32 ResizeSinglePane = 0x00001000,
33 DrawGrip = 0x10000000
34 };
35
37 {
38 return static_cast<splitter_style>(static_cast<uint32_t>(aLhs) | static_cast<uint32_t>(aRhs));
39 }
40
42 {
43 return static_cast<splitter_style>(static_cast<uint32_t>(aLhs) & static_cast<uint32_t>(aRhs));
44 }
45
46 class splitter : public widget<>
47 {
49 private:
50 typedef std::pair<uint32_t, uint32_t> separator_type;
51 public:
56 public:
57 neogfx::size_policy size_policy() const override;
58 public:
59 i_widget& get_widget_at(const point& aPosition) override;
60 public:
61 void mouse_button_pressed(mouse_button aButton, const point& aPosition, key_modifiers_e aKeyModifiers) override;
62 void mouse_button_double_clicked(mouse_button aButton, const point& aPosition, key_modifiers_e aKeyModifiers) override;
63 void mouse_moved(const point& aPosition, key_modifiers_e aKeyModifiers) override;
64 void mouse_entered(const point& aPosition) override;
65 void mouse_left() override;
67 void capture_released() override;
68 public:
69 virtual void panes_resized();
70 virtual void reset_pane_sizes_requested(const std::optional<uint32_t>& aPane = {});
71 protected:
72 void paint(i_graphics_context& aGc) const override;
73 private:
74 void init();
75 std::optional<separator_type> separator_at(const point& aPosition) const;
76 private:
77 splitter_style iStyle;
78 std::optional<separator_type> iTracking;
79 std::pair<size, size> iSizeBeforeTracking;
80 point iTrackFrom;
81 };
82}
splitter(i_widget &aParent, splitter_style aStyle=splitter_style::Horizontal|splitter_style::DrawGrip)
void mouse_entered(const point &aPosition) override
virtual void panes_resized()
void paint(i_graphics_context &aGc) const override
void mouse_button_pressed(mouse_button aButton, const point &aPosition, key_modifiers_e aKeyModifiers) override
neogfx::size_policy size_policy() const override
neogfx::mouse_cursor mouse_cursor() const override
splitter(splitter_style aStyle=splitter_style::Horizontal|splitter_style::DrawGrip)
i_widget & get_widget_at(const point &aPosition) override
void mouse_left() override
splitter(i_layout &aLayout, splitter_style aStyle=splitter_style::Horizontal|splitter_style::DrawGrip)
void mouse_moved(const point &aPosition, key_modifiers_e aKeyModifiers) override
void capture_released() override
virtual void reset_pane_sizes_requested(const std::optional< uint32_t > &aPane={})
void mouse_button_double_clicked(mouse_button aButton, const point &aPosition, key_modifiers_e aKeyModifiers) override
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:60
splitter_style
Definition splitter.hpp:28
mouse_button
Definition i_mouse.hpp:31
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:55
#define meta_object(...)
Definition i_object.hpp:28