Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions
CPageSetupFormatDlg Class Reference

#include <PageSetupDlg.h>

List of all members.

Public Types

enum  { IDD = IDD_PPAGE_FORMAT }

Public Member Functions

 CPageSetupFormatDlg ()
void Init (nsIPrintSettings *aPrintSettings)
void Apply (nsIPrintSettings *aPrintSettings)
LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT OnClickShrinkToFit (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)

Detailed Description

Definition at line 102 of file PageSetupDlg.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 105 of file PageSetupDlg.h.


Constructor & Destructor Documentation

Definition at line 112 of file PageSetupDlg.h.

    {
    }

Member Function Documentation

void CPageSetupFormatDlg::Apply ( nsIPrintSettings aPrintSettings) [inline]

Definition at line 146 of file PageSetupDlg.h.

    {

        // Background options are tied to a single checkbox
        PRBool boolVal = 
            (SendDlgItemMessage(IDC_PRINTBACKGROUND, BM_GETCHECK) == BST_CHECKED) ?
                PR_TRUE : PR_FALSE;
        aPrintSettings->SetPrintBGColors(boolVal);
        aPrintSettings->SetPrintBGImages(boolVal);

        // Print scale
        TCHAR szBuf[128];
        GetDlgItemText(IDC_SCALE, szBuf, sizeof(szBuf) / sizeof(szBuf[0]));
        double scale = _tstof(szBuf) / 100.0;
        aPrintSettings->SetScaling(scale);

        // Shrink to fit
        PRBool shrinkToFit =
            (IsDlgButtonChecked(IDC_SHRINKTOFIT) == BST_CHECKED) ? PR_TRUE : PR_FALSE;
        aPrintSettings->SetShrinkToFit(shrinkToFit);

        // Landscape or portrait
        PRInt32 orientation = nsIPrintSettings::kLandscapeOrientation;
        if (SendDlgItemMessage(IDC_PORTRAIT, BM_GETCHECK) == BST_CHECKED)
        {
            orientation = nsIPrintSettings::kPortraitOrientation;
        }
        aPrintSettings->SetOrientation(orientation);
    }

Here is the caller graph for this function:

void CPageSetupFormatDlg::Init ( nsIPrintSettings aPrintSettings) [inline]

Definition at line 116 of file PageSetupDlg.h.

    {
        // Set landscape / portrait mode
        PRInt32 orientation = nsIPrintSettings::kPortraitOrientation;
        aPrintSettings->GetOrientation(&orientation);
        SendDlgItemMessage(
            (orientation == nsIPrintSettings::kPortraitOrientation)
                ? IDC_PORTRAIT : IDC_LANDSCAPE,
            BM_SETCHECK, 
            BST_CHECKED, 0);

        // Set scaling
        TCHAR szBuf[10];
        double scaling = 1.0;
        aPrintSettings->GetScaling(&scaling);
        _stprintf(szBuf, _T("%.1f"), scaling * 100.0);
        SetDlgItemText(IDC_SCALE, szBuf);

        // Set shrink to fit (& disable scale field)
        PRBool shrinkToFit = PR_FALSE;
        aPrintSettings->GetShrinkToFit(&shrinkToFit);
        CheckDlgButton(IDC_SHRINKTOFIT, shrinkToFit ? BST_CHECKED : BST_UNCHECKED);
        ::EnableWindow(GetDlgItem(IDC_SCALE), shrinkToFit ? FALSE : TRUE);

        // Print background - we use PrintBGColors to control both images & colours
        PRBool printBGColors = PR_TRUE;
        aPrintSettings->GetPrintBGColors(&printBGColors);
        CheckDlgButton(IDC_PRINTBACKGROUND, printBGColors ? BST_CHECKED : BST_UNCHECKED);
    }

Here is the caller graph for this function:

LRESULT CPageSetupFormatDlg::OnClickShrinkToFit ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL bHandled 
) [inline]

Definition at line 181 of file PageSetupDlg.h.

    {
        BOOL bEnableScale = TRUE;
        if (IsDlgButtonChecked(IDC_SHRINKTOFIT) == BST_CHECKED)
            bEnableScale = FALSE;
        ::EnableWindow(GetDlgItem(IDC_SCALE), bEnableScale);
        return 0;
    }
LRESULT CPageSetupFormatDlg::OnInitDialog ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
) [inline]

Definition at line 176 of file PageSetupDlg.h.

    {
        return 0;
    }

The documentation for this class was generated from the following file: