18c1ad886SRyan Leavengood /* 28c1ad886SRyan Leavengood * Copyright 2003-2009 Haiku Inc. All rights reserved. 38c1ad886SRyan Leavengood * Distributed under the terms of the MIT License. 48c1ad886SRyan Leavengood * 58c1ad886SRyan Leavengood * Authors: 68c1ad886SRyan Leavengood * Michael Pfeiffer, laplace@haiku-os.org 78c1ad886SRyan Leavengood */ 88c1ad886SRyan Leavengood #ifndef PRINT_OPTIONS_WINDOW_H 98c1ad886SRyan Leavengood #define PRINT_OPTIONS_WINDOW_H 10780d8a62SMichael Pfeiffer 11780d8a62SMichael Pfeiffer 12780d8a62SMichael Pfeiffer #include <Messenger.h> 138c1ad886SRyan Leavengood #include <RadioButton.h> 14780d8a62SMichael Pfeiffer #include <Rect.h> 158c1ad886SRyan Leavengood #include <TextControl.h> 168c1ad886SRyan Leavengood #include <Window.h> 178c1ad886SRyan Leavengood 18780d8a62SMichael Pfeiffer 19780d8a62SMichael Pfeiffer class PrintOptions { 20780d8a62SMichael Pfeiffer public: 218c1ad886SRyan Leavengood PrintOptions(); 228c1ad886SRyan Leavengood 238c1ad886SRyan Leavengood // bounds of the image Bounds()248c1ad886SRyan Leavengood BRect Bounds() const { return fBounds; } 258c1ad886SRyan Leavengood void SetBounds(BRect bounds); 268c1ad886SRyan Leavengood 27780d8a62SMichael Pfeiffer enum Option { 28780d8a62SMichael Pfeiffer kFitToPage, 29780d8a62SMichael Pfeiffer kZoomFactor, 30780d8a62SMichael Pfeiffer kDPI, 31780d8a62SMichael Pfeiffer kWidth, 32d3046f7dSMichael Pfeiffer kHeight, 33d3046f7dSMichael Pfeiffer kNumberOfOptions 34780d8a62SMichael Pfeiffer }; Option()35057ceb61SOliver Tappe enum Option Option() const { return fOption; } SetOption(enum Option op)36057ceb61SOliver Tappe void SetOption(enum Option op) { fOption = op; } 378c1ad886SRyan Leavengood 388c1ad886SRyan Leavengood // ZoomFactor = 72.0 / dpi ZoomFactor()39780d8a62SMichael Pfeiffer float ZoomFactor() const { return fZoomFactor; } 40780d8a62SMichael Pfeiffer void SetZoomFactor(float z); DPI()41780d8a62SMichael Pfeiffer float DPI() const { return fDPI; } 42780d8a62SMichael Pfeiffer void SetDPI(float dpi); 438c1ad886SRyan Leavengood 448c1ad886SRyan Leavengood // Setting width/height updates height/width to keep aspect ratio Width()45780d8a62SMichael Pfeiffer float Width() const { return fWidth; } Height()46780d8a62SMichael Pfeiffer float Height() const { return fHeight; } 47780d8a62SMichael Pfeiffer void SetWidth(float width); 48780d8a62SMichael Pfeiffer void SetHeight(float height); 49780d8a62SMichael Pfeiffer 50780d8a62SMichael Pfeiffer private: 51780d8a62SMichael Pfeiffer BRect fBounds; 52057ceb61SOliver Tappe enum Option fOption; 53780d8a62SMichael Pfeiffer float fZoomFactor; 54780d8a62SMichael Pfeiffer float fDPI; 55780d8a62SMichael Pfeiffer float fWidth, fHeight; // 1/72 Inches 56780d8a62SMichael Pfeiffer }; 57780d8a62SMichael Pfeiffer 588c1ad886SRyan Leavengood class PrintOptionsWindow : public BWindow { 59780d8a62SMichael Pfeiffer public: 608c1ad886SRyan Leavengood PrintOptionsWindow(BPoint at, 618c1ad886SRyan Leavengood PrintOptions* options, BWindow* listener); 62780d8a62SMichael Pfeiffer ~PrintOptionsWindow(); 63780d8a62SMichael Pfeiffer 64780d8a62SMichael Pfeiffer void MessageReceived(BMessage* msg); 65780d8a62SMichael Pfeiffer 66780d8a62SMichael Pfeiffer private: 67*1ed4535fSStephan Aßmus BRadioButton* AddRadioButton(const char* name, const char* label, 688c1ad886SRyan Leavengood uint32 what, bool selected); 698c1ad886SRyan Leavengood 70*1ed4535fSStephan Aßmus BTextControl* AddTextControl(const char* name, const char* label, 71*1ed4535fSStephan Aßmus float value, uint32 what); 728c1ad886SRyan Leavengood 73780d8a62SMichael Pfeiffer void Setup(); 74780d8a62SMichael Pfeiffer enum PrintOptions::Option MsgToOption(uint32 what); 75780d8a62SMichael Pfeiffer bool GetValue(BTextControl* text, float* value); 76780d8a62SMichael Pfeiffer void SetValue(BTextControl* text, float value); 77780d8a62SMichael Pfeiffer 788c1ad886SRyan Leavengood PrintOptions* fPrintOptions; 798c1ad886SRyan Leavengood PrintOptions fCurrentOptions; 808c1ad886SRyan Leavengood BMessenger fListener; 818c1ad886SRyan Leavengood status_t fStatus; 828c1ad886SRyan Leavengood BTextControl* fZoomFactor; 838c1ad886SRyan Leavengood BTextControl* fDPI; 848c1ad886SRyan Leavengood BTextControl* fWidth; 858c1ad886SRyan Leavengood BTextControl* fHeight; 868c1ad886SRyan Leavengood 87780d8a62SMichael Pfeiffer enum { 88780d8a62SMichael Pfeiffer kMsgOK = 'mPOW', 89780d8a62SMichael Pfeiffer kMsgFitToPageSelected, 90780d8a62SMichael Pfeiffer kMsgZoomFactorSelected, 91780d8a62SMichael Pfeiffer kMsgDPISelected, 92780d8a62SMichael Pfeiffer kMsgWidthAndHeightSelected, 93780d8a62SMichael Pfeiffer 94780d8a62SMichael Pfeiffer kMsgZoomFactorChanged, 95780d8a62SMichael Pfeiffer kMsgDPIChanged, 96780d8a62SMichael Pfeiffer kMsgWidthChanged, 97780d8a62SMichael Pfeiffer kMsgHeightChanged, 98780d8a62SMichael Pfeiffer 99780d8a62SMichael Pfeiffer kMsgJobSetup, 100780d8a62SMichael Pfeiffer 101780d8a62SMichael Pfeiffer kIndent = 5, 102780d8a62SMichael Pfeiffer kLineSkip = 5, 103780d8a62SMichael Pfeiffer }; 104780d8a62SMichael Pfeiffer }; 105780d8a62SMichael Pfeiffer 1068c1ad886SRyan Leavengood 107780d8a62SMichael Pfeiffer #endif 1088c1ad886SRyan Leavengood 109