widget.cpp

Go to the documentation of this file.
00001 /* $Id: widget.cpp 26360 2008-05-03 15:10:39Z mordante $ */
00002 /*
00003    copyright (C) 2007 - 2008 by mark de wever <koraq@xs4all.nl>
00004    part of the battle for wesnoth project http://www.wesnoth.org/
00005 
00006    this program is free software; you can redistribute it and/or modify
00007    it under the terms of the gnu general public license version 2
00008    or at your option any later version.
00009    this program is distributed in the hope that it will be useful,
00010    but without any warranty.
00011 
00012    see the copying file for more details.
00013 */
00014 
00015 #include "gui/widgets/widget.hpp"
00016 
00017 #include "filesystem.hpp"
00018 #include "gui/widgets/window.hpp"
00019 #include "log.hpp"
00020 #include "serialization/parser.hpp"
00021 #include "serialization/preprocessor.hpp"
00022 
00023 #include <cassert>
00024 
00025 #define DBG_G LOG_STREAM_INDENT(debug, gui)
00026 #define LOG_G LOG_STREAM_INDENT(info, gui)
00027 #define WRN_G LOG_STREAM_INDENT(warn, gui)
00028 #define ERR_G LOG_STREAM_INDENT(err, gui)
00029 
00030 #define DBG_G_D LOG_STREAM_INDENT(debug, gui_draw)
00031 #define LOG_G_D LOG_STREAM_INDENT(info, gui_draw)
00032 #define WRN_G_D LOG_STREAM_INDENT(warn, gui_draw)
00033 #define ERR_G_D LOG_STREAM_INDENT(err, gui_draw)
00034 
00035 #define DBG_G_E LOG_STREAM_INDENT(debug, gui_event)
00036 #define LOG_G_E LOG_STREAM_INDENT(info, gui_event)
00037 #define WRN_G_E LOG_STREAM_INDENT(warn, gui_event)
00038 #define ERR_G_E LOG_STREAM_INDENT(err, gui_event)
00039 
00040 #define DBG_G_P LOG_STREAM_INDENT(debug, gui_parse)
00041 #define LOG_G_P LOG_STREAM_INDENT(info, gui_parse)
00042 #define WRN_G_P LOG_STREAM_INDENT(warn, gui_parse)
00043 #define ERR_G_P LOG_STREAM_INDENT(err, gui_parse)
00044 
00045 namespace gui2 {
00046 
00047 twindow* twidget::get_window()
00048 {
00049     // Go up into the parent tree until we find the top level
00050     // parent, we can also be the toplevel so start with
00051     // ourselves instead of our parent.
00052     twidget* result = this;
00053     while(result->parent_) {
00054         result = result->parent_;
00055     }
00056 
00057     // on error dynamic_cast return 0 which is what we want.
00058     return dynamic_cast<twindow*>(result);
00059 }
00060 
00061 } // namespace gui2

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs