예제 #1
0
/**
 * name:	InitTreeItems()
 * desc:	initialize the tree control's datastructure
 * param:	needWidth	- width to expand the tree by
 * return:	TRUE if initialization is ok, FALSE otherwise
 **/
BOOLEAN CPsTree::InitTreeItems(LPWORD needWidth)
{
	INT i;
	DBVARIANT dbv;

	if (!_hWndTree || !_pItems)
	{
		return FALSE;
	}

	if (!DB::Setting::GetUString(NULL, MODNAME, SET_LASTITEM, &dbv)) 
	{
		_curItem = FindItemIndexByName(dbv.pszVal);
		DB::Variant::Free(&dbv);
	}

	// init the groups
	if ((_dwFlags & PSTVF_GROUPS) || (!_pPs->hContact && myGlobals.CanChangeDetails)) 
	{
		LPSTR pszGroup;
		
		// set treeview styles
		TreeView_SetIndent(_hWndTree, 3);
		SetWindowLongPtr(_hWndTree, GWL_STYLE, GetWindowLongPtr(_hWndTree, GWL_STYLE)|TVS_HASBUTTONS);

		// init the iParent member for all the items
		for (i = 0; i < _numItems; i++) 
		{
			if (_pItems[i] && (pszGroup = _pItems[i]->ParentItemName()) != NULL) 
			{
				INT iParent = FindItemIndexByName(pszGroup);
				
				// need to add an empty parent item
				if (iParent == -1) 
				{
					iParent = AddDummyItem(pszGroup);
				}
				_pItems[i]->Parent(iParent);
				mir_free(pszGroup);
			}
		}
	}

	if (needWidth)
	{
		*needWidth = 0;
	}
	ShowWindow(_hWndTree, SW_HIDE);
	for (i = 0; i < _numItems; i++)
	{
		if (_pItems[i]->State() != DBTVIS_INVISIBLE)
		{
			ShowItem(i, needWidth);
		}
	}
	ShowWindow(_hWndTree, SW_SHOW);
	return TRUE;
}
예제 #2
0
CCList::CCList(HWND hTreeView) : 
	hTreeView(hTreeView), 
	ExtraImageList(nullptr)
{
	CWndUserData(GetParent(hTreeView)).SetCList(this);
	OrigTreeViewProc = (WNDPROC)SetWindowLongPtr(hTreeView, GWLP_WNDPROC, (LONG_PTR)ContactListSubclassProc);
	OrigParentProc = (WNDPROC)SetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC, (LONG_PTR)ParentSubclassProc);
	TreeView_SetImageList(hTreeView, Clist_GetImageList(), TVSIL_NORMAL);
	WindowList_Add(hCLWindowList, hTreeView, NULL);
	TreeView_SetIndent(hTreeView, 5); // doesn't set it less than the initial value on my system, and i guess it's because of icons... but who knows - maybe it will work somewhere
}
예제 #3
0
	void SetTreeViewWindowExplorerTheme(HWND wnd, bool b_reduce_indent)
	{
		if (IsVistaOrNewer())
		{
			UINT_PTR stylesex = /*TVS_EX_FADEINOUTEXPANDOS|*/TVS_EX_DOUBLEBUFFER | TVS_EX_AUTOHSCROLL;
			UINT_PTR styles = NULL;//TVS_TRACKSELECT;

			SendMessage(wnd, TV_FIRST + 44, stylesex, stylesex);
			SetWindowTheme(wnd, L"Explorer", NULL);
			SetWindowLongPtr(wnd, GWL_STYLE, (GetWindowLongPtr(wnd, GWL_STYLE) & ~(TVS_HASLINES/*|TVS_NOHSCROLL*/)) | styles);
			if (b_reduce_indent)
				TreeView_SetIndent(wnd, 0xa);
		}

	}
예제 #4
0
void TffdshowPageDec::onActivate(void)
{
    cbxSetDroppedWidth(IDC_CBX_PRESETS, 340);

    Tpresets *presets;
    deciD->getPresetsPtr(&presets);
    localPresets = presets->newPresets();
    deciD->getPresets(localPresets);
    deciD->getActivePresetName(oldActivePresetName, MAX_PATH);

    TreeView_SetIndent(htv, 24);
    //TreeView_SetItemHeight(htv,26);
    TreeView_Expand(htv, htiPresets, TVE_EXPAND);
    fillPresetsCbx();
    cbxSetCurSel(IDC_CBX_PRESETS, cbxFindItem(IDC_CBX_PRESETS, oldActivePresetName, true));
    selectPreset(oldActivePresetName);
    CRect rp;
    GetWindowRect(m_hwnd, &rp);
    CRect rc;
    GetWindowRect(htv, &rc);
    tvx = rc.left - rp.left;
    tvy = rc.top - rp.top;
    deciD->setOnNewFiltersMsg(m_hwnd, WM_FFONNEWFILTERS);
}
예제 #5
0
STDMETHODIMP TffdshowPageBase::Activate(HWND hwndParent, LPCRECT rect, BOOL fModal)
{
    CheckPointer(rect, E_POINTER);

    if (!wasobjectset) {
        return E_UNEXPECTED;
    }
    if (m_hwnd) {
        return E_UNEXPECTED;
    }

    HWND hwnd = createDialog(dialogId, hwndParent);
    if (hwnd == NULL) {
        return E_OUTOFMEMORY;
    }
    //setHWND(hwnd);
    translate();

    Move(rect);
    Show(SW_SHOWNORMAL);

    //LOGFONT lf={-13L,-13L,0L,0L,FW_NORMAL,0,0,0,SYMBOL_CHARSET,OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,DRAFT_QUALITY,FF_ROMAN+VARIABLE_PITCH,"Webdings"};
    LOGFONT lf = {18L, 0L, 0L, 0L, FW_NORMAL, 0, 0, 0, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, NONANTIALIASED_QUALITY, FF_DONTCARE + DEFAULT_PITCH, _l("Webdings")};
    arrowsFont = CreateFontIndirect(&lf);

    dlg = findParentDlg();
    if (IsWindow(dlg)) {
        if (resorePos && cfgGet(IDFF_dlgRestorePos)) {
            int x, y;
            x = cfgGet(IDFF_dlgPosX);
            y = cfgGet(IDFF_dlgPosY);
            WINDOWPLACEMENT wpl;
            wpl.length = sizeof(wpl);
            GetWindowPlacement(dlg, &wpl);
            OffsetRect(&wpl.rcNormalPosition, x - wpl.rcNormalPosition.left, y - wpl.rcNormalPosition.top);
            SetWindowPlacement(dlg, &wpl);
        }
        if (cfgGet(IDFF_alwaysOnTop)) {
            SetWindowPos(dlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
        }
    }

    htv = GetDlgItem(m_hwnd, IDC_TV_TREE);
    SetWindowLong(htv, GWL_STYLE, TVS_NOHSCROLL | GetWindowLong(htv, GWL_STYLE));

    hil = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 2, 2);
    ilClear  = ImageList_Add(hil, bmp1[0] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_CLEAR)), bmp2[0] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_CHB_MASK)));
    ilChecked = ImageList_Add(hil, bmp1[1] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_CHECKED)), bmp2[1] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_CHB_MASK)));
    ilArrowUD = ImageList_Add(hil, bmp1[2] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_ARROWS)), bmp2[2] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_ARROWS_MASK_UD)));
    ilArrowU = ImageList_Add(hil, bmp1[3] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_ARROWS)), bmp2[3] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_ARROWS_MASK_U)));
    ilArrowD = ImageList_Add(hil, bmp1[4] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_ARROWS)), bmp2[4] = LoadBitmap(hi, MAKEINTRESOURCE(IDB_ARROWS_MASK_D)));

    onActivate();
    static const TanchorInfo ainfo[] = {
        IDC_PLACE_PAGE, TanchorInfo::LEFT | TanchorInfo::RIGHT | TanchorInfo::TOP | TanchorInfo::BOTTOM,
        0, 0
    };
    anchors.add(ainfo, *this);
    TreeView_SetIndent(htv, 24);
    //TreeView_SetItemHeight(htv,26);

    showShowHide();

    int lastPage = cfgGet(IDFF_lastPage);
    treeSelectItem(lastPage);
    enableHints(!!cfgGet(IDFF_showHints));
    deci->setCfgDlgHwnd(dlg);
    deci->setOnChangeMsg(m_hwnd, WM_FFONCHANGE);
    deci->setOnFrameMsg(m_hwnd, WM_FFONFRAME);
    return NOERROR;
}