Skip to content

Commit

Permalink
Add flex column & row support to CGUIGridLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
Lpsd committed Jan 19, 2025
1 parent 068a497 commit 548e530
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 51 deletions.
19 changes: 15 additions & 4 deletions Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,11 @@ void CSettings::CreateGUI()
* CEGUI tab.
**/
m_pGridLayout = reinterpret_cast<CGUIGridLayout*>(pManager->CreateGridLayout(pTabCEGUI));
m_pGridLayout->SetGrid(1, 1);

m_pGridLayout->SetGrid(9, 9);
m_pGridLayout->SetColumnWidth(1, 0.25f);
m_pGridLayout->SetColumnWidth(3, 0.25f);
m_pGridLayout->SetRowHeight(2, 0.25f);
m_pGridLayout->SetRowHeight(4, 0.25f);
vecTemp = CVector2D(12.f, 12.f);

// Grid layout section label
Expand Down Expand Up @@ -1336,14 +1339,22 @@ void CSettings::CreateGUI()
m_pGridRowsValueLabel->SetHorizontalAlign(CGUI_ALIGN_LEFT);

m_pCellAlpha->SetScrollPosition(0.5f);
m_pGridColumns->SetScrollPosition(0.2f);
m_pGridRows->SetScrollPosition(0.2f);
m_pGridColumns->SetScrollPosition(0.9f);
m_pGridRows->SetScrollPosition(0.9f);

// Grid layout
vecTemp.fY += 20.0f;
m_pGridLayout->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
m_pGridLayout->SetSize(CVector2D(500.0f, 300.0f));

//m_pTestCellLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabCEGUI, _("Test cell")));
//m_pTestCellLabel->AutoSize();
//m_pTestCellLabel->SetHorizontalAlign(CGUI_ALIGN_HORIZONTALCENTER);
//m_pTestCellLabel->SetVerticalAlign(CGUI_ALIGN_VERTICALCENTER);

//bool add = m_pGridLayout->AddItem(m_pTestCellLabel, 1, 1);
//m_pTestCellLabel->SetText(add ? "true" : "false");

// Set up the events
m_pWindow->SetEnterKeyHandler(GUI_CALLBACK(&CSettings::OnOKButtonClick, this));
m_pButtonOK->SetClickHandler(GUI_CALLBACK(&CSettings::OnOKButtonClick, this));
Expand Down
Loading

0 comments on commit 548e530

Please sign in to comment.