2 * Copyright 2003-2009 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Michael Pfeiffer, laplace@haiku-os.org
8 #ifndef PRINT_OPTIONS_WINDOW_H
9 #define PRINT_OPTIONS_WINDOW_H
12 #include <Messenger.h>
13 #include <RadioButton.h>
15 #include <TextControl.h>
23 // bounds of the image
24 BRect
Bounds() const { return fBounds
; }
25 void SetBounds(BRect bounds
);
35 enum Option
Option() const { return fOption
; }
36 void SetOption(enum Option op
) { fOption
= op
; }
38 // ZoomFactor = 72.0 / dpi
39 float ZoomFactor() const { return fZoomFactor
; }
40 void SetZoomFactor(float z
);
41 float DPI() const { return fDPI
; }
42 void SetDPI(float dpi
);
44 // Setting width/height updates height/width to keep aspect ratio
45 float Width() const { return fWidth
; }
46 float Height() const { return fHeight
; }
47 void SetWidth(float width
);
48 void SetHeight(float height
);
55 float fWidth
, fHeight
; // 1/72 Inches
58 class PrintOptionsWindow
: public BWindow
{
60 PrintOptionsWindow(BPoint at
,
61 PrintOptions
* options
, BWindow
* listener
);
62 ~PrintOptionsWindow();
64 void MessageReceived(BMessage
* msg
);
67 BRadioButton
* AddRadioButton(const char* name
, const char* label
,
68 uint32 what
, bool selected
);
70 BTextControl
* AddTextControl(const char* name
, const char* label
,
71 float value
, uint32 what
);
74 enum PrintOptions::Option
MsgToOption(uint32 what
);
75 bool GetValue(BTextControl
* text
, float* value
);
76 void SetValue(BTextControl
* text
, float value
);
78 PrintOptions
* fPrintOptions
;
79 PrintOptions fCurrentOptions
;
82 BTextControl
* fZoomFactor
;
85 BTextControl
* fHeight
;
89 kMsgFitToPageSelected
,
90 kMsgZoomFactorSelected
,
92 kMsgWidthAndHeightSelected
,
94 kMsgZoomFactorChanged
,