00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Serge Lussier,,, * 00003 * serge.lussier@videotron.ca * 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 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #include <stdobject.h> 00021 00022 namespace stdui { 00023 00028 stdobject::stdobject():sigc::trackable() 00029 { 00030 _flags = (stdflags)0; 00031 _name = "undef"; 00032 _parent= (stdobject*)0; 00033 _thid = pthread_self(); 00034 } 00035 00041 stdobject::stdobject(stdobject* __parentobj, const std::string& nameid, stdflags __flags): 00042 sigc::trackable(), 00043 _parent(__parentobj), 00044 _name(nameid) 00045 { 00046 _flags = __flags; 00047 _thid = pthread_self(); 00048 } 00049 00050 00051 stdobject::~stdobject() 00052 { 00053 // Informs all non-child object, which want to be notified about the destruction of this object. 00054 destroy_.emit(this); //this call returns when the last connected slot returns... 00055 destroy_children(); 00056 } 00057 00058 00059 00060 00061 00067 int stdobject::addchild(stdobject* _obj) 00068 { 00069 _children.push_back(_obj); 00070 _obj->setparent(this); 00071 return _children.size(); 00072 } 00073 00074 00075 00076 00077 00083 int stdobject::destroy_children() 00084 { 00085 int i = _children.size(); 00086 if(!i) return 0; 00087 for( iterator it = _children.begin(); it != _children.end(); it++) delete (*it); 00088 return i; 00089 } 00090 00091 00092 00093 00094 00095 00100 int stdobject::setparent(stdobject* _obj) 00101 { 00102 _parent = _obj; 00103 return 0; 00104 } 00105 00106 } 00107 00108 00112 int stdui::stdobject::postevent( stdmessage msg ) 00113 { 00114 _holdmsgqueu.push( msg ); 00115 return _holdmsgqueu.size(); 00116 } 00117 00118 00122 void stdui::stdobject::purgemessages() 00123 { 00125 } 00126 00127 00131 stdui::evt::result stdui::stdobject::messageevent( cmessageevent* mes ) 00132 { 00134 }