⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 about.cpp

📁 funambol window mobile客户端源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    GetDlgItem(IDC_IMG_FUNLOGO)->SetWindowPos(&CWnd::wndTop, x,VPADDING,100,100,SWP_NOSIZE);
    if (FUNOPT_SHOW_DEV_INFO){
        GetDlgItem(IDC_IMG_FUNLOGO)->ShowWindow(SW_HIDE);
    }   

    // set text position
    if (FUNOPT_SHOW_DEV_INFO){
        modifyWindow(GetDlgItem(IDC_ABOUT_MSG), 0, -130 , 0 , 100);
    }
    else{
        CRect rectText;
        CRect rectTextVersion;
        GetClientRect(&rectClient);
        GetDlgItem(IDC_ABOUT_MSG)->GetClientRect(&rectText);
        GetDlgItem(IDC_ABOUT_MSG2)->GetClientRect(&rectTextVersion);
        x = (rectClient.Width()/2) - (rectText.Width()/2);
        GetDlgItem(IDC_ABOUT_MSG)->SetWindowPos(&CWnd::wndTop, x,rectImage.BottomRight().y + 15,100,100,SWP_NOSIZE);
        GetDlgItem(IDC_ABOUT_MSG2)->SetWindowPos(&CWnd::wndTop, x,rectImage.BottomRight().y + rectText.BottomRight().y + 10,0,0,SWP_NOSIZE);
#if defined(WIN32_PLATFORM_WFSP)
        GetDlgItem(IDC_ABOUT_CR)->SetWindowPos(&CWnd::wndTop, x, 
            (rectImage.BottomRight().y + rectText.BottomRight().y + 
            rectTextVersion.BottomRight().y + 35),
        0,0,SWP_NOSIZE);
#else
        GetDlgItem(IDC_ABOUT_CR)->SetWindowPos(&CWnd::wndTop, 3, 
            (rectImage.BottomRight().y + rectText.BottomRight().y + 
            rectTextVersion.BottomRight().y + 35),
        0,0,SWP_NOSIZE);
#endif
    }



    // set ppc header
    LOGFONT lf;
    memset(&lf, 0, sizeof(LOGFONT));
    HFONT hFont = (HFONT) GetStockObject(SYSTEM_FONT);
    GetObject(hFont, sizeof lf, &lf);
    lf.lfWeight = FW_BOLD;
    lf.lfHeight +=FONT_HEIGHT_OFFSET;
    VERIFY(fontBold.CreateFontIndirect(&lf));

    // cr font
    LOGFONT cpf;
    memset(&cpf, 0, sizeof(LOGFONT));
    HFONT cpFont = (HFONT) GetStockObject(SYSTEM_FONT);
    GetObject(cpFont, sizeof cpf, &cpf);
    LONG h = lf.lfHeight;
    h = h + 2;
    lf.lfHeight = h ;
    VERIFY(crFont.CreateFontIndirect(&lf));

    GetDlgItem(IDC_ABOUT_CR)->SetFont(&crFont);



    if(FUNOPT_SHOW_COPYRIGHT){
#if defined(WIN32_PLATFORM_PSPC)
        s1.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_ABOUT); SetDlgItemText(IDC_HEADER_STATIC, s1);
        GetDlgItem(IDC_HEADER_STATIC)->SetFont(&fontBold);
#endif
    }

    s1 = APP_LINK;

    //SetDlgItemText(IDC_APP_LINK, s1);
    //appLink.setText(s1);

    // fix for wrong title problem, we get & set the title for the main window

    s1 = "";
    s1.Append(TEXT("Copyright (C) 2003 - 2008 Funambol, Inc.\n\n"));
    s1.Append(TEXT("This program is provided AS IS, without warranty licensed under AGPLV3. The Program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation including the additional permission set forth source code file header.\n\n"));
    s1.Append(TEXT("The interactive user interfaces in modified source and object code versions of this program must display Appropriate Legal Notices, as required under Section 5 of the GNU Affero General Public License version 3.\n\n"));
    s1.Append(TEXT("In accordance with Section 7(b) of the GNU Affero General Public License version 3, these Appropriate Legal Notices must retain the display of the \"Powered by Funambol\" logo. If the display of the logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices must display the words \"Powered by Funambol\". Funambol is a trademark of Funambol, Inc."));

    SetDlgItemText(IDC_ABOUT_CR, s1);



    wchar_t title[256];
    AfxGetMainWnd()->GetWindowText(title,256);
    AfxGetMainWnd()->SetWindowText(title);

    return TRUE;
}


