1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/*
$Id: menuitem.cpp,v 1.31 2001/12/22 19:46:24 sphair Exp $
ClanGUI, copyrights by various people. Have a look in the CREDITS file.
This sourcecode is distributed using the Library GNU Public Licence,
version 2 or (at your option) any later version. Please read LICENSE
for details.
*/
#include "precomp.h"
#include "API/GUI/menuitem.h"
#include "API/GUI/component_options.h"
#include "API/GUI/stylemanager.h"
#include "menuitem_generic.h"
/////////////////////////////////////////////////////////////////////////////
// Construction:
CL_MenuItem::CL_MenuItem(
const CL_ComponentOptions &options,
CL_Component *parent,
CL_StyleManager *style)
:
CL_Component(options, parent, style),
impl(NULL)
{
init(options);
}
CL_MenuItem::CL_MenuItem(
const std::string &text,
CL_Component *parent,
CL_StyleManager *style)
:
CL_Component(
CL_MenuItem_Generic::create_options(text, false, false, false),
parent,
style),
impl(NULL)
{
CL_ComponentOptions options = CL_MenuItem_Generic::create_options(text, false, false, false);
init(options);
}
CL_MenuItem::CL_MenuItem(
const std::string &text,
bool checked,
CL_Component *parent,
CL_StyleManager *style)
:
CL_Component(
CL_MenuItem_Generic::create_options(text, true, checked, false),
parent,
style),
impl(NULL)
{
CL_ComponentOptions options = CL_MenuItem_Generic::create_options(text, true, checked, false);
init(options);
}
CL_MenuItem::CL_MenuItem(
CL_Component *parent,
CL_StyleManager *style)
:
CL_Component(
CL_MenuItem_Generic::create_options("", false, false, true),
parent,
style),
impl(NULL)
{
CL_ComponentOptions options = CL_MenuItem_Generic::create_options("", false, false, true);
init(options);
}
void CL_MenuItem::init(const CL_ComponentOptions &options)
{
impl = new CL_MenuItem_Generic(this, options, get_style_manager());
get_style_manager()->connect_styles("menuitem", options, this);
find_preferred_size();
}
CL_MenuItem::~CL_MenuItem()
{
delete impl;
}
/////////////////////////////////////////////////////////////////////////////
// Attributes:
bool CL_MenuItem::is_checkable() const
{
return impl->is_checkable();
}
bool CL_MenuItem::is_separator() const
{
return impl->is_separator();
}
bool CL_MenuItem::is_checked() const
{
return impl->is_checked();
}
bool CL_MenuItem::is_highlighted() const
{
return impl->is_highlighted();
}
bool CL_MenuItem::has_submenu() const
{
return impl->has_submenu();
}
const std::string &CL_MenuItem::get_text() const
{
return impl->get_text();
}
/////////////////////////////////////////////////////////////////////////////
// Operations:
void CL_MenuItem::set_text(const std::string &text)
{
impl->set_text(text);
}
/////////////////////////////////////////////////////////////////////////////
// Signals:
CL_Signal_v0 &CL_MenuItem::sig_clicked()
{
return impl->sig_clicked;
}
|