]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormGraphics.h
More pref work from Angus
[lyx.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  * ======================================================
14  */
15
16 #ifndef FORMGRAPHICS_H
17 #define FORMGRAPHICS_H
18
19 #include "LString.h"
20 #include "RadioButtonGroup.h"
21 #include "ButtonPolicies.h"
22 #include "FormInset.h"
23
24 #ifdef __GNUG__
25 #pragma interface
26 #endif 
27
28 // Forward declarations for classes we use only as pointers.
29 class InsetGraphics;
30
31 struct FD_form_graphics;
32
33 /** This class provides an XForms implementation of the FormGraphics Dialog.
34  *
35  *  @Author Baruch Even <baruch.even@writeme.com>
36  */
37 class FormGraphics : public FormInset {
38 public:
39         /// #FormGraphics x(LyXFunc ..., Dialogs ...);#
40         FormGraphics(LyXView *, Dialogs *);
41         ///
42         ~FormGraphics();
43
44 private:
45         /// The maximum digits for the image width (cm, inch, percent)
46         enum {
47             ///
48             WIDTH_MAXDIGITS = 3
49         };
50         /// The maximum digits for the image height (cm, inch, percent)
51         enum {
52             ///
53             HEIGHT_MAXDIGITS = 3
54         };
55         /// The maximum characters in the rotation angle (minus sign and 3 digits)
56         enum {
57             ///
58             ROTATE_MAXCHARS = 4
59         };
60         /// The maximum characters in a filename.
61         enum {
62             ///
63             FILENAME_MAXCHARS = 1024
64         };
65         ///
66         enum State {
67                 ///
68                 CHECKINPUT,
69                 ///
70                 BROWSE,
71                 ///
72                 ADVANCEDINPUT
73         };
74
75         /// Build the dialog
76         virtual void build();
77         /// Filter the inputs
78         virtual bool input( FL_OBJECT *, long );
79         /// Update the popup.
80         virtual void update();
81         /// Apply from popup
82         virtual void apply();
83
84         /// Disconnect signals. Also perform any necessary housekeeping.
85         virtual void disconnect();
86
87         /// Save the active inset and show the dialog.
88         void showDialog(InsetGraphics *);
89         /// Explicitly free the dialog.
90         void free();
91         /// Verify that the input is correct. If not disable ok/apply buttons.
92         bool checkInput();
93         /// Open the file browse dialog to select an image file.
94         void browse();
95         /// Display a file browser dialog and return the file chosen.
96         string browseFile(string const & filename);
97
98         /// Pointer to the actual instantiation of the xform's form
99         virtual FL_FORM * form() const;
100         /// Fdesign generated method
101         FD_form_graphics * build_graphics();
102
103         /// Real GUI implementation.
104         FD_form_graphics * dialog_;
105         /** Which Inset do we belong to?
106            Used to set and update data to/from the inset.
107         */
108         InsetGraphics * inset_;
109         /// The radio buttons groups
110         RadioButtonGroup widthButtons;
111         ///
112         RadioButtonGroup heightButtons;
113         ///
114         RadioButtonGroup displayButtons;
115         /// Last used figure path
116         string last_image_path;
117 };
118
119 #endif