00001
00002
00003
00004
00005
00006
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
00046 }
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
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
00082
00083 }
00084 }
00085
00086 void CL_MenuBar::on_item_highlighted(CL_MenuItem *item)
00087 {
00088 }