]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/FormRef.h
Small fix from Angus
[lyx.git] / src / frontends / gnome / FormRef.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000 The LyX Team.
8  *
9  * ======================================================
10  */
11
12 #ifndef FORMREF_H
13 #define FORMREF_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "DialogBase.h"
20 #include "LString.h"
21 #include "boost/utility.hpp"
22 #include "insets/insetcommand.h"
23
24 #include <gtk--/container.h>
25 #include <gtk--/clist.h>
26 #include <gtk--/button.h>
27 #include <gnome--/entry.h>
28 #include <gtk--/optionmenu.h>
29 #include <gtk--/menu.h>
30 #include "pixbutton.h"
31
32 /** This class provides an Gnome implementation of the FormRef Dialog.
33  */
34 class FormRef : public DialogBase, public noncopyable {
35 public:
36   ///
37   FormRef(LyXView *, Dialogs *);
38   ///
39   ~FormRef();
40 private:
41   ///
42   enum Type{
43     ///
44     REF,
45     ///
46     PAGEREF,
47     ///
48     VREF,
49     ///
50     VPAGEREF,
51     ///
52     PRETTYREF
53   };
54   ///
55   enum Goto{
56     ///
57     GOREF,
58     ///
59     GOBACK
60   };
61   ///
62   enum ActionType {
63     ///
64     INSERT,
65     ///
66     EDIT
67   };
68
69   /// Slot launching dialog to (possibly) create a new inset
70   void createInset( string const & );
71   /// Slot launching dialog to an existing inset
72   void showInset( InsetCommand * const );
73   
74   /// Update dialog before showing it (not used in this implementation)
75   virtual void update(bool = false);
76   /// Apply from dialog (modify or create inset)
77   virtual void apply();
78   /// Explicitly free the dialog.
79   void free();
80   /// dummy function
81   virtual void show() { }
82   /// Show selection of the references
83   void showStageSelect();
84   /// Edit properties
85   void showStageAction();
86   /// Error (no labels)
87   void showStageError(string const & mess);
88   /// Hide the dialog.
89   void hide();
90   /// Go to reference or return back
91   void gotoRef();
92   
93   /// moves from Search to Select "stage"
94   void moveFromSelectToAction();
95
96   /// changes the type of the reference
97   void changeType(Type);
98   ///
99   Type getType() const;
100   ///
101   string getName( Type type ) const;
102
103   /** Which LyXFunc do we use?
104       We could modify Dialogs to have a visible LyXFunc* instead and
105       save a couple of bytes per dialog.
106   */
107   LyXView * lv_;
108   /** Which Dialogs do we belong to?
109       Used so we can get at the signals we have to connect to.
110   */
111   Dialogs * d_;
112   /// pointer to the inset passed through showInset (if any)
113   InsetCommand * inset_;
114   /// the nitty-griity. What is modified and passed back
115   InsetCommandParams params;
116   /// Update connection.
117   Connection u_;
118   /// Hide connection.
119   Connection h_;
120   /// inset::hide connection.
121   Connection ih_;
122   /// 
123   std::vector<string> refs;
124   ///
125   Type reftype_;
126   ///
127   Goto gototype_;
128   ///
129   ActionType acttype_;
130   
131   /// Real GUI implementation.
132   Gtk::Container * dialog_;
133   Gtk::CList * list_;
134   Gtk::Button * b_ok;
135   Gtk::Button * b_cancel;
136   Gnome::Entry * name_;
137   Gtk::OptionMenu * choice_;
138   Gnome::PixButton * b_goto;
139 };
140
141 #endif