mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
d1182f17da
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2141 a592a061-630c-0410-9148-cb99ea01b6c8
67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
// -*- C++ -*-
|
|
/* This file is part of
|
|
* ======================================================
|
|
*
|
|
* LyX, The Document Processor
|
|
*
|
|
* Copyright 1995-2001 The LyX Team
|
|
*
|
|
* ======================================================*/
|
|
|
|
#ifndef COLOR_HANDLER_H
|
|
#define COLOR_HANDLER_H
|
|
|
|
#ifdef __GNUG__
|
|
#pragma interface
|
|
#endif
|
|
|
|
#include <boost/smart_ptr.hpp>
|
|
|
|
// This is only included to provide stuff for the non-public sections
|
|
#include <X11/Xlib.h>
|
|
|
|
#include "PainterBase.h"
|
|
|
|
class LyXFont;
|
|
class WorkArea;
|
|
|
|
/**
|
|
* This is a factory class that can produce GCs with a specific
|
|
* color. It will cache GCs for performance.
|
|
*/
|
|
class LyXColorHandler {
|
|
public:
|
|
///
|
|
LyXColorHandler();
|
|
///
|
|
~LyXColorHandler();
|
|
///
|
|
unsigned long colorPixel(LColor::color c);
|
|
///
|
|
GC getGCForeground(LColor::color c);
|
|
///
|
|
GC getGCLinepars(PainterBase::line_style,
|
|
PainterBase::line_width, LColor::color c);
|
|
/// update the cache after a color definition change
|
|
void updateColor(LColor::color c);
|
|
|
|
private:
|
|
///
|
|
Display * display;
|
|
///
|
|
Colormap colormap;
|
|
///
|
|
GC colorGCcache[LColor::ignore + 1];
|
|
///
|
|
typedef std::map<int, GC> LineGCCache;
|
|
///
|
|
LineGCCache lineGCcache;
|
|
///
|
|
Pixmap drawable;
|
|
};
|
|
|
|
///
|
|
extern boost::scoped_ptr<LyXColorHandler> lyxColorHandler;
|
|
|
|
#endif
|