//***************************************************************************** void CBCGPCaptionBar::SetImageToolTip (LPCTSTR lpszToolTip, LPCTSTR lpszDescription) { m_strImageToolTip = lpszToolTip == NULL ? _T("") : lpszToolTip; m_strImageDescription = lpszDescription == NULL ? _T("") : lpszDescription; UpdateTooltips (); }
pnlRepeater::pnlRepeater(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) : PluginPanel(this) { mSerPort = NULL; BuildContent(parent,id,pos,size); wndId2Enum[ID_ENABLE_TX]=ENABLE_TX; wndId2Enum[ID_ENABLE_RX]=ENABLE_RX; wndId2Enum[ID_GCORRQ_TX]=GCORRQ_TX; wndId2Enum[ID_GCORRI_TX]=GCORRI_TX; wndId2Enum[ID_INSEL]=INSEL; wndId2Enum[ID_IQCORR_TX]=IQCORR_TX; wndId2Enum[ID_DCCORRI]=DCCORRI_TX; wndId2Enum[ID_DCCORRQ]=DCCORRQ_TX; wndId2Enum[ID_DC_BYP_TX]=DC_BYP_TX; wndId2Enum[ID_INVSINC_BYP_TX]=INVSINC_BYP; wndId2Enum[ID_FIR_BYP_TX]=FIR_BYP_TX; wndId2Enum[ID_GC_BYP_TX]=GC_BYP_TX; wndId2Enum[ID_PHC_BYP_TX]=PHC_BYP_TX; wndId2Enum[ID_TNCO]=TNCO; wndId2Enum[ID_GCORRQ_RX]=GCORRQ_RX; wndId2Enum[ID_GCORRI_RX]=GCORRI_RX; wndId2Enum[ID_IQCORR_RX]=IQCORR_RX; wndId2Enum[ID_DCCORR]=DCCORR; wndId2Enum[ID_FIR_BYP_RX]=FIR_BYP_RX; wndId2Enum[ID_DC_BYP_RX]=DC_BYP_RX; wndId2Enum[ID_PHC_BYP_RX]=PHC_BYP_RX; wndId2Enum[ID_GC_BYP_RX]=GC_BYP_RX; vector<cmbKeyValuePair> keyvalues; for(int i=-2048; i<=2047; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("%i", i))); cmbIQCORR_TX->Set(keyvalues); cmbIQCORR_RX->Set(keyvalues); keyvalues.clear(); for(int i=0; i<2048; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("%i", i))); cmbGCORRI_TX->Set(keyvalues); cmbGCORRQ_TX->Set(keyvalues); cmbGCORRI_RX->Set(keyvalues); cmbGCORRQ_RX->Set(keyvalues); keyvalues.clear(); for(int i=-128; i<128; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("%i", i))); cmbDCCORRI->Set(keyvalues); cmbDCCORRQ->Set(keyvalues); keyvalues.clear(); for(int i=0; i<8; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("2^%i", i+12))); cmbDCCORR->Set(keyvalues); UpdateGUI(this); int values[] = {1, 2}; rgrTNCO->SetIndexValues(values, 2); UpdateTooltips(this); }
void pnlCDS::Initialize(LMS7002_MainControl *pControl) { lmsControl = pControl; wxArrayString temp; UpdateTooltips(this); }
//********************************************************************************** void CToolPalette::AdjustLocations () { CalcButtonLocations (m_nColumns, false); UpdateTooltips (); return; }
//***************************************************************************** void CBCGPCaptionBar::RecalcLayout () { CClientDC dc (NULL); CFont* pOldFont = dc.SelectObject ( m_hFont == NULL ? &globalData.fontRegular : CFont::FromHandle (m_hFont)); ASSERT (pOldFont != NULL); TEXTMETRIC tm; dc.GetTextMetrics (&tm); int nTextHeight = tm.tmHeight + 2; CSize sizeImage = GetImageSize (); const int nButtonVertMargin = CBCGPVisualManager::GetInstance()->GetMessageBarMargin(); const int nBorderSize = m_bIsMessageBarMode ? 0 : m_nBorderSize; //------------------------------------------------------------------- // the height is set to the default (provided by the user in Create) // or calculated if it is -1 //------------------------------------------------------------------- if (m_nDefaultHeight != -1) { m_nCurrentHeight = m_nDefaultHeight; } else { if (!m_strBtnText.IsEmpty () && m_bIsMessageBarMode) { nTextHeight += 2 * nButtonVertMargin; } m_nCurrentHeight = max (nTextHeight, sizeImage.cy) + m_nMargin * 2 + nBorderSize; } if (m_bIsMessageBarMode) { m_nCurrentHeight += CBCGPVisualManager::GetInstance()->GetMessageBarMargin() * 2; } // for left and center alignment: icon, button, text // for right alignment: text, button, icon CRect rectClient; GetClientRect (rectClient); if (rectClient.IsRectEmpty ()) { return; } if (m_bIsMessageBarMode) { CSize sizeImage = CBCGPMenuImages::Size (); const int nCloseButtonMargin = 4; sizeImage.cx += 2 * nCloseButtonMargin; sizeImage.cy += 2 * nCloseButtonMargin; m_rectClose = CRect ( CPoint (rectClient.right - sizeImage.cx, rectClient.top + nCloseButtonMargin), sizeImage); m_rectClose.right--; rectClient.DeflateRect (nCloseButtonMargin, nCloseButtonMargin); rectClient.right -= m_rectClose.Width (); } else { m_rectClose.SetRectEmpty(); } BOOL bButtonLeftOfIcon = FALSE; BOOL bTextLeftOfButton = FALSE; BOOL bTextLeftOfIcon = FALSE; BOOL bIconCenter = FALSE; BOOL bButtonCenter = FALSE; BOOL bButtonAfterText = FALSE; BOOL bTextCenter = FALSE; // differs from the current height, because the border size is non-client area int nBaseLine = rectClient.CenterPoint ().y; int nCenterOffset = rectClient.CenterPoint ().x; int nNextXOffsetLeft = rectClient.left + m_nMargin; int nNextXOffsetRight = rectClient.right - m_nMargin; int nNextXOffsetCenter = nCenterOffset; if (IsImageSet ()) { if (sizeImage.cy < rectClient.Height () || m_bIsMessageBarMode) { // center the icon if its height lesser than client area height m_rectImage.top = nBaseLine - sizeImage.cy / 2; } else { // otherwise, clip it from the buttom m_rectImage.top = rectClient.top + m_nMargin; } if (!m_bStretchImage) { m_rectImage.bottom = m_rectImage.top + sizeImage.cy; } else { m_rectImage.bottom = rectClient.bottom - m_nMargin; } switch (m_iconAlignment) { case ALIGN_LEFT: m_rectImage.left = nNextXOffsetLeft; m_rectImage.right = m_rectImage.left + sizeImage.cx; nNextXOffsetLeft = m_rectImage.right + m_nHorzElementOffset; break; case ALIGN_RIGHT: m_rectImage.left = nNextXOffsetRight - sizeImage.cx; m_rectImage.right = m_rectImage.left + sizeImage.cx; nNextXOffsetRight = m_rectImage.left - m_nHorzElementOffset; // only in this case button and text is at the left side of the icon bButtonLeftOfIcon = TRUE; bTextLeftOfIcon = TRUE; break; case ALIGN_CENTER: bIconCenter = TRUE; nNextXOffsetCenter -= sizeImage.cx / 2; if (m_btnAlignnment == ALIGN_LEFT) { bButtonLeftOfIcon = TRUE; } if (m_textAlignment == ALIGN_LEFT) { bTextLeftOfIcon = TRUE; } break; default: ASSERT (FALSE); } } else { m_rectImage.SetRectEmpty(); } int nButtonWidth = 0; if (!m_strBtnText.IsEmpty ()) { nButtonWidth = dc.GetTextExtent (m_strBtnText).cx + 2 * m_nHorzElementOffset; if (m_bIsMessageBarMode) { nButtonWidth += 2 * nButtonHorzMargin; } if (m_uiBtnID != 0 && m_bBtnEnabled && m_bBtnHasDropDownArrow) { nButtonWidth += nMenuArrowWidth; } // the button always has a height equivalent to the bar's height m_rectButton.top = rectClient.top; m_rectButton.bottom = rectClient.bottom; if (m_bIsMessageBarMode) { m_rectButton.DeflateRect (0, nButtonVertMargin); } switch (m_btnAlignnment) { case ALIGN_LEFT: if (!m_bIsMessageBarMode || m_textAlignment != ALIGN_LEFT) { m_rectButton.left = nNextXOffsetLeft; if (nNextXOffsetLeft == rectClient.left + m_nMargin) { m_rectButton.left = rectClient.left + m_nMargin; } m_rectButton.right = m_rectButton.left + nButtonWidth; nNextXOffsetLeft = m_rectButton.right + m_nHorzElementOffset; } else { bButtonAfterText = TRUE; } break; case ALIGN_RIGHT: m_rectButton.left = nNextXOffsetRight - nButtonWidth; if (nNextXOffsetRight == rectClient.right - m_nMargin) { m_rectButton.left = rectClient.right - nButtonWidth - m_nMargin; } m_rectButton.right = m_rectButton.left + nButtonWidth; nNextXOffsetRight = m_rectButton.left - m_nHorzElementOffset; // only in this case text at the left side of the button bTextLeftOfButton = TRUE; break; case ALIGN_CENTER: bButtonCenter = TRUE; nNextXOffsetCenter -= nButtonWidth / 2; if (m_textAlignment == ALIGN_LEFT) { bTextLeftOfButton = TRUE; } break; default: ASSERT (FALSE); return; } } else { m_rectButton.SetRectEmpty(); } CSize sizeText (0, 0); if (!m_strText.IsEmpty ()) { sizeText = GetTextSize (&dc, m_strText); m_rectText.top = nBaseLine - sizeText.cy / 2; m_rectText.bottom = m_rectText.top + sizeText.cy; switch (m_textAlignment) { case ALIGN_LEFT: m_rectText.left = nNextXOffsetLeft; nNextXOffsetLeft += sizeText.cx + 2 * m_nMargin; break; case ALIGN_RIGHT: m_rectText.left = nNextXOffsetRight - sizeText.cx; break; case ALIGN_CENTER: bTextCenter = TRUE; nNextXOffsetCenter -= sizeText.cx / 2; break; default: ASSERT (FALSE); return; } m_rectText.right = m_rectText.left + sizeText.cx; AdjustRectToMargin (m_rectText, rectClient, m_nMargin); m_rectDrawText = m_rectText; } if (bIconCenter) { m_rectImage.left = nNextXOffsetCenter; m_rectImage.right = m_rectImage.left + sizeImage.cx; nNextXOffsetCenter = m_rectImage.right + m_nHorzElementOffset; } if (bButtonAfterText) { m_rectButton.left = nNextXOffsetLeft; m_rectButton.right = m_rectButton.left + nButtonWidth; if (m_rectButton.right + m_nMargin > rectClient.right) { m_rectButton.right = rectClient.right - m_nMargin; m_rectButton.left = m_rectButton.right - nButtonWidth; } } else if (bButtonCenter) { m_rectButton.left = nNextXOffsetCenter; m_rectButton.right = m_rectButton.left + nButtonWidth; nNextXOffsetCenter = m_rectButton.right + m_nHorzElementOffset; } if (bTextCenter) { m_rectText.left = nNextXOffsetCenter; m_rectText.right = m_rectText.left + sizeText.cx; AdjustRectToMargin (m_rectText, rectClient, m_nMargin); m_rectDrawText = m_rectText; } if (IsImageSet ()) { // do not retain image size if it should be stretched AdjustRectToMargin (m_rectImage, rectClient, m_nMargin, !m_bStretchImage); if (m_rectImage.left < rectClient.left || m_rectImage.right > rectClient.right) { m_rectImage.SetRectEmpty (); } } CRect rectButtonTemp = m_rectButton; if (!m_strBtnText.IsEmpty () && IsImageSet ()) { CheckRectangle (rectButtonTemp, m_rectImage, bButtonLeftOfIcon); } if (!m_strBtnText.IsEmpty ()) { AdjustRectToMargin (rectButtonTemp, rectClient, m_nMargin); if (m_rectButton.Width () + m_rectImage.Width () + 2 * m_nMargin > rectClient.Width ()) { m_rectButton.SetRectEmpty (); } } if (!m_strText.IsEmpty ()) { CheckRectangle (m_rectDrawText, m_rectImage, bTextLeftOfIcon); CheckRectangle (m_rectDrawText, rectButtonTemp, bTextLeftOfButton || bButtonAfterText); } dc.SelectObject (pOldFont); m_bTextIsTruncated = m_rectDrawText.Width () < sizeText.cx; UpdateTooltips (); }