1 /* 2 * Copyright 2010, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Pfeiffer 7 */ 8 #ifndef GP_PARAMETER_VISITOR_H 9 #define GP_PARAMETER_VISITOR_H 10 11 #include <gutenprint/gutenprint.h> 12 13 #include <Size.h> 14 #include <Rect.h> 15 16 17 extern const char* kJobMode; 18 extern const char* kJob; 19 20 extern const char* kPrintingMode; 21 extern const char* kColor; 22 extern const char* kBlackAndWhite; 23 24 extern const char* kResolution; 25 extern const char* kFakeResolutionKey; 26 27 extern const char* kPageSize; 28 29 extern const char* kChannelBitDepth; 30 31 32 class GPParameterVisitor 33 { 34 public: 35 GPParameterVisitor(); 36 virtual ~GPParameterVisitor(); 37 38 void Visit(const stp_printer_t* printer); 39 void VisitParameter(stp_parameter_list_t list, 40 const stp_parameter_t* parameter, stp_parameter_t* description); 41 void VisitStringList(stp_parameter_t* parameter); 42 void VisitBooleanParameter(stp_parameter_t* description, 43 stp_parameter_class_t parameterClass); 44 void VisitDoubleParameter(stp_parameter_t* description, 45 stp_parameter_class_t parameterClass); 46 void VisitIntParameter(stp_parameter_t* description, 47 stp_parameter_class_t parameterClass); 48 void VisitDimensionParameter(stp_parameter_t* description, 49 stp_parameter_class_t parameterClass); 50 51 virtual bool BeginParameter(const char* name, const char* displayName, 52 stp_parameter_class_t parameterClass) = 0; 53 // key is null if there is no default value 54 virtual void DefaultStringParameter(const char* name, 55 const char* key) = 0; 56 virtual void StringParameterSize(const char* name, int size) = 0; 57 virtual void StringParameter(const char* name, const char* key, 58 const char* displayName) = 0; 59 virtual void ResolutionParameter(const char* name, const char* key, 60 const char* displayName, int x, int y) = 0; 61 virtual void PageSizeParameter(const char* name, const char* key, 62 const char* displayName, BSize pageSize, 63 BRect imageableArea) = 0; 64 virtual void EndParameter(const char* name) = 0; 65 virtual void BooleanParameter(const char* name, const char* displayName, 66 bool defaultValue, 67 stp_parameter_class_t parameterClass) = 0; 68 virtual void DoubleParameter(const char* name, const char* displayName, 69 double lower, double upper, double defaultValue, 70 stp_parameter_class_t parameterClass) = 0; 71 virtual void IntParameter(const char* name, const char* displayName, 72 int lower, int upper, int defaultValue, 73 stp_parameter_class_t parameterClass) = 0; 74 virtual void DimensionParameter(const char* name, 75 const char* displayName, int lower, 76 int upper, int defaultValue, 77 stp_parameter_class_t parameterClass) = 0; 78 virtual void EndVisit() = 0; 79 80 private: 81 void AddMissingResolution(); 82 83 stp_vars_t* fVariables; 84 bool fHasResolutionParameter; 85 }; 86 87 88 #endif 89