diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-06 15:56:40 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-06 15:56:40 -0600 |
commit | e16866e072f94410321d70daedbcb855ea878cac (patch) | |
tree | ee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /tdeui/tests/kstatusbartest.cpp | |
parent | a58c20c1a7593631a1b50213c805507ebc16adaf (diff) | |
download | tdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip |
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'tdeui/tests/kstatusbartest.cpp')
-rw-r--r-- | tdeui/tests/kstatusbartest.cpp | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/tdeui/tests/kstatusbartest.cpp b/tdeui/tests/kstatusbartest.cpp new file mode 100644 index 000000000..669044c55 --- /dev/null +++ b/tdeui/tests/kstatusbartest.cpp @@ -0,0 +1,121 @@ +#include <tqpopupmenu.h> +#include <tqwidget.h> +#include <tqstring.h> +#include <tqmessagebox.h> +#include <tqmultilineedit.h> +#include <tqkeycode.h> +#include <tqpixmap.h> +#include <tqcursor.h> + +#include <stdlib.h> + +#include "kstatusbar.h" +#include <kapplication.h> +#include <kmainwindow.h> +#include <kmenubar.h> +#include "kstatusbartest.h" + +testWindow::testWindow (TQWidget *, const char *name) + : KMainWindow (0, name) + { + // Setup Menus + menuBar = new KMenuBar (this); + fileMenu = new TQPopupMenu; + menuBar->insertItem ("&File", fileMenu); + fileMenu->insertItem ("&Exit", KApplication::kApplication(), + TQT_SLOT( quit() ), ALT + Key_Q ); + statusbar = new KStatusBar (this); + statusbar->insertItem("Zoom: XXXX", 0); + statusbar->insertItem("XXX", 1); + statusbar->insertItem("Line: XXXXX", 2); + + statusbar->changeItem("Zoom: 100%", 0); + statusbar->changeItem("INS", 1); + insert = true; + statusbar->changeItem("Line: 13567", 2); + + connect (statusbar, TQT_SIGNAL(pressed(int)), this, TQT_SLOT(slotPress(int))); + connect (statusbar, TQT_SIGNAL(released(int)), this, TQT_SLOT(slotClick(int))); + + widget = new TQMultiLineEdit (this); + + setCentralWidget(widget); + + setCaption( KApplication::kApplication()->caption() ); + + smenu = new TQPopupMenu; + + smenu->insertItem("50%"); + smenu->insertItem("75%"); + smenu->insertItem("100%"); + smenu->insertItem("150%"); + smenu->insertItem("200%"); + smenu->insertItem("400%"); + smenu->insertItem("oo%"); + + connect (smenu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMenu(int))); +} + +void testWindow::slotClick(int id) +{ + switch (id) + { + case 0: + break; + + case 1: + if (insert == true) + { + insert = false; + statusbar->changeItem("OVR", 1); + } + else + { + insert = true; + statusbar->changeItem("INS", 1); + } + break; + + case 2: + TQMessageBox::information(0, "Go to line", "Enter line number:", "where?"); + statusbar->changeItem("16543", 2); + break; + } +} + +void testWindow::slotPress(int id) +{ + if (id == 0) + smenu->popup(TQCursor::pos()); // This popup should understand keys up and down +} + +void testWindow::slotMenu(int id) +{ + TQString s = "Zoom: "; + s.append (smenu->text(id)); + statusbar->changeItem(s,0); +} + +testWindow::~testWindow () +{ + // I would delete toolbars here, but there are none + delete statusbar; +} + +int main( int argc, char *argv[] ) +{ + KApplication *myApp = new KApplication( argc, argv, "KStatusBarTest" ); + testWindow *test = new testWindow; + + myApp->setMainWidget(test); + test->show(); + test->resize(test->width(), test->height()); // I really really really dunno why it doesn't show + int ret = myApp->exec(); + + delete test; + + return ret; +} + +#include "kstatusbartest.moc" + |