]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormColorpicker.h
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FormColorpicker.h
1 // -*- C++ -*-
2 /**
3  * \file FormColorpicker.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef FORMCOLORPICKER_H
13 #define FORMCOLORPICKER_H
14
15 #include "Color.h"
16 #include "forms_fwd.h"
17
18 #include <boost/scoped_ptr.hpp>
19 #include <X11/Xlib.h> // for Pixmap
20
21
22 class Tooltips;
23 class FD_colorpicker;
24 class FD_colorpicker_rgb;
25 class FD_colorpicker_hsv;
26
27
28 class FormColorpicker
29 {
30 public:
31         FormColorpicker();
32         ~FormColorpicker();
33
34         /** Launch the color picker. All other dialogs are frozen till
35             a color is chosen (or the dialog is closed).
36             \param color the color used to initialise the dialog.
37          */
38         RGBColor const & requestColor(RGBColor const & color);
39
40         /** Input callback function.
41          *  Invoked only by the xforms callback interface
42          */
43         void input(FL_OBJECT *, long);
44
45 private:
46         /// Build the dialog
47         void build();
48         /// Hide the dialog.
49         void hide() const;
50         /// Create the dialog if necessary, update it and display it.
51         void show();
52         /// Update dialog before/whilst showing it.
53         void update() const;
54
55         Tooltips & tooltips() const;
56         /// Pointer to the actual instantiation of xform's form
57         FL_FORM * form() const;
58
59         /** Called on the first show() request, initialising various bits and
60          *  pieces.
61          */
62         void prepare_to_show();
63
64         void InputRGB();
65         void InputHSV();
66
67         /// The dialog's minimum allowable dimensions.
68         int minw_;
69         int minh_;
70
71         /// The title displayed by the Window Manager.
72         std::string title_;
73
74         RGBColor input_color_;
75         RGBColor color_;
76         bool finished_;
77
78         /// Passed to the window manager to give a pretty little symbol ;-)
79         Pixmap icon_pixmap_;
80         Pixmap icon_mask_;
81
82         boost::scoped_ptr<Tooltips> tooltips_;
83         boost::scoped_ptr<FD_colorpicker> dialog_;
84         boost::scoped_ptr<FD_colorpicker_rgb> rgb_;
85         boost::scoped_ptr<FD_colorpicker_hsv> hsv_;
86 };
87
88 #endif // FORMCOLORPICKER_H