Linux: Add new CefPrintHandler and CefPrintSettings classes to support printing and a GTK implementation in cefclient (issue #1258).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1762 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-07-10 15:41:30 +00:00
parent 6f63f5d4f8
commit 8313963a27
47 changed files with 3803 additions and 3 deletions

View File

@@ -1107,6 +1107,14 @@ typedef struct _cef_rect_t {
int height;
} cef_rect_t;
///
// Structure representing a size.
///
typedef struct _cef_size_t {
int width;
int height;
} cef_size_t;
///
// Existing process IDs.
///
@@ -1745,6 +1753,51 @@ typedef struct _cef_geoposition_t {
cef_string_t error_message;
} cef_geoposition_t;
///
// Print job color mode values.
///
typedef enum {
COLOR_MODEL_UNKNOWN,
COLOR_MODEL_GRAY,
COLOR_MODEL_COLOR,
COLOR_MODEL_CMYK,
COLOR_MODEL_CMY,
COLOR_MODEL_KCMY,
COLOR_MODEL_CMY_K, // CMY_K represents CMY+K.
COLOR_MODEL_BLACK,
COLOR_MODEL_GRAYSCALE,
COLOR_MODEL_RGB,
COLOR_MODEL_RGB16,
COLOR_MODEL_RGBA,
COLOR_MODEL_COLORMODE_COLOR, // Used in samsung printer ppds.
COLOR_MODEL_COLORMODE_MONOCHROME, // Used in samsung printer ppds.
COLOR_MODEL_HP_COLOR_COLOR, // Used in HP color printer ppds.
COLOR_MODEL_HP_COLOR_BLACK, // Used in HP color printer ppds.
COLOR_MODEL_PRINTOUTMODE_NORMAL, // Used in foomatic ppds.
COLOR_MODEL_PRINTOUTMODE_NORMAL_GRAY, // Used in foomatic ppds.
COLOR_MODEL_PROCESSCOLORMODEL_CMYK, // Used in canon printer ppds.
COLOR_MODEL_PROCESSCOLORMODEL_GREYSCALE, // Used in canon printer ppds.
COLOR_MODEL_PROCESSCOLORMODEL_RGB, // Used in canon printer ppds
} cef_color_model_t;
///
// Print job duplex mode values.
///
typedef enum {
DUPLEX_MODE_UNKNOWN = -1,
DUPLEX_MODE_SIMPLEX,
DUPLEX_MODE_LONG_EDGE,
DUPLEX_MODE_SHORT_EDGE,
} cef_duplex_mode_t;
///
// Structure representing a print job page range.
///
typedef struct _cef_page_range_t {
int from;
int to;
} cef_page_range_t;
#ifdef __cplusplus
}
#endif

View File

@@ -174,6 +174,48 @@ inline bool operator!=(const CefRect& a, const CefRect& b) {
return !(a == b);
}
struct CefSizeTraits {
typedef cef_size_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing a size.
///
class CefSize : public CefStructBase<CefSizeTraits> {
public:
typedef CefStructBase<CefSizeTraits> parent;
CefSize() : parent() {}
CefSize(const cef_size_t& r) : parent(r) {} // NOLINT(runtime/explicit)
CefSize(const CefSize& r) : parent(r) {} // NOLINT(runtime/explicit)
CefSize(int width, int height) : parent() {
Set(width, height);
}
bool IsEmpty() const { return width <= 0 || height <= 0; }
void Set(int width, int height) {
this->width = width, this->height = height;
}
};
inline bool operator==(const CefSize& a, const CefSize& b) {
return a.width == b.width && a.height == b.height;
}
inline bool operator!=(const CefSize& a, const CefSize& b) {
return !(a == b);
}
struct CefScreenInfoTraits {
typedef cef_screen_info_t struct_type;
@@ -228,6 +270,7 @@ class CefScreenInfo : public CefStructBase<CefScreenInfoTraits> {
}
};
struct CefKeyEventTraits {
typedef cef_key_event_t struct_type;
@@ -253,6 +296,7 @@ struct CefKeyEventTraits {
///
typedef CefStructBase<CefKeyEventTraits> CefKeyEvent;
struct CefMouseEventTraits {
typedef cef_mouse_event_t struct_type;
@@ -273,6 +317,7 @@ struct CefMouseEventTraits {
///
typedef CefStructBase<CefMouseEventTraits> CefMouseEvent;
struct CefPopupFeaturesTraits {
typedef cef_popup_features_t struct_type;
@@ -627,4 +672,47 @@ struct CefGeopositionTraits {
///
typedef CefStructBase<CefGeopositionTraits> CefGeoposition;
struct CefPageRangeTraits {
typedef cef_page_range_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
bool copy) {
*target = *src;
}
};
///
// Class representing a print job page range.
///
class CefPageRange : public CefStructBase<CefPageRangeTraits> {
public:
typedef CefStructBase<CefPageRangeTraits> parent;
CefPageRange() : parent() {}
CefPageRange(const cef_page_range_t& r) // NOLINT(runtime/explicit)
: parent(r) {}
CefPageRange(const CefPageRange& r) // NOLINT(runtime/explicit)
: parent(r) {}
CefPageRange(int from, int to) : parent() {
Set(from, to);
}
void Set(int from, int to) {
this->from = from, this->to = to;
}
};
inline bool operator==(const CefPageRange& a, const CefPageRange& b) {
return a.from == b.from && a.to == b.to;
}
inline bool operator!=(const CefPageRange& a, const CefPageRange& b) {
return !(a == b);
}
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_