LRESULT CBrowsersToolbarDlg::HandleInitDialog(WPARAM wParam, LPARAM lParam)
{
	LRESULT nStatus = CDialogBar::HandleInitDialog(wParam, lParam);	

	CString sTitle;
	sTitle.LoadString(IDS_TOOLBARTITLE_BROWSERS);
	SetWindowText(sTitle);

	m_cIE.SubclassDlgItem(IDC_BUTTON_TOOLBAR_IE, this);
	m_cIE.LoadPNG(_T("IEXPLORE32.PNG"), 2);

	m_cFirefox.SubclassDlgItem(IDC_BUTTON_TOOLBAR_FIREFOX, this);
	m_cFirefox.LoadPNG(_T("FIREFOX32.PNG"), 2);

	m_cOpera.SubclassDlgItem(IDC_BUTTON_TOOLBAR_OPERA, this);
	m_cOpera.LoadPNG(_T("OPERA32.PNG"), 2);

	m_cSafari.SubclassDlgItem(IDC_BUTTON_TOOLBAR_SAFARI, this);
	m_cSafari.LoadPNG(_T("SAFARI32.PNG"), 2);

	SetBarStyle(GetBarStyle() | CBRS_FLYBY | CBRS_TOOLTIPS);
	EnableToolTips(TRUE);

	return nStatus;
}
Exemple #2
0
HRESULT CTRiASToolBar::InitNew (void)
{
	AFX_MANAGE_STATE(AfxGetModuleState());
    ASSERT_VALID(this);
	ASSERT_VALID(m_pMainFrm);

#if !defined(_USE_SEC_CLASSES)
	m_uiID = m_pMainFrm -> GetNextBarID();
	if (!Create (m_pMainFrm, WS_CHILD|CBRS_ALIGN_TOP|CBRS_FLOATING, m_uiID))
		return E_FAIL;

	SetBarStyle(GetBarStyle() | (CBRS_TOOLTIPS|CBRS_SIZE_FIXED));
	EnableDocking (CBRS_ALIGN_ANY);

	m_pMainFrm -> AddNewBar (m_pIBar);		// jetzt hier, damit alle von außen das geleiche tun können
	m_pMainFrm -> ShowControlBar (this, false, false);
	m_pMainFrm -> DockControlBar (this);

TBBUTTON tb = { 25, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0, };
CToolBarCtrl &rTB = GetToolBarCtrl();

	rTB.SetButtonSize (CSize(24, 23));

HRESULT hr = (rTB.InsertButton (0, &tb)) ? NOERROR : S_FALSE;

	if (S_OK == hr)			// leeres Feld einfügen
		m_fHasDummySep = true;
#endif // _USE_SEC_CLASSES

	return NOERROR;
}
BOOL CSizingControlBar::Create(CWnd* pParentWnd, CSize sizeDefault, UINT nID, DWORD dwStyle) 
{
    ASSERT_VALID(pParentWnd);   // must have a parent
    ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));

    // save the style
    m_dwStyle = dwStyle;

    dwStyle &= ~CBRS_ALL;
    dwStyle |= CCS_NOPARENTALIGN | CCS_NOMOVEY | CCS_NODIVIDER | CCS_NORESIZE;

    m_sizeHorz = sizeDefault;
    m_sizeVert = sizeDefault;
    m_sizeFloat = sizeDefault;

	//****Pleas add this in it******************* 
	// save the style 
	SetBarStyle(dwStyle & CBRS_ALL); 
	//******************************************* 

    CString wndclass = AfxRegisterWndClass(CS_DBLCLKS, LoadCursor(NULL, IDC_ARROW),
        CreateSolidBrush(GetSysColor(COLOR_BTNFACE)), 0);

    if (!CWnd::Create(wndclass, NULL, dwStyle, CRect(0,0,0,0),
        pParentWnd, nID))
        return FALSE;

    return TRUE;
}
bool CDynamicHelp::Create(CWnd* parent_wnd, UINT id)
{
	CControlBar::Create(wnd_class_, title_,
		WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
		CRect(10, 10, 100, 100), parent_wnd, id);

	SetBarStyle(CBRS_ALIGN_RIGHT | CBRS_FLYBY | CBRS_GRIPPER | CBRS_SIZE_DYNAMIC);

	close_wnd_.Create(WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER,
		CRect(0,0,0,0), this, -1);
	close_wnd_.SetButtonStructSize(sizeof(TBBUTTON));
	close_wnd_.AddBitmap(1, IDB_CLOSE_TB);
	close_wnd_.SetBitmapSize(CSize(8, 8));
	TBBUTTON btn;
	btn.iBitmap = 0;
	btn.idCommand = IDCLOSE;
	btn.fsState = TBSTATE_ENABLED;
	btn.fsStyle = TBSTYLE_BUTTON;
	btn.data = 0;
	btn.iString = 0;
	close_wnd_.AddButtons(1, &btn);

	Resize();

	return true;
}
Exemple #5
0
BOOL GuiCapOutBar::Create (DWORD dwStyle, CWnd* pParentWnd, UINT uID,int iMaxi)
{
	SetBarStyle (CBRS_ALIGN_TOP);
	m_uID=uID;
	m_iHigh=iMaxi;
	return CControlBar::Create(0,0,dwStyle,CRect(0,0,0,0),pParentWnd,uID);
}
Exemple #6
0
BOOL CTestList::Create( CWnd* pParentWnd )
{
  BOOL b = CSizingControlBarG::Create( _T("Test list"), pParentWnd, 1967, WS_CLIPCHILDREN );

	SetSCBStyle(GetSCBStyle() | SCBS_SHOWEDGES | SCBS_SIZECHILD);

  if( !b )
		return FALSE;

	SetBarStyle( GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC );

	m_treeList.Create( WS_VISIBLE | WS_CHILD | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_HASLINES | TVS_SHOWSELALWAYS, CRect( 0, 0, 0, 0 ), this, IDC_TREE );

	if( !AddFilesFromPath( GetModulePath( NULL ) + _T("\\Test files\\"), TVI_ROOT ) )
	{
		AddFilesFromPath( GetModulePath( NULL ) +  _T("../../\\components\\QHTM\\Test\\Test files\\"), TVI_ROOT );
	}


	CFont font;
	font.CreateStockObject( DEFAULT_GUI_FONT );
	m_treeList.SetFont( &font );

  return TRUE;
}
void CIVReBar::AdjustBorders ()
{
	DWORD dwStyle = GetBarStyle();
	dwStyle &= ~CBRS_BORDER_ANY;
	
	dwStyle |= CBRS_BORDER_LEFT | CBRS_BORDER_3D;

	SetBarStyle(dwStyle);
}
Exemple #8
0
DialogBar::DialogBar(
	CFrameWnd*	pParent,
	FontDlg*		pDlg,
	UINT			nIDTemplate,
	TCHAR*		pszTitle,
	int			nID,
	DWORD			dwDockStyle,
   bool        bUseMaxButton
) :

   // Call base class.
   inherited( bUseMaxButton ),

	// Init vars.
	m_pDlg			( pDlg			),
	m_nIDTemplate	( nIDTemplate	),
	m_pParent		( pParent		)

