Exemple #1
0
//create toolbar
void
TableView::CreateToolBar()
{
    wyUInt32 style = WS_CHILD | CCS_NOPARENTALIGN | TBSTYLE_TOOLTIPS | WS_VISIBLE | CCS_NODIVIDER | TBSTYLE_FLAT;

	m_hwndtoolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, style, 
                                   0, 0, 0, 0, m_hwndframe,
                                   (HMENU)IDC_TOOLBAR, (HINSTANCE)GetModuleHandle(0), NULL);

    //add tool buttons
	AddToolButtons();

    //size the toolbar
    SendMessage(m_hwndtoolbar, TB_AUTOSIZE, 0, 0);

    //remove auto sizing
    style = GetWindowLongPtr(m_hwndtoolbar, GWL_STYLE);
    SetWindowLongPtr(m_hwndtoolbar, GWL_STYLE, style | CCS_NORESIZE);
}
wyBool
TableTabInterfaceTabMgmt::CreateToolBar(HWND hwnd)
{
    wyUInt32 style = WS_CHILD | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER | TBSTYLE_TOOLTIPS;
	
    if(m_tabinterfaceptr->m_open_in_dialog == wyFalse)
    {
        style |= TBSTYLE_FLAT;
    }

	// create the tool bar to show options for the result set
	VERIFY(m_hwndtool = CreateWindowEx(WS_EX_CONTROLPARENT, TOOLBARCLASSNAME, NULL, style, 0,0,0,0, hwnd,
											(HMENU)IDC_TOOLBAR, (HINSTANCE)pGlobals->m_hinstance, NULL));

	m_origtoolwndproc = (WNDPROC)SetWindowLongPtr(m_hwndtool, GWLP_WNDPROC, (LONG_PTR)TableTabInterfaceTabMgmt::ToolbarProc);
    SetWindowLongPtr(m_hwndtool, GWLP_USERDATA, (LONG_PTR)this);

	// buttons to the toolbar
	AddToolButtons();

	return wyTrue;
}