Add function to add a Dialog tab

This commit is contained in:
Kingcom 2013-09-28 17:23:14 +02:00
parent 478962ae2c
commit c4dbe37444
2 changed files with 31 additions and 0 deletions

View File

@ -217,6 +217,36 @@ HWND CGEDebugger::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style)
return hwnd;
}
void CGEDebugger::AddTabDialog(Dialog* dialog, wchar_t* title)
{
HWND tabControl = GetDlgItem(m_hDlg,IDC_GEDBG_MAINTAB);
HWND handle = dialog->GetDlgHandle();
TCITEM tcItem;
ZeroMemory (&tcItem,sizeof (tcItem));
tcItem.mask = TCIF_TEXT;
tcItem.dwState = 0;
tcItem.pszText = title;
tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1;
tcItem.iImage = 0;
int index = TabCtrl_GetItemCount(tabControl);
int result = TabCtrl_InsertItem(tabControl,index,&tcItem);
RECT tabRect;
GetWindowRect(tabControl,&tabRect);
MapWindowPoints(HWND_DESKTOP,m_hDlg,(LPPOINT)&tabRect,2);
TabCtrl_AdjustRect(tabControl, FALSE, &tabRect);
SetParent(handle,m_hDlg);
DWORD style = (GetWindowLong(handle,GWL_STYLE) | WS_CHILD) & ~(WS_POPUP | WS_TILEDWINDOW);
SetWindowLong(handle, GWL_STYLE, style);
MoveWindow(handle,tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top,TRUE);
tabs.push_back(handle);
ShowTab(index);
}
void CGEDebugger::ShowTab(int index, bool setControlIndex)
{
HWND tabControl = GetDlgItem(m_hDlg,IDC_GEDBG_MAINTAB);

View File

@ -44,6 +44,7 @@ private:
void SetupPreviews();
void UpdatePreviews();
HWND AddTabWindow(wchar_t* className, wchar_t* title, DWORD style = 0);
void AddTabDialog(Dialog* dialog, wchar_t* title);
void ShowTab(int index, bool setControlIndex = true);
void ShowTab(HWND pageHandle);
void UpdateSize(WORD width, WORD height);