diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/MainWidget.cpp | 12 | ||||
-rw-r--r-- | src/MainWidget.h | 4 | ||||
-rw-r--r-- | src/resizabledragwidget.cpp | 19 | ||||
-rw-r--r-- | src/resizabledragwidget.h | 2 |
4 files changed, 25 insertions, 12 deletions
diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp index d320cea..be6aad5 100644 --- a/src/MainWidget.cpp +++ b/src/MainWidget.cpp @@ -541,7 +541,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const dock->hide(); } - tray->contextMenu()->setItemChecked(mnu_lock, locked); + setLockState(locked); popup_menu = new VButton ( this,"popupmenu" ); popup_menu->resize ( 15,30 ); @@ -735,10 +735,16 @@ void MainWidget::quitClicked() hide(); } -void MainWidget::toggleLock() +void MainWidget::setLockState(bool lock) { - locked = !locked; + locked = lock; tray->contextMenu()->setItemChecked(mnu_lock, locked); + repaint(); // Force repainting to update the resize handle display +} + +void MainWidget::toggleLock() +{ + setLockState(!locked); TDEConfig *cfg = TDEApplication::kApplication()->config(); cfg->writeEntry("locked", locked); diff --git a/src/MainWidget.h b/src/MainWidget.h index d0fb301..ba5b8ae 100644 --- a/src/MainWidget.h +++ b/src/MainWidget.h @@ -71,8 +71,8 @@ public slots: protected: void resizeEvent(TQResizeEvent *e); - void hideEvent ( TQHideEvent *e ); - + void hideEvent(TQHideEvent *e); + void setLockState(bool lock); private: void updateFont(); diff --git a/src/resizabledragwidget.cpp b/src/resizabledragwidget.cpp index 9cb3ade..e8f6f09 100644 --- a/src/resizabledragwidget.cpp +++ b/src/resizabledragwidget.cpp @@ -25,8 +25,7 @@ ResizableDragWidget::ResizableDragWidget(TQWidget *parent, const char *name, WFlags f) : DragWidget(parent,name,f) { -rsz=false; - + rsz=false; } @@ -65,7 +64,6 @@ void ResizableDragWidget::mouseMoveEvent(TQMouseEvent * e) int nh = curr.y()-pos.y()+dragP.y(); resize(nw,nh); - } void ResizableDragWidget::mouseReleaseEvent(TQMouseEvent * e) @@ -80,17 +78,24 @@ void ResizableDragWidget::mouseReleaseEvent(TQMouseEvent * e) void ResizableDragWidget::paintEvent(TQPaintEvent *) { + drawResizeHandle(); +} + +void ResizableDragWidget::drawResizeHandle() +{ + if (locked) + { + return; + } TQPainter p(this); - - for (int a=0;a<20;a+=5){ - + for (int a = 0; a < 20; a += 5) + { p.setPen(TQColor(170,0,0)); p.drawLine(width()-20+a,height()-2,width()-2,height()-20+a); p.setPen(TQColor(200,0,0)); p.drawLine(width()-19+a,height()-2,width()-2,height()-19+a); } - } #include "resizabledragwidget.moc" diff --git a/src/resizabledragwidget.h b/src/resizabledragwidget.h index 770434a..f44e671 100644 --- a/src/resizabledragwidget.h +++ b/src/resizabledragwidget.h @@ -32,6 +32,8 @@ Q_OBJECT public: ResizableDragWidget(TQWidget *parent, const char *name, WFlags f); ~ResizableDragWidget(); + + void drawResizeHandle(); private: bool rsz; |