]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormGraphics.h
create and use a little setEnabled() xforms wrapper function.
[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         /// Verify that the input is correct. If not disable ok/apply buttons.
90         bool checkInput();
91         /// Open the file browse dialog to select an image file.
92         void browse();
93
94         /// Pointer to the actual instantiation of the xforms form
95         virtual FL_FORM * form() const;
96         /// Fdesign generated method
97         FD_form_graphics * build_graphics();
98
99         /// Real GUI implementation.
100         FD_form_graphics * dialog_;
101         /** Which Inset do we belong to?
102            Used to set and update data to/from the inset.
103         */
104         InsetGraphics * inset_;
105         /// The radio buttons groups
106         RadioButtonGroup widthButtons;
107         ///
108         RadioButtonGroup heightButtons;
109         ///
110         RadioButtonGroup displayButtons;
111         /// Last used figure path
112         string last_image_path;
113 };
114
115 #endif