void CAbout::OnSize(UINT nType, int cx, int cy)
{
    
    CDialog::OnSize(nType, cx, cy);
#if defined(WIN32_PLATFORM_WFSP)
        ::SendMessage(GetSafeHwnd(), DM_RESETSCROLL, TRUE, TRUE);
#endif

    CString s1;
#if defined(_DEVICE_RESOLUTION_AWARE)&& !defined(WIN32_PLATFORM_WFSP)
    int resId;
    switch(DRA::GetDisplayMode())
    {
        case DRA::Landscape:
            resId = IDD_UI_ABOUT_WIDE; break;
        case DRA::Portrait:
            resId = IDD_UI_ABOUT; break;
        case DRA::Square:
            resId = IDD_UI_ABOUT_SQUARE; break;
        default:
            resId = IDD_UI_ABOUT; break;
    };


    DRA::RelayoutDialog( AfxGetInstanceHandle(), this->m_hWnd, MAKEINTRESOURCE(resId));

    resIdOld = resId;

#endif


    

    // set image position
    CRect rectImage;
    CRect rectClient;
    int x = 0;
    GetClientRect(&rectClient);
    GetDlgItem(IDC_IMG_FUNLOGO)->GetClientRect(&rectImage);
    x = (rectClient.Width()/2) - (rectImage.Width()/2);
    GetDlgItem(IDC_IMG_FUNLOGO)->SetWindowPos(&CWnd::wndTop, x,VPADDING,100,100,SWP_NOSIZE);

    // set text position
    CRect rectText;
    CRect rectTextVersion;
    GetClientRect(&rectClient);
    GetDlgItem(IDC_ABOUT_MSG)->GetClientRect(&rectText);
    GetDlgItem(IDC_ABOUT_MSG2)->GetClientRect(&rectTextVersion);
    x = (rectClient.Width()/2) - (rectText.Width()/2);
    if (FUNOPT_SHOW_DEV_INFO){
        modifyWindow(GetDlgItem(IDC_ABOUT_MSG), 0, -130, 0 , 100);
    }
    else{
        GetDlgItem(IDC_ABOUT_MSG)->SetWindowPos(&CWnd::wndTop, x,rectImage.BottomRight().y + 15,100,100,SWP_NOSIZE);
        GetDlgItem(IDC_ABOUT_MSG2)->SetWindowPos(&CWnd::wndTop, x,rectImage.BottomRight().y + rectText.BottomRight().y + 10,0,0,SWP_NOSIZE);
    }

    SetDlgItemText(IDC_ABOUT_MSG, aboutMessage);
    SetDlgItemText(IDC_ABOUT_MSG2, versionMessage);

    s1 = "";
    s1.Append(TEXT("This program is provided AS IS, without warranty licensed under AGPLV3. The Program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation including the additional permission set forth source code file header.\n\n"));
    s1.Append(TEXT("The interactive user interfaces in modified source and object code versions of this program must display Appropriate Legal Notices, as required under Section 5 of the GNU Affero General Public License version 3.\n\n"));
    s1.Append(TEXT("In accordance with Section 7(b) of the GNU Affero General Public License version 3, these Appropriate Legal Notices must retain the display of the \"Powered by Funambol\" logo. If the display of the logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices must display the words \"Powered by Funambol\". Funambol is a trademark of Funambol, Inc."));

    SetDlgItemText(IDC_ABOUT_CR, s1);

    GetDlgItem(IDC_ABOUT_MSG)->SetFont(&fontBold);

#if defined(WIN32_PLATFORM_WFSP)
        GetDlgItem(IDC_ABOUT_CR)->SetWindowPos(&CWnd::wndTop, x, 
            (rectImage.BottomRight().y + rectText.BottomRight().y + 
            rectTextVersion.BottomRight().y + 35),
        0,0,SWP_NOSIZE);
#else
        GetDlgItem(IDC_ABOUT_CR)->SetWindowPos(&CWnd::wndTop, 3, 
            (rectImage.BottomRight().y + rectText.BottomRight().y +
            rectTextVersion.BottomRight().y + 35),
        0,0,SWP_NOSIZE);
#endif

        dlgCurrentHeight = cy;
    scrollbarPosition = 0;

     // Manage the vertical scrolling-bar
    //
    GetWindowRect(&dlgRect);
    scrollbarPosition = 0;                   // reset bar position

    // Get the position of the bottom object of the dialog,
    // the max scrollbar height is derived from this.
    // *** NOTE: CHANGE IT IF THE OBJECT POSITION CHANGES! ***
    CRect aboutmessageRect;

    GetDlgItem(IDC_ABOUT_CR)->GetClientRect(&aboutmessageRect);

    // 5 = some space
    dlgMaxHeight = rectImage.bottom + rectText.bottom + rectTextVersion.bottom + aboutmessageRect.bottom + 45;
    //dlgMaxHeight = 1000;


    SCROLLINFO si;
    si.cbSize = sizeof(SCROLLINFO);
    si.fMask = SIF_PAGE;                // Set only the new nPage = cy
    si.nPage = cy;
    //si.nPage = dlgRect.Height();
    si.nPos = 0;
    si.nMax = dlgMaxHeight;
    SetScrollInfo(SB_VERT, &si, TRUE);


#if defined(WIN32_PLATFORM_PSPC)
    s1.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_ABOUT); SetDlgItemText(IDC_HEADER_STATIC, s1);
#endif


}

HBRUSH CAbout::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    // set ppc header text color
#if defined(WIN32_PLATFORM_PSPC)
    if(pWnd->GetDlgCtrlID() == IDC_HEADER_STATIC) {
        pDC->SetBkMode(TRANSPARENT);
        pDC->SetTextColor(PPC_HEADER_TEXT_COLOR);
    }
#endif
    if(pWnd->GetDlgCtrlID() == IDC_ABOUT_CR){
        COLORREF grey = RGB(180,180,180);
        //pDC->SetBkMode(TRASPARENT);
        pDC->SetTextColor(grey);
    }

    return hbr;
}

void CAbout::OnPaint() {

    Default();
    
    // CDC::LineTo() uses x,y coordinates related to the display window area,
    // we need the offset between the window rect and the client rect.
    CRect clientRect, windowrect;
    CRect rectImage;
    GetClientRect(&clientRect);
    GetWindowRect(&windowrect);
    CRect rectText;
    GetDlgItem(IDC_ABOUT_MSG)->GetClientRect(&rectText);
    GetDlgItem(IDC_IMG_FUNLOGO)->GetClientRect(&rectImage);
    int offset = windowrect.top - clientRect.top;
    
    //
    // 1st horizontal line: black line above the SyncMode.
    // Starts left aligned with "SyncMode" and ends at 95% of the screen width
    // Top aligned with the groupbox (hidden)
    //
    CPoint start, end;
    start.x = rectText.left +2;               start.y = rectText.bottom + rectImage.bottom + 5;
    end.x   = (int)(clientRect.Width() * 0.99);   end.y   = rectText.bottom + rectImage.bottom + 5;

    CClientDC dc(this);
    COLORREF grey = RGB(180,180,180);
    //drawLine(&dc, start, end, grey);
}

/**
 * Called when vertical scrollbar is touched.
 * Manages the window scrolling.
 */
void CAbout::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
    int nDelta;
    int nMaxPos = dlgMaxHeight - dlgCurrentHeight;

    // Calculate the offset to scroll (nDelta)
    switch (nSBCode) 
    {
        case SB_LINEDOWN:
            if (scrollbarPosition >= nMaxPos)
                return;
            nDelta = 2;
            break;

        case SB_LINEUP:
            if (scrollbarPosition <= 0)
                return;
            nDelta = -2;
            break;

        case SB_THUMBPOSITION:
            nDelta = (int)nPos - scrollbarPosition;
            break;
        case SB_PAGEDOWN:        
            if (scrollbarPosition >= nMaxPos)
                return;            
            nDelta = min(nMaxPos/10, nMaxPos - scrollbarPosition);
            break;                           
        case SB_PAGEUP:
            if (scrollbarPosition <= 0)
                return;
            nDelta = -min(nMaxPos/10, scrollbarPosition);
            break;
         case SB_THUMBTRACK:                
            if (LOBYTE(nSBCode) == SB_THUMBTRACK) {                           
                nDelta = nPos - scrollbarPosition;
            }
            break;
        default:
            // Don't handle other commands...
            return;
    }

    // Move the scrollbar
    scrollbarPosition += nDelta;
    SetScrollPos(SB_VERT, scrollbarPosition, TRUE);

    // Scroll the dialog window
    ScrollWindowEx(0, -nDelta, NULL, &dlgRect, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE);
    
    CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -