00001 /* $Id: spacer.hpp 26662 2008-05-17 07:18:31Z mordante $ */ 00002 /* 00003 copyright (C) 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 #ifndef __GUI_WIDGETS_SPACER_HPP_INCLUDED__ 00016 #define __GUI_WIDGETS_SPACER_HPP_INCLUDED__ 00017 00018 #include "gui/widgets/control.hpp" 00019 00020 namespace gui2 { 00021 00022 // Class for a spacer 00023 class tspacer : public tcontrol 00024 { 00025 public: 00026 tspacer() : 00027 tcontrol(0), 00028 best_size_(0, 0) 00029 { 00030 } 00031 00032 //! Inherited from tcontrol. 00033 // We are always active, might not be visible but always active. 00034 void set_active(const bool) {} 00035 bool get_active() const { return true; } 00036 unsigned get_state() const { return 0; } 00037 00038 void draw(surface&) {} 00039 00040 void set_best_size(const tpoint& best_size) { best_size_ = best_size; } 00041 00042 /** Inherited from tcontrol. */ 00043 tpoint get_best_size() const 00044 { return best_size_ != tpoint(0, 0) ? best_size_ : tcontrol::get_best_size(); } 00045 00046 private: 00047 00048 /** When we're used as a fixed size item, this holds the best size. */ 00049 tpoint best_size_; 00050 00051 //! Inherited from tcontrol. 00052 const std::string& get_control_type() const 00053 { static const std::string type = "spacer"; return type; } 00054 }; 00055 00056 00057 } // namespace gui2 00058 00059 #endif 00060 00061
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |