Пример #1
0
/**
 * Creates a new tree control
 */
CTreeControl::CTreeControl(CContainer* _parent, int _x, int _y, int _w, int _h, DWORD _id):CControl(_parent, _x, _y, _w, _h, L"", _id)
{
	hwnd = CreateWindowEx(WS_EX_CONTROLPARENT,
            WC_TREEVIEW,
            L"Tree View",
			WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_EDITLABELS | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_TRACKSELECT | TVS_SHOWSELALWAYS | WS_TABSTOP, 
            _x, 
            _y, 
            _w, 
            _h,
            mainHandle, 
            (HMENU)_id, 
            (HINSTANCE) GetWindowLong(_parent->getHandle(), GWL_HINSTANCE), 
            NULL); 

	//SendMessage(hwnd, WM_SETFONT, (WPARAM)sysFont, TRUE);
DWORD currentStyle = GetWindowLong(hwnd, GWL_STYLE);
	SetWindowLong(hwnd, GWL_STYLE | currentStyle, TVS_CHECKBOXES);
	TreeView_SetLineColor(hwnd,RGB(0,0,0));

	onStartEditItemsLabel = NULL;
	onFinishEditItemsLabel = NULL;
	items.clear();
	allControls.insert(std::pair<HWND,CControl*>(hwnd,this));
}
void CATTreeCtrl::OSUpdateTreeColors()
{
    if (this->IsEnabled())
    {
        TreeView_SetBkColor  (fControlWnd, RGB(this->fBackgroundColor.r, this->fBackgroundColor.g, this->fBackgroundColor.b));
        TreeView_SetTextColor(fControlWnd, RGB(this->fForegroundColor.r, this->fForegroundColor.g, this->fForegroundColor.b));
        TreeView_SetLineColor(fControlWnd, RGB(this->fForegroundColor.r, this->fForegroundColor.g, this->fForegroundColor.b));
        TreeView_SetInsertMarkColor(fControlWnd, RGB(this->fForegroundColor.r, this->fForegroundColor.g, this->fForegroundColor.b));
    }
    else
    {
        TreeView_SetBkColor  (fControlWnd, RGB(this->fBgDisColor.r, this->fBgDisColor.g, this->fBgDisColor.b));
        TreeView_SetTextColor(fControlWnd, RGB(this->fFgDisColor.r, this->fFgDisColor.g, this->fFgDisColor.b));
        TreeView_SetLineColor(fControlWnd, RGB(this->fFgDisColor.r, this->fFgDisColor.g, this->fFgDisColor.b));
        TreeView_SetInsertMarkColor(fControlWnd, RGB(this->fFgDisColor.r, this->fFgDisColor.g, this->fFgDisColor.b));
    }
}
void CATTreeCtrl::OnParentCreate()
{
    CATControlWnd::OnParentCreate();
    TreeView_SetBkColor  (fControlWnd, RGB(this->fBackgroundColor.r, this->fBackgroundColor.g, this->fBackgroundColor.b));
    TreeView_SetTextColor(fControlWnd, RGB(this->fForegroundColor.r, this->fForegroundColor.g, this->fForegroundColor.b));
    TreeView_SetLineColor(fControlWnd, RGB(this->fForegroundColor.r, this->fForegroundColor.g, this->fForegroundColor.b));
    TreeView_SetInsertMarkColor(fControlWnd, RGB(this->fForegroundColor.r, this->fForegroundColor.g, this->fForegroundColor.b));

    fFont = GetWindow()->OSGetFont(fFontName,fFontSize);
    ::SendMessage(fControlWnd,WM_SETFONT,(WPARAM)fFont,TRUE);

    OSClearTree();
    OSRebuildTree(&fRootList);
    ExpandRoot();
}
Пример #4
0
    COLORREF SetLineColor(COLORREF clr) {

        return TreeView_SetLineColor(m_hWnd, clr);
    }
Пример #5
0
void TreeView::lineColor ( const Color& color )
{
    TreeView_SetLineColor(handle(),color.value());
}