From: boca4711 <boc...@us...> - 2004-10-17 19:12:38
|
Update of /cvsroot/anyedit/AnyEditToolkit/GuiLib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15880/GuiLib Modified Files: GuiButton.cpp GuiButton.h Log Message: - Renamed member functions and variable names - Deleted unused code - Added doxygen comments Index: GuiButton.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiButton.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GuiButton.cpp 11 Oct 2004 18:01:23 -0000 1.5 --- GuiButton.cpp 17 Oct 2004 19:12:29 -0000 1.6 *************** *** 43,54 **** m_iAlign = ALIGN_LEFT; m_iStyle = STYLE_SEMIFLAT; - m_lpMsg = _T(""); m_iSelected = 0; m_bShowImage = FALSE; m_bShowText = TRUE; m_iTypeButton = TYPE_NORMAL; // Normal by default ! m_iMenuActivo = FALSE; ! m_clrface = GuiDrawLayer::GetRGBColorFace(); ! m_ReposWindow = FALSE; m_bIsDark = FALSE; m_iResMenu = 0; --- 43,53 ---- m_iAlign = ALIGN_LEFT; m_iStyle = STYLE_SEMIFLAT; m_iSelected = 0; m_bShowImage = FALSE; m_bShowText = TRUE; m_iTypeButton = TYPE_NORMAL; // Normal by default ! m_bMenuActive = FALSE; ! m_clrFace = GuiDrawLayer::GetRGBColorFace(); ! m_bReposWindow = FALSE; m_bIsDark = FALSE; m_iResMenu = 0; *************** *** 120,124 **** { if (STYLEXP == m_iStyle) ! cb.CreateSolidBrush(m_clrface); } else if (m_iSelected == 1) // el mouse esta sobre el boton --- 119,123 ---- { if (STYLEXP == m_iStyle) ! cb.CreateSolidBrush(m_clrFace); } else if (m_iSelected == 1) // el mouse esta sobre el boton *************** *** 369,373 **** pDC->Draw3dRect(m_rect, GuiDrawLayer::GetRGBColorShadow(), GuiDrawLayer::GetRGBColorBTNHigh()); else if (STYLEXP == m_iStyle) ! DrawBottonXP(pDC, m_rect, NORMAL); else // si es 3d { --- 368,372 ---- pDC->Draw3dRect(m_rect, GuiDrawLayer::GetRGBColorShadow(), GuiDrawLayer::GetRGBColorBTNHigh()); else if (STYLEXP == m_iStyle) ! DrawButtonXP(pDC, m_rect, NORMAL); else // si es 3d { *************** *** 391,395 **** pDC->Draw3dRect(m_rect, GuiDrawLayer::GetRGBColorBTNHigh(), GuiDrawLayer::GetRGBColorShadow()); else if (STYLEXP == m_iStyle) ! DrawBottonXP(pDC, m_rect, OVER); else // si es 3d { --- 390,394 ---- pDC->Draw3dRect(m_rect, GuiDrawLayer::GetRGBColorBTNHigh(), GuiDrawLayer::GetRGBColorShadow()); else if (STYLEXP == m_iStyle) ! DrawButtonXP(pDC, m_rect, OVER); else // si es 3d { *************** *** 425,436 **** if (m_State & ODS_DISABLED) { ! DrawBottonXP(pDC, m_rect, DISABLED); } else { if (m_State & ODS_FOCUS) ! DrawBottonXP(pDC, m_rect, FOCUS); else ! DrawBottonXP(pDC, m_rect, NORMAL); } } --- 424,435 ---- if (m_State & ODS_DISABLED) { ! DrawButtonXP(pDC, m_rect, DISABLED); } else { if (m_State & ODS_FOCUS) ! DrawButtonXP(pDC, m_rect, FOCUS); else ! DrawButtonXP(pDC, m_rect, NORMAL); } } *************** *** 441,445 **** else { ! pDC->Draw3dRect(m_rect, m_clrface, m_clrface); } } --- 440,444 ---- else { ! pDC->Draw3dRect(m_rect, m_clrFace, m_clrFace); } } *************** *** 453,460 **** } ! ! void CGuiButton::AutoSizeButton(BOOL m_bAutoAjust) { ! m_ReposWindow = m_bAutoAjust; Invalidate(); UpdateWindow(); --- 452,458 ---- } ! void CGuiButton::AutoSizeButton(BOOL bAutoAdjust) { ! m_bReposWindow = bAutoAdjust; Invalidate(); UpdateWindow(); *************** *** 464,472 **** { CButton::OnSysColorChange(); ! m_clrface = GuiDrawLayer::GetRGBColorXP(); } //************************************************************************* ! void CGuiButton::DrawBottonXP(CDC* pDC, CRect rc, int Estado) { COLORREF clrPress = ::GetSysColor(COLOR_HIGHLIGHT); --- 462,470 ---- { CButton::OnSysColorChange(); ! m_clrFace = GuiDrawLayer::GetRGBColorXP(); } //************************************************************************* ! void CGuiButton::DrawButtonXP(CDC* pDC, CRect rc, int iState) { COLORREF clrPress = ::GetSysColor(COLOR_HIGHLIGHT); *************** *** 476,485 **** CPen cp(PS_SOLID, 1, clrPress); ! CPen cpface(PS_SOLID, 1, m_clrface); CPen cpsxp(PS_SOLID, 1, GuiDrawLayer::GetRGBColorXP()); CPen cpOver(PS_SOLID, 1, RGB(255, 193, 111)); CPen cpShadow(PS_SOLID, 1, clrShadow); CPen* pOld = NULL; ! if (Estado != DISABLED) pOld = pDC->SelectObject(&cp); else --- 474,483 ---- CPen cp(PS_SOLID, 1, clrPress); ! CPen cpface(PS_SOLID, 1, m_clrFace); CPen cpsxp(PS_SOLID, 1, GuiDrawLayer::GetRGBColorXP()); CPen cpOver(PS_SOLID, 1, RGB(255, 193, 111)); CPen cpShadow(PS_SOLID, 1, clrShadow); CPen* pOld = NULL; ! if (iState != DISABLED) pOld = pDC->SelectObject(&cp); else *************** *** 500,504 **** pDC->LineTo(rc.right - 1, rc.bottom); ! if (Estado != DISABLED) { // se dibuja algunas lineas para dar forma 3d --- 498,502 ---- pDC->LineTo(rc.right - 1, rc.bottom); ! if (iState != DISABLED) { // se dibuja algunas lineas para dar forma 3d *************** *** 520,524 **** rcBordes.left += 1; rcBordes.top += 1; ! switch (Estado) { case OVER: --- 518,522 ---- rcBordes.left += 1; rcBordes.top += 1; ! switch (iState) { case OVER: *************** *** 536,555 **** // pintar los vertices // left,top ! pDC->SetPixel(rc.left + 1, rc.top, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left, rc.top + 1, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left + 1, rc.top + 1, Estado != DISABLED ? clrPress:clrShadow); // pintar los vertices // left,bottom ! pDC->SetPixel(rc.left + 1, rc.bottom, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left, rc.bottom - 1, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left + 1, rc.bottom - 1, Estado != DISABLED ? clrPress:clrShadow); // right,top ! pDC->SetPixel(rc.right - 1, rc.top, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right, rc.top + 1, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right - 1, rc.top + 1, Estado != DISABLED ? clrPress:clrShadow); // right,bottom ! pDC->SetPixel(rc.right - 1, rc.bottom, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right, rc.bottom - 1, Estado != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right - 1, rc.bottom - 1, Estado != DISABLED ? clrPress:clrShadow); } pDC->SelectObject(pOld); --- 534,553 ---- // pintar los vertices // left,top ! pDC->SetPixel(rc.left + 1, rc.top, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left, rc.top + 1, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left + 1, rc.top + 1, iState != DISABLED ? clrPress:clrShadow); // pintar los vertices // left,bottom ! pDC->SetPixel(rc.left + 1, rc.bottom, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left, rc.bottom - 1, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.left + 1, rc.bottom - 1, iState != DISABLED ? clrPress:clrShadow); // right,top ! pDC->SetPixel(rc.right - 1, rc.top, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right, rc.top + 1, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right - 1, rc.top + 1, iState != DISABLED ? clrPress:clrShadow); // right,bottom ! pDC->SetPixel(rc.right - 1, rc.bottom, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right, rc.bottom - 1, iState != DISABLED ? GuiDrawLayer::GetRGBFondoXP():clrShadow); ! pDC->SetPixel(rc.right - 1, rc.bottom - 1, iState != DISABLED ? clrPress:clrShadow); } pDC->SelectObject(pOld); *************** *** 557,563 **** //***************************************************************************** ! void CGuiButton::SetColor(COLORREF m_clrFaces) { ! m_clrface = m_clrFaces; } --- 555,561 ---- //***************************************************************************** ! void CGuiButton::SetColor(COLORREF clrFaces) { ! m_clrFace = clrFaces; } *************** *** 566,570 **** { m_bShowImage = bShowImage; ! CalLayout(); } --- 564,568 ---- { m_bShowImage = bShowImage; ! CalcLayout(); } *************** *** 573,581 **** { m_bShowText = bShowText; ! CalLayout(); } //***************************************************************************** ! void CGuiButton::CalLayout() { CString m_str; --- 571,579 ---- { m_bShowText = bShowText; ! CalcLayout(); } //***************************************************************************** ! void CGuiButton::CalcLayout() { CString m_str; *************** *** 615,619 **** m_szButton= CSize(SizeCad.cx + sizeImag.cx + 7, m_High); ! if (m_ReposWindow == TRUE) { SetWindowPos(NULL, 0, 0, SizeCad.cx + sizeImag.cx + 10, m_High, --- 613,617 ---- m_szButton= CSize(SizeCad.cx + sizeImag.cx + 7, m_High); ! if (m_bReposWindow == TRUE) { SetWindowPos(NULL, 0, 0, SizeCad.cx + sizeImag.cx + 10, m_High, *************** *** 626,632 **** CSize CGuiButton::GetSizeButton() { ! m_ReposWindow = FALSE; ! CalLayout(); ! m_ReposWindow = TRUE; return m_szButton; } --- 624,630 ---- CSize CGuiButton::GetSizeButton() { ! m_bReposWindow = FALSE; ! CalcLayout(); ! m_bReposWindow = TRUE; return m_szButton; } *************** *** 695,705 **** //***************************************************************************** ! void CGuiButton::SetToolTip(LPCTSTR lpMsg) { - CRect rc; - m_lpMsg = lpMsg; if (GetSafeHwnd()== NULL) return; ! if (m_lpMsg != NULL) { if (m_ToolTipCtrl.GetSafeHwnd() == NULL) --- 693,701 ---- //***************************************************************************** ! void CGuiButton::SetToolTip(LPCTSTR lpszToolTip) { if (GetSafeHwnd()== NULL) return; ! if (lpszToolTip != NULL) { if (m_ToolTipCtrl.GetSafeHwnd() == NULL) *************** *** 707,715 **** m_ToolTipCtrl.Create(this, TTS_ALWAYSTIP); m_ToolTipCtrl.Activate(TRUE); ! m_ToolTipCtrl.AddTool(this, lpMsg); } else { ! m_ToolTipCtrl.UpdateTipText(lpMsg, this); } } --- 703,711 ---- m_ToolTipCtrl.Create(this, TTS_ALWAYSTIP); m_ToolTipCtrl.Activate(TRUE); ! m_ToolTipCtrl.AddTool(this, lpszToolTip); } else { ! m_ToolTipCtrl.UpdateTipText(lpszToolTip, this); } } *************** *** 719,727 **** { m_ToolTipCtrl.Create(this, TTS_ALWAYSTIP); ! m_ToolTipCtrl.AddTool(this, lpMsg); } else { ! m_ToolTipCtrl.UpdateTipText(lpMsg, this); } --- 715,723 ---- { m_ToolTipCtrl.Create(this, TTS_ALWAYSTIP); ! m_ToolTipCtrl.AddTool(this, lpszToolTip); } else { ! m_ToolTipCtrl.UpdateTipText(lpszToolTip, this); } *************** *** 731,746 **** //***************************************************************************** ! void CGuiButton::SetCaption(LPCTSTR lpMsg) { ! SetWindowText(lpMsg); m_bShowText = TRUE; ! CalLayout(); Invalidate(); } //***************************************************************************** ! void CGuiButton::SetTypeButton(TypeButton m_TypeButton) { ! m_iTypeButton = m_TypeButton; if (m_iTypeButton == TYPE_ARROW) { --- 727,742 ---- //***************************************************************************** ! void CGuiButton::SetCaption(LPCTSTR lpszCaption) { ! SetWindowText(lpszCaption); m_bShowText = TRUE; ! CalcLayout(); Invalidate(); } //***************************************************************************** ! void CGuiButton::SetTypeButton(TypeButton iType) { ! m_iTypeButton = iType; if (m_iTypeButton == TYPE_ARROW) { *************** *** 749,753 **** m_iTypeButton = TYPE_ARROW; m_iStyle = STYLE_3D; - m_lpMsg = _T(""); m_iSelected = 0; m_bShowImage = TRUE; --- 745,748 ---- *************** *** 795,808 **** //***************************************************************************** ! void CGuiButton::SetStyleBorder(Style m_Style) { ! m_iStyle = m_Style; } //***************************************************************************** ! void CGuiButton::SetAlignMsg(AlignMsg m_AlignMsg) { if (m_iTypeButton == TYPE_NORMAL) ! m_iAlign = m_AlignMsg; } --- 790,803 ---- //***************************************************************************** ! void CGuiButton::SetStyleBorder(Style iStyle) { ! m_iStyle = iStyle; } //***************************************************************************** ! void CGuiButton::SetAlign(Align iAlign) { if (m_iTypeButton == TYPE_NORMAL) ! m_iAlign = iAlign; } *************** *** 896,902 **** } ! if (m_pMenu->GetSafeHmenu() != NULL && m_iMenuActivo == FALSE) { ! m_iMenuActivo = TRUE; m_iResMenu = m_pMenu->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, x, y, GetParent(), NULL); --- 891,897 ---- } ! if (m_pMenu->GetSafeHmenu() != NULL && m_bMenuActive == FALSE) { ! m_bMenuActive = TRUE; m_iResMenu = m_pMenu->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, x, y, GetParent(), NULL); *************** *** 906,910 **** pParent->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM) m_hWnd); } ! m_iMenuActivo = FALSE; } else --- 901,905 ---- pParent->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM) m_hWnd); } ! m_bMenuActive = FALSE; } else *************** *** 1074,1079 **** { COLORREF clrOrig = ::GetPixel (memDCDst, x, y); ! COLORREF clrFace = (m_clrface == (COLORREF)-1) ? ! GuiDrawLayer::GetRGBColorFace() : m_clrface; COLORREF clrNew = (clrOrig == clrFace) ? RGB (255, 255, 255) : clrOrig; --- 1069,1074 ---- { COLORREF clrOrig = ::GetPixel (memDCDst, x, y); ! COLORREF clrFace = (m_clrFace == (COLORREF) -1) ? ! GuiDrawLayer::GetRGBColorFace() : m_clrFace; COLORREF clrNew = (clrOrig == clrFace) ? RGB (255, 255, 255) : clrOrig; Index: GuiButton.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiButton.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GuiButton.h 15 Oct 2004 14:01:50 -0000 1.5 --- GuiButton.h 17 Oct 2004 19:12:29 -0000 1.6 *************** *** 44,48 **** //************************************************* ! enum Style // Disposicìón del estilo { STYLE_3D = 0, --- 44,48 ---- //************************************************* ! enum Style //< style of button { STYLE_3D = 0, *************** *** 52,56 **** }; ! enum AlignMsg // alineacion del Mensaje { ALIGN_LEFT = 0, --- 52,56 ---- }; ! enum Align //< alignment { ALIGN_LEFT = 0, *************** *** 58,72 **** }; ! enum TypeButton { ! TYPE_NORMAL = 0, // Un boton normal ! TYPE_ARROW = 1, // un Boton con flecha por lo general para menus ! TYPE_LINK = 2 // Un boton con links }; enum StyleArrow { ! ARROW_RIGHT = 0, // el flecha va a la derecha ! ARROW_DOWN = 1 // el flecha va hacia abajo }; --- 58,72 ---- }; ! enum TypeButton //< type of button { ! TYPE_NORMAL = 0, //< normal button ! TYPE_ARROW = 1, //< menu button with arrow ! TYPE_LINK = 2 //< button for a link }; enum StyleArrow { ! ARROW_RIGHT = 0, //< arrow to right ! ARROW_DOWN = 1 //< arrow to down }; *************** *** 78,91 **** public: //********************************************************* ! void SetToolTip(LPCTSTR lpMsg); // pone tooltip al boton ! void SetCaption(LPCTSTR lpMsg); // pone un mensaje en el boton ! void SetStyleBorder(Style m_Style = STYLE_3D); // el boton es 3d semiflat estilo xp, etc ! void SetTypeButton(TypeButton m_TypeButton = TYPE_NORMAL); ! void SetAlignArrow(StyleArrow m_AlignArron = ARROW_RIGHT); ! void DrawBottonXP(CDC* pDC, CRect rc, BOOL bPress); ! BOOL SetImage(UINT uBitmapNormal, UINT uBitmapFoco = (UINT) - 1, UINT uBitmapPush = (UINT) - 1); void SetImage(HICON hIcon); ! void SetAlignMsg(AlignMsg m_AlignMsg = ALIGN_LEFT); /// Show image on button void ShowImage(BOOL bShowImage = TRUE); --- 78,91 ---- public: //********************************************************* ! void SetToolTip(LPCTSTR lpszToolTip); //< set tooltip text ! void SetCaption(LPCTSTR lpszCaption); //< set caption of button ! void SetStyleBorder(Style iStyle = STYLE_3D); //< set button style ! void SetTypeButton(TypeButton iType = TYPE_NORMAL); ! void SetAlignArrow(StyleArrow iAlignArrow = ARROW_RIGHT); ! void DrawButtonXP(CDC* pDC, CRect rc, int iState); ! BOOL SetImage(UINT uBitmapNormal, UINT uBitmapFocus = (UINT) - 1, UINT uBitmapPush = (UINT) - 1); void SetImage(HICON hIcon); ! void SetAlign(Align iAlign = ALIGN_LEFT); /// Show image on button void ShowImage(BOOL bShowImage = TRUE); *************** *** 93,98 **** void ShowText(BOOL bShowText = TRUE); void ShowMenu(); ! void CalLayout(); ! void SetColor(COLORREF m_clrFace); CSize GetSizeButton(); void SetDarkButton(BOOL bDark) --- 93,98 ---- void ShowText(BOOL bShowText = TRUE); void ShowMenu(); ! void CalcLayout(); ! void SetColor(COLORREF clrFace); CSize GetSizeButton(); void SetDarkButton(BOOL bDark) *************** *** 100,104 **** m_bIsDark = bDark; }; ! void AutoSizeButton(BOOL m_bAutoAjust = TRUE); void SetPopupMenu(CMenu* pMenu); //******************************************************** --- 100,104 ---- m_bIsDark = bDark; }; ! void AutoSizeButton(BOOL bAutoAdjust = TRUE); void SetPopupMenu(CMenu* pMenu); //******************************************************** *************** *** 108,129 **** //******************************************************** CToolTipCtrl m_ToolTipCtrl; ! int m_iAlign; //< message align ! int m_iStyle; //< Border Style ! int m_iTypeButton; //< Style bottom (Arrow, Normal, Link) int m_iSelected; int m_iStyleArrow; HICON m_hicon[3]; - LPCTSTR m_lpMsg; BOOL m_bShowImage; //< show image BOOL m_bShowText; //< show text int m_iResMenu; //< result of popup menu selection ! BOOL m_iMenuActivo; ! COLORREF m_clrface; CSize m_szButton; ! BOOL m_ReposWindow; BOOL m_bIsDark; ! HBITMAP m_hBitmap; //< Bitmap for buttons CSize m_sizeImage; //< size of bitmap image ! HBITMAP m_hBitmapDisabled; //< Bitmap for disabled buttons // ******************************************************* public: --- 108,128 ---- //******************************************************** CToolTipCtrl m_ToolTipCtrl; ! int m_iAlign; //< alignment ! int m_iStyle; //< border Style ! int m_iTypeButton; //< button style (Arrow, Normal, Link) int m_iSelected; int m_iStyleArrow; HICON m_hicon[3]; BOOL m_bShowImage; //< show image BOOL m_bShowText; //< show text int m_iResMenu; //< result of popup menu selection ! BOOL m_bMenuActive; ! COLORREF m_clrFace; CSize m_szButton; ! BOOL m_bReposWindow; BOOL m_bIsDark; ! HBITMAP m_hBitmap; //< bitmap for buttons CSize m_sizeImage; //< size of bitmap image ! HBITMAP m_hBitmapDisabled; //< bitmap for disabled buttons // ******************************************************* public: |