added option to hide page controls

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1998-08-14 11:20:00 +00:00
parent 163f0dbef0
commit 64a1451536

View File

@@ -73,7 +73,7 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
{ {
if ( data ) if ( data )
printData = *data; printData = *data;
int buttonWidth = 65; int buttonWidth = 65;
int buttonHeight = 25; int buttonHeight = 25;
int spacing = 5; int spacing = 5;
@@ -96,28 +96,34 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintData* data):
fromText = (wxTextCtrl*)NULL; fromText = (wxTextCtrl*)NULL;
rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"), if(printData.GetFromPage() != 0)
wxPoint(5, yPos), wxSize(-1, -1), 2, choices, 2); {
rangeRadioBox->SetSelection(1); rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
wxPoint(5, yPos), wxSize(-1, -1), 2, choices, 2);
rangeRadioBox->SetSelection(1);
}
yPos += 60; yPos += 60;
xPos = 5; xPos = 5;
int staticWidth = 45; int staticWidth = 45;
int textWidth = 40; int textWidth = 40;
spacing = 10; spacing = 10;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(xPos, yPos)); if(printData.GetFromPage() != 0)
xPos += staticWidth; {
(void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(xPos, yPos));
fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(xPos, yPos), wxSize(textWidth, -1)); xPos += staticWidth;
xPos += spacing + textWidth;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(xPos, yPos));
xPos += staticWidth;
toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
xPos += spacing + textWidth;
fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
xPos += spacing + textWidth;
(void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(xPos, yPos));
xPos += staticWidth;
toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
xPos += spacing + textWidth;
}
(void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(xPos, yPos)); (void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(xPos, yPos));
xPos += spacing + staticWidth; xPos += spacing + staticWidth;
@@ -218,29 +224,33 @@ void wxGenericPrintDialog::OnSetup(wxCommandEvent& WXUNUSED(event))
bool wxGenericPrintDialog::TransferDataToWindow(void) bool wxGenericPrintDialog::TransferDataToWindow(void)
{ {
char buf[10]; char buf[10];
if (printData.GetEnablePageNumbers())
{
fromText->Enable(TRUE);
toText->Enable(TRUE);
sprintf(buf, "%d", printData.GetFromPage()); if(printData.GetFromPage() != 0)
fromText->SetValue(buf); {
sprintf(buf, "%d", printData.GetToPage()); if (printData.GetEnablePageNumbers())
toText->SetValue(buf); {
fromText->Enable(TRUE);
if (printData.GetAllPages()) toText->Enable(TRUE);
rangeRadioBox->SetSelection(0);
else sprintf(buf, "%d", printData.GetFromPage());
rangeRadioBox->SetSelection(1); fromText->SetValue(buf);
} sprintf(buf, "% d", printData.GetFromPage());
else toText->SetValue(buf);
{
fromText->Enable(FALSE); if (printData.GetAllPages())
toText->Enable(FALSE); rangeRadioBox->SetSelection(0);
rangeRadioBox->SetSelection(0); else
rangeRadioBox->wxRadioBox::Enable(1, FALSE); rangeRadioBox->SetSelection(1);
} }
else
{
fromText->Enable(FALSE);
toText->Enable(FALSE);
rangeRadioBox->SetSelection(0);
rangeRadioBox->wxRadioBox::Enable(1, FALSE);
}
}
sprintf(buf, "%d", printData.GetNoCopies()); sprintf(buf, "%d", printData.GetNoCopies());
noCopiesText->SetValue(buf); noCopiesText->SetValue(buf);
@@ -251,17 +261,25 @@ bool wxGenericPrintDialog::TransferDataToWindow(void)
bool wxGenericPrintDialog::TransferDataFromWindow(void) bool wxGenericPrintDialog::TransferDataFromWindow(void)
{ {
if (printData.GetEnablePageNumbers()) if(printData.GetFromPage() != -1)
{ {
printData.SetFromPage(atoi(fromText->GetValue())); if (printData.GetEnablePageNumbers())
printData.SetToPage(atoi(toText->GetValue())); {
} printData.SetFromPage(atoi(fromText->GetValue()));
if (rangeRadioBox->GetSelection() == 0) printData.SetToPage(atoi(toText->GetValue()));
printData.SetAllPages(TRUE); }
else if (rangeRadioBox->GetSelection() == 0)
printData.SetAllPages(FALSE); printData.SetAllPages(TRUE);
printData.SetNoCopies(atoi(noCopiesText->GetValue())); else
printData.SetPrintToFile(printToFileCheckBox->GetValue()); printData.SetAllPages(FALSE);
}
else
{ // continuous printing
printData.SetFromPage(1);
printData.SetToPage(32000);
}
printData.SetNoCopies(atoi(noCopiesText->GetValue()));
printData.SetPrintToFile(printToFileCheckBox->GetValue());
return TRUE; return TRUE;
} }