Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

simpleimpl.cpp

Go to the documentation of this file.
00001 
00002 #include "simpleimpl.h"
00003 
00004 #include <opie2/oresource.h> // for OResource loading
00005 #include <opie2/otaskbarapplet.h>
00006 
00007 #include <qpe/applnk.h> // for AppLnk
00008 
00009 #include <qlabel.h>
00010 #include <qpainter.h>
00011 #include <qmessagebox.h>
00012 
00013 
00014 
00015 
00016 SimpleApplet::SimpleApplet(QWidget *parent)
00017     : QWidget( parent,  "Simple Applet" ) {
00018 /*
00019  * we will load an Pixmap, scaled for the right usage
00020  * remember your applet might be used by different
00021  * resolutions.
00022  */
00023 
00024     m_pix = new QPixmap( Opie::Core::OResource::loadPixmap("Tux", Opie::Core::OResource::SmallIcon) );
00025 
00026     /*
00027      * Now we will say that we don't want to be bigger than our
00028      * Pixmap
00029      */
00030     setFixedHeight( AppLnk::smallIconSize() );
00031     setFixedWidth( AppLnk::smallIconSize() );
00032 
00033 }
00034 
00035 SimpleApplet::~SimpleApplet() {
00036     delete m_pix;
00037 }
00038 
00039 
00040 /*
00041  * here you would normal show or do something
00042  * useful. If you want to show a widget at the top left
00043  * of your icon you need to map your rect().topLeft() to
00044  * global with mapToGlobal(). Then you might also need to
00045  * move the widgets so it is visible
00046  */
00047 void SimpleApplet::mousePressEvent(QMouseEvent* ) {
00048     QMessageBox::information(this, tr("No action taken"),
00049                              tr("<qt>This Plugin does not yet support anything usefule aye.</qt>"),
00050                              QMessageBox::Ok );
00051 
00052 }
00053 
00054 void SimpleApplet::paintEvent( QPaintEvent* ) {
00055     QPainter p(this);
00056 
00057     /* simpy draw the pixmap from the start of this widget */
00058     p.drawPixmap(0, 0,  *m_pix );
00059 }
00060 
00061 /*
00062  * We need to add this symbol for the plugin exporter!
00063  */
00064 int SimpleApplet::position(){
00065     return 1;
00066 }
00067 
00068 
00069 
00070 /*
00071  * Here comes the implementation of the interface
00072  */
00073 EXPORT_OPIE_APPLET_v1( SimpleApplet )
00074 

Generated on Sat Nov 5 16:15:58 2005 for OPIE by  doxygen 1.4.2