Lagrange
UIPanel.h
1/*
2 * Copyright 2021 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/ui/Entity.h>
15#include <Eigen/Eigen>
16#include <functional>
17#include <string>
18
19struct ImGuiWindow;
20
21namespace lagrange {
22namespace ui {
23
24
25struct UIPanel
26{
27 enum class DockDir : int {
28 AS_NEW_TAB = -1, // Dock as tab
29 LEFT = 0,
30 RIGHT = 1,
31 UP = 2,
32 DOWN = 3
33 };
34
36 std::string title;
37
38 bool visible = true;
39 bool is_focused = false;
40
41 int imgui_flags = 0;
42 bool no_padding = false;
43
44 bool is_docked = false;
45 unsigned int dock_id = 0;
46 bool is_child = false;
47
48 int child_width = 0;
49 int child_height = 0;
50
51 // set to hide the tab bar. Don't read it, it's only true for one frame.
52 bool hide_tab_bar = false;
53
54 bool static_position_enabled = false;
55 Eigen::Vector2f static_position;
56
57 bool static_size_enabled = false;
58 Eigen::Vector2f static_size;
59
60 ImGuiWindow* imgui_window = nullptr; // non-owning
61
62
63 bool queued_focus = false;
64
65 std::function<void(Registry&, Entity)> before_fn;
66 std::function<void(Registry&, Entity)> body_fn;
67 std::function<void(Registry&, Entity)> after_fn;
68 std::function<void(Registry&, Entity)> menubar_fn;
69};
70
71/*
72 Context variables used throughout the UI.
73 They are set by the Viewer
74*/
75
77{
78 float height = 0.0f;
79};
80
82{
83 unsigned int ID;
84};
85
87{
88 int width;
89 int height;
90};
91
92
93} // namespace ui
94} // namespace lagrange
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Definition: UIPanel.h:82
Definition: UIPanel.h:77
Definition: UIPanel.h:26
std::string title
Window title, used as ImGUI ID.
Definition: UIPanel.h:36
Definition: UIPanel.h:87