]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormColorpicker.h
If I ever see another licence blurb again, it'll be too soon...
[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 "LString.h"
19 #include <boost/scoped_ptr.hpp>
20 #include <X11/Xlib.h> // for Pixmap
21
22
23 class Tooltips;
24 class FD_colorpicker;
25 class FD_colorpicker_rgb;
26 class FD_colorpicker_hsv;
27
28
29 class FormColorpicker
30 {
31 public:
32         FormColorpicker();
33         ~FormColorpicker();
34
35         /** Launch the color picker. All other dialogs are frozen till
36             a color is chosen (or the dialog is closed).
37             \param color the color used to initialise the dialog.
38          */
39         RGBColor const & requestColor(RGBColor const & color);
40
41         /** Input callback function.
42          *  Invoked only by the xforms callback interface
43          */
44         void input(FL_OBJECT *, long);
45
46 private:
47         /// Build the dialog
48         void build();
49         /// Hide the dialog.
50         void hide() const;
51         /// Create the dialog if necessary, update it and display it.
52         void show();
53         /// Update dialog before/whilst showing it.
54         void update() const;
55
56         Tooltips & tooltips() const;
57         /// Pointer to the actual instantiation of xform's form
58         FL_FORM * form() const;
59
60         /** Called on the first show() request, initialising various bits and
61          *  pieces.
62          */
63         void prepare_to_show();
64
65         void InputRGB();
66         void InputHSV();
67
68         /// The dialog's minimum allowable dimensions.
69         int minw_;
70         int minh_;
71
72         /// The title displayed by the Window Manager.
73         string title_;
74
75         RGBColor input_color_;
76         RGBColor color_;
77         bool finished_;
78
79         /// Passed to the window manager to give a pretty little symbol ;-)
80         Pixmap icon_pixmap_;
81         Pixmap icon_mask_;
82
83         boost::scoped_ptr<Tooltips> tooltips_;
84         boost::scoped_ptr<FD_colorpicker> dialog_;
85         boost::scoped_ptr<FD_colorpicker_rgb> rgb_;
86         boost::scoped_ptr<FD_colorpicker_hsv> hsv_;
87 };
88
89 #endif // FORMCOLORPICKER_H