MCPcopy Create free account
hub / github.com/Raais/ImStudio / drawall

Method drawall

src/sources/ims_buffer.cpp:3–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "ims_buffer.h"
2
3void ImStudio::BufferWindow::drawall()
4{
5 if (state)
6 {
7 ImVec2 parent_size = ImGui::GetWindowSize();
8 ImVec2 init_size = ImVec2(parent_size.x * 0.8, parent_size.y * 0.7);
9 ImVec2 center = ImGui::GetMainViewport()->GetCenter();
10 ImGui::SetNextWindowPos(center, ImGuiCond_Once, ImVec2(0.5f, 0.5f));
11 ImGui::SetNextWindowSize(size);
12 ImGui::SetNextWindowSize(init_size, ImGuiCond_Once);
13 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.08f, 0.09f, 0.09f, 1.00f));
14 ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.08f, 0.09f, 0.09f, 1.00f));
15 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.26f, 0.59f, 0.98f, 0.40f));
16 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.86f, 0.86f, 0.86f, 0.50f));
17 ImGui::Begin("buffer", &state);
18 size = ImGui::GetWindowSize();
19 pos = ImGui::GetWindowPos();
20 {
21 // Draw gl cursor when dragging
22 if (ImGui::IsMouseDown(0))
23 {
24 ImGui::GetIO().MouseDrawCursor = true;
25 }
26 else
27 {
28 ImGui::GetIO().MouseDrawCursor = false;
29 }
30
31 //HOTKEY: ALT + M - "Add" Context Menu
32 if ((ImGui::IsWindowHovered()) &&
33 ((ImGui::IsKeyDown(ImGuiKey_ModAlt) && (ImGui::IsKeyPressed(ImGuiKey_M))) ||
34 (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(1))))
35 {
36 ImGui::OpenPopup("bwcontextmenu");
37
38 }
39 if (ImGui::BeginPopupContextWindow("bwcontextmenu"))
40 {
41 if (ImGui::BeginMenu("Add"))
42 {
43 if (ImGui::BeginMenu("Primitives"))
44 {
45 if (ImGui::MenuItem("Button"))
46 create("button",1);
47 if (ImGui::MenuItem("Radio Button"))
48 create("radio",1);
49 if (ImGui::MenuItem("Checkbox"))
50 create("checkbox",1);
51 if (ImGui::MenuItem("Text"))
52 create("text",1);
53 if (ImGui::MenuItem("Bullet"))
54 create("bullet",1);
55 if (ImGui::MenuItem("Arrow"))
56 create("arrow",1);
57 if (ImGui::MenuItem("Combo"))
58 create("combo",1);
59 if (ImGui::MenuItem("Listbox"))
60 create("listbox",1);

Callers

nothing calls this directly

Calls 7

ImVec2Function · 0.85
ImVec4Class · 0.85
BeginPopupContextWindowFunction · 0.85
GetCenterMethod · 0.80
drawMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected