Exemplo n.º 1
0
CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Dialog((LPCSTR)IDD_DISASM, _hInstance, _hParent)
{
	cpu = _cpu;

	SetWindowText(m_hDlg,_cpu->GetName());
#ifdef THEMES
	//if (WTL::CTheme::IsThemingSupported())
		//EnableThemeDialogTexture(m_hDlg ,ETDT_ENABLETAB);
#endif
	SetWindowPos(m_hDlg,0,500,200,0,0,SWP_NOSIZE);

	CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
	ptr->setDebugger(cpu);
	ptr->gotoAddr(0x00000000);

	CtrlRegisterList *rl = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST));

  rl->setCPU(cpu);

	GetWindowRect(m_hDlg,&minRect);

	//symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
	symbolMap.FillSymbolComboBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);

	GetWindowRect(GetDlgItem(m_hDlg, IDC_REGLIST),&regRect);
	GetWindowRect(GetDlgItem(m_hDlg, IDC_DISASMVIEW),&disRect);

	HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS);

	TCITEM tcItem;
	ZeroMemory (&tcItem,sizeof (tcItem));
	tcItem.mask			= TCIF_TEXT;
	tcItem.dwState		= 0;
	tcItem.pszText		= "Regs";
	tcItem.cchTextMax	= (int)strlen(tcItem.pszText)+1;
	tcItem.iImage		= 0;
	int result1 = TabCtrl_InsertItem(tabs, TabCtrl_GetItemCount(tabs),&tcItem);
	tcItem.pszText		= "Funcs";
	tcItem.cchTextMax	= (int)strlen(tcItem.pszText)+1;
	int result2 = TabCtrl_InsertItem(tabs, TabCtrl_GetItemCount(tabs),&tcItem);
	ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), SW_NORMAL);
	ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), SW_HIDE);
	SetTimer(m_hDlg,1,1000,0);
	/*
	DWORD intAddress[14] =
	{0x100, 0x200,0x300,0x400,0x500,0x600,0x700,0x800,0x900,0xc00,0xd00,0xf00,0x1300,0x1700};
	char *intName[14] = 
	{"100 Reset","200 Mcheck", "300 DSI","400 ISI","500 External",
	"600 Align","700 Program","800 FPU N/A","900 DEC","C00 SC",
	"D00 Trace","F00 Perf","1300 Breakpt","1700 Thermal"};*/

	//
	// --- activate debug mode ---
	//

	SetDebugMode(true);
}
Exemplo n.º 2
0
HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style)
{
    style |= WS_CHILD;

    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(hwnd);
    int result = TabCtrl_InsertItem(hwnd,index,&tcItem);

    RECT tabRect;
    GetWindowRect(hwnd,&tabRect);
    MapWindowPoints(HWND_DESKTOP,GetParent(hwnd),(LPPOINT)&tabRect,2);
    TabCtrl_AdjustRect(hwnd, FALSE, &tabRect);

    HWND tabHandle = CreateWindowEx(0,className,title,style,
                                    tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top,
                                    GetParent(hwnd),0,MainWindow::GetHInstance(),0);
    tabs.push_back(tabHandle);

    ShowTab(index);
    return tabHandle;
}
Exemplo n.º 3
0
int TabToFront(HWND TabWindow, int Index)
{
	assert(IsWindow(TabWindow));

	if(Index == -1)
		Index = TabCtrl_GetCurSel(TabWindow);

	if(Index == -1)
		Index = 0;

	assert(Index >= 0);
	assert(Index < TabCtrl_GetItemCount(TabWindow));

	TC_ITEM TabData;
	TabData.mask = TCIF_PARAM;

	if(TabCtrl_GetItem(TabWindow, Index, &TabData))
	{
		ShowWindow(static_cast<HWND>(GetProp(TabWindow, PropName)), SW_HIDE);
		SetWindowPos(reinterpret_cast<HWND>(TabData.lParam), HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
		SetProp(TabWindow, PropName, reinterpret_cast<HANDLE>(TabData.lParam));
		TabCtrl_SetCurSel(TabWindow, Index);
		return Index;
	}
	return -1;
}
Exemplo n.º 4
0
void TabControl::AddTabDialog(Dialog* dialog, wchar_t* title)
{
    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(hwnd);
    int result = TabCtrl_InsertItem(hwnd,index,&tcItem);

    RECT tabRect;
    GetWindowRect(hwnd,&tabRect);
    MapWindowPoints(HWND_DESKTOP,GetParent(hwnd),(LPPOINT)&tabRect,2);
    TabCtrl_AdjustRect(hwnd, FALSE, &tabRect);

    SetParent(handle,GetParent(hwnd));
    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);
}
Exemplo n.º 5
0
BOOL HexCreateNewFile(MAINWND *mainWnd)
{
	// create a new
	int count;

	TCITEM tci = { TCIF_TEXT|TCIF_PARAM, 0, 0, TEXT("(Untitled)"), 0, 0 }; 
	
	tci.lParam = (LPARAM)CreateHexViewCtrl(mainWnd->hwndMain);

	g_fFileChanged   = FALSE;

	// reset to an empty file
	SetWindowFileName(mainWnd->hwndMain, TEXT("Untitled"), FALSE, FALSE);

	g_szFileTitle[0] = '\0';
	g_szFileName[0]  = '\0';
	g_fFileChanged   = FALSE;
	
	// insert at the end of the tab-list
	count = TabCtrl_GetItemCount(mainWnd->hwndTabView);
	TabCtrl_InsertItem(mainWnd->hwndTabView, count, &tci);
	
	HexSetCurFile(mainWnd->hwndMain, count, TRUE);
	return TRUE;
}
Exemplo n.º 6
0
size_t wxNotebook::GetPageCount() const
{
    // consistency check
    wxASSERT( (int)m_pages.Count() == TabCtrl_GetItemCount(GetHwnd()) );

    return m_pages.Count();
}
Exemplo n.º 7
0
static void ActivatePrevChild(struct ParentWindowData *dat, HWND child)
{
	int i = GetTabFromHWND(dat, child);
	int l = TabCtrl_GetItemCount(dat->hwndTabs);
	i = (i+l-1) % l;
	ActivateChild(dat, GetChildFromTab(dat->hwndTabs, i)->hwnd);
}
Exemplo n.º 8
0
static INT_PTR SkinEdit_Invoke(WPARAM wParam, LPARAM lParam)
{
	SKINDESCRIPTION *psd = (SKINDESCRIPTION *)lParam;
	TCITEM tci = {0};
	RECT rcClient;
	int iTabs;

	if (psd->cbSize != sizeof(SKINDESCRIPTION))
		return 0;

	iTabs = TabCtrl_GetItemCount(psd->hWndTab);
	GetClientRect(psd->hWndParent, &rcClient);

	tci.mask = TCIF_PARAM|TCIF_TEXT;
	tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SKINITEMEDIT), psd->hWndParent, SkinEdit_ExtBkDlgProc, (LPARAM)psd);

	tci.pszText = TranslateT("Skin items");
	TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci);
	MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1);
	psd->hwndSkinEdit = (HWND)tci.lParam;

	/*
	tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_IMAGEITEMEDIT), psd->hWndParent, SkinEdit_ImageItemEditProc, (LPARAM)psd);
	tci.pszText = TranslateT("Image items");
	TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci);
	MoveWindow((HWND)tci.lParam, 5, 25, rcClient.right - 9, rcClient.bottom - 60, 1);
	psd->hwndImageEdit = (HWND)tci.lParam;
	*/

	return (INT_PTR)psd->hwndSkinEdit;
}
Exemplo n.º 9
0
int AddTab(HWND TabWindow, HWND Window, const TCHAR* Caption, int Index)
{
	assert(IsWindow(TabWindow));
	assert(IsWindow(Window));
	assert(Caption);

	if(Index == -1)
		Index = TabCtrl_GetItemCount(TabWindow);

	assert(Index >= 0);

	TC_ITEM TabData;
	TabData.mask       = TCIF_TEXT | TCIF_PARAM;
	TabData.pszText    = const_cast<TCHAR*>(Caption);
	TabData.cchTextMax = _tcslen(Caption) + 1;
	TabData.lParam     = reinterpret_cast<LPARAM>(Window);

	Index = TabCtrl_InsertItem(TabWindow, Index, &TabData);
	if(Index != -1)
	{
		RECT TabRect;
		GetWindowRect(TabWindow, &TabRect);
		MapWindowPoints(HWND_DESKTOP, GetParent(TabWindow), reinterpret_cast<POINT*>(&TabRect), 2);
		TabCtrl_AdjustRect(TabWindow, false, &TabRect);
		TabRect.right  -= TabRect.left; // .right  == width
		TabRect.bottom -= TabRect.top;  // .bottom == heigth
		SetWindowPos(Window, HWND_BOTTOM, TabRect.left, TabRect.top, TabRect.right, TabRect.bottom, SWP_HIDEWINDOW);
		SetProp(TabWindow, PropName, Window);
		SetTabThemeTexture(Window, true);
	}
	return Index;
}
Exemplo n.º 10
0
/**
 * popuplate the side bar with all sessions inside the current window. Information
 * is gathered from the tab control, which remains active (but invisible) when the
 * switch bar is in use.
 *
 * This is needed when the user switches from tabs to a switchbar layout while a
 * window is open.
 */
void CSideBar::populateAll()
{
	HWND	hwndTab = ::GetDlgItem(m_pContainer->hwnd, IDC_MSGTABS);
	if (hwndTab == NULL)
		return;

	int iItems = (int)TabCtrl_GetItemCount(hwndTab);

	TCITEM item = { 0 };
	item.mask = TCIF_PARAM;

	m_iTopButtons = 0;

	for (int i = 0; i < iItems; i++) {
		TabCtrl_GetItem(hwndTab, i, &item);
		if (item.lParam == 0 || !IsWindow((HWND)item.lParam))
			continue;

		TWindowData *dat = (TWindowData*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
		if (dat == NULL)
			continue;

		CSideBarButton *b_item = findSession(dat);
		if (b_item == NULL)
			addSession(dat, i);
		else {
			b_item->setLayout(m_currentLayout);
			if (m_dwFlags & SIDEBARLAYOUT_VERTICALORIENTATION) {
				b_item->measureItem();
				m_topHeight += b_item->getHeight() + 1;
			}
			else m_topHeight += m_elementHeight + 1;
		}
	}
}
void Explorerplusplus::SetTabIcon(int iTabId)
{
	LPITEMIDLIST pidl = NULL;
	TCITEM tcItem;
	int nTabs;
	int i = 0;

	pidl = m_pShellBrowser[iTabId]->QueryCurrentDirectoryIdl();

	nTabs = TabCtrl_GetItemCount(m_hTabCtrl);

	for(i = 0;i < nTabs;i++)
	{
		tcItem.mask = TCIF_PARAM;
		TabCtrl_GetItem(m_hTabCtrl,i,&tcItem);

		if((int)tcItem.lParam == iTabId)
		{
			SetTabIcon(i,iTabId,pidl);
			break;
		}
	}

	CoTaskMemFree(pidl);
}
Exemplo n.º 12
0
void File_Addify(HWND hwndChild, HWND hwndEdit, LPTSTR pszFile)
{
    LPFILEINFO lpfi;
    TC_ITEM tci;

    lpfi = (LPFILEINFO)Mem_Alloc(sizeof(FILEINFO));

    _tcscpy(lpfi->szFileName, pszFile);

    if (String_NumEqual(pszFile, _T("Edit1"), 5, TRUE))
            lpfi->dwFileType |= FI_TYPE_MASK_FIRST;

    SetWindowLong(hwndChild, GWL_USERDATA, (LONG)lpfi);
    EditView_SetModify(hwndEdit, FALSE);
    SetWindowText(hwndChild, pszFile);

    tci.mask = TCIF_TEXT | TCIF_PARAM;
    tci.pszText = Path_GetFileName(pszFile);
    tci.lParam = (LPARAM)hwndChild;
    TabCtrl_SetCurSel(g_hwndTabWindowBar, TabCtrl_InsertItem(g_hwndTabWindowBar, TabCtrl_GetItemCount(g_hwndTabWindowBar), &tci));

    MDI_Child_Edit_EnableToolbarButtons(hwndChild, FALSE);

    Window_UpdateLayout(g_hwndTabWindowBar);
    RedrawWindow(g_hwndTabWindowBar, NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
}
Exemplo n.º 13
0
bool RemoveTab(HWND TabWindow, int Index)
{
	assert(IsWindow(TabWindow));
	assert(Index >= 0);
	assert(Index < TabCtrl_GetItemCount(TabWindow));

	TC_ITEM TabData;
	TabData.mask = TCIF_IMAGE | TCIF_PARAM;

	if(TabCtrl_GetItem(TabWindow, Index, &TabData))
	{
		int CurIndex = TabCtrl_GetCurSel(TabWindow);
		assert(CurIndex >= -1);
		if(CurIndex != -1 && TabCtrl_DeleteItem(TabWindow, Index))
		{
			if(TabData.iImage != -1)
				TabCtrl_RemoveImage(TabWindow, TabData.iImage);

			int Count = TabCtrl_GetItemCount(TabWindow);
			assert(Count >= 0);
			if(Count == 0) // We just removed the last one, do some addition cleanup
			{
				ShowWindow(reinterpret_cast<HWND>(TabData.lParam), SW_HIDE);
				HIMAGELIST ImageList = TabCtrl_GetImageList(TabWindow);
				if(ImageList)
				{
					ImageList_Destroy(ImageList);
					TabCtrl_SetImageList(TabWindow, NULL);
				}
				RemoveProp(TabWindow, PropName);
			}
			else if(Index == CurIndex) // We're deleting the currently visible tab
			{
				if(Index == Count) // Last tab
					Index--;
				TabToFront(TabWindow, Index);
			}

			SetTabThemeTexture(reinterpret_cast<HWND>(TabData.lParam), false);
			return true;
		}
	}
	return false;
}
Exemplo n.º 14
0
BOOL CMainWnd::AddToTab(LPCTSTR szTabTitle) 
{ 
    TCITEM tie; 
	
    tie.mask = TCIF_TEXT | TCIF_IMAGE; 
    tie.iImage = -1; 
    tie.pszText = (LPTSTR)szTabTitle; 
	
    return !(TabCtrl_InsertItem(hTap, TabCtrl_GetItemCount(hTap), &tie) == -1);
}
Exemplo n.º 15
0
void
mxTab::add (mxWidget *widget, const char *text)
{
	TC_ITEM ti;

	ti.mask = TCIF_TEXT | TCIF_PARAM;
	ti.pszText = (LPSTR) text;
	ti.lParam = (LPARAM) widget;

	TabCtrl_InsertItem ((HWND) getHandle (), TabCtrl_GetItemCount ((HWND) getHandle ()), &ti);
	mxTab_resizeChild ((HWND) getHandle ());
}
Exemplo n.º 16
0
HWND GetTabWindow(HWND TabWindow, int Index)
{
	assert(IsWindow(TabWindow));
	assert(Index >= 0);
	assert(Index < TabCtrl_GetItemCount(TabWindow));

	TC_ITEM TabData;
	TabData.mask = TCIF_PARAM;
	if(TabCtrl_GetItem(TabWindow, Index, &TabData))
	{
		return reinterpret_cast<HWND>(TabData.lParam);
	}
	return NULL; 
}
Exemplo n.º 17
0
int TabControl::AppendPageToControl(wchar_t* title)
{
	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(hwnd);
	int result = TabCtrl_InsertItem(hwnd,index,&tcItem);
	return index;
}
Exemplo n.º 18
0
void Aggregates_ShowProperties (LPIDENT lpiAggregate, size_t nAlerts, BOOL fJumpToThreshold, HWND hParentModal)
{
   HWND hCurrent;

   if ((hCurrent = PropCache_Search (pcAGG_PROP, lpiAggregate)) != NULL)
      {
      SetFocus (hCurrent);

      if (fJumpToThreshold)
         {
         HWND hTab;
         if ((hTab = GetDlgItem (hCurrent, IDC_PROPSHEET_TABCTRL)) != NULL)
            {
            int nTabs = TabCtrl_GetItemCount (hTab);
            TabCtrl_SetCurSel (hTab, nTabs-1);

            NMHDR nm;
            nm.hwndFrom = hTab;
            nm.idFrom = IDC_PROPSHEET_TABCTRL;
            nm.code = TCN_SELCHANGE;
            SendMessage (hCurrent, WM_NOTIFY, 0, (LPARAM)&nm);
            }
         }
      }
   else
      {
      TCHAR szSvrName[ cchNAME ];
      TCHAR szAggName[ cchNAME ];
      lpiAggregate->GetServerName (szSvrName);
      lpiAggregate->GetAggregateName (szAggName);
      LPTSTR pszTitle = FormatString (IDS_AGG_PROP_TITLE, TEXT("%s%s"), szSvrName, szAggName);

      LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE);
      psh->fMadeCaption = TRUE;
      psh->sh.hwndParent = hParentModal;

      if (PropSheet_AddProblemsTab (psh, IDD_AGG_PROBLEMS, lpiAggregate, nAlerts) &&
          PropSheet_AddTab (psh, IDS_AGG_GENERAL_TAB, IDD_AGG_GENERAL, (DLGPROC)Aggregates_General_DlgProc, (LPARAM)lpiAggregate, TRUE, FALSE))
         {
         if (fJumpToThreshold)
            psh->sh.nStartPage = psh->sh.nPages-1;

         if (hParentModal)
            PropSheet_ShowModal (psh, PumpMessage);
         else
            PropSheet_ShowModeless (psh);
         }
      }
}
Exemplo n.º 19
0
bool TabCleanup(HWND TabWindow)
{
	assert(IsWindow(TabWindow));

	int Count = TabCtrl_GetItemCount(TabWindow);
	assert(Count >= 0);

	bool Result = true;
	for(int i = 1; i <= Count; i++)
	{
		Result = RemoveTab(TabWindow, Count-i) && Result;
	}

	return Result;
}
Exemplo n.º 20
0
int ChatContainer::getChildTab(ChatWindow *child)  {
	TCITEM tci;
	int l, i;
	HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
	l = TabCtrl_GetItemCount(hwndTabs);
	for (i = 0; i < l; i++) {
		tci.mask = TCIF_PARAM;
		TabCtrl_GetItem(hwndTabs, i, &tci);
		if (child == (ChatWindow *) tci.lParam) {
			return i;
		}
	}
	return -1;

}
Exemplo n.º 21
0
static void ActivatePrevChild(struct ParentWindowData *dat, HWND child) 
{
	int i = GetTabFromHWND(dat, child);
	int l = TabCtrl_GetItemCount(dat->hwndTabs);
	i = (i+l-1) % l;
	ActivateChild(dat, GetChildFromTab(dat->hwndTabs, i)->hwnd);
/*	int i;
	for (i=0;i<dat->childrenCount;i++) {
		if (dat->children[i] == child) {
			ActivateChild(dat, dat->children[(dat->childrenCount+i-1)%dat->childrenCount]);
			break;
		}
	}
	*/
}
Exemplo n.º 22
0
static struct MessageWindowData * GetChildFromHWND(struct ParentWindowData *dat, HWND hwnd)
{
	struct MessageWindowData * mdat;
	TCITEM tci;
	int l, i;
	l = TabCtrl_GetItemCount(dat->hwndTabs);
	for (i = 0; i < l; i++) {
		tci.mask = TCIF_PARAM;
		TabCtrl_GetItem(dat->hwndTabs, i, &tci);
		mdat = (struct MessageWindowData *) tci.lParam;
		if (mdat->hwnd == hwnd) {
			return mdat;
		}
	}
	return NULL;
}
Exemplo n.º 23
0
void TabControl::SetShowTabTitles(bool enabled)
{
	showTabTitles = enabled;
	int itemCount = TabCtrl_GetItemCount(hwnd);

	for (int i = 0; i < itemCount; i++)
	{
		TabCtrl_DeleteItem(hwnd,0);
	}

	if (showTabTitles)
	{
		for (int i = 0; i < (int) tabs.size(); i++)
		{
			AppendPageToControl(tabs[i].title);
			
			if (hasButtons == false && !noDisplayArea_)
			{
				DWORD style = GetWindowLong(tabs[i].pageHandle,GWL_STYLE) & (~WS_BORDER);
				SetWindowLong(tabs[i].pageHandle,GWL_STYLE,style);

				DWORD exStyle = GetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE) & (~WS_EX_CLIENTEDGE);
				SetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE,exStyle);
			}
		}
		TabCtrl_SetCurSel(hwnd,CurrentTabIndex());
	} else if (hasButtons == false && !noDisplayArea_)
	{
		for (int i = 0; i < (int) tabs.size(); i++)
		{
			if (tabs[i].hasBorder)
			{
				DWORD style = GetWindowLong(tabs[i].pageHandle,GWL_STYLE) | WS_BORDER;
				SetWindowLong(tabs[i].pageHandle,GWL_STYLE,style);
			}

			if (tabs[i].hasClientEdge)
			{
				DWORD exStyle = GetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE) | WS_EX_CLIENTEDGE;
				SetWindowLong(tabs[i].pageHandle,GWL_EXSTYLE,exStyle);
			}
		}
	}
	
	OnResize();
}
static void OnNextTab(HWND hDlg, BOOL bNextTab)
{
    HWND hTabCtrl = GetDlgItem(hDlg, IDC_TAB);
    int nPageCount = TabCtrl_GetItemCount(hTabCtrl);
    int nPageIndex = TabCtrl_GetCurSel(hTabCtrl);

    UNREFERENCED_PARAMETER(hDlg);

    // Determine index of the page to be selected next
    if(bNextTab == FALSE)
        nPageIndex += (nPageCount - 1);
    else
        nPageIndex++;
    nPageIndex %= nPageCount;

    // Select the given tab
    TabCtrl_SelectPageByIndex(hTabCtrl, nPageIndex);
}
Exemplo n.º 25
0
void ChatContainer::getChildWindowRect(RECT *rcChild)
{
	RECT rc, rcTabs; //rcStatus, 
	HWND hwndTabs = GetDlgItem(hWnd, IDC_TABS);
	int l = TabCtrl_GetItemCount(hwndTabs);
	GetClientRect(hWnd, &rc);
	GetClientRect(hwndTabs, &rcTabs);
	TabCtrl_AdjustRect(hwndTabs, FALSE, &rcTabs);
//	GetWindowRect(dat->hwndStatus, &rcStatus);
	rcChild->left = 0;
	rcChild->right = rc.right;
	if (l > 1) {
		rcChild->top = rcTabs.top - 1;
	} else {
		rcChild->top = 0;
	}
	rcChild->bottom = rc.bottom - rc.top;// - (rcStatus.bottom - rcStatus.top);
}
Exemplo n.º 26
0
/**
 * Adds a new page
 */
void CTabControl::addPage(CTabPage* _page)
{
wchar_t s[256];
TCITEM tc;
	tc.mask = TCIF_PARAM | TCIF_TEXT;
	wcsncpy(s,_page->getText().c_str(), 256);
	tc.pszText = s;
	tc.cchTextMax = wcslen(tc.pszText);
	tc.lParam = (LPARAM)_page;
	
	if(TabCtrl_InsertItem(getHandle(), TabCtrl_GetItemCount(getHandle()), &tc) == -1)
	{
		MessageBox(parent->getHandle(), L"Could not add tab page", L"Error", MB_OK);
	}

	pages.push_back(_page);
	_page->hide();
}
Exemplo n.º 27
0
int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
{
	TWindowData *dat = (TWindowData*) GetWindowLongPtr(hwndChild, GWLP_USERDATA);	// needed to obtain the hContact for the message window
	if (!dat || !pContainer)
		return FALSE;

	NMHDR nmhdr = { 0 };
	nmhdr.code = TCN_SELCHANGE;
	if (TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS)) > 1 && !(pContainer->dwFlags & CNT_DEFERREDTABSELECT)) {
		TabCtrl_SetCurSel(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetTabIndexFromHWND(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), hwndChild));
		SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr);	// just select the tab and let WM_NOTIFY do the rest
	}
	if (dat->bType == SESSIONTYPE_IM)
		SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
	if (IsIconic(pContainer->hwnd)) {
		SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
		SetForegroundWindow(pContainer->hwnd);
	}
	//MaD - hide on close feature
	if (!IsWindowVisible(pContainer->hwnd)) {
		WINDOWPLACEMENT wp={0};
		wp.length = sizeof(wp);
		GetWindowPlacement(pContainer->hwnd, &wp);

		/*
		 * all tabs must re-check the layout on activation because adding a tab while
		 * the container was hidden can make this necessary
		 */
		BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0);
		if (wp.showCmd == SW_SHOWMAXIMIZED)
			ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
		else {
			ShowWindow(pContainer->hwnd, SW_SHOWNA);
			SetForegroundWindow(pContainer->hwnd);
		}
		SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);			// make sure the active tab resizes its layout properly
	}
	//MaD_
	else if (GetForegroundWindow() != pContainer->hwnd)
		SetForegroundWindow(pContainer->hwnd);
	if (dat->bType == SESSIONTYPE_IM)
		SetFocus(GetDlgItem(hwndChild, IDC_MESSAGE));
	return TRUE;
}
Exemplo n.º 28
0
void Filesets_ShowProperties (LPIDENT lpiFileset, size_t nAlerts, BOOL fJumpToThreshold)
{
   HWND hCurrent;
   if ((hCurrent = PropCache_Search (pcSET_PROP, lpiFileset)) != NULL)
      {
      SetFocus (hCurrent);

      if (fJumpToThreshold)
         {
         HWND hTab;
         if ((hTab = GetDlgItem (hCurrent, IDC_PROPSHEET_TABCTRL)) != NULL)
            {
            int nTabs = TabCtrl_GetItemCount (hTab);
            TabCtrl_SetCurSel (hTab, nTabs-1);

            NMHDR nm;
            nm.hwndFrom = hTab;
            nm.idFrom = IDC_PROPSHEET_TABCTRL;
            nm.code = TCN_SELCHANGE;
            SendMessage (hCurrent, WM_NOTIFY, 0, (LPARAM)&nm);
            }
         }
      }
   else
      {
      TCHAR szCell[ cchNAME ];
      lpiFileset->GetCellName (szCell);

      TCHAR szFileset[ cchNAME ];
      lpiFileset->GetFilesetName (szFileset);

      LPTSTR pszTitle = FormatString (IDS_SET_PROP_TITLE, TEXT("%s"), szFileset);
      LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE);
      psh->fMadeCaption = TRUE;

      if (PropSheet_AddProblemsTab (psh, IDD_SET_PROBLEMS, lpiFileset, nAlerts) &&
          PropSheet_AddTab (psh, IDS_SET_GENERAL_TAB, IDD_SET_GENERAL, (DLGPROC)Filesets_General_DlgProc, (LPARAM)lpiFileset, TRUE))
         {
         if (fJumpToThreshold)
            psh->sh.nStartPage = psh->sh.nPages-1;
         PropSheet_ShowModeless (psh);
         }
      }
}
Exemplo n.º 29
0
BOOL DockWnd_HideInternal2(DOCKWND *dwp, BOOL fPreserveContent)
{
	DOCKPANEL *dpp = dwp->pDockPanel;
	int idx;

	dwp->fVisible = FALSE;

	if(fPreserveContent == FALSE)
	{
		// destroy the content
		DestroyWindow(dwp->hwndContents);
		dwp->hwndContents = 0;
	}

	// remove the tab
	idx = TabCtrl_GetCurSel(dpp->hwndTabView);
	TabCtrl_DeleteItem(dpp->hwndTabView, idx);
	UpdateDockTabView(dpp);

	// destroy the DOCKPANEL if this is the last tab
	if(dpp->hwndTabView && TabCtrl_GetItemCount(dpp->hwndTabView) == 0 || !dpp->hwndTabView)
	{
		DestroyWindow(dpp->hwndPanel);
		dpp->fVisible = FALSE;
	}
	// show the next item
	else
	{
		TCITEM tci = { TCIF_PARAM };
		DOCKWND *dwpnext;
				
		idx = TabCtrl_GetCurSel(dpp->hwndTabView);
		TabCtrl_GetItem(dpp->hwndTabView, idx, &tci);

		dpp->uCurrentTabId = (UINT)tci.lParam;
		dwpnext = DOCKWNDFromId(dpp->hwndMain, (UINT)tci.lParam);

		DockWnd_ShowInternal2(dwpnext);//, TRUE, fRemoving);
	}

	return TRUE;
}
Exemplo n.º 30
0
BOOL HexCloseFile(MAINWND *mainWnd, int iItem)
{
	TCITEM	tci = { TCIF_PARAM };
	HWND	hwndHV;
	TCHAR	szFilePath[MAX_PATH];

	if(!TabCtrl_GetItem(mainWnd->hwndTabView, iItem, &tci))
		return FALSE;

	hwndHV = (HWND)tci.lParam;

	// is this the last tab left?
	if(TabCtrl_GetItemCount(mainWnd->hwndTabView) == 1)
	{
		HexView_Clear((HWND)tci.lParam);
		
		tci.mask = TCIF_TEXT;
		tci.pszText = TEXT("(Untitled)");
		TabCtrl_SetItem(mainWnd->hwndTabView, 0, &tci);
		tci.lParam = 0;
	}
	else
	{
		// remove the tab
		TabCtrl_DeleteItem(mainWnd->hwndTabView, iItem);
	}

	// set focus to a new tab
	iItem = TabCtrl_GetCurSel(mainWnd->hwndTabView);
	HexSetCurFile(mainWnd->hwndMain, iItem, TRUE);
	
	// lastly destroy the unwanted hexview
	SaveHighlights(hwndHV);
	
	HexView_GetFileName(hwndHV, szFilePath, MAX_PATH);
	
	if(hwndHV == (HWND)tci.lParam)
		DestroyWindow(hwndHV);

	UpdateHighlight(szFilePath, 0, TRUE);
	return TRUE;
}