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

child.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Bosselut Cyril                                   *
00003  *   bosselut@b1project.com                                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 #include "child.h"
00011 
00012 
00013 Child::Child( int x, int y, int w, int h )
00014         : Meter( x, y, w, h ){
00015     theme = "";
00016     rect = QRect( x, y, w, h );
00017     myChild = 0;
00018     parent = 0;
00019 }
00020 
00021 Child::~Child(){
00022 }
00023 
00024 
00025 void Child::enter( QMouseEvent * ){
00026   if( theme != "" && (event == "over" || event == "ofocus") ){
00027     if(!myChild){
00028       myChild = new karamba(parent, theme, true);
00029       if(event == "ofocus"){
00030         connect( myChild,SIGNAL(ActiveWin(bool)), this,SLOT(hide(bool)) );
00031       }
00032       if(parent){
00033         myChild->setBackgroundMode(myKaramba->backgroundMode());
00034         if(myChild->backgroundMode() == PaletteBackground){
00035           myChild->setPaletteBackgroundColor(myKaramba->paletteBackgroundColor());
00036         }
00037       }
00038       myKaramba->KarChildList->append( myChild );
00039     }
00040     if(myChild->isHidden()){
00041       myChild->show();
00042       myChild->updateSensors();
00043     }
00044   }
00045 }
00046 
00047 void Child::leave( QMouseEvent * ){
00048   if(event == "over"){
00049     if( myChild ){
00050       if(myChild->isShown()){
00051         myChild->hide();
00052         myKaramba->setActiveWindow();
00053       }
00054     }
00055   }
00056 }
00057 
00058 void Child::hide(bool b){
00059   if( myChild && !b){
00060     if(myChild->isShown()){
00061       myChild->hide();
00062       myKaramba->setActiveWindow();
00063     }
00064   }
00065 }
00066 
00067 void Child::click( QMouseEvent *e ){
00068   if( rect.contains( e->x(), e->y() ) && (event == "click" || event == "cfocus") ){
00069     if( theme != "" ){
00070       if(!myChild){
00071         myChild = new karamba(parent, theme, true);
00072         if(event == "cfocus"){
00073           connect( myChild,SIGNAL(ActiveWin(bool)), this,SLOT(hide(bool)) );
00074         }
00075         if(parent){
00076           myChild->setBackgroundMode(myKaramba->backgroundMode());
00077           if(myChild->backgroundMode() == PaletteBackground){
00078             myChild->setPaletteBackgroundColor(myKaramba->paletteBackgroundColor());
00079           }
00080         }
00081         myKaramba->KarChildList->append( myChild );
00082         myChild->show();
00083       }
00084       else{
00085         if(myChild->isHidden()){
00086           myChild->show();
00087           myChild->updateSensors();
00088        }
00089         else if(myChild->isShown()){
00090           myChild->hide();
00091           myKaramba->setActiveWindow();
00092         }
00093       }
00094     }
00095   }
00096 }
00097 
00098 void Child::setEvent( QString e ){
00099     event = e;
00100 }
00101 
00102 void Child::closeEvent(QCloseEvent *ce){
00103         ce->ignore();
00104 }
00105 
00106 QRect Child::getRectangle(){
00107     return rect;
00108 }
00109 
00110 void Child::mUpdate( QPainter *p ){
00111 
00112     p->drawRect( x, y, width, height );
00113 
00114 }
00115 
00116 void Child::setValue( int v){
00117 
00118     setValue( QString::number( v ) );
00119 
00120 }
00121 
00122 void Child::setValue( QString v ){
00123     theme = v;
00124 }
00125 
00126 void Child::setEmbed( bool b ){
00127   if(b){
00128     parent = myKaramba;
00129   }
00130   else{
00131     parent = 0;
00132   }
00133 }
00134 
00135 void Child::setTooltip(QString txt){
00136         QRect rect(x,y,width,height);
00137         QToolTip::add(myKaramba, rect, txt);
00138 }
00139 
00140 void Child::setKaramba(karamba* k){
00141         myKaramba = k;
00142 }
00143 
00144 
00145 

Generated on Mon May 16 13:59:20 2005 for karamba by  doxygen 1.3.9.1