-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
268 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// Generated with ImRAD 0.7 | ||
// visit https://github.com/tpecholt/imrad | ||
|
||
#include "ui_clone_style.h" | ||
#include "ui_message_box.h" | ||
|
||
CloneStyle cloneStyle; | ||
|
||
|
||
void CloneStyle::OpenPopup(std::function<void(ImRad::ModalResult)> clb) | ||
{ | ||
callback = clb; | ||
modalResult = ImRad::None; | ||
animator.Start(ImRad::Animator::OpenPopup); | ||
ImGui::OpenPopup(ID); | ||
Init(); | ||
} | ||
|
||
void CloneStyle::ClosePopup(ImRad::ModalResult mr) | ||
{ | ||
modalResult = mr; | ||
animator.Start(ImRad::Animator::ClosePopup); | ||
} | ||
|
||
void CloneStyle::Init() | ||
{ | ||
// TODO: Add your code here | ||
styleName = ""; | ||
} | ||
|
||
void CloneStyle::Draw() | ||
{ | ||
/// @style Dark | ||
/// @unit px | ||
/// @begin TopWindow | ||
auto* ioUserData = (ImRad::IOUserData*)ImGui::GetIO().UserData; | ||
ID = ImGui::GetID("###CloneStyle"); | ||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), 0, { 0.5f, 0.5f }); //Center | ||
ImGui::SetNextWindowSize({ 250, 120 }); | ||
bool tmpOpen = true; | ||
if (ImGui::BeginPopupModal("Clone Style###CloneStyle", &tmpOpen, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) | ||
{ | ||
if (modalResult != ImRad::None) | ||
{ | ||
ImGui::CloseCurrentPopup(); | ||
if (modalResult != ImRad::Cancel) callback(modalResult); | ||
} | ||
/// @separator | ||
|
||
// TODO: Add Draw calls of dependent popup windows here | ||
messageBox.Draw(); | ||
|
||
/// @begin Input | ||
if (ImGui::IsWindowAppearing()) | ||
ImGui::SetKeyboardFocusHere(); | ||
ImGui::SetNextItemWidth(-1); | ||
ImGui::InputTextWithHint("##styleName", "New style name", &styleName, ImGuiInputTextFlags_CharsNoBlank); | ||
if (ImGui::IsItemActive()) | ||
ioUserData->imeType = ImRad::ImeText; | ||
/// @end Input | ||
|
||
/// @begin Table | ||
ImRad::Spacing(3); | ||
if (ImGui::BeginTable("table1", 3, ImGuiTableFlags_NoPadOuterX | ImGuiTableFlags_NoPadInnerX, { 0, 0 })) | ||
{ | ||
ImGui::TableSetupColumn("left-stretch", ImGuiTableColumnFlags_WidthStretch, 0); | ||
ImGui::TableSetupColumn("content", ImGuiTableColumnFlags_WidthFixed, 0); | ||
ImGui::TableSetupColumn("right-stretch", ImGuiTableColumnFlags_WidthStretch, 0); | ||
ImGui::TableNextRow(0, 0); | ||
ImGui::TableSetColumnIndex(0); | ||
/// @separator | ||
|
||
/// @begin Button | ||
ImRad::TableNextColumn(1); | ||
ImGui::BeginDisabled(styleName==""||styleName=="Classic"||styleName=="Dark"||styleName=="Light"); | ||
if (ImGui::Button("OK", { 90, 30 }) || | ||
(!ImRad::IsItemDisabled() && ImGui::IsKeyPressed(ImGuiKey_Enter, false))) | ||
{ | ||
ClosePopup(ImRad::Ok); | ||
} | ||
ImGui::EndDisabled(); | ||
/// @end Button | ||
|
||
|
||
/// @separator | ||
ImGui::EndTable(); | ||
} | ||
/// @end Table | ||
|
||
/// @separator | ||
ImGui::EndPopup(); | ||
} | ||
/// @end TopWindow | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Generated with ImRAD 0.7 | ||
// visit https://github.com/tpecholt/imrad | ||
|
||
#pragma once | ||
#include "imrad.h" | ||
|
||
class CloneStyle | ||
{ | ||
public: | ||
/// @begin interface | ||
void OpenPopup(std::function<void(ImRad::ModalResult)> clb = [](ImRad::ModalResult){}); | ||
void ClosePopup(ImRad::ModalResult mr); | ||
void Draw(); | ||
|
||
std::string styleName; | ||
/// @end interface | ||
|
||
private: | ||
/// @begin impl | ||
void Init(); | ||
|
||
ImGuiID ID = 0; | ||
ImRad::ModalResult modalResult; | ||
ImRad::Animator animator; | ||
std::function<void(ImRad::ModalResult)> callback; | ||
|
||
/// @end impl | ||
}; | ||
|
||
extern CloneStyle cloneStyle; |