]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/FormRef.h
Clean-up of the button controller.
[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 "insets/insetcommand.h"
22
23 #include <gtk--/container.h>
24 #include <gtk--/clist.h>
25 #include <gtk--/button.h>
26 #include <gnome--/entry.h>
27 #include <gtk--/optionmenu.h>
28 #include <gtk--/menu.h>
29 #include "pixbutton.h"
30
31 /** This class provides an Gnome implementation of the FormRef Dialog.
32  */
33 class FormRef : public DialogBase {
34 public:
35   ///
36   FormRef(LyXView *, Dialogs *);
37   ///
38   ~FormRef();
39 private:
40   ///
41   enum Type{
42     ///
43     REF,
44     ///
45     PAGEREF,
46     ///
47     VREF,
48     ///
49     VPAGEREF,
50     ///
51     PRETTYREF
52   };
53   ///
54   enum Goto{
55     ///
56     GOREF,
57     ///
58     GOBACK
59   };
60   ///
61   enum ActionType {
62     ///
63     INSERT,
64     ///
65     EDIT
66   };
67
68   /// Slot launching dialog to (possibly) create a new inset
69   void createInset( string const & );
70   /// Slot launching dialog to an existing inset
71   void showInset( InsetCommand * const );
72   
73   /// Update dialog before showing it (not used in this implementation)
74   virtual void update() { } 
75   virtual void updateSlot(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   SigC::Connection u_;
118   /// Hide connection.
119   SigC::Connection h_;
120   /// inset::hide connection.
121   SigC::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