From 066bf7ced7d367e897af169d4bc0c93a30409ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 30 Sep 2015 22:36:56 -0700 Subject: [PATCH] Cleanup. --- 3rdparty/ocornut-imgui/imgui_wm.cpp | 264 ++++++++++++------------ 3rdparty/ocornut-imgui/imgui_wm.h | 168 +++++++-------- examples/common/imgui/ocornut_imgui.cpp | 16 +- 3 files changed, 224 insertions(+), 224 deletions(-) diff --git a/3rdparty/ocornut-imgui/imgui_wm.cpp b/3rdparty/ocornut-imgui/imgui_wm.cpp index e4927089e..51599e81c 100644 --- a/3rdparty/ocornut-imgui/imgui_wm.cpp +++ b/3rdparty/ocornut-imgui/imgui_wm.cpp @@ -17,68 +17,68 @@ #define ImwSafeDelete(pObj) { if (NULL != pObj) { delete pObj; pObj = NULL; } } -namespace ImWindow +namespace ImGuiWM { static const ImVec2 IM_VEC2_0 = ImVec2(0, 0); static const ImVec2 IM_VEC2_N1 = ImVec2(-1, -1); - int ImwId::s_iNextId = 0; + int Id::s_iNextId = 0; - ImwId::ImwId() + Id::Id() { m_iId = s_iNextId++; ImFormatString(m_pId, 11, "0x%8X", m_iId); } - ImU32 ImwId::GetId() const + ImU32 Id::GetId() const { return m_iId; } - const char* ImwId::GetStr() const + const char* Id::GetStr() const { return m_pId; } - ImwWindow::ImwWindow() + Window::Window() { m_pTitle = NULL; - ImwWindowManager::GetInstance()->AddWindow(this); + WindowManager::GetInstance()->AddWindow(this); } - ImwWindow::~ImwWindow() + Window::~Window() { - ImwWindowManager::GetInstance()->RemoveWindow(this); + WindowManager::GetInstance()->RemoveWindow(this); ImGui::MemFree(m_pTitle); } - void ImwWindow::Destroy() + void Window::Destroy() { - ImwWindowManager::GetInstance()->DestroyWindow(this); + WindowManager::GetInstance()->DestroyWindow(this); } - void ImwWindow::SetTitle(const char* pTitle) + void Window::SetTitle(const char* pTitle) { ImGui::MemFree(m_pTitle); m_pTitle = ImStrdup(pTitle); } - const char* ImwWindow::GetTitle() const + const char* Window::GetTitle() const { return m_pTitle; } - const ImVec2& ImwWindow::GetLastPosition() const + const ImVec2& Window::GetLastPosition() const { return m_oLastPosition; } - const ImVec2& ImwWindow::GetLastSize() const + const ImVec2& Window::GetLastSize() const { return m_oLastSize; } - ImwContainer::ImwContainer(ImwContainer* pParent) + Container::Container(Container* pParent) { IM_ASSERT(NULL != pParent); m_pSplits[0] = NULL; @@ -91,7 +91,7 @@ namespace ImWindow m_pParentWindow = (NULL != pParent) ? pParent->m_pParentWindow : NULL; } - ImwContainer::ImwContainer(ImwPlatformWindow* pParent) + Container::Container(PlatformWindow* pParent) { IM_ASSERT(NULL != pParent); m_pSplits[0] = NULL; @@ -104,11 +104,11 @@ namespace ImWindow m_pParentWindow = pParent; } - ImwContainer::~ImwContainer() + Container::~Container() { while (m_lWindows.begin() != m_lWindows.end()) { - ImwWindowManager::GetInstance()->RemoveWindow(*m_lWindows.begin()); + WindowManager::GetInstance()->RemoveWindow(*m_lWindows.begin()); delete *m_lWindows.begin(); m_lWindows.erase(m_lWindows.begin()); } @@ -117,13 +117,13 @@ namespace ImWindow ImwSafeDelete(m_pSplits[1]); } - void ImwContainer::CreateSplits() + void Container::CreateSplits() { - m_pSplits[0] = new ImwContainer(this); - m_pSplits[1] = new ImwContainer(this); + m_pSplits[0] = new Container(this); + m_pSplits[1] = new Container(this); } - void ImwContainer::Dock(ImwWindow* pWindow, EDockOrientation eOrientation) + void Container::Dock(Window* pWindow, EDockOrientation eOrientation) { IM_ASSERT(NULL != pWindow); @@ -197,8 +197,8 @@ namespace ImWindow break; case E_DOCK_ORIENTATION_TOP: { - ImwContainer* pSplit0 = m_pSplits[0]; - ImwContainer* pSplit1 = m_pSplits[1]; + Container* pSplit0 = m_pSplits[0]; + Container* pSplit1 = m_pSplits[1]; CreateSplits(); m_pSplits[0]->m_lWindows.push_back(pWindow); m_pSplits[1]->m_bVerticalSplit = m_bVerticalSplit; @@ -207,14 +207,14 @@ namespace ImWindow m_pSplits[1]->m_pSplits[1] = pSplit1; m_pSplits[1]->m_pSplits[0]->m_pParent = m_pSplits[1]; m_pSplits[1]->m_pSplits[1]->m_pParent = m_pSplits[1]; - m_fSplitRatio = ImwWindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; + m_fSplitRatio = WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; m_bVerticalSplit = true; } break; case E_DOCK_ORIENTATION_LEFT: { - ImwContainer* pSplit0 = m_pSplits[0]; - ImwContainer* pSplit1 = m_pSplits[1]; + Container* pSplit0 = m_pSplits[0]; + Container* pSplit1 = m_pSplits[1]; CreateSplits(); m_pSplits[0]->m_lWindows.push_back(pWindow); m_pSplits[1]->m_bVerticalSplit = m_bVerticalSplit; @@ -223,14 +223,14 @@ namespace ImWindow m_pSplits[1]->m_pSplits[1] = pSplit1; m_pSplits[1]->m_pSplits[0]->m_pParent = m_pSplits[1]; m_pSplits[1]->m_pSplits[1]->m_pParent = m_pSplits[1]; - m_fSplitRatio = ImwWindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; + m_fSplitRatio = WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; m_bVerticalSplit = false; } break; case E_DOCK_ORIENTATION_RIGHT: { - ImwContainer* pSplit0 = m_pSplits[0]; - ImwContainer* pSplit1 = m_pSplits[1]; + Container* pSplit0 = m_pSplits[0]; + Container* pSplit1 = m_pSplits[1]; CreateSplits(); m_pSplits[1]->m_lWindows.push_back(pWindow); m_pSplits[0]->m_bVerticalSplit = m_bVerticalSplit; @@ -239,14 +239,14 @@ namespace ImWindow m_pSplits[0]->m_pSplits[1] = pSplit1; m_pSplits[0]->m_pSplits[0]->m_pParent = m_pSplits[0]; m_pSplits[0]->m_pSplits[1]->m_pParent = m_pSplits[0]; - m_fSplitRatio = 1.f - ImwWindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; + m_fSplitRatio = 1.f - WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; m_bVerticalSplit = false; } break; case E_DOCK_ORIENTATION_BOTTOM: { - ImwContainer* pSplit0 = m_pSplits[0]; - ImwContainer* pSplit1 = m_pSplits[1]; + Container* pSplit0 = m_pSplits[0]; + Container* pSplit1 = m_pSplits[1]; CreateSplits(); m_pSplits[1]->m_lWindows.push_back(pWindow); m_pSplits[0]->m_bVerticalSplit = m_bVerticalSplit; @@ -255,7 +255,7 @@ namespace ImWindow m_pSplits[0]->m_pSplits[1] = pSplit1; m_pSplits[0]->m_pSplits[0]->m_pParent = m_pSplits[0]; m_pSplits[0]->m_pSplits[1]->m_pParent = m_pSplits[0]; - m_fSplitRatio = 1.f - ImwWindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; + m_fSplitRatio = 1.f - WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; m_bVerticalSplit = true; } break; @@ -264,7 +264,7 @@ namespace ImWindow } } - bool ImwContainer::UnDock(ImwWindow* pWindow) + bool Container::UnDock(Window* pWindow) { if (std::find(m_lWindows.begin(), m_lWindows.end(), pWindow) != m_lWindows.end()) { @@ -283,7 +283,7 @@ namespace ImWindow { if (m_pSplits[1]->IsSplit()) { - ImwContainer* pSplit = m_pSplits[1]; + Container* pSplit = m_pSplits[1]; m_bVerticalSplit = pSplit->m_bVerticalSplit; ImwSafeDelete(m_pSplits[0]); m_pSplits[0] = pSplit->m_pSplits[0]; @@ -312,7 +312,7 @@ namespace ImWindow { if (m_pSplits[0]->IsSplit()) { - ImwContainer* pSplit = m_pSplits[0]; + Container* pSplit = m_pSplits[0]; m_bVerticalSplit = pSplit->m_bVerticalSplit; ImwSafeDelete(m_pSplits[1]); m_pSplits[0] = pSplit->m_pSplits[0]; @@ -339,24 +339,24 @@ namespace ImWindow return false; } - bool ImwContainer::IsEmpty() + bool Container::IsEmpty() { //IM_ASSERT(IsSplit() != HasWindowTabbed()); return !(IsSplit() || HasWindowTabbed()); } - bool ImwContainer::IsSplit() + bool Container::IsSplit() { IM_ASSERT((NULL == m_pSplits[0]) == (NULL == m_pSplits[1])); return (NULL != m_pSplits[0] && NULL != m_pSplits[1]); } - bool ImwContainer::HasWindowTabbed() + bool Container::HasWindowTabbed() { return m_lWindows.size() > 0; } - ImwContainer* ImwContainer::HasWindow(const ImwWindow* pWindow) + Container* Container::HasWindow(const Window* pWindow) { if (std::find(m_lWindows.begin(), m_lWindows.end(), pWindow) != m_lWindows.end()) { @@ -366,7 +366,7 @@ namespace ImWindow { if (NULL != m_pSplits[0]) { - ImwContainer* pContainer = m_pSplits[0]->HasWindow(pWindow); + Container* pContainer = m_pSplits[0]->HasWindow(pWindow); if (NULL != pContainer) { return pContainer; @@ -374,7 +374,7 @@ namespace ImWindow } if (NULL != m_pSplits[1]) { - ImwContainer* pContainer = m_pSplits[1]->HasWindow(pWindow); + Container* pContainer = m_pSplits[1]->HasWindow(pWindow); if (NULL != pContainer) { return pContainer; @@ -384,14 +384,14 @@ namespace ImWindow return NULL; } - ImwPlatformWindow* ImwContainer::GetPlatformWindowParent() const + PlatformWindow* Container::GetPlatformWindowParent() const { return m_pParentWindow; } - void ImwContainer::Paint() + void Container::Paint() { - ImwWindowManager* pWindowManager = ImwWindowManager::GetInstance(); + WindowManager* pWindowManager = WindowManager::GetInstance(); ImGuiWindow* pWindow = ImGui::GetCurrentWindow(); const ImGuiStyle& oStyle = ImGui::GetStyle(); @@ -491,7 +491,7 @@ namespace ImWindow if (ImGui::BeginPopupContextItem("TabListMenu", 0)) { int iIndex = 0; - for (ImwWindowList::const_iterator itWindow = m_lWindows.begin(); itWindow != m_lWindows.end(); ++itWindow, ++iIndex) + for (WindowList::const_iterator itWindow = m_lWindows.begin(); itWindow != m_lWindows.end(); ++itWindow, ++iIndex) { if (ImGui::Selectable((*itWindow)->GetTitle())) { @@ -529,7 +529,7 @@ namespace ImWindow int iIndex = 0; int iNewActive = m_iActiveWindow; int iSize = int(m_lWindows.size()); - for (ImwWindowList::iterator it = m_lWindows.begin(); it != m_lWindows.end(); ++it) + for (WindowList::iterator it = m_lWindows.begin(); it != m_lWindows.end(); ++it) { const ImVec2 oTextSize = ImGui::CalcTextSize((*it)->GetTitle()); const ImVec2 oRectSize(oTextSize.x + 4, oTextSize.y+2); @@ -571,8 +571,8 @@ namespace ImWindow ImGui::PopID(); ++iIndex1; } - const ImwWindowList& lWindows = pWindowManager->GetWindowList(); - for (ImwWindowList::const_iterator itWindow = lWindows.begin(); itWindow != lWindows.end(); ++itWindow) + const WindowList& lWindows = pWindowManager->GetWindowList(); + for (WindowList::const_iterator itWindow = lWindows.begin(); itWindow != lWindows.end(); ++itWindow) { if ((*it) != (*itWindow)) { @@ -580,7 +580,7 @@ namespace ImWindow if (ImGui::BeginMenu((*itWindow)->GetTitle())) { bool bHovered = false; - ImwPlatformWindow* pPlatformWindow = pWindowManager->GetWindowParent((*itWindow)); + PlatformWindow* pPlatformWindow = pWindowManager->GetWindowParent((*itWindow)); ImVec2 oLastWinPos = (*itWindow)->GetLastPosition(); ImVec2 oLastWinSize = (*itWindow)->GetLastSize(); @@ -661,7 +661,7 @@ namespace ImWindow } m_iActiveWindow = iNewActive; - ImwWindowList::iterator itActiveWindow = m_lWindows.begin(); + WindowList::iterator itActiveWindow = m_lWindows.begin(); std::advance(itActiveWindow, m_iActiveWindow); //Draw active @@ -676,7 +676,7 @@ namespace ImWindow ImVec2 oWinPos = ImGui::GetWindowPos(); ImVec2 oWinSize = ImGui::GetWindowSize(); - for (ImwWindowList::iterator it = m_lWindows.begin(); it != m_lWindows.end(); ++it) + for (WindowList::iterator it = m_lWindows.begin(); it != m_lWindows.end(); ++it) { (*it)->m_oLastPosition = oWinPos; (*it)->m_oLastSize = oWinSize; @@ -695,7 +695,7 @@ namespace ImWindow } } - ImwContainer* ImwContainer::GetBestDocking(const ImVec2 oCursorPos, EDockOrientation& oOutOrientation, ImVec2& oOutAreaPos, ImVec2& oOutAreaSize) + Container* Container::GetBestDocking(const ImVec2 oCursorPos, EDockOrientation& oOutOrientation, ImVec2& oOutAreaPos, ImVec2& oOutAreaSize) { if (m_pParent == NULL || (oCursorPos.x >= m_oLastPosition.x && oCursorPos.x <= (m_oLastPosition.x + m_oLastSize.x) && @@ -703,7 +703,7 @@ namespace ImWindow { if (IsSplit()) { - ImwContainer* pBestContainer = NULL; + Container* pBestContainer = NULL; pBestContainer = m_pSplits[0]->GetBestDocking(oCursorPos, oOutOrientation, oOutAreaPos, oOutAreaSize); if (NULL != pBestContainer) { @@ -745,19 +745,19 @@ namespace ImWindow //Center ImRect oRectCenter(ImVec2(oCenter.x - c_fBoxHalfSize, oCenter.y - c_fBoxHalfSize), ImVec2(oCenter.x + c_fBoxHalfSize, oCenter.y + c_fBoxHalfSize)); bIsInCenter = oRectCenter.Contains(oCursorPos); - ImwWindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectCenter.Min, oRectCenter.GetSize(), bIsInCenter ? oBoxHightlightColor : oBoxColor); + WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectCenter.Min, oRectCenter.GetSize(), bIsInCenter ? oBoxHightlightColor : oBoxColor); if (m_oLastSize.y >= c_fMinSize) { //Top ImRect oRectTop(ImVec2(oCenter.x - c_fBoxHalfSize, oCenter.y - c_fBoxHalfSize * 4.f), ImVec2(oCenter.x + c_fBoxHalfSize, oCenter.y - c_fBoxHalfSize * 2.f)); bIsInTop = oRectTop.Contains(oCursorPos); - ImwWindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectTop.Min, oRectTop.GetSize(), bIsInTop ? oBoxHightlightColor : oBoxColor); + WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectTop.Min, oRectTop.GetSize(), bIsInTop ? oBoxHightlightColor : oBoxColor); //Bottom ImRect oRectBottom(ImVec2(oCenter.x - c_fBoxHalfSize, oCenter.y + c_fBoxHalfSize * 2.f), ImVec2(oCenter.x + c_fBoxHalfSize, oCenter.y + c_fBoxHalfSize * 4.f)); bIsInBottom = oRectBottom.Contains(oCursorPos); - ImwWindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectBottom.Min, oRectBottom.GetSize(), bIsInBottom ? oBoxHightlightColor : oBoxColor); + WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectBottom.Min, oRectBottom.GetSize(), bIsInBottom ? oBoxHightlightColor : oBoxColor); } if (m_oLastSize.x >= c_fMinSize) @@ -765,12 +765,12 @@ namespace ImWindow //Left ImRect oRectLeft(ImVec2(oCenter.x - c_fBoxHalfSize * 4.f, oCenter.y - c_fBoxHalfSize), ImVec2(oCenter.x - c_fBoxHalfSize * 2.f, oCenter.y + c_fBoxHalfSize)); bIsInLeft = oRectLeft.Contains(oCursorPos); - ImwWindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectLeft.Min, oRectLeft.GetSize(), bIsInLeft ? oBoxHightlightColor : oBoxColor); + WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectLeft.Min, oRectLeft.GetSize(), bIsInLeft ? oBoxHightlightColor : oBoxColor); //Right ImRect oRectRight(ImVec2(oCenter.x + c_fBoxHalfSize * 2.f, oCenter.y - c_fBoxHalfSize), ImVec2(oCenter.x + c_fBoxHalfSize * 4.f, oCenter.y + c_fBoxHalfSize)); bIsInRight = oRectRight.Contains(oCursorPos); - ImwWindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectRight.Min, oRectRight.GetSize(), bIsInRight ? oBoxHightlightColor : oBoxColor); + WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectRight.Min, oRectRight.GetSize(), bIsInRight ? oBoxHightlightColor : oBoxColor); } if (bIsInCenter) @@ -815,11 +815,11 @@ namespace ImWindow return NULL; } - ImwPlatformWindow::ImwPlatformWindow(bool bMain, bool bIsDragWindow) + PlatformWindow::PlatformWindow(bool bMain, bool bIsDragWindow) { m_bMain = bMain; m_bIsDragWindow = bIsDragWindow; - m_pContainer = new ImwContainer(this); + m_pContainer = new Container(this); m_pState = NULL; m_pPreviousState = NULL; @@ -830,7 +830,7 @@ namespace ImWindow ImGui::SetInternalState(pTemp); } - ImwPlatformWindow::~ImwPlatformWindow() + PlatformWindow::~PlatformWindow() { ImwSafeDelete(m_pContainer); @@ -844,19 +844,19 @@ namespace ImWindow ImGui::MemFree(m_pState); } - void ImwPlatformWindow::OnClose() + void PlatformWindow::OnClose() { - ImwWindowManager::GetInstance()->OnClosePlatformWindow(this); + WindowManager::GetInstance()->OnClosePlatformWindow(this); } static bool s_bStatePush = false; - bool ImwPlatformWindow::IsStateSet() + bool PlatformWindow::IsStateSet() { return s_bStatePush; } - void ImwPlatformWindow::SetState() + void PlatformWindow::SetState() { IM_ASSERT(s_bStatePush == false); s_bStatePush = true; @@ -865,7 +865,7 @@ namespace ImWindow memcpy(&((ImGuiState*)m_pState)->Style, &((ImGuiState*)m_pPreviousState)->Style, sizeof(ImGuiStyle)); } - void ImwPlatformWindow::RestoreState() + void PlatformWindow::RestoreState() { IM_ASSERT(s_bStatePush == true); s_bStatePush = false; @@ -873,48 +873,48 @@ namespace ImWindow ImGui::SetInternalState(m_pPreviousState); } - void ImwPlatformWindow::OnLoseFocus() + void PlatformWindow::OnLoseFocus() { ImGuiState& g = *((ImGuiState*)m_pState); g.SetNextWindowPosCond = g.SetNextWindowSizeCond = g.SetNextWindowContentSizeCond = g.SetNextWindowCollapsedCond = g.SetNextWindowFocus = 0; } - void ImwPlatformWindow::Paint() + void PlatformWindow::Paint() { - ImwWindowManager::GetInstance()->Paint(this); + WindowManager::GetInstance()->Paint(this); } - bool ImwPlatformWindow::IsMain() + bool PlatformWindow::IsMain() { return m_bMain; } - void ImwPlatformWindow::Dock(ImwWindow* pWindow) + void PlatformWindow::Dock(Window* pWindow) { m_pContainer->Dock(pWindow); } - bool ImwPlatformWindow::UnDock(ImwWindow* pWindow) + bool PlatformWindow::UnDock(Window* pWindow) { return m_pContainer->UnDock(pWindow); } - ImwContainer* ImwPlatformWindow::GetContainer() + Container* PlatformWindow::GetContainer() { return m_pContainer; } - ImwContainer* ImwPlatformWindow::HasWindow(ImwWindow* pWindow) + Container* PlatformWindow::HasWindow(Window* pWindow) { return m_pContainer->HasWindow(pWindow); } - void ImwPlatformWindow::PaintContainer() + void PlatformWindow::PaintContainer() { m_pContainer->Paint(); } - ImwWindowManager::DrawWindowAreaAction::DrawWindowAreaAction(ImwPlatformWindow* pWindow, const ImVec2& oRectPos, const ImVec2& oRectSize, const ImColor& oColor) + WindowManager::DrawWindowAreaAction::DrawWindowAreaAction(PlatformWindow* pWindow, const ImVec2& oRectPos, const ImVec2& oRectSize, const ImColor& oColor) : m_oColor(oColor) { m_pWindow = pWindow; @@ -922,11 +922,11 @@ namespace ImWindow m_oRectSize = oRectSize; } - ImwWindowManager* ImwWindowManager::s_pInstance = 0; + WindowManager* WindowManager::s_pInstance = 0; ////////////////////////////////////////////////////////////////////////// - ImwWindowManager::Config::Config() + WindowManager::Config::Config() : m_fDragMarginRatio(0.1f) , m_fDragMarginSizeRatio(0.25f) , m_oHightlightAreaColor(0.f, 0.5f, 1.f, 0.5f) @@ -935,7 +935,7 @@ namespace ImWindow ////////////////////////////////////////////////////////////////////////// - ImwWindowManager::ImwWindowManager() + WindowManager::WindowManager() { s_pInstance = this; m_pMainPlatformWindow = NULL; @@ -945,7 +945,7 @@ namespace ImWindow m_oDragPreviewOffset = ImVec2(-20, -10); } - ImwWindowManager::~ImwWindowManager() + WindowManager::~WindowManager() { ImwSafeDelete(m_pMainPlatformWindow); ImwSafeDelete(m_pDragPlatformWindow); @@ -953,7 +953,7 @@ namespace ImWindow ImGui::Shutdown(); } - bool ImwWindowManager::Init() + bool WindowManager::Init() { m_pMainPlatformWindow = CreatePlatformWindow(true, NULL, false); if (NULL != m_pMainPlatformWindow) @@ -966,7 +966,7 @@ namespace ImWindow return false; } - bool ImwWindowManager::Run() + bool WindowManager::Run() { if (m_pMainPlatformWindow != NULL) { @@ -977,22 +977,22 @@ namespace ImWindow return m_pMainPlatformWindow != NULL; } - void ImwWindowManager::Exit() + void WindowManager::Exit() { //TODO : Manual exit } - ImwPlatformWindow* ImwWindowManager::GetMainPlatformWindow() + PlatformWindow* WindowManager::GetMainPlatformWindow() { return m_pMainPlatformWindow; } - ImwWindowManager::Config& ImwWindowManager::GetConfig() + WindowManager::Config& WindowManager::GetConfig() { return m_oConfig; } - void ImwWindowManager::SetMainTitle(const char* pTitle) + void WindowManager::SetMainTitle(const char* pTitle) { if (NULL != m_pMainPlatformWindow) { @@ -1000,7 +1000,7 @@ namespace ImWindow } } - void ImwWindowManager::Dock(ImwWindow* pWindow, EDockOrientation eOrientation, ImwPlatformWindow* pToPlatformWindow) + void WindowManager::Dock(Window* pWindow, EDockOrientation eOrientation, PlatformWindow* pToPlatformWindow) { DockAction* pAction = new DockAction(); pAction->m_bFloat = false; @@ -1012,7 +1012,7 @@ namespace ImWindow m_lDockActions.push_back(pAction); } - void ImwWindowManager::DockTo(ImwWindow* pWindow, EDockOrientation eOrientation, ImwContainer* pContainer) + void WindowManager::DockTo(Window* pWindow, EDockOrientation eOrientation, Container* pContainer) { IM_ASSERT(NULL != pContainer); if (NULL != pContainer) @@ -1028,7 +1028,7 @@ namespace ImWindow } } - void ImwWindowManager::DockWith(ImwWindow* pWindow, ImwWindow* pWithWindow, EDockOrientation eOrientation) + void WindowManager::DockWith(Window* pWindow, Window* pWithWindow, EDockOrientation eOrientation) { DockAction* pAction = new DockAction(); pAction->m_bFloat = false; @@ -1038,7 +1038,7 @@ namespace ImWindow m_lDockActions.push_back(pAction); } - void ImwWindowManager::Float(ImwWindow* pWindow, const ImVec2& oPosition, const ImVec2& oSize) + void WindowManager::Float(Window* pWindow, const ImVec2& oPosition, const ImVec2& oSize) { DockAction* pAction = new DockAction(); pAction->m_bFloat = true; @@ -1048,25 +1048,25 @@ namespace ImWindow m_lDockActions.push_back(pAction); } - const ImwWindowList& ImwWindowManager::GetWindowList() const + const WindowList& WindowManager::GetWindowList() const { return m_lWindows; } - ImwPlatformWindow* ImwWindowManager::GetCurrentPlatformWindow() + PlatformWindow* WindowManager::GetCurrentPlatformWindow() { return m_pCurrentPlatformWindow; } - ImwPlatformWindow* ImwWindowManager::GetWindowParent(ImwWindow* pWindow) + PlatformWindow* WindowManager::GetWindowParent(Window* pWindow) { - ImwContainer* pContainer = m_pMainPlatformWindow->HasWindow(pWindow); + Container* pContainer = m_pMainPlatformWindow->HasWindow(pWindow); if (NULL != pContainer) { return m_pMainPlatformWindow; } - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) { pContainer = (*it)->HasWindow(pWindow); if (NULL != pContainer) @@ -1078,7 +1078,7 @@ namespace ImWindow return NULL; } - void ImwWindowManager::Log(const char* pFormat, ...) + void WindowManager::Log(const char* pFormat, ...) { char pBuffer[32768]; va_list argptr; @@ -1088,20 +1088,20 @@ namespace ImWindow LogFormatted(pBuffer); } - void ImwWindowManager::PreUpdate() + void WindowManager::PreUpdate() { if (NULL != m_pMainPlatformWindow) { m_pMainPlatformWindow->PreUpdate(); } - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) { (*it)->PreUpdate(); } } - void ImwWindowManager::Update() + void WindowManager::Update() { UpdatePlatformwWindowActions(); UpdateDockActions(); @@ -1109,7 +1109,7 @@ namespace ImWindow while (m_lToDestroyWindows.begin() != m_lToDestroyWindows.end()) { - ImwWindow* pWindow = *m_lToDestroyWindows.begin(); + Window* pWindow = *m_lToDestroyWindows.begin(); m_lToDestroyWindows.remove(pWindow); m_lOrphanWindows.remove(pWindow); @@ -1122,7 +1122,7 @@ namespace ImWindow while (m_lToDestroyPlatformWindows.begin() != m_lToDestroyPlatformWindows.end()) { - ImwPlatformWindow* pPlatformWindow = *m_lToDestroyPlatformWindows.begin(); + PlatformWindow* pPlatformWindow = *m_lToDestroyPlatformWindows.begin(); m_lToDestroyPlatformWindows.remove(pPlatformWindow); m_lPlatformWindows.remove(pPlatformWindow); delete pPlatformWindow; @@ -1136,7 +1136,7 @@ namespace ImWindow m_pMainPlatformWindow->Paint(); } - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) { m_pCurrentPlatformWindow = (*it); (*it)->Paint(); @@ -1145,7 +1145,7 @@ namespace ImWindow m_pCurrentPlatformWindow = NULL; } - void ImwWindowManager::UpdatePlatformwWindowActions() + void WindowManager::UpdatePlatformwWindowActions() { while (m_lPlatformWindowActions.begin() != m_lPlatformWindowActions.end()) { @@ -1171,7 +1171,7 @@ namespace ImWindow } else { - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) { if (*it == pAction->m_pPlatformWindow) { @@ -1214,7 +1214,7 @@ namespace ImWindow } } - void ImwWindowManager::UpdateDockActions() + void WindowManager::UpdateDockActions() { while (m_lDockActions.begin() != m_lDockActions.end()) { @@ -1249,7 +1249,7 @@ namespace ImWindow } } - void ImwWindowManager::UpdateOrphans() + void WindowManager::UpdateOrphans() { while (m_lOrphanWindows.begin() != m_lOrphanWindows.end()) { @@ -1270,7 +1270,7 @@ namespace ImWindow } } - void ImwWindowManager::Paint(ImwPlatformWindow* pWindow) + void WindowManager::Paint(PlatformWindow* pWindow) { if (!pWindow->GetContainer()->IsEmpty() ) { @@ -1333,7 +1333,7 @@ namespace ImWindow } } - void ImwWindowManager::StartDragWindow(ImwWindow* pWindow) + void WindowManager::StartDragWindow(Window* pWindow) { if (NULL == m_pDraggedWindow) { @@ -1352,7 +1352,7 @@ namespace ImWindow } } - void ImwWindowManager::StopDragWindow() + void WindowManager::StopDragWindow() { PlatformWindowAction* pAction = new PlatformWindowAction(); pAction->m_pPlatformWindow = m_pDragPlatformWindow; @@ -1362,7 +1362,7 @@ namespace ImWindow m_pDraggedWindow = NULL; } - void ImwWindowManager::UpdateDragWindow() + void WindowManager::UpdateDragWindow() { if (NULL != m_pDraggedWindow) { @@ -1377,10 +1377,10 @@ namespace ImWindow EDockOrientation eBestDockOrientation; ImVec2 oHightlightPos; ImVec2 oHightlightSize; - ImwContainer* pBestContainer = GetBestDocking(m_pMainPlatformWindow, oCursorPos, eBestDockOrientation, oHightlightPos, oHightlightSize); + Container* pBestContainer = GetBestDocking(m_pMainPlatformWindow, oCursorPos, eBestDockOrientation, oHightlightPos, oHightlightSize); if (NULL == pBestContainer) { - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end() && NULL == pBestContainer; ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end() && NULL == pBestContainer; ++it) { pBestContainer = GetBestDocking(*it, oCursorPos, eBestDockOrientation, oHightlightPos, oHightlightSize); } @@ -1407,7 +1407,7 @@ namespace ImWindow } } - ImwContainer* ImwWindowManager::GetBestDocking(ImwPlatformWindow* pPlatformWindow, const ImVec2 oCursorPos, EDockOrientation& oOutOrientation, ImVec2& oOutAreaPos, ImVec2& oOutAreaSize) + Container* WindowManager::GetBestDocking(PlatformWindow* pPlatformWindow, const ImVec2 oCursorPos, EDockOrientation& oOutOrientation, ImVec2& oOutAreaPos, ImVec2& oOutAreaSize) { ImVec2 oPos = pPlatformWindow->GetPosition(); ImVec2 oSize = pPlatformWindow->GetSize(); @@ -1416,7 +1416,7 @@ namespace ImWindow { ImVec2 oRectPos(oCursorPos.x - oPos.x, oCursorPos.y - oPos.y); - ImwContainer* pBestContainer = pPlatformWindow->GetContainer()->GetBestDocking(oRectPos, oOutOrientation, oOutAreaPos, oOutAreaSize); + Container* pBestContainer = pPlatformWindow->GetContainer()->GetBestDocking(oRectPos, oOutOrientation, oOutAreaPos, oOutAreaSize); if (NULL != pBestContainer) { return pBestContainer; @@ -1463,20 +1463,20 @@ namespace ImWindow return NULL; } - void ImwWindowManager::AddWindow(ImwWindow* pWindow) + void WindowManager::AddWindow(Window* pWindow) { m_lWindows.push_back(pWindow); m_lOrphanWindows.push_back(pWindow); } - void ImwWindowManager::RemoveWindow(ImwWindow* pWindow) + void WindowManager::RemoveWindow(Window* pWindow) { m_lWindows.remove(pWindow); m_lOrphanWindows.remove(pWindow); } - void ImwWindowManager::DestroyWindow(ImwWindow* pWindow) + void WindowManager::DestroyWindow(Window* pWindow) { if (NULL != pWindow && std::find(m_lToDestroyWindows.begin(), m_lToDestroyWindows.end(), pWindow) == m_lToDestroyWindows.end()) { @@ -1484,25 +1484,25 @@ namespace ImWindow } } - void ImwWindowManager::InternalDock(ImwWindow* pWindow, EDockOrientation eOrientation, ImwPlatformWindow* pToPlatformWindow) + void WindowManager::InternalDock(Window* pWindow, EDockOrientation eOrientation, PlatformWindow* pToPlatformWindow) { pToPlatformWindow->m_pContainer->Dock(pWindow, eOrientation); } - void ImwWindowManager::InternalDockTo(ImwWindow* pWindow, EDockOrientation eOrientation, ImwContainer* pToContainer) + void WindowManager::InternalDockTo(Window* pWindow, EDockOrientation eOrientation, Container* pToContainer) { pToContainer->Dock(pWindow, eOrientation); } - void ImwWindowManager::InternalDockWith(ImwWindow* pWindow, ImwWindow* pWithWindow, EDockOrientation eOrientation) + void WindowManager::InternalDockWith(Window* pWindow, Window* pWithWindow, EDockOrientation eOrientation) { - ImwContainer* pContainer = m_pMainPlatformWindow->HasWindow(pWithWindow); + Container* pContainer = m_pMainPlatformWindow->HasWindow(pWithWindow); if (NULL != pContainer) { pContainer->Dock(pWindow, eOrientation); } - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) { pContainer = (*it)->HasWindow(pWithWindow); if (NULL != pContainer) @@ -1513,9 +1513,9 @@ namespace ImWindow } } - void ImwWindowManager::InternalFloat(ImwWindow* pWindow, ImVec2 oPosition, ImVec2 oSize) + void WindowManager::InternalFloat(Window* pWindow, ImVec2 oPosition, ImVec2 oSize) { - ImwPlatformWindow* pPlatformWindow = CreatePlatformWindow(false, m_pMainPlatformWindow, false); + PlatformWindow* pPlatformWindow = CreatePlatformWindow(false, m_pMainPlatformWindow, false); if (NULL != pPlatformWindow) { m_lPlatformWindows.push_back(pPlatformWindow); @@ -1538,14 +1538,14 @@ namespace ImWindow } } - void ImwWindowManager::InternalUnDock(ImwWindow* pWindow) + void WindowManager::InternalUnDock(Window* pWindow) { if (m_pMainPlatformWindow->UnDock(pWindow)) { return; } - for (ImwPlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) + for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) { if ((*it)->UnDock(pWindow)) { @@ -1561,7 +1561,7 @@ namespace ImWindow m_pDragPlatformWindow->UnDock(pWindow); } - void ImwWindowManager::OnClosePlatformWindow(ImwPlatformWindow* pWindow) + void WindowManager::OnClosePlatformWindow(PlatformWindow* pWindow) { PlatformWindowAction* pAction = new PlatformWindowAction(); pAction->m_iFlags = E_PLATFORM_WINDOW_ACTION_DESTOY; @@ -1569,13 +1569,13 @@ namespace ImWindow m_lPlatformWindowActions.push_back(pAction); } - void ImwWindowManager::DrawWindowArea(ImwPlatformWindow* pWindow, const ImVec2& oPos, const ImVec2& oSize, const ImColor& oColor) + void WindowManager::DrawWindowArea(PlatformWindow* pWindow, const ImVec2& oPos, const ImVec2& oSize, const ImColor& oColor) { m_lDrawWindowAreas.push_back(DrawWindowAreaAction(pWindow, oPos, oSize, oColor)); } // Static - ImwWindowManager* ImwWindowManager::GetInstance() + WindowManager* WindowManager::GetInstance() { return s_pInstance; } diff --git a/3rdparty/ocornut-imgui/imgui_wm.h b/3rdparty/ocornut-imgui/imgui_wm.h index 82988de48..b7337f7a3 100644 --- a/3rdparty/ocornut-imgui/imgui_wm.h +++ b/3rdparty/ocornut-imgui/imgui_wm.h @@ -28,7 +28,7 @@ typedef unsigned int ImU32; # define ImwMap std::unordered_map #endif // ImMap -namespace ImWindow +namespace ImGuiWM { enum EDockOrientation { @@ -39,10 +39,10 @@ namespace ImWindow E_DOCK_ORIENTATION_BOTTOM, }; - class ImwId + class Id { public: - ImwId(); + Id(); ImU32 GetId() const; const char* GetStr() const; @@ -52,10 +52,10 @@ namespace ImWindow static int s_iNextId; }; - class ImwWindow + class Window { - friend class ImwWindowManager; - friend class ImwContainer; + friend class WindowManager; + friend class Container; public: virtual void OnGui() = 0; @@ -72,47 +72,47 @@ namespace ImWindow const ImVec2& GetLastSize() const; protected: - ImwWindow(); - virtual ~ImwWindow(); + Window(); + virtual ~Window(); char* m_pTitle; - ImwId m_oId; + Id m_oId; ImVec2 m_oLastPosition; ImVec2 m_oLastSize; }; - typedef ImwList ImwWindowList; + typedef ImwList WindowList; - class ImwPlatformWindow; + class PlatformWindow; - class ImwContainer + class Container { - friend class ImwPlatformWindow; + friend class PlatformWindow; public: - void Dock(ImwWindow* pWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER); - bool UnDock(ImwWindow* pWindow); + void Dock(Window* pWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER); + bool UnDock(Window* pWindow); bool IsEmpty(); bool IsSplit(); bool HasWindowTabbed(); - ImwContainer* HasWindow(const ImwWindow* pWindow); - ImwPlatformWindow* GetPlatformWindowParent() const; - ImwContainer* GetBestDocking(const ImVec2 oCursorPosInContainer,EDockOrientation& oOutOrientation,ImVec2& oOutAreaPos,ImVec2& oOutAreaSize); + Container* HasWindow(const Window* pWindow); + PlatformWindow* GetPlatformWindowParent() const; + Container* GetBestDocking(const ImVec2 oCursorPosInContainer,EDockOrientation& oOutOrientation,ImVec2& oOutAreaPos,ImVec2& oOutAreaSize); protected: - ImwContainer(ImwContainer* pParent); - ImwContainer(ImwPlatformWindow* pParent); - ~ImwContainer(); + Container(Container* pParent); + Container(PlatformWindow* pParent); + ~Container(); void CreateSplits(); void Paint(); - ImwContainer* m_pParent; - ImwPlatformWindow* m_pParentWindow; - ImwWindowList m_lWindows; - ImwContainer* m_pSplits[2]; + Container* m_pParent; + PlatformWindow* m_pParentWindow; + WindowList m_lWindows; + Container* m_pSplits[2]; float m_fSplitRatio; bool m_bVerticalSplit; @@ -124,15 +124,15 @@ namespace ImWindow ImVec2 m_oLastSize; }; - class ImwPlatformWindow + class PlatformWindow { - friend class ImwWindowManager; + friend class WindowManager; public: - ImwPlatformWindow(bool bMainWindow,bool bIsDragWindow); - virtual ~ImwPlatformWindow(); + PlatformWindow(bool bMainWindow,bool bIsDragWindow); + virtual ~PlatformWindow(); - virtual bool Init(ImwPlatformWindow* pParent) = 0; + virtual bool Init(PlatformWindow* pParent) = 0; virtual const ImVec2& GetPosition() const = 0; virtual const ImVec2& GetSize() const = 0; @@ -145,11 +145,11 @@ namespace ImWindow bool IsMain(); - void Dock(ImwWindow* pWindow); - bool UnDock(ImwWindow* pWindow); + void Dock(Window* pWindow); + bool UnDock(Window* pWindow); - ImwContainer* GetContainer(); - ImwContainer* HasWindow(ImwWindow* pWindow); + Container* GetContainer(); + Container* HasWindow(Window* pWindow); bool IsStateSet(); protected: @@ -166,21 +166,21 @@ namespace ImWindow void PaintContainer(); void OnClose(); - ImwId m_oId; + Id m_oId; bool m_bMain; bool m_bIsDragWindow; - ImwContainer* m_pContainer; + Container* m_pContainer; void* m_pState; void* m_pPreviousState; }; - typedef ImwList ImwPlatformWindowList; + typedef ImwList PlatformWindowList; - class ImwWindowManager + class WindowManager { - friend class ImwWindow; - friend class ImwPlatformWindow; - friend class ImwContainer; + friend class Window; + friend class PlatformWindow; + friend class Container; enum EPlatformWindowAction { @@ -193,7 +193,7 @@ namespace ImWindow struct PlatformWindowAction { - ImwPlatformWindow* m_pPlatformWindow; + PlatformWindow* m_pPlatformWindow; unsigned int m_iFlags; ImVec2 m_oPosition; ImVec2 m_oSize; @@ -201,16 +201,16 @@ namespace ImWindow struct DockAction { - ImwWindow* m_pWindow; + Window* m_pWindow; // Is Dock or Float bool m_bFloat; //For Docking - ImwWindow* m_pWith; + Window* m_pWith; EDockOrientation m_eOrientation; - ImwPlatformWindow* m_pToPlatformWindow; - ImwContainer* m_pToContainer; + PlatformWindow* m_pToPlatformWindow; + Container* m_pToContainer; //For Floating ImVec2 m_oPosition; @@ -219,8 +219,8 @@ namespace ImWindow struct DrawWindowAreaAction { - DrawWindowAreaAction(ImwPlatformWindow* pWindow,const ImVec2& oRectPos,const ImVec2& oRectSize,const ImColor& oColor); - ImwPlatformWindow* m_pWindow; + DrawWindowAreaAction(PlatformWindow* pWindow,const ImVec2& oRectPos,const ImVec2& oRectSize,const ImColor& oColor); + PlatformWindow* m_pWindow; ImVec2 m_oRectPos; ImVec2 m_oRectSize; ImColor m_oColor; @@ -235,52 +235,52 @@ namespace ImWindow ImColor m_oHightlightAreaColor; }; - ImwWindowManager(); - virtual ~ImwWindowManager(); + WindowManager(); + virtual ~WindowManager(); bool Init(); bool Run(); void Exit(); - ImwPlatformWindow* GetMainPlatformWindow(); + PlatformWindow* GetMainPlatformWindow(); Config& GetConfig(); void SetMainTitle(const char* pTitle); - void Dock(ImwWindow* pWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER,ImwPlatformWindow* pToPlatformWindow = NULL); - void DockTo(ImwWindow* pWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER,ImwContainer* pContainer = NULL); - void DockWith(ImwWindow* pWindow,ImwWindow* pWithWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER); - void Float(ImwWindow* pWindow,const ImVec2& oPosition = ImVec2(-1,-1),const ImVec2& oSize = ImVec2(-1,-1)); + void Dock(Window* pWindow, EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER, PlatformWindow* pToPlatformWindow = NULL); + void DockTo(Window* pWindow, EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER, Container* pContainer = NULL); + void DockWith(Window* pWindow, Window* pWithWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER); + void Float(Window* pWindow, const ImVec2& oPosition = ImVec2(-1,-1), const ImVec2& oSize = ImVec2(-1,-1)); - const ImwWindowList& GetWindowList() const; - ImwPlatformWindow* GetCurrentPlatformWindow(); - ImwPlatformWindow* GetWindowParent(ImwWindow* pWindow); + const WindowList& GetWindowList() const; + PlatformWindow* GetCurrentPlatformWindow(); + PlatformWindow* GetWindowParent(Window* pWindow); void Log(const char* pFormat, ...); virtual void LogFormatted(const char* pStr) = 0;; - static ImwWindowManager* GetInstance(); + static WindowManager* GetInstance(); protected: - virtual ImwPlatformWindow* CreatePlatformWindow(bool bMain,ImwPlatformWindow* pParent,bool bDragWindow) = 0; + virtual PlatformWindow* CreatePlatformWindow(bool bMain,PlatformWindow* pParent,bool bDragWindow) = 0; virtual void InternalRun() = 0; virtual ImVec2 GetCursorPos() = 0; virtual bool IsLeftClickDown() = 0; - void AddWindow(ImwWindow* pWindow); - void RemoveWindow(ImwWindow* pWindow); - void DestroyWindow(ImwWindow* pWindow); + void AddWindow(Window* pWindow); + void RemoveWindow(Window* pWindow); + void DestroyWindow(Window* pWindow); - void InternalDock(ImwWindow* pWindow,EDockOrientation eOrientation,ImwPlatformWindow* pToPlatformWindow); - void InternalDockTo(ImwWindow* pWindow,EDockOrientation eOrientation,ImwContainer* pToContainer); - void InternalDockWith(ImwWindow* pWindow,ImwWindow* pWithWindow,EDockOrientation eOrientation); - void InternalFloat(ImwWindow* pWindow,ImVec2 oPosition,ImVec2 oSize); - void InternalUnDock(ImwWindow* pWindow); - void InternalDrag(ImwWindow* pWindow); + void InternalDock(Window* pWindow,EDockOrientation eOrientation,PlatformWindow* pToPlatformWindow); + void InternalDockTo(Window* pWindow,EDockOrientation eOrientation,Container* pToContainer); + void InternalDockWith(Window* pWindow,Window* pWithWindow,EDockOrientation eOrientation); + void InternalFloat(Window* pWindow,ImVec2 oPosition,ImVec2 oSize); + void InternalUnDock(Window* pWindow); + void InternalDrag(Window* pWindow); - void OnClosePlatformWindow(ImwPlatformWindow* pWindow); + void OnClosePlatformWindow(PlatformWindow* pWindow); - void DrawWindowArea(ImwPlatformWindow* pWindow,const ImVec2& oPos,const ImVec2& oSize,const ImColor& oColor); + void DrawWindowArea(PlatformWindow* pWindow,const ImVec2& oPos,const ImVec2& oSize,const ImColor& oColor); void PreUpdate(); void Update(); @@ -288,31 +288,31 @@ namespace ImWindow void UpdateDockActions(); void UpdateOrphans(); - void Paint(ImwPlatformWindow* pWindow); + void Paint(PlatformWindow* pWindow); - void StartDragWindow(ImwWindow* pWindow); + void StartDragWindow(Window* pWindow); void StopDragWindow(); void UpdateDragWindow(); - ImwContainer* GetBestDocking(ImwPlatformWindow* pPlatformWindow,const ImVec2 oCursorPos,EDockOrientation& oOutOrientation,ImVec2& oOutAreaPos,ImVec2& oOutAreaSize); + Container* GetBestDocking(PlatformWindow* pPlatformWindow,const ImVec2 oCursorPos,EDockOrientation& oOutOrientation,ImVec2& oOutAreaPos,ImVec2& oOutAreaSize); Config m_oConfig; - ImwPlatformWindow* m_pMainPlatformWindow; - ImwPlatformWindowList m_lPlatformWindows; - ImwPlatformWindow* m_pDragPlatformWindow; - ImwWindowList m_lWindows; - ImwWindowList m_lOrphanWindows; - ImwWindowList m_lToDestroyWindows; - ImwPlatformWindowList m_lToDestroyPlatformWindows; + PlatformWindow* m_pMainPlatformWindow; + PlatformWindowList m_lPlatformWindows; + PlatformWindow* m_pDragPlatformWindow; + WindowList m_lWindows; + WindowList m_lOrphanWindows; + WindowList m_lToDestroyWindows; + PlatformWindowList m_lToDestroyPlatformWindows; ImwList m_lPlatformWindowActions; ImwList m_lDockActions; ImwList m_lDrawWindowAreas; - ImwPlatformWindow* m_pCurrentPlatformWindow; - ImwWindow* m_pDraggedWindow; + PlatformWindow* m_pCurrentPlatformWindow; + Window* m_pDraggedWindow; ImVec2 m_oDragPreviewOffset; - static ImwWindowManager* s_pInstance; + static WindowManager* s_pInstance; }; } diff --git a/examples/common/imgui/ocornut_imgui.cpp b/examples/common/imgui/ocornut_imgui.cpp index e90958ad7..69806a040 100644 --- a/examples/common/imgui/ocornut_imgui.cpp +++ b/examples/common/imgui/ocornut_imgui.cpp @@ -21,13 +21,13 @@ #include "vs_ocornut_imgui.bin.h" #include "fs_ocornut_imgui.bin.h" -class PlatformWindow : public ImWindow::ImwPlatformWindow +class PlatformWindow : public ImGuiWM::PlatformWindow { - typedef ImWindow::ImwPlatformWindow Super; + typedef ImGuiWM::PlatformWindow Super; public: PlatformWindow(bool _mainWindow, bool _isDragWindow) - : ImWindow::ImwPlatformWindow(_mainWindow, _isDragWindow) + : ImGuiWM::PlatformWindow(_mainWindow, _isDragWindow) , m_pos(0.0f, 0.0f) , m_size(0.0f, 0.0f) , m_drag(false) @@ -38,7 +38,7 @@ public: { } - virtual bool Init(ImWindow::ImwPlatformWindow* /*_parent*/) BX_OVERRIDE + virtual bool Init(ImGuiWM::PlatformWindow* /*_parent*/) BX_OVERRIDE { return true; } @@ -112,9 +112,9 @@ private: bool m_drag; }; -class WindowManager : public ImWindow::ImwWindowManager +class WindowManager : public ImGuiWM::WindowManager { - typedef ImWindow::ImwWindowManager Super; + typedef ImGuiWM::WindowManager Super; public: WindowManager() @@ -126,11 +126,11 @@ public: } protected: - virtual ImWindow::ImwPlatformWindow* CreatePlatformWindow(bool _main, ImWindow::ImwPlatformWindow* _parent, bool _isDragWindow) BX_OVERRIDE + virtual ImGuiWM::PlatformWindow* CreatePlatformWindow(bool _main, ImGuiWM::PlatformWindow* _parent, bool _isDragWindow) BX_OVERRIDE { PlatformWindow* window = new PlatformWindow(_main, _isDragWindow); window->Init(_parent); - return static_cast(window); + return static_cast(window); } virtual void LogFormatted(const char* _str) BX_OVERRIDE