]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/GnomeBase.C
fix tooltips in toolbar
[lyx.git] / src / frontends / gnome / GnomeBase.C
1 /* This file is part of
2  * =================================================
3  *
4  *          LyX, The Document Processor
5  *          Copyright 1995 Matthias Ettrich.
6  *          Copyright 1995-2000 The LyX Team.
7  *
8  * ================================================= */
9
10 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include <config.h>
15 #include "GnomeBase.h"
16 #include "support/LAssert.h"
17 #include "debug.h"
18 #include "support/filetools.h"
19 #include <glib.h>
20 #include <gtkmm/dialog.h>
21
22 GnomeBase::GnomeBase(ControlButtons & c,
23                  string const & name)
24         : ViewBC<gnomeBC>(c)
25         , file_(name + ".glade"), widget_name_(name), xml_(0)
26         , dialog_(0)
27 {
28         loadXML();
29 }
30
31 GnomeBase::~GnomeBase()
32 {}
33
34
35 void GnomeBase::loadXML() 
36 {
37 #ifdef WITH_WARNINGS
38 #warning Change this before declaring it production code! (be 20010325)
39 #endif
40         string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;");
41         string const file = FileOpenSearch(path, file_, "glade");
42
43         if (file.empty()) {
44                 lyxerr << "Cannot find glade file. Aborting." << std::endl;
45                 lyx::Assert(true);
46         }
47
48         lyxerr[Debug::GUI] << "Glade file to open is " << file << '\n';
49
50         xml_ = Gnome::Glade::Xml::create (file, widget_name_);
51 }
52
53
54 void GnomeBase::show()
55 {
56         update();
57         dialog()->show();
58 }
59
60
61 void GnomeBase::hide()
62 {
63         dialog()->hide();
64 }
65
66 bool GnomeBase::validate()
67 {
68         return true;
69 }
70
71 void GnomeBase::OKClicked()
72 {
73         lyxerr[Debug::GUI] << "GnomeBase::OKClicked()\n";
74         OKButton();
75 }
76
77 void GnomeBase::CancelClicked() 
78
79         lyxerr[Debug::GUI] << "GnomeBase::CancelClicked()\n";
80         CancelButton(); 
81 }
82
83 void GnomeBase::ApplyClicked() 
84
85         lyxerr[Debug::GUI] << "GnomeBase::ApplyClicked()\n";
86         ApplyButton(); 
87 }
88
89 void GnomeBase::RestoreClicked() 
90
91         lyxerr[Debug::GUI] << "GnomeBase::RestoreClicked()\n";
92         RestoreButton(); 
93 }
94
95 void GnomeBase::InputChanged()
96 {
97         bc().valid(validate());
98 }
99
100 Gtk::Dialog * GnomeBase::dialog()
101 {
102         if (!dialog_)
103                 dialog_ = getWidget<Gtk::Dialog>(widget_name_);
104
105         return dialog_;
106 }