3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
20 BaseCap(const string
&label
);
23 const char* Label() const;
28 struct EnumCap
: public BaseCap
{
29 EnumCap(const string
& label
, bool isDefault
);
31 virtual int32
ID() const = 0;
32 const char* Key() const;
39 struct PaperCap
: public EnumCap
{
40 PaperCap(const string
&label
, bool isDefault
,
41 JobData::Paper paper
, const BRect
&paperRect
,
42 const BRect
&physicalRect
);
46 JobData::Paper fPaper
;
51 struct PaperSourceCap
: public EnumCap
{
52 PaperSourceCap(const string
&label
, bool isDefault
,
53 JobData::PaperSource paperSource
);
57 JobData::PaperSource fPaperSource
;
60 struct ResolutionCap
: public EnumCap
{
61 ResolutionCap(const string
&label
, bool isDefault
,
62 int32 id
, int xResolution
, int yResolution
);
71 struct OrientationCap
: public EnumCap
{
72 OrientationCap(const string
&label
, bool isDefault
,
73 JobData::Orientation orientation
);
77 JobData::Orientation fOrientation
;
80 struct PrintStyleCap
: public EnumCap
{
81 PrintStyleCap(const string
&label
, bool isDefault
,
82 JobData::PrintStyle printStyle
);
86 JobData::PrintStyle fPrintStyle
;
89 struct BindingLocationCap
: public EnumCap
{
90 BindingLocationCap(const string
&label
,
92 JobData::BindingLocation bindingLocation
);
96 JobData::BindingLocation fBindingLocation
;
99 struct ColorCap
: public EnumCap
{
100 ColorCap(const string
&label
, bool isDefault
,
101 JobData::Color color
);
105 JobData::Color fColor
;
108 struct ProtocolClassCap
: public EnumCap
{
109 ProtocolClassCap(const string
&label
,
110 bool isDefault
, int32 protocolClass
,
111 const string
&description
);
115 int32 fProtocolClass
;
120 struct DriverSpecificCap
: public EnumCap
{
129 DriverSpecificCap(const string
& label
,
130 int32 category
, Type type
);
138 struct ListItemCap
: public EnumCap
{
139 ListItemCap(const string
& label
,
140 bool isDefault
, int32 id
);
148 struct BooleanCap
: public BaseCap
{
149 BooleanCap(const string
& label
, bool defaultValue
);
151 bool DefaultValue() const;
157 struct IntRangeCap
: public BaseCap
{
158 IntRangeCap(const string
& label
, int lower
,
159 int upper
, int defaultValue
);
163 int32
DefaultValue() const;
171 struct DoubleRangeCap
: public BaseCap
{
172 DoubleRangeCap(const string
& label
, double lower
,
173 double upper
, double defaultValue
);
175 double Lower() const;
176 double Upper() const;
177 double DefaultValue() const;
181 double fDefaultValue
;
188 PrinterCap(const PrinterData
*printer_data
);
189 virtual ~PrinterCap();
200 kDriverSpecificCapabilities
,
202 // Static boolean settings follow.
203 // For them Supports() has to be implemented only.
204 kCopyCommand
, // supports printer page copy command?
205 kHalftone
, // needs the printer driver the configuration
206 // for class Halftone?
207 kCanRotatePageInLandscape
,
208 // can the printer driver rotate the page
209 // printing in landscape
211 // The driver specific generic capabilities start here
212 kDriverSpecificCapabilitiesBegin
= 100
223 bool operator()(const BaseCap
* baseCap
) {
224 const EnumCap
* enumCap
= dynamic_cast<const EnumCap
*>(baseCap
);
227 return enumCap
->ID() == fID
;
233 struct LabelPredicate
235 LabelPredicate(const char* label
)
241 bool operator()(const BaseCap
* baseCap
) {
242 return baseCap
->fLabel
== fLabel
;
251 KeyPredicate(const char* key
)
257 bool operator()(const BaseCap
* baseCap
) {
258 const EnumCap
* enumCap
= dynamic_cast<const EnumCap
*>(baseCap
);
261 return enumCap
->fKey
== fKey
;
268 virtual int CountCap(CapID category
) const = 0;
269 virtual bool Supports(CapID category
) const = 0;
270 virtual const BaseCap
** GetCaps(CapID category
) const = 0;
272 const EnumCap
* GetDefaultCap(CapID category
) const;
273 const EnumCap
* FindCap(CapID category
, int id
) const;
274 const BaseCap
* FindCap(CapID category
, const char* label
) const;
275 const EnumCap
* FindCapWithKey(CapID category
, const char* key
)
278 const BooleanCap
* FindBooleanCap(CapID category
) const;
279 const IntRangeCap
* FindIntRangeCap(CapID category
) const;
280 const DoubleRangeCap
* FindDoubleRangeCap(CapID category
) const;
282 int GetProtocolClass() const;
285 PrinterCap(const PrinterCap
& printerCap
);
286 PrinterCap
& operator=(const PrinterCap
& printerCap
);
287 template<typename Predicate
>
288 const BaseCap
* FindCap(CapID category
, Predicate
& predicate
) const;
290 const PrinterData
* GetPrinterData() const;
293 const PrinterData
* fPrinterData
;
299 #endif /* __PRINTERCAP_H */