//------------------------------------------------------------------------------ // We process the WM_SIZE message just to notify the Task Bar manager // that we've changed, so it can do what it needs with any task bars // docked on top of us. // void CNetscapeStatusBar::OnSize( UINT nType, int cx, int cy ) { CNetscapeStatusBarBase::OnSize( nType, cx, cy ); if ( nType != SIZE_MINIMIZED && cx && cy) { #ifdef MOZ_TASKBAR if( m_bTaskbar ) { // Tell the Task Bar manager ((CNetscapeApp *)AfxGetApp())->GetTaskBarMgr().OnSizeStatusBar( this ); } #endif /* MOZ_TASKBAR */ RECT rcTool; int idx = CommandToIndex(IDS_SECURITY_STATUS); if (idx > -1) { if (m_pTooltip) { GetItemRect(idx, &rcTool); m_pTooltip->SetToolRect(this, IDS_SECURITY_STATUS, &rcTool); } } idx = CommandToIndex(IDS_SIGNED_STATUS); if (idx > -1) { if (m_pTooltip) { GetItemRect(idx, &rcTool); m_pTooltip->SetToolRect(this, IDS_SIGNED_STATUS, &rcTool); } } } }
void CPWFindToolBar::AddExtraControls() { CRect rect, rt; int index; GetItemRect(0, &rt); const int iBtnHeight = rt.Height(); const int iHeight = iBtnHeight; // Add find search text CEdit control (CEditExtn) // Get the index of the placeholder's position in the toolbar index = CommandToIndex(ID_TOOLBUTTON_FINDEDITCTRL); ASSERT(index != -1); // If we have been here before, destroy it first if (m_findedit.GetSafeHwnd() != NULL) { m_findedit.DestroyWindow(); } // Convert that button to a separator SetButtonInfo(index, ID_TOOLBUTTON_FINDEDITCTRL, TBBS_SEPARATOR, EDITCTRL_WIDTH); // Note: "ES_WANTRETURN | ES_MULTILINE". This is to allow the return key to be // trapped by PreTranslateMessage and treated as if the Find button had been // pressed rect = CRect(0, 0, EDITCTRL_WIDTH, iHeight); VERIFY(m_findedit.Create(WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_LEFT | ES_WANTRETURN | ES_MULTILINE, CRect(rect.left + 2, rect.top, rect.right - 2, rect.bottom), this, ID_TOOLBUTTON_FINDEDITCTRL)); GetItemRect(index, &rect); m_findedit.SetWindowPos(NULL, rect.left + 2, rect.top , 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS); // Add find search results CStatic control // Get the index of the placeholder's position in the toolbar index = CommandToIndex(ID_TOOLBUTTON_FINDRESULTS); ASSERT(index != -1); // If we have been here before, destroy it first if (m_findresults.GetSafeHwnd() != NULL) { m_findresults.DestroyWindow(); } // Convert that button to a separator SetButtonInfo(index, ID_TOOLBUTTON_FINDRESULTS, TBBS_SEPARATOR, FINDRESULTS_WIDTH); rect = CRect(0, 0, FINDRESULTS_WIDTH, iHeight); VERIFY(m_findresults.Create(L"", WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP | SS_CENTERIMAGE, CRect(rect.left + 2, rect.top, rect.right - 2, rect.bottom), this, ID_TOOLBUTTON_FINDEDITCTRL)); GetItemRect(index, &rect); m_findresults.SetWindowPos(NULL, rect.left + 2, rect.top, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS); }
void CToolBarEx::dropArrow(UINT nID, UINT nMenu) { menuID = nMenu; SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DRAWDDARROWS); DWORD dw = GetButtonStyle(CommandToIndex(nID)); dw |= TBSTYLE_DROPDOWN; SetButtonStyle(CommandToIndex(nID), dw); }
void CAppStatusBar::OnSize(UINT nType, int cx, int cy) { CStatusBar::OnSize(nType, cx, cy); CRect rc; int i = CommandToIndex (ID_SB_TRAFFIC_THISMONTH); GetStatusBarCtrl ().GetRect (i, &rc); m_ttip.SetToolRect (this, ID_SB_TRAFFIC_THISMONTH, &rc); i = CommandToIndex (ID_SB_TOTALSPEED); GetStatusBarCtrl ().GetRect (i, &rc); m_ttip.SetToolRect (this, ID_SB_TOTALSPEED, &rc); }
//------------------------------------------------------------------------------ void CNetscapeStatusBar::DrawSignedStatus(HDC hdc) { int idx = CommandToIndex( IDS_SIGNED_STATUS ); if (idx < 0) return; UINT nID, nStyle; int cxWidth; GetPaneInfo(idx, nID, nStyle, cxWidth); BOOL bSigned = !(nStyle & SBPS_DISABLED); if (bSigned) { RECT rect; GetItemRect( idx, &rect ); HDC hdcBitmap = ::CreateCompatibleDC( hdc ); HBITMAP hbmOld = (HBITMAP)::SelectObject( hdcBitmap, sm_hbmpSecure ); FEU_TransBlt( hdc, rect.left+1, rect.top+1, sm_sizeSecure.cx, sm_sizeSecure.cy, hdcBitmap, sm_sizeSecure.cx * 2, 0 ,WFE_GetUIPalette(GetParentFrame())); ::SelectObject( hdcBitmap, hbmOld ); VERIFY( ::DeleteDC( hdcBitmap )); } }
void CPWFindToolBar::ToggleToolBarFindCase() { CToolBarCtrl& tbCtrl = GetToolBarCtrl(); int ID, index; if (m_bCaseSensitive) ID = ID_TOOLBUTTON_FINDCASE_S; else ID = ID_TOOLBUTTON_FINDCASE_I; index = CommandToIndex(ID); m_bCaseSensitive = !m_bCaseSensitive; tbCtrl.CheckButton(ID, m_bCaseSensitive ? TRUE : FALSE); TBBUTTONINFO tbinfo = {0}; tbinfo.cbSize = sizeof(tbinfo); tbinfo.dwMask = TBIF_IMAGE; tbCtrl.GetButtonInfo(ID, &tbinfo); tbinfo.iImage = m_bCaseSensitive ? m_iCase_Sensitive_BM_offset : m_iCase_Insensitive_BM_offset; tbinfo.dwMask = TBIF_IMAGE; tbCtrl.SetButtonInfo(ID, &tbinfo); tbCtrl.SetCmdID(index, m_bCaseSensitive ? ID_TOOLBUTTON_FINDCASE_S : ID_TOOLBUTTON_FINDCASE_I); }
void MPCStatusBar::PositionControls() { int h,v,s; GetStatusBarCtrl( ).GetBorders( h, v, s ) ; for(int i = 0; i < m_aPans.GetSize(); i++ ) { CRect rect; int index = CommandToIndex( m_aPans[i]->m_nPaneID ); GetItemRect(index,rect); if( (GetPaneStyle(index) & SBPS_NOBORDERS) == SBPS_NOBORDERS) m_aPans[i]->m_hWnd->MoveWindow(rect); else { rect.top+=v; rect.bottom-=v; rect.left+=h+s; rect.right-=(h+s); m_aPans[i]->m_hWnd->MoveWindow(rect); } } }
void CRRECToolBar::OnColorDropDown(NMHDR* pNMHDR, LRESULT* pResult) { LPNMTOOLBAR pNMTB = (LPNMTOOLBAR)pNMHDR; UINT nBtnID = pNMTB->iItem; switch (nBtnID) { case BUTTON_BACKCOLOR: case BUTTON_TEXTCOLOR: { CRect rButton; GetItemRect(CommandToIndex(pNMTB->iItem), rButton); ClientToScreen(rButton); COLORREF color = GetFontColor(nBtnID == BUTTON_TEXTCOLOR); CString defaultText, customText; defaultText.LoadString(STRING_DEFAULT); customText.LoadString(STRING_CUSTOM); new CColourPopup(CPoint(rButton.left, rButton.bottom), color, this, nBtnID, defaultText, customText, TRUE); } break; } *pResult = 0; }
//------------------------------------------------------------------------------ void CNetscapeStatusBar::SaveModeState() { switch( m_enStatBarMode ) { case eSBM_Panes: { #ifdef MOZ_TASKBAR if( m_bTaskbar ) { // Save the IDS_TASKBAR pane width UINT u; GetPaneInfo( CommandToIndex( IDS_TASKBAR ), u, u, m_iStatBarPaneWidth ); } #endif /* MOZ_TASKBAR */ break; } case eSBM_Simple: { // Don't care to save anything break; } default: { break; } } }
//------------------------------------------------------------------------------ void CNetscapeStatusBar::OnLButtonDown( UINT nFlags, CPoint point ) { if( m_bSecurityStatus ) { RECT rc; GetItemRect( CommandToIndex( IDS_SECURITY_STATUS ), &rc ); if( PtInRect( &rc, point ) ) { CGenericFrame *pGenFrame = DYNAMIC_DOWNCAST( CGenericFrame, GetParentFrame() ); if( pGenFrame ) { MWContext *pContext = pGenFrame->GetMainContext()->GetContext(); if( pContext ) { CAbstractCX *pCX = ABSTRACTCX(pContext); if( pCX ) { URL_Struct *pURL = pCX->CreateUrlFromHist( TRUE ); SECNAV_SecurityAdvisor( pContext, pURL ); } } } } } CNetscapeStatusBarBase::OnLButtonDown( nFlags, point ); }
//------------------------------------------------------------------------------ BOOL CNetscapeStatusBar::SetTaskBarSize( CDockedTaskBar *pTaskBar ) { #ifdef MOZ_TASKBAR if( !m_bTaskbar || !pTaskBar ) { return FALSE; } CRect rc; int iIndex = CommandToIndex( IDS_TASKBAR ); if( iIndex != -1 ) { GetItemRect( iIndex, &rc ); //Get Item Rect is returning us the wrong dimensions. It's off by 6 pixels //Eventually figure out what's going wrong rc.right -= 6; pTaskBar->MoveWindow( &rc ); } else { // The pane is not available right now. We'll resize the task bar later. m_pTaskBar = pTaskBar; } #endif /* MOZ_TASKBAR */ return TRUE; }
CWnd* CToolBarEx::InsertControl(CWnd* pCtrl, RECT& rect, UINT nID) { ASSERT_VALID(pCtrl); // make sure the id is valid, and set the button style for a seperator. int nState, nIndex = CommandToIndex(nID); if (nIndex > -1) { ASSERT(nIndex >= 0); SetButtonInfo(nIndex, nID, TBBS_SEPARATOR, rect.right - rect.left); // insert the control into the toolbar. GetItemRect(nIndex, &rect); pCtrl->SetWindowPos(0, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS); pCtrl->SetFont(GetFont()); BOOL bVert = (m_dwStyle & CBRS_ORIENT_VERT) != 0; if (bVert) { nState = GetToolBarCtrl().GetState(nIndex); GetToolBarCtrl().SetState(nID,(nState | TBSTATE_HIDDEN)); pCtrl->ShowWindow(SW_HIDE); } else { nState = GetToolBarCtrl().GetState(nIndex); GetToolBarCtrl().SetState(nIndex,(nState & ~TBSTATE_HIDDEN)); pCtrl->ShowWindow(SW_SHOW); } } else pCtrl->ShowWindow(SW_HIDE); return pCtrl; }
bool CSideBar::IsItemChecked(int Command) const { int Index=CommandToIndex(Command); if (Index<0) return false; return m_ItemList[Index].IsChecked(); }
bool CDropDownMenu::SetItemText(int Command,LPCTSTR pszText) { int Index=CommandToIndex(Command); if (Index<0) return false; m_ItemList[Index]->SetText(pszText); return true; }
//********************************************************************************** void CToolPalette::CheckButtonID(UINT uCommandID) { int index = CommandToIndex (uCommandID); if (index >= 0) { CBCGPToolbarButton* pButton = GetButton (index); ASSERT_VALID (pButton); m_nCheckedIndex = index; Invalidate (); } }
bool CSideBar::RedrawItem(int Command) { int Index=CommandToIndex(Command); if (Index<0) return false; UpdateItem(Index); return true; }
LRESULT CStatusBar::OnSetText( WPARAM wParam, LPARAM lParam ) /***********************************************************/ { UNUSED_ALWAYS( wParam ); int n = CommandToIndex( ID_SEPARATOR ); if( n < 0 ) { return( FALSE ); } SetPaneText( n, (LPCTSTR)lParam ); return( TRUE ); }
bool CSideBar::CheckItem(int Command,bool fCheck) { int Index=CommandToIndex(Command); if (Index<0) return false; if (m_ItemList[Index].IsChecked()!=fCheck) { m_ItemList[Index].State^=ITEM_STATE_CHECKED; UpdateItem(Index); } return true; }
LRESULT CStatusBar::OnGetTextLength( WPARAM wParam, LPARAM lParam ) /*****************************************************************/ { UNUSED_ALWAYS( wParam ); UNUSED_ALWAYS( lParam ); int n = CommandToIndex( ID_SEPARATOR ); if( n < 0 ) { return( 0L ); } return( GetPaneText( n ).GetLength() ); }
void CMightyCaslStatusBar::OnSize(UINT nType, int cx, int cy) { CStatusBar::OnSize(nType, cx, cy); int nIndex = CommandToIndex(ID_INDICATOR_PROGRESS); if (nIndex == -1) return; CRect rect; GetItemRect(nIndex, &rect); m_meter.MoveWindow(rect); }
bool CDropDownMenu::DeleteItem(int Command) { int Index=CommandToIndex(Command); if (Index<0) return false; std::vector<CItem*>::iterator i=m_ItemList.begin(); std::advance(i,Index); delete *i; m_ItemList.erase(i); return true; }
bool CSideBar::EnableItem(int Command,bool fEnable) { int Index=CommandToIndex(Command); if (Index<0) return false; if (m_ItemList[Index].IsEnabled()!=fEnable) { m_ItemList[Index].State^=ITEM_STATE_DISABLED; if (!fEnable && m_HotItem==Index) m_HotItem=-1; UpdateItem(Index); } return true; }
void BookmarkToolBar::OnGetDispInfo(NMHDR *pNMHDR, LRESULT *pResult) { NMTBDISPINFO *sNmTbDispInfo = (NMTBDISPINFO *)pNMHDR; *pResult = 0; if (sNmTbDispInfo->dwMask == TBNF_IMAGE) { xpr_sint_t sIndex = CommandToIndex(sNmTbDispInfo->idCommand); sNmTbDispInfo->iImage = sIndex; } sNmTbDispInfo->dwMask = TBNF_DI_SETITEM; }
void CTrueColorToolBar::AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID) { if (!m_bDropDown) { GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DRAWDDARROWS); m_bDropDown = TRUE; } SetButtonStyle(CommandToIndex(uButtonID), TBSTYLE_DROPDOWN); stDropDownInfo DropDownInfo; DropDownInfo.pParent = pParent; DropDownInfo.uButtonID = uButtonID; DropDownInfo.uMenuID = uMenuID; m_lstDropDownButton.Add(DropDownInfo); }
void CToolBarXP::TrackPopupMenu (int nID, CMenu* pMenu) { CRect rcTBItem; int nTBIndex = CommandToIndex (nID); TPMPARAMS tpmp = { sizeof TPMPARAMS }; GetItemRect (nTBIndex, rcTBItem); ClientToScreen (rcTBItem); CopyRect (&tpmp.rcExclude, rcTBItem); rcTBItem.OffsetRect (4, 0); CMenuXP::SetMRUMenuBarItem (rcTBItem); SetButtonStyle (nTBIndex, GetButtonStyle (nTBIndex)|TBBS_INDETERMINATE); UpdateWindow(); ::TrackPopupMenuEx (pMenu->GetSafeHmenu(), TPM_LEFTBUTTON, tpmp.rcExclude.left, tpmp.rcExclude.bottom, GetParentFrame()->GetSafeHwnd(), &tpmp); SetButtonStyle (nTBIndex, GetButtonStyle (nTBIndex)&~TBBS_INDETERMINATE); }
void BookmarkToolBar::addBookmarkButton(xpr_sint_t aIndex, BookmarkItem *aBookmarkItem) { CToolBarCtrl &sToolBarCtrl = GetToolBarCtrl(); xpr_sint_t nImage = -1; HICON hIcon = XPR_NULL; BookmarkMgr::Result sResult = BookmarkMgr::instance().getIcon(aIndex, hIcon); if (hIcon) nImage = mImgList.Add(hIcon); xpr_bool_t sSeparator = aBookmarkItem->isSeparator(); TBBUTTON sTbButton = {0}; if (sSeparator == XPR_TRUE) { sTbButton.iBitmap = -1; sTbButton.fsState = TBSTATE_ENABLED; sTbButton.fsStyle = BTNS_SEP; sTbButton.dwData = (DWORD)aIndex; } else { sTbButton.iBitmap = nImage; sTbButton.fsState = TBSTATE_ENABLED; sTbButton.fsStyle = BTNS_BUTTON | BTNS_SHOWTEXT | TBSTYLE_AUTOSIZE; sTbButton.idCommand = ID_BOOKMARK_FIRST + aIndex; sTbButton.iString = 0; sTbButton.dwData = (DWORD)aIndex; } sToolBarCtrl.InsertButton(aIndex, &sTbButton); if (sSeparator == XPR_FALSE) SetButtonText(CommandToIndex(sTbButton.idCommand), XPR_IS_TRUE(gOpt->mMain.mBookmarkBarText) ? aBookmarkItem->mName.c_str() : XPR_STRING_LITERAL("")); if (sSeparator == XPR_FALSE && gOpt->mMain.mBookmarkBarText == XPR_FALSE) { TBBUTTONINFO sTbButtonInfo = {0}; sTbButtonInfo.cbSize = sizeof(TBBUTTONINFO); sTbButtonInfo.dwMask = TBIF_BYINDEX | TBIF_STYLE; sToolBarCtrl.GetButtonInfo(aIndex, &sTbButtonInfo); sTbButtonInfo.fsStyle &= ~BTNS_SHOWTEXT; sToolBarCtrl.SetButtonInfo(aIndex, &sTbButtonInfo); } }
// called to modify a pane BOOL CStatusBarACT::SetPane(LPSBACTPANEINFO lpsbactpi) { if (lpsbactpi == NULL) { return FALSE; } int nIndex = CommandToIndex(lpsbactpi->nID); int nMax = GetStatusBarCtrl().GetParts(0, NULL); if (nIndex < nMax) { return FALSE; } SetPaneTooltipIndex(nIndex, lpsbactpi->lpszTip); SetPaneFlagsIndex(nIndex, lpsbactpi->dwFlags); SetPaneCursorIndex(nIndex, lpsbactpi->lpszCursor); return TRUE; }
LRESULT CStatusBar::OnGetText( WPARAM wParam, LPARAM lParam ) /***********************************************************/ { ASSERT( (LPCTSTR)lParam != NULL ); int n = CommandToIndex( ID_SEPARATOR ); if( n < 0 ) { ((LPTSTR)lParam)[0] = _T('\0'); return( 0L ); } CString strText = GetPaneText( n ); int nLength = strText.GetLength(); if( nLength >= (int)wParam ) { nLength = (int)wParam - 1; } _tcsncpy( (LPTSTR)lParam, (LPCTSTR)strText, nLength ); ((LPTSTR)lParam)[0] = _T('\0'); return( nLength ); }
LRESULT CExtThemeSwitcherToolControlBar::WindowProc( UINT message, WPARAM wParam, LPARAM lParam ) { if( message == WM_COMMAND ) { UINT nCmdID = ThemeSwitcher_GetToolBarCmdIDByMenuCmdID( UINT(wParam) ); int nButtonIndex = CommandToIndex( nCmdID ); if( nButtonIndex >= 0 ) { CExtThemeSwitcherToolButton * pTBB = DYNAMIC_DOWNCAST( CExtThemeSwitcherToolButton, GetButton( nButtonIndex ) ); if( pTBB != NULL ) { ThemeSwitcher_OnButtonInvoke( pTBB ); return 0; } } } else if( message == (WM_USER+765) ) { HWND hWnd = ::GetParent( m_hWnd ); for( ; hWnd != NULL; hWnd = ::GetParent( hWnd ) ) { __EXT_MFC_LONG_PTR dwStyle = ::__EXT_MFC_GetWindowLong( hWnd, GWL_STYLE ); if( (dwStyle&WS_CHILD) == 0 ) { CWnd * pWndPermanent = CWnd::FromHandlePermanent( hWnd ); if( pWndPermanent != NULL && pWndPermanent->IsKindOf( RUNTIME_CLASS( CExtMiniDockFrameWnd ) ) ) continue; SetupHookWndSink( hWnd ); break; } } } LRESULT lResult = CExtToolControlBar::WindowProc( message, wParam, lParam ); return lResult; }
BOOL MPCStatusBar::AddControl(CWnd * pWnd, int paneID, BOOL bAutodeleteControl) { MPCStatusBarPaneControlInfo * pPanInfo = GetPanControl(paneID); if( pPanInfo ) return FALSE; int idx = CommandToIndex( paneID ) ; if( idx == -1 ) return FALSE; MPCStatusBarPaneControlInfo * pPan = new MPCStatusBarPaneControlInfo; pPan->m_nPaneID = paneID; pPan->m_hWnd = pWnd; pPan->m_bAutodelete = bAutodeleteControl; m_aPans.Add(pPan); PositionControls(); Invalidate(TRUE); return TRUE; }