]> git.lyx.org Git - features.git/blob - src/frontends/xforms/FormGraphics.h
make doc++ able to generate the source documentation for lyx
[features.git] / src / frontends / xforms / FormGraphics.h
1 // -*- C++ -*-
2 /* FormGraphics.h
3  * FormGraphics Interface Class
4  *
5  * This file is part of
6  * ====================================================== 
7  *
8  *           LyX, The Document Processor
9  *
10  *           Copyright 1995 Matthias Ettrich
11  *           Copyright 1995-2000 The LyX Team.
12  *
13  *           This file Copyright 2000
14  *           Baruch Even
15  * ======================================================
16  */
17
18 #ifndef FORMGRAPHICS_H
19 #define FORMGRAPHICS_H
20
21 #include <config.h>
22 #include "LString.h"
23 #include "frontends/DialogBase.h"
24 //#include "form_graphics.h"
25 #include "RadioButtonGroup.h"
26
27 #ifdef __GNUG__
28 #pragma interface
29 #endif
30
31 class Dialogs;
32 // same arguement as in Dialogs.h s/LyX/UI/
33 class LyXView;
34 class InsetGraphics;
35
36 struct FD_form_graphics;
37
38 /** This class provides an XForms implementation of the FormGraphics Dialog.
39  */
40 class FormGraphics: public DialogBase {
41 public:
42         /// #FormGraphics x(LyXFunc ..., Dialogs ...);#
43         FormGraphics(LyXView *, Dialogs *);
44         ///
45         ~FormGraphics();
46         ///
47         static  int WMHideCB(FL_FORM *, void *);
48         ///
49         static void OKCB(FL_OBJECT *, long);
50         ///
51         static void ApplyCB(FL_OBJECT *, long);
52         ///
53         static void CancelCB(FL_OBJECT *, long);
54         ///
55         static void BrowseCB(FL_OBJECT *, long);
56         ///
57         static void AdvancedOptionsCB(FL_OBJECT *, long);
58         ///
59         static void InputCB(FL_OBJECT *, long);
60
61 private:
62         ///
63         FormGraphics()
64                 : widthButtons(5), heightButtons(4), displayButtons(4) {}
65         //
66         FormGraphics(FormGraphics const &) : DialogBase() {}
67         
68         /// The maximum digits for the image width (cm, inch, percent)
69         enum {
70                 ///
71                 WIDTH_MAXDIGITS = 3
72         }; 
73         /// The maximum digits for the image height (cm, inch, percent)
74         enum {
75                 ///
76                 HEIGHT_MAXDIGITS = 3
77         };
78         /// The maximum characters in the rotation angle (minus sign and 3 digits)
79         enum {
80                 ///
81                 ROTATE_MAXCHARS = 4
82         };
83         /// The maximum characters in a filename.
84         enum {
85                 ///
86                 FILENAME_MAXCHARS = 1024
87         };
88     
89         /**@name Slot Methods */
90         //@{
91         /// Save the active inset and show the dialog.
92         void showDialog(InsetGraphics * inset);
93         /// Create the dialog if necessary, update it and display it.
94         void show();
95         /// Hide the dialog.
96         void hide();
97         /// Update the dialog
98         void update();
99         //@}
100
101         /**@name Callback methods */
102         //@{
103         /// Apply the changes to the inset.
104         void apply();
105         /// Verify that the input is correct. If not disable ok/apply buttons.
106         void input();
107         /// Open the file browse dialog to select an image file.
108         void browse();
109         //@}
110         
111         /// Build the dialog
112         void build();
113         ///
114         FD_form_graphics * build_graphics();
115         /// Explicitly free the dialog.
116         void free();
117         /// Display a file browser dialog and return the file chosen.
118         string browseFile(string const & filename);
119
120         /**@name Data */
121         //@{
122         /// Real GUI implementation.
123         FD_form_graphics * dialog_;
124         /** Which LyXFunc do we use?
125             We could modify Dialogs to have a visible LyXFunc* instead and
126             save a couple of bytes per dialog.
127         */
128         LyXView * lv_;
129         /** Which Dialogs do we belong to?
130             Used so we can get at the signals we have to connect to.
131         */
132         Dialogs * d_;
133         /** Which Inset do we belong to?
134            Used to set and update data to/from the inset.
135         */
136         InsetGraphics * inset_;
137         /// The radio buttons groups
138         RadioButtonGroup widthButtons;
139         ///
140         RadioButtonGroup heightButtons;
141         ///
142         RadioButtonGroup displayButtons;
143
144         /// Inset Hide connection, connected to the calling inset hide signal.
145         Connection ih_;
146         /// Hide connection.
147         Connection h_;
148         /// Update connection.
149         Connection u_;
150         /// Last used figure path
151         string last_image_path;
152         //@}
153
154 };
155
156 #endif
157
158