Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

menubar.cpp

Go to the documentation of this file.
00001 /*
00002         ClanGUI, copyrights by various people. Have a look in the CREDITS file.
00003         
00004         This sourcecode is distributed using the Library GNU Public Licence,
00005         version 2 or (at your option) any later version. Please read LICENSE
00006         for details.
00007 */
00008 
00009 #include "precomp.h"
00010 #include "API/GUI/menuitem.h"
00011 #include "API/GUI/menubar.h"
00012 #include "API/GUI/gui_manager.h"
00013 #include "API/GUI/popupmenu.h"
00014 
00015 CL_MenuBar *CL_MenuBar::create(
00016         const CL_ComponentOptions &options,
00017         CL_Component *parent,
00018         CL_StyleManager *style)
00019 {
00020         return (CL_MenuBar *) style->create_component("menubar", options, parent);
00021 }
00022 
00023 CL_MenuBar::CL_MenuBar(const CL_ComponentOptions &options, CL_Component *parent) 
00024         : CL_MenuData(parent)
00025 {
00026         int x = 0, y = 0, width = 0, height = 0;
00027 
00028         real_parent = this;
00029         
00030         if(options.exists("x"))
00031                 x = options.get_value_as_int("x");
00032         if(options.exists("y"))
00033                 y = options.get_value_as_int("y");
00034         if(options.exists("width"))
00035                 width = options.get_value_as_int("width");
00036         if(options.exists("height"))
00037                 height = options.get_value_as_int("height");
00038         if(options.exists("visible"))
00039                 show(options.get_value_as_bool("visible"));
00040         if(options.exists("enabled"))
00041                 enable(options.get_value_as_bool("enabled"));
00042 
00043         set_position(CL_Rect(x, y, x + width, y + height));
00044 
00045 //      slot_highlight = sig_paint().connect(CL_CreateSlot(this, &CL_MenuBar::on_paint));
00046 }
00047 
00048 /*void CL_MenuBar::update()
00049 {
00050         sig_begin_paint();
00051 
00052         if(initialized == false)
00053         {
00054                 adjust_size();
00055                 initialized = true;
00056         }
00057 
00058         sig_paint();
00059 
00060         std::list<CL_Component *> &children = get_children();
00061         for (
00062                 std::list<CL_Component *>::iterator it = children.begin();
00063                 it != children.end();
00064                 it++)
00065         {
00066                 CL_MenuItem *c = (CL_MenuItem *)(*it);
00067                 c->update();
00068         }
00069 
00070         sig_end_paint();
00071 }
00072 */
00073 void CL_MenuBar::on_item_activated(CL_MenuItem *item, CL_PopupMenu *child)
00074 {
00075         CL_MenuData::on_item_activated(item, child);
00076         
00077         if(child)
00078         {
00079                 get_gui_manager()->add_child(child);
00080 
00081 //              CL_Rect pos = item->get_screen_rect();
00082 //              child->create(this, pos.x1, pos.y1 + get_height());
00083         }
00084 }
00085 
00086 void CL_MenuBar::on_item_highlighted(CL_MenuItem *item)
00087 {
00088 }

Generated at Wed Apr 4 19:54:01 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001