BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / showimage / PrintOptionsWindow.h
blob9c6b0a6dd42dc32e518db663eef8fae81950d931
1 /*
2 * Copyright 2003-2009 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Pfeiffer, laplace@haiku-os.org
7 */
8 #ifndef PRINT_OPTIONS_WINDOW_H
9 #define PRINT_OPTIONS_WINDOW_H
12 #include <Messenger.h>
13 #include <RadioButton.h>
14 #include <Rect.h>
15 #include <TextControl.h>
16 #include <Window.h>
19 class PrintOptions {
20 public:
21 PrintOptions();
23 // bounds of the image
24 BRect Bounds() const { return fBounds; }
25 void SetBounds(BRect bounds);
27 enum Option {
28 kFitToPage,
29 kZoomFactor,
30 kDPI,
31 kWidth,
32 kHeight,
33 kNumberOfOptions
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);
50 private:
51 BRect fBounds;
52 enum Option fOption;
53 float fZoomFactor;
54 float fDPI;
55 float fWidth, fHeight; // 1/72 Inches
58 class PrintOptionsWindow : public BWindow {
59 public:
60 PrintOptionsWindow(BPoint at,
61 PrintOptions* options, BWindow* listener);
62 ~PrintOptionsWindow();
64 void MessageReceived(BMessage* msg);
66 private:
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);
73 void Setup();
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;
80 BMessenger fListener;
81 status_t fStatus;
82 BTextControl* fZoomFactor;
83 BTextControl* fDPI;
84 BTextControl* fWidth;
85 BTextControl* fHeight;
87 enum {
88 kMsgOK = 'mPOW',
89 kMsgFitToPageSelected,
90 kMsgZoomFactorSelected,
91 kMsgDPISelected,
92 kMsgWidthAndHeightSelected,
94 kMsgZoomFactorChanged,
95 kMsgDPIChanged,
96 kMsgWidthChanged,
97 kMsgHeightChanged,
99 kMsgJobSetup,
101 kIndent = 5,
102 kLineSkip = 5,
107 #endif