{
	CRect rectFrame;
	m_pParent->GetWindowRect( rectFrame );

	CSize szDlg = GetDialogSizeFromTemplate( nIDTemplate, pParent );

	// determine the initial size of the docked dialog
	CSize dockSize;
	if(dwDockStyle & CBRS_ALIGN_LEFT || dwDockStyle & CBRS_ALIGN_RIGHT)
		dockSize = CSize(szDlg.cx+2*GetSystemMetrics(SM_CXSIZEFRAME) ,rectFrame.Height());
	else if(dwDockStyle & CBRS_ALIGN_TOP || dwDockStyle & CBRS_ALIGN_BOTTOM)
		dockSize = CSize(rectFrame.Width(),szDlg.cy+2*GetSystemMetrics(SM_CYSIZEFRAME));
	else
		dockSize = CSize(szDlg.cx,szDlg.cy);

	if (
		!Create(
			pszTitle,
			pParent, 
			dockSize,
			TRUE, 
			nID									// nID, must be unique across bars.
		)
	) {
	  	ASSERT( false );
		return;									// fail to create
	}
	// CBRS_SIZE_DYNAMIC allows the bar to be resized when floating
	SetBarStyle(
			GetBarStyle() 
		|	CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
	);

	// Dock the control bar.
	EnableDocking(
		dwDockStyle
	);

}
BOOL CGuiDockToolBarEx::Create(CWnd* pParentWnd,DWORD dwAling)
{
    // TODO: Add your specialized code here and/or call the base class
    ASSERT ( dwAling & CBRS_ALIGN_ANY);
    SetBarStyle (dwAling);
    DWORD dwStyle = CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE;
    if (pParentWnd->GetStyle() & WS_THICKFRAME)
        dwStyle |= SBARS_SIZEGRIP;
    dwStyle |= WS_CHILD;
    return CControlBar::Create(0,0,dwStyle,	CRect(0,0,0,0),pParentWnd,0x9999);
}
//*****************************************************************************
BOOL CBCGPCaptionBar::Create (DWORD dwStyle, CWnd* pParentWnd, UINT uID, int nHeight,
							  BOOL bIsMessageBarMode)
{
	SetBarStyle (CBRS_ALIGN_TOP);
	m_nDefaultHeight = nHeight;

	if (bIsMessageBarMode)
	{
		m_dwStyle |= CBRS_HIDE_INPLACE;
	}
	
	if (!CBCGPControlBar::Create (NULL, dwStyle, CRect (0, 0, 0, 0),
		pParentWnd, uID, 0))
	{
		return FALSE;
	}

	// register with parent frames' dock manager!!!
	if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPFrameWnd)))
	{
		((CBCGPFrameWnd*) pParentWnd)->AddControlBar (this);
	}
	else if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPMDIFrameWnd)))
	{
		((CBCGPMDIFrameWnd*) pParentWnd)->AddControlBar (this);
	}
	else if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPOleIPFrameWnd)))
	{
		((CBCGPOleIPFrameWnd*) pParentWnd)->AddControlBar (this);
	}
	else if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPOleDocIPFrameWnd)))
	{
		((CBCGPOleIPFrameWnd*) pParentWnd)->AddControlBar (this);
	}
	else if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPMDIChildWnd)))
	{
		((CBCGPMDIChildWnd*) pParentWnd)->AddControlBar (this);
	}
	else if (pParentWnd->IsKindOf (RUNTIME_CLASS (CDialog)))
	{
		if (pParentWnd->GetSafeHwnd() == AfxGetMainWnd()->GetSafeHwnd())
		{
			globalUtils.m_bDialogApp = TRUE;
		}
	}
	else
	{
		ASSERT (FALSE);
	}
	
	m_bIsMessageBarMode = bIsMessageBarMode;
	return TRUE;
}
void CCJControlBar::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) 
{
    // Compute the rectangle of the mobile edge
    GetWindowRect(m_rectBorder);
    m_rectBorder.OffsetRect(-m_rectBorder.left, -m_rectBorder.top);
    m_rectBorder.DeflateRect(1,1);
    
    CRect rcWnd = lpncsp->rgrc[0];
    DWORD dwBorderStyle = m_dwStyle | CBRS_BORDER_ANY;

    switch (m_nDockBarID)
    {
    case AFX_IDW_DOCKBAR_TOP:
		{
			dwBorderStyle &= ~CBRS_BORDER_BOTTOM;
			rcWnd.DeflateRect(2, 2, 2, m_cxEdge + 2);
			m_rectBorder.top = m_rectBorder.bottom - m_cxEdge;
			break;
		}
    case AFX_IDW_DOCKBAR_BOTTOM:
		{
			dwBorderStyle &= ~CBRS_BORDER_TOP;
			rcWnd.DeflateRect(2, m_cxEdge + 2, 2, 2);
			m_rectBorder.bottom = m_rectBorder.top + m_cxEdge;
			lpncsp->rgrc[0].left += 10;
			break;
		}
    case AFX_IDW_DOCKBAR_LEFT:
		{
			dwBorderStyle &= ~CBRS_BORDER_RIGHT;
			rcWnd.DeflateRect(2, 2, m_cxEdge + 2, 6);
			m_rectBorder.left = m_rectBorder.right - m_cxEdge;
			break;
		}
    case AFX_IDW_DOCKBAR_RIGHT:
		{
			dwBorderStyle &= ~CBRS_BORDER_LEFT;
			rcWnd.DeflateRect(m_cxEdge + 2, 2, 2, 6);
			m_rectBorder.right = m_rectBorder.left + m_cxEdge;
			break;
		}
    default:
		{
			m_rectBorder.SetRectEmpty();
			break;
		}
    }

    lpncsp->rgrc[0] = rcWnd;

    SetBarStyle(dwBorderStyle);
}
Exemple #12
0
int CBCGPMSMToolBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CBCGPToolBar::OnCreate(lpCreateStruct) == -1)
		return -1;

	SetBarStyle((GetBarStyle () & 
		~(CBRS_GRIPPER | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT))
		| CBRS_SIZE_DYNAMIC);
	SetBorders ();
	
	SetGrayDisabledButtons (FALSE);

	return 0;
}
Exemple #13
0
void CCoolDialogBar::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) 
{
    // Compute the rectangle of the mobile edge
    GetWindowRect(m_rectBorder);
    m_rectBorder = CRect(0, 0, m_rectBorder.Width(), m_rectBorder.Height());
    
    DWORD dwBorderStyle = m_dwStyle | CBRS_BORDER_ANY;

    switch(m_nDockBarID)
    {
    case AFX_IDW_DOCKBAR_TOP:
        dwBorderStyle &= ~CBRS_BORDER_BOTTOM;
        lpncsp->rgrc[0].left += m_cxGripper;
        lpncsp->rgrc[0].bottom += -m_cxEdge;
        lpncsp->rgrc[0].top += m_cxBorder;
        lpncsp->rgrc[0].right += -m_cxBorder;
	    m_rectBorder.top = m_rectBorder.bottom - m_cxEdge;
        break;
    case AFX_IDW_DOCKBAR_BOTTOM:
        dwBorderStyle &= ~CBRS_BORDER_TOP;
        lpncsp->rgrc[0].left += m_cxGripper;
        lpncsp->rgrc[0].top += m_cxEdge;
        lpncsp->rgrc[0].bottom += -m_cxBorder;
        lpncsp->rgrc[0].right += -m_cxBorder;
        m_rectBorder.bottom = m_rectBorder.top + m_cxEdge;
        break;
    case AFX_IDW_DOCKBAR_LEFT:
        dwBorderStyle &= ~CBRS_BORDER_RIGHT;
        lpncsp->rgrc[0].right += -m_cxEdge;
        lpncsp->rgrc[0].left += m_cxBorder;
        lpncsp->rgrc[0].bottom += -m_cxBorder;
        lpncsp->rgrc[0].top += m_cxGripper;
        m_rectBorder.left = m_rectBorder.right - m_cxEdge;
        break;
    case AFX_IDW_DOCKBAR_RIGHT:
        dwBorderStyle &= ~CBRS_BORDER_LEFT;
        lpncsp->rgrc[0].left += m_cxEdge;
        lpncsp->rgrc[0].right += -m_cxBorder;
        lpncsp->rgrc[0].bottom += -m_cxBorder;
        lpncsp->rgrc[0].top += m_cxGripper;
        m_rectBorder.right = m_rectBorder.left + m_cxEdge;
        break;
    default:
        m_rectBorder.SetRectEmpty();
        break;
    }

    SetBarStyle(dwBorderStyle);
}
Exemple #14
0
BOOL CGuiDockToolBar::Create(CWnd* pParentWnd,DWORD dwAling) 
{
	// TODO: Add your specialized code here and/or call the base class
/*		ASSERT (  (dwAling & CBRS_ALIGN_TOP) &&
				  (dwAling & CBRS_ALIGN_RIGHT) &&
				  (dwAling & CBRS_ALIGN_BOTTOM) &&
				  (dwAling & CBRS_ALIGN_LEFT) );
*/	ASSERT ( dwAling & CBRS_ALIGN_ANY);
	SetBarStyle (dwAling);
	DWORD dwStyle = CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE;
	if (pParentWnd->GetStyle() & WS_THICKFRAME)
		dwStyle |= SBARS_SIZEGRIP;
	dwStyle |= WS_CHILD|WS_VISIBLE;
	return CControlBar::Create(0,0,dwStyle,
						CRect(0,0,0,0),pParentWnd,AFX_IDW_STATUS_BAR);
}
Exemple #15
0
BOOL ULTooToolBar::SetHorizontal()
{
	m_bVertical = FALSE;

	SetBarStyle((GetBarStyle() & ~CBRS_ALIGN_ANY) | CBRS_ALIGN_TOP);

	SetButtonInfo(COMBOBOX_INDEX, ID_TOOLCOMBOBOXID, TBBS_SEPARATOR, COMBOBOX_WIDTH);

	if (m_ToolBox.m_hWnd != NULL)
	{
		CRect rect;
		GetItemRect(COMBOBOX_INDEX, rect);

		m_ToolBox.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOCOPYBITS);
		m_ToolBox.ShowWindow(SW_SHOW);
	}

	return TRUE;
}
BOOL CCJControlBar::Create(CWnd * pParentWnd, UINT nID, LPCTSTR lpszWindowName, CSize sizeDefault, DWORD dwStyle)
{
    ASSERT_VALID(pParentWnd);   // must have a parent
    ASSERT (((dwStyle & CBRS_SIZE_FIXED)   != CBRS_SIZE_FIXED) && 
	    	((dwStyle & CBRS_SIZE_DYNAMIC) != CBRS_SIZE_DYNAMIC));

    // save the style
    SetBarStyle(dwStyle & CBRS_ALL);

    CString wndclass = ::AfxRegisterWndClass(CS_DBLCLKS,
        ::LoadCursor(NULL, IDC_ARROW),
        ::GetSysColorBrush(COLOR_BTNFACE), 0);

    m_sizeHorz = m_sizeVert = m_sizeFloat = sizeDefault;

    dwStyle &= ~CBRS_ALL;
    dwStyle &= WS_VISIBLE | WS_CHILD;
    
	return CWnd::Create(wndclass, lpszWindowName, dwStyle,
		CRect(0,0,0,0), pParentWnd, nID);
}
Exemple #17
0
BOOL CScribbleBar::Create(CWnd* pParentWnd)
{
    //if (!CToolBar::Create(pParentWnd) || !LoadToolBar(IDR_MAINFRAME))
      //  return FALSE;

    // Remove this if you don't want tool tips

    SetBarStyle(GetBarStyle() |    CBRS_TOOLTIPS |
        CBRS_FLYBY | CBRS_SIZE_FIXED);

    // By setting the button style of each the marker color buttons
    // to TBBS_CHECKGROUP, we ensure that only one may be depressed
    // at a time.

    SetButtonStyle(0, TBBS_CHECKGROUP);
    SetButtonStyle(1, TBBS_CHECKGROUP);
    SetButtonStyle(2, TBBS_CHECKGROUP);
    SetButtonStyle(3, TBBS_CHECKGROUP);
    //GetToolBarCtrl().CheckButton(IDB_BLACK_MARKER);

    return TRUE;
}
Exemple #18
0
HRESULT CTRiASToolBar::SetBarStyleEx (LPCSTR pcName, DWORD dwStyle, DWORD dwStyleEx, bool fDelay)
{
	AFX_MANAGE_STATE(AfxGetModuleState());
    ASSERT_VALID(this);
    ASSERT(::IsWindow(m_hWnd));

// Sichtbar/unsichtbar
bool fWasVisible = (GetStyle() & WS_VISIBLE) ? true : false;
bool fMadeVisible = (WS_VISIBLE & dwStyle) ? true : false;

// Style ändern
#if _MSC_VER >= 1200
	dwStyle &= CBRS_ALL;
#endif // _MSC_VER >= 1200
	SetBarStyle (dwStyle);
	m_pMainFrm -> ShowControlBar (this, fMadeVisible, fDelay);

// sonstige Flags
#if !defined(_USE_SEC_CLASSES)
	m_dwFlags = dwStyleEx;
#else
	m_dwFlags = dwStyleEx & TRIASTOOLBAR_FLAGS;		// TRiASExFlags
	SetExBarStyle (dwStyleEx & ~TRIASTOOLBAR_FLAGS, fWasVisible && fMadeVisible);	// SEC-ExFlags
	if(m_dwExStyle & CBRS_EX_COOLBORDERS)
		Invalidate();

	if (fWasVisible || fMadeVisible)
		m_pMainFrm -> DelayRecalcLayout();		// evl. neu zeichnen
#endif // _USE_SEC_CLASSES

// Caption neu setzen
	if (NULL != pcName)		
		SetWindowText (pcName);

	return NOERROR;
}
Exemple #19
0
void MyFrame::OnPositionTopLabels(wxCommandEvent& WXUNUSED(evt))
{
    SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE);
}
Exemple #20
0
void CDynToolBar::LoadState(char* pFilename)
  {
  CProfINIFile PF(pFilename);
  CMDIFrameWnd* pM = pTBMngr->pMainFrame;
  Strng Section;
  Section.Set("ToolBar_%d", iWindowID);
  Strng NewTitle = PF.RdStr(Section(), "Title", (char*)(const char*)sTitle);
  if (NewTitle.Length()!=sTitle.GetLength() || strcmp(NewTitle(), (const char*)sTitle)!=0)
    {
    SetWindowText(NewTitle());
    sTitle = NewTitle();
    }
  DWORD BarStyle = GetBarStyle();
  DWORD Style = GetStyle();
  BarStyle = PF.RdLong(Section(), "BarStyle", BarStyle);
  BarStyle &= CBRS_ALL; //CNM Prevent an ASSERT
  SetBarStyle(BarStyle);

  if (bCanConfigure)
    {
    CToolBarCtrl& bc = GetToolBarCtrl();
    int Cnt = bc.GetButtonCount();
    Cnt = PF.RdInt(Section(), "ButtonIDCount", Cnt);
    BOOL Chngd = (Cnt!=bc.GetButtonCount());
    UINT* NewIDs = new UINT[Cnt];
    Strng Item;
    for (int i=0; i<Cnt; i++)
      {
      Item.Set("ID_%d", i);
      int Cmd = (i<(int)iLen ? BtnIDs[i] : ID_SEPARATOR);
      Cmd = PF.RdInt(Section(), Item(), Cmd);
      NewIDs[i] = (UINT)Cmd;
      Chngd = (Chngd || (NewIDs[i]!=BtnIDs[i]));
      }
    if (Chngd)
      ChangeButtons(NewIDs, Cnt);
    delete []NewIDs;
    }

  flag Visible = ((Style & WS_VISIBLE) != 0);
  Visible = PF.RdInt(Section(), "Visible", Visible);
  pM->ShowControlBar(this, Visible, FALSE);
  pM->RecalcLayout(); //get MFC to adjust the dimensions of all docked ToolBars so that GetWindowRect will be accurate
  CRect Rect;
  CWnd* pWnd = GetParent();
  if (BarStyle & CBRS_FLOATING)
    {
    if (pWnd && pWnd->GetParent())
      {
      if (PrjFileVerNo()>=25)
        {
        CRect MRect;
        AfxGetMainWnd()->GetWindowRect(MRect);
        Rect.OffsetRect(-MRect.left, -MRect.top);
        int L=PF.RdInt(Section(), "Left", Rect.left);
        int T=PF.RdInt(Section(), "Top", Rect.top);
        Rect.OffsetRect(L-Rect.left, T-Rect.top);
        Rect.OffsetRect(+MRect.left, +MRect.top);
        }
      else
        {
        pWnd->GetParent()->GetWindowRect(&Rect);
        Location.x = PF.RdInt(Section(), "Left", Rect.left);
        Location.y = PF.RdInt(Section(), "Top", Rect.top);
        }
      pM->FloatControlBar(this, Location);
      }
    }
  else
    {
    GetWindowRect(&Rect);
    if (PrjFileVerNo()>=25)
      {
      CRect MRect;
      AfxGetMainWnd()->GetWindowRect(MRect);
      Rect.OffsetRect(-MRect.left, -MRect.top);
      int L=PF.RdInt(Section(), "Left", Rect.left);
      int T=PF.RdInt(Section(), "Top", Rect.top);
      Rect.OffsetRect(L-Rect.left, T-Rect.top);
      Rect.OffsetRect(+MRect.left, +MRect.top);
      }
    else
      {
    //Rect.left = PF.RdInt(Section(), "Left", Rect.left);
    //Rect.top = PF.RdInt(Section(), "Top", Rect.top);
      int L=PF.RdInt(Section(), "Left", Rect.left);
      int T=PF.RdInt(Section(), "Top", Rect.top);
      Rect.right  += L-Rect.left;
      Rect.bottom += T-Rect.top;
      Rect.left   += L-Rect.left;
      Rect.top    += T-Rect.top;
      }
    //Rect.top = PF.RdInt(Section(), "Top", Rect.top);
    UINT n = 0;
    if (BarStyle & CBRS_ALIGN_TOP)
      {
      Rect.top -= 1;
      Rect.bottom -= 1;
      n = AFX_IDW_DOCKBAR_TOP;
      }
    if (n==0 && BarStyle & CBRS_ALIGN_BOTTOM)
      {
      Rect.top += 1;
      Rect.bottom += 1;
      n = AFX_IDW_DOCKBAR_BOTTOM;
      }
    if (n==0 && BarStyle & CBRS_ALIGN_LEFT)
      {
      Rect.left -= 1;
      Rect.right -= 1;
      n = AFX_IDW_DOCKBAR_LEFT;
      }
    if (n==0 && BarStyle & CBRS_ALIGN_RIGHT)
      {
      Rect.left += 1;
      Rect.right += 1;
      n = AFX_IDW_DOCKBAR_RIGHT;
      }
    pM->DockControlBar(this, n, &Rect);
    }
  pM->RecalcLayout();
  }
Exemple #21
0
int CDynToolBar::Create(BOOL ShowTitle, BOOL FloatIt, DWORD dwDockingStyle, DWORD dwBarStyle, BOOL Show, BOOL UseEscape)
  {
  DWORD dwStyle = WS_CHILD|CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY;
  if (Show)
    dwStyle |= WS_VISIBLE;
  if (bCanConfigure)
    dwStyle |= CCS_ADJUSTABLE;
  if (!CToolBar::Create(pTBMngr->pMainFrame, dwStyle, iWindowID))
    return -1;
  //if (!SetButtons(pBtnIDs, iLen))
  //  return -2; 

  BITMAP bm;
  bm.bmType = 0;
  bm.bmWidth = pTBMngr->BtnWidth * iBitLen * 8 / pTBMngr->BitsPixel;
  bm.bmHeight = pTBMngr->BtnHeight;
  bm.bmWidthBytes = pTBMngr->BtnWidth * iBitLen;
  bm.bmPlanes = 1;
  bm.bmBitsPixel = pTBMngr->BitsPixel;
  bm.bmBits = (LPVOID)pBits;
  if (!Bitmap.CreateBitmapIndirect(&bm))
    return -3;
  CToolBarCtrl& bc = GetToolBarCtrl();
  if (bc.AddBitmap(iBitLen/*(bButtonsOnce ? iBitLen : iLen)*/, &Bitmap)<0)
    return -4;
  if (!DoCreateButtons())
    return -5;

  if (iTxtLen>0)
    {
    pTxtButtons = new CButton[iTxtLen];
    UINT TxtCnt = 0;
    CRect rect;
    for (UINT i=0; i<iLen; i++)
      if (BtnStyles[i]==ButText)
        {
        SetButtonInfo(i, BtnIDs[i], TBBS_SEPARATOR, (BtnTxts[TxtCnt].GetLength()+3)*6);
        GetItemRect(i, &rect);
        pTxtButtons[TxtCnt].Create((const char*)(BtnTxts[TxtCnt]), WS_VISIBLE|WS_TABSTOP, rect, this, BtnIDs[i]);
        pTxtButtons[TxtCnt].SetFont(&(pTBMngr->Font));
        TxtCnt++;
        }
    }
  
  if (iComboLen>0)
    {
    bComboListChanged = 0;
    const int nDropHeight = 100;
    pComboButtons = new CComboBox[iComboLen];
    UINT ComboCnt = 0;
    CRect rect;
    for (UINT i=0; i<iLen; i++)
      if (BtnStyles[i]==ButCombo)
        {
        SetButtonInfo(i, BtnIDs[i], TBBS_SEPARATOR, 120);
        GetItemRect(i, &rect);
        rect.top = 3;
        rect.bottom = rect.top + nDropHeight;
        pComboButtons[ComboCnt].Create(CBS_DROPDOWN|CBS_AUTOHSCROLL|WS_VISIBLE|WS_TABSTOP, rect, this, ID_TOOLBAR_COMBO_0+ComboCnt);//BtnIDs[i]);
        pComboButtons[ComboCnt].SetFont(&(pTBMngr->Font));
        ComboCnt++;
        }
    }

  if (iEditLen>0)
    {
    pEditButtons = new CEdit[iEditLen];
    UINT EditCnt = 0;
    CRect rect;
    for (UINT i=0; i<iLen; i++)
      if (BtnStyles[i]==ButEdit)
        {
        SetButtonInfo(i, BtnIDs[i], TBBS_SEPARATOR, 120);
        GetItemRect(i, &rect);
        //rect.top = 3;
        //rect.bottom = rect.top + nDropHeight;
        pEditButtons[EditCnt].Create(WS_VISIBLE|WS_TABSTOP, rect, this, BtnIDs[i]);//ID_TOOLBAR_EDIT_0+EditCnt);
        pEditButtons[EditCnt].SetFont(&(pTBMngr->Font));
        EditCnt++;
        }
    }
  
  SetBarStyle(GetBarStyle() | dwBarStyle);
  if (ShowTitle)
    SetWindowText((const char*)sTitle);
  EnableDocking(dwDockingStyle);
  if (FloatIt)
    pTBMngr->pMainFrame->FloatControlBar(this, Location);
  else
    pTBMngr->pMainFrame->DockControlBar(this);
  bUseEscape = UseEscape;
  bWasVisible = Show;
  return 0;
  }
Exemple #22
0
void ULTooToolBar::InitControlWithULInfo(CWnd* pParentWnd)
{

	CFDMSApp* pApp = (CFDMSApp*)AfxGetApp();

	Create(pParentWnd);
	LoadToolBar(IDR_TOOLBAR1);
	DWORD sty = GetBarStyle();
	SetBarStyle(sty | CBRS_TOOLTIPS | CBRS_FLYBY);
	EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
	SetWindowText(_T("Integrated Tools"));

	CRect rect(-COMBOBOX_WIDTH, -COMBOBOX_HEIGHT, 0, 0);

	// The ID of the ComboBox is important for two reasons.  One, so you
	// can receive notifications from the control.  And also for ToolTips.
	// During HitTesting if the ToolBar sees that the mouse is one a child
	// control, the toolbar will lookup the controls ID and search for a
	// string in the string table with the same ID to use for ToolTips
	// and StatusBar info.
	if (m_ToolBox.Create(WS_CHILD | CBS_DROPDOWN |
		CBS_AUTOHSCROLL | WS_VSCROLL | CBS_HASSTRINGS, rect, this,
		ID_TOOLCOMBOBOXID))
	{
		HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
		if (hFont == NULL)
			hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);

		m_ToolBox.SendMessage(WM_SETFONT, (WPARAM)hFont);


		// determine if UL is available.

		UINT num_tools = 0;


		if (pApp->m_pRT_Init != NULL)
			num_tools = pApp->m_pRT_Init->Get_Tools_Num();

		if (num_tools > 0)
		{
			const char * tool_name;
			unsigned int i, j;
			BOOL tool_status;
			m_bULToolsAvailable = true;
			j = 0;
			for (i=0; i<num_tools; i++)
			{
				tool_status = pApp->m_pRT_Init->Get_Tool_Installed (i);
				if (tool_status == FALSE)
					continue;
				tool_status = pApp->m_pRT_Init->Get_Data_Match_Tool (i);
				if (tool_status == FALSE)
					continue;
				tool_name = pApp->m_pRT_Init->Get_Tool_Name (i);
				m_ToolBox.InsertString(j, tool_name);
				m_ToolBox.SetItemData(j, i);
				j++;
			}
		}
		else
			m_ToolBox.InsertString(0, "None Available");

		if (ULSupport::ULIRSDataPath.GetLength() > 5) // need something with suffix at least
		{
			// no UL no IRS no FacMgr or whtever so don't bother to check
			CheckForImportFileExistence();
			SetTimer(TIMER_CHECKIMP,21000,0);  // check every 21 seconds
		}
	}

	if(!SetHorizontal())
		return;
}
void CEGPaneBar::SetAlign( DWORD dwAlign ) {
	SetBarStyle ( dwAlign | CBRS_HIDE_INPLACE & ~(CBRS_BORDER_ANY | CBRS_GRIPPER));
}
Exemple #24
0
BOOL CRRECToolBar::Create( CWnd* parent)
{
    if (CreateEx(parent, TBSTYLE_FLAT | TBSTYLE_WRAPABLE, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_SIZE_DYNAMIC/* | WS_CLIPCHILDREN*/,
                 CRect(0, 0, 0, 0), TOOLBAR_CONTROL) && LoadToolBar(TOOLBAR_CONTROL))
    {
        SetImage(IDB_TOOLBAR, RGB(255, 0, 255));

        // very important - turn OFF all the auto positioning and sizing
        // by default have no borders
        UINT nStyle = GetBarStyle();
        //	nStyle &= ~(CCS_NORESIZE | CCS_NOPARENTALIGN | CBRS_BORDER_ANY);
        nStyle |= (/*CBRS_SIZE_FIXED | */CBRS_TOOLTIPS | CBRS_FLYBY);
        SetBarStyle(nStyle);

        SetOwner(parent);
        GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);

        // colour drop buttons
        int nIndex = CommandToIndex(BUTTON_BACKCOLOR);
        SetButtonStyle(nIndex, GetButtonStyle(nIndex) | TBSTYLE_DROPDOWN);

        nIndex = CommandToIndex(BUTTON_TEXTCOLOR);
        SetButtonStyle(nIndex, GetButtonStyle(nIndex) | TBSTYLE_DROPDOWN);

        /////////////////////////////////////
        // Map in combo boxes
        //

        TBBUTTON buttons[] =
        {
            { 0, FONT_NAME_ID, 0, TBSTYLE_SEP, 0, NULL },
            { 0, -1, 0, TBSTYLE_SEP, 0, NULL },
            { 0, FONT_SIZE_ID, 0, TBSTYLE_SEP, 0, NULL },
            { 0, -1, 0, TBSTYLE_SEP, 0, NULL },
        };
        const int BTNCOUNT = sizeof(buttons) / sizeof(TBBUTTON);

        for (int nBtn = 0; nBtn < BTNCOUNT; nBtn++)
            GetToolBarCtrl().InsertButton(nBtn, &buttons[nBtn]);

        CRect rect;

        TBBUTTONINFO tbi;
        tbi.cbSize = sizeof( TBBUTTONINFO );
        tbi.cx = FONT_COMBO_WIDTH;
        tbi.dwMask = TBIF_SIZE;  // By index

        // The font name combo
        GetToolBarCtrl().SetButtonInfo( FONT_NAME_ID, &tbi );
        GetItemRect( FONT_NAME_POS, &rect );

        rect.left++;
        rect.top++;
        rect.bottom += COMBO_HEIGHT;

        if (!m_font.Create( WS_CHILD | WS_VSCROLL |	WS_VISIBLE | CBS_AUTOHSCROLL |
                            CBS_DROPDOWNLIST | CBS_SORT, rect, this, DROPDOWN_FONT ))
            return FALSE;

        m_font.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( DEFAULT_GUI_FONT ) ) );
        m_font.FillCombo();

        // The font size combo
        tbi.cx = COMBO_WIDTH;
        GetToolBarCtrl().SetButtonInfo( FONT_SIZE_ID, &tbi );
        GetItemRect( FONT_SIZE_POS, &rect );

        rect.top++;
        rect.bottom += COMBO_HEIGHT;

        if (!m_size.Create(WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST |
                           CBS_HASSTRINGS, rect, this, DROPDOWN_SIZE ))
            return FALSE;

        m_size.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( DEFAULT_GUI_FONT ) ) );
        m_size.FillCombo();

        return TRUE;
    }

    return FALSE;
}
Exemple #25
0
void MyFrame::OnPositionLeftBoth(wxCommandEvent& WXUNUSED(evt))
{
    SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE | wxRIBBON_BAR_SHOW_PAGE_ICONS |
                wxRIBBON_BAR_FLOW_VERTICAL);
}
Exemple #26
0
void MyFrame::OnPositionLeftIcons(wxCommandEvent& WXUNUSED(evt))
{
    SetBarStyle((wxRIBBON_BAR_DEFAULT_STYLE &~wxRIBBON_BAR_SHOW_PAGE_LABELS) |
                wxRIBBON_BAR_SHOW_PAGE_ICONS | wxRIBBON_BAR_FLOW_VERTICAL);
}
Exemple #27
0
void MyFrame::OnPositionLeftLabels(wxCommandEvent& WXUNUSED(evt))
{
    SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE | wxRIBBON_BAR_FLOW_VERTICAL);
}
Exemple #28
0
void MyFrame::OnPositionTopBoth(wxCommandEvent& WXUNUSED(evt))
{
    SetBarStyle(wxRIBBON_BAR_DEFAULT_STYLE | wxRIBBON_BAR_SHOW_PAGE_ICONS);
}
int COutlook2Ctrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (OLCTRL2_BASE_CLASS::OnCreate(lpCreateStruct) == -1) return -1;
	SetBarStyle (CBRS_LEFT|CBRS_HIDE_INPLACE|CBRS_SIZE_DYNAMIC & ~(CBRS_BORDER_ANY | CBRS_GRIPPER));
	return 0;
}