]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QWorkArea.C
The initial merge of the Qt frontend, and the necessary compile fixes.
[lyx.git] / src / frontends / qt2 / QWorkArea.C
1 /**
2  * \file QWorkArea.C
3  * Copyright 1995-2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include "debug.h"
16 #include "LyXView.h"
17 #include "lyxrc.h" // lyxrc.show_banner
18 #include "version.h" // lyx_version
19
20 #include "support/filetools.h" // LibFileSearch
21 #include "support/lstrings.h"
22 #include "support/LAssert.h"
23
24 #include <cmath>
25 #include <cctype>
26
27 #include "QWorkArea.h"
28  
29 #include <qapplication.h>
30 #include <qevent.h> 
31 #include <qpainter.h>
32 #include <qmainwindow.h>
33 #include <qlayout.h>
34  
35 using std::endl;
36 using std::abs;
37 using std::hex;
38
39  
40 QWorkArea::QWorkArea(int, int, int, int)
41         : WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
42 {
43         // Add a splash screen to the centre of the work area
44         string const splash_file = (lyxrc.show_banner) ?
45                 LibFileSearch("images", "banner", "xpm") : string();
46
47         if (!splash_file.empty()) {
48                 // FIXME
49         }
50
51         scrollbar_ = new QScrollBar(QScrollBar::Vertical, this);
52         content_ = new QContentPane(this);
53
54         (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
55  
56         content_->show();
57
58         content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
59
60         QHBoxLayout * vl = new QHBoxLayout(this);
61         vl->addWidget(content_, 5);
62         vl->addWidget(scrollbar_, 0);
63  
64         show();
65 }
66
67
68 QWorkArea::~QWorkArea()
69 {
70 }
71
72
73 void QWorkArea::resize(int xpos, int ypos, int width, int height)
74 {
75         setGeometry(xpos, ypos, width, height);
76 }
77
78
79 void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
80 {
81         // do what cursor movement does (some grey)
82         h += height() / 4;
83  
84         int max = h - height();
85         if (max < 0)
86                 max = 0;
87         scrollbar_->setRange(0, max);
88         scrollbar_->setValue(pos);
89         scrollbar_->setLineStep(line_h);
90         scrollbar_->setPageStep(height());
91 }
92
93
94 void QWorkArea::haveSelection(bool ) const
95 {
96         // FIXME 
97 }
98
99  
100 string const QWorkArea::getClipboard() const 
101 {
102         // FIXME 
103         return "nothing"; 
104 }
105
106         
107 void QWorkArea::putClipboard(string const &) const
108 {
109         // FIXME
110 }