summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/TEWidget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/TEWidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp52
1 files changed, 49 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index e4415dc..bf9a313 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -90,8 +90,6 @@
90#define rimX 0 // left/right rim width 90#define rimX 0 // left/right rim width
91#define rimY 0 // top/bottom rim high 91#define rimY 0 // top/bottom rim high
92 92
93#define SCRWIDTH 16 // width of the scrollbar
94
95#define yMouseScroll 1 93#define yMouseScroll 1
96// scroll increment used when dragging selection at top/bottom of window. 94// scroll increment used when dragging selection at top/bottom of window.
97 95
@@ -319,6 +317,10 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
319 scrollbar->setCursor( arrowCursor ); 317 scrollbar->setCursor( arrowCursor );
320 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 318 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
321 319
320 hscrollbar = new QScrollBar( Qt::Horizontal, this );
321 hscrollbar->setCursor( arrowCursor );
322 connect(hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(hscrollChanged(int)));
323
322 m_cornerButton = new QPushButton( this ); 324 m_cornerButton = new QPushButton( this );
323 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 325 m_cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
324 m_cornerButton->setMaximumSize( 14, 14 ); 326 m_cornerButton->setMaximumSize( 14, 14 );
@@ -352,6 +354,7 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
352 font_h = 1; 354 font_h = 1;
353 font_a = 1; 355 font_a = 1;
354 word_selection_mode = FALSE; 356 word_selection_mode = FALSE;
357 vcolumns = 0;
355 358
356 setMouseMarks(TRUE); 359 setMouseMarks(TRUE);
357 setVTFont( QFont("fixed") ); 360 setVTFont( QFont("fixed") );
@@ -630,6 +633,13 @@ void TEWidget::scrollChanged(int)
630 emit changedHistoryCursor(scrollbar->value()); //expose 633 emit changedHistoryCursor(scrollbar->value()); //expose
631} 634}
632 635
636void TEWidget::hscrollChanged(int loc)
637{
638 hposition = loc;
639 propagateSize();
640 update();
641}
642
633void TEWidget::setScroll(int cursor, int slines) 643void TEWidget::setScroll(int cursor, int slines)
634{ 644{
635 disconnect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 645 disconnect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
@@ -1139,18 +1149,38 @@ void TEWidget::calcGeometry()
1139{ 1149{
1140 //FIXME: set rimX == rimY == 0 when running in full screen mode. 1150 //FIXME: set rimX == rimY == 0 when running in full screen mode.
1141 1151
1152 int showhscrollbar = 1;
1153 int hwidth = 0;
1154
1155 if(vcolumns == 0) showhscrollbar = 0;
1156 if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
1157
1142 scrollbar->resize(QApplication::style().scrollBarExtent().width(), 1158 scrollbar->resize(QApplication::style().scrollBarExtent().width(),
1143 contentsRect().height()); 1159 contentsRect().height() - hwidth);
1160
1161 if(showhscrollbar == 1)
1162 {
1163 hscrollbar->resize(contentsRect().width() - hwidth, hwidth);
1164 hscrollbar->setRange(0, 40);
1165
1166 QPoint p = contentsRect().bottomLeft();
1167 hscrollbar->move(QPoint(p.x(), p.y() - hwidth));
1168 hscrollbar->show();
1169 }
1170 else hscrollbar->hide();
1171
1144 switch(scrollLoc) 1172 switch(scrollLoc)
1145 { 1173 {
1146 case SCRNONE : 1174 case SCRNONE :
1147 columns = ( contentsRect().width() - 2 * rimX ) / font_w; 1175 columns = ( contentsRect().width() - 2 * rimX ) / font_w;
1176 if(vcolumns) columns = vcolumns;
1148 blX = (contentsRect().width() - (columns*font_w) ) / 2; 1177 blX = (contentsRect().width() - (columns*font_w) ) / 2;
1149 brX = blX; 1178 brX = blX;
1150 scrollbar->hide(); 1179 scrollbar->hide();
1151 break; 1180 break;
1152 case SCRLEFT : 1181 case SCRLEFT :
1153 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1182 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1183 if(vcolumns) columns = vcolumns;
1154 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1184 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1155 blX = brX + scrollbar->width(); 1185 blX = brX + scrollbar->width();
1156 scrollbar->move(contentsRect().topLeft()); 1186 scrollbar->move(contentsRect().topLeft());
@@ -1158,7 +1188,10 @@ void TEWidget::calcGeometry()
1158 break; 1188 break;
1159 case SCRRIGHT: 1189 case SCRRIGHT:
1160 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1190 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1191 if(vcolumns) columns = vcolumns;
1161 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1192 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1193 if(showhscrollbar)
1194 blX = -hposition * font_w;
1162 brX = blX; 1195 brX = blX;
1163 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); 1196 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
1164 scrollbar->show(); 1197 scrollbar->show();
@@ -1167,6 +1200,12 @@ void TEWidget::calcGeometry()
1167 //FIXME: support 'rounding' styles 1200 //FIXME: support 'rounding' styles
1168 lines = ( contentsRect().height() - 2 * rimY ) / font_h; 1201 lines = ( contentsRect().height() - 2 * rimY ) / font_h;
1169 bY = (contentsRect().height() - (lines *font_h)) / 2; 1202 bY = (contentsRect().height() - (lines *font_h)) / 2;
1203
1204 if(showhscrollbar == 1)
1205 {
1206 //bY = bY - 10;
1207 lines = lines - 1;
1208 }
1170} 1209}
1171 1210
1172void TEWidget::makeImage() 1211void TEWidget::makeImage()
@@ -1301,3 +1340,10 @@ void TEWidget::drop_menu_activated(int)
1301QPushButton* TEWidget::cornerButton() { 1340QPushButton* TEWidget::cornerButton() {
1302 return m_cornerButton; 1341 return m_cornerButton;
1303} 1342}
1343
1344void TEWidget::setWrapAt(int columns)
1345{
1346 vcolumns = columns;
1347}
1348
1349