Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

WiBox.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "WiBox.h"
00010 
00011 //-----------------------------------------------------------------
00012 /**
00013  * Release all subwidgets.
00014  */
00015 WiBox::~WiBox()
00016 {
00017     t_widgets::iterator end = m_widgets.end();
00018     for (t_widgets::iterator i = m_widgets.begin(); i != end; ++i) {
00019         delete *i;
00020     }
00021 }
00022 //-----------------------------------------------------------------
00023 /**
00024  * Draw all subwidgets.
00025  */
00026 void
00027 WiBox::drawOn(SDL_Surface *screen)
00028 {
00029     t_widgets::iterator end = m_widgets.end();
00030     for (t_widgets::iterator i = m_widgets.begin(); i != end; ++i) {
00031         (*i)->drawOn(screen);
00032     }
00033 }
00034 //-----------------------------------------------------------------
00035 /**
00036  * Returns tooltip for active subwidget.
00037  */
00038 std::string
00039 WiBox::own_getTip(const V2 &loc)
00040 {
00041     if (!m_tip.empty()) {
00042         return m_tip;
00043     }
00044 
00045     std::string result;
00046     t_widgets::iterator end = m_widgets.end();
00047     for (t_widgets::iterator i = m_widgets.begin(); i != end; ++i) {
00048         result = (*i)->getTip(loc);
00049         if (!result.empty()) {
00050             return result;
00051         }
00052     }
00053     return result;
00054 }
00055 //-----------------------------------------------------------------
00056 /**
00057  * Let all subwidgets to react on button press.
00058  */
00059 void
00060 WiBox::own_mouseButton(const MouseStroke &stroke)
00061 {
00062     t_widgets::iterator end = m_widgets.end();
00063     for (t_widgets::iterator i = m_widgets.begin(); i != end; ++i) {
00064         (*i)->mouseButton(stroke);
00065     }
00066 }
00067 

Generated on Wed Jun 1 09:54:32 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2