Exemplo n.º 1
0
platform_display_type insert<reveal_t>(display_t&             display,
                                       platform_display_type& parent,
                                       reveal_t&              element)
{
    assert(!element.control_m);

    boost::shared_ptr<GG::StyleFactory> style = GG::GUI::GetGUI()->GetStyleFactory();
    element.control_m = style->NewButton(GG::X0, GG::Y0, GG::X(100), GG::Y(100),
                                         "", style->DefaultFont(), GG::CLR_GRAY);

    const GG::SubTexture& subtexture =
        element.current_value_m == element.show_value_m ? showing_image() : hidden_image();
    element.control_m->SetUnpressedGraphic(subtexture);
    element.control_m->SetPressedGraphic(subtexture);
    element.control_m->SetRolloverGraphic(subtexture);

    GG::Connect(element.control_m->ClickedSignal,
                boost::bind(&reveal_clicked, boost::ref(element)));

    if (!element.alt_text_m.empty())
        implementation::set_control_alt_text(element.control_m, element.alt_text_m);

    platform_display_type result(display.insert(parent, element.control_m));

    if (element.using_label_m)
        display.insert(parent, get_display(element.name_m));

    return result;
}
Exemplo n.º 2
0
    platform_display_type insert<color_button_t>(display_t& display,
                                                 platform_display_type& parent,
                                                 color_button_t& element)
    {
        if (element.using_label_m)
            insert(display, parent, element.name_m);

        assert(!element.control_m);

        ColorButton* button = new ColorButton(GG::X(element.width_m),
                                              GG::Y(element.height_m),
                                              element.border_color_m,
                                              2,
                                              element.dialog_color_m,
                                              element.dialog_border_color_m,
                                              element.dialog_text_color_m);
        element.original_size_m = GG::Pt(button->Width(), button->Height());

        element.control_m = button;

        GG::Connect(button->ColorChanged, boost::bind(&color_changed, boost::ref(element)));

        if (!element.alt_text_m.empty())
            adobe::implementation::set_control_alt_text(element.control_m, element.alt_text_m);

        return display.insert(parent, element.control_m);
    }
Exemplo n.º 3
0
platform_display_type insert<toggle_t>(display_t&             display,
                                       platform_display_type& parent,
                                       toggle_t&              element)
{
    assert(!element.control_m);

    element.control_m = ::CreateWindowExW(  WS_EX_COMPOSITED | WS_EX_TRANSPARENT, L"STATIC",
                                    NULL,
                                    WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_NOTIFY,
                                    0, 0, 100, 20,
                                    parent,
                                    0,
                                    ::GetModuleHandle(NULL),
                                    NULL);

    if (element.control_m == NULL)
        ADOBE_THROW_LAST_ERROR;

    set_font(element.control_m, EP_EDITTEXT); // REVISIT (fbrereto) : a better type?

    ::SetWindowSubclass(element.control_m, &toggle_subclass_proc, reinterpret_cast<UINT_PTR>(&element), 0);

    if (!element.alt_text_m.empty())
        implementation::set_control_alt_text(element.control_m, element.alt_text_m);

    return display.insert(parent, element.control_m);
}
Exemplo n.º 4
0
template <> platform_display_type insert<presets_t>(display_t&             display,
                                                    platform_display_type& parent,
                                                    presets_t&             element)
{
    assert(!element.control_m);

    insert(display, parent, element.category_popup_m);

    insert(display, parent, element.popup_m);

    GG::X width(26);
    GG::Y height(21);
    boost::shared_ptr<GG::StyleFactory> style = GG::GUI::GetGUI()->GetStyleFactory();
    element.control_m = style->NewButton(GG::X0, GG::Y0, width, height,
                                         "", style->DefaultFont(), GG::CLR_GRAY);
    reset_textures(element);

    GG::Connect(element.control_m->ClickedSignal,
                boost::bind(&presets_button_clicked, boost::ref(element)));

    element.popup_m.monitor(boost::bind(&presets_t::do_imbue, boost::ref(element), _1));

    if (!element.alt_text_m.empty())
        adobe::implementation::set_control_alt_text(element.control_m, element.alt_text_m);

    return display.insert(parent, element.control_m);
}
platform_display_type insert<group_t>(display_t&             display,
                                             platform_display_type& parent,
                                             group_t&        element)
{
    HWND parent_hwnd(parent);

    element.control_m = ::CreateWindowExW(WS_EX_CONTROLPARENT | WS_EX_COMPOSITED | WS_EX_TRANSPARENT,
                                          L"BUTTON",
                                          hackery::convert_utf(element.name_m).c_str(),
                                          WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
                                          0, 0, 10, 10,
                                          parent_hwnd,
                                          0,
                                          ::GetModuleHandle(NULL),
                                          NULL);

    if (element.control_m == NULL)
        ADOBE_THROW_LAST_ERROR;

    set_font(element.control_m, BP_GROUPBOX);

    ::SetWindowSubclass(element.control_m, &group_subclass_proc, reinterpret_cast<UINT_PTR>(&element), 0);

    return display.insert(parent, element.control_m);
}
platform_display_type insert<image_t>(display_t&             display,
                                      platform_display_type& parent,
                                      image_t&               element)
{
    initialize(element, parent);

    return display.insert(parent, element.control_m.get());
}
Exemplo n.º 7
0
platform_display_type insert<display_number_t>(display_t& display,
                                             platform_display_type& parent,
                                             display_number_t& element)
{
    HWND parent_hwnd(parent);
    element.initialize(parent_hwnd);
    return display.insert(parent, get_display(element));
}
Exemplo n.º 8
0
platform_display_type insert<tab_group_t>(display_t&             display,
        platform_display_type&  parent,
        tab_group_t&     element)
{
    HWND parent_hwnd(parent);

    element.initialize(parent_hwnd);

    return display.insert(parent, element.control_m);
}
platform_display_type insert<checkbox_t>(display_t&             display,
                                                platform_display_type& parent,
                                                checkbox_t&     element)
{
    HWND parent_hwnd(parent);

    initialize(element, parent_hwnd);

    return display.insert(parent, element.control_m);
}
platform_display_type insert<checkbox_t>(display_t&             display,
                                         platform_display_type& parent,
                                         checkbox_t&            element)
{
    ::HIViewRef parent_ref(parent);

    initialize(element, parent_ref);

    return display.insert(parent, element.control_m);
}
Exemplo n.º 11
0
platform_display_type insert<window_t>(display_t&             display,
                                       platform_display_type& parent,
                                       window_t&              element)
{
    assert(!element.window_m);
    assert(!parent);

    element.window_m = new GG::EveDialog(element, element.color_m, element.text_color_m);

    return display.insert(parent, element.window_m);
}
platform_display_type insert<link_t>(display_t&             display,
                                            platform_display_type& parent,
                                            link_t&         element)
{
    HWND parent_hwnd(parent);

    element.control_m = ::CreateWindowExW(WS_EX_COMPOSITED, L"STATIC",
                                          NULL,
                                          WS_CHILD | WS_VISIBLE,
                                          0, 0, 50, 50,
                                          parent_hwnd,
                                          0,
                                          ::GetModuleHandle(NULL),
                                          NULL);

    if (element.control_m == NULL)
        ADOBE_THROW_LAST_ERROR;

    if (!element.alt_text_m.empty())
        implementation::set_control_alt_text(element.control_m, element.alt_text_m);

    ::SetWindowSubclass(element.control_m, link_subclass_proc, reinterpret_cast<UINT_PTR>(&element), 0);

    element.link_icon_m = ::CreateWindowExW(WS_EX_COMPOSITED | WS_EX_TRANSPARENT, L"STATIC",
                                            NULL,
                                            WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_NOTIFY,
                                            0, 0, 9, 16,
                                            parent_hwnd,
                                            0,
                                            ::GetModuleHandle(NULL),
                                            NULL);

    if (element.link_icon_m == NULL)
        ADOBE_THROW_LAST_ERROR;
    ::SendMessage(element.link_icon_m, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) link_bitmap());

    display.insert(parent, element.link_icon_m);

    return display.insert(parent, element.control_m);
}
Exemplo n.º 13
0
platform_display_type insert<tab_group_t>(display_t&             display,
                                          platform_display_type& parent,
                                          tab_group_t&           element)
{
    assert (!element.control_m);

    // This probably looks odd.  The interface of tab groups in Eve is wildly
    // different from that of GG's TabWnd.  The most expedient way to get all
    // the Wnds in the right styles and still match the Eve interface was to
    // replace the built-in TabBar inside of TabWnd with one created here.

    boost::shared_ptr<GG::StyleFactory> style = GG::GUI::GetGUI()->GetStyleFactory();
    element.tab_bar_m = style->NewTabBar(GG::X0, GG::Y0, GG::X(100),
                                         style->DefaultFont(), element.color_m, element.text_color_m,
                                         element.style_m);
    element.tab_bar_m->SetMinSize(GG::Pt(element.tab_bar_m->MinSize().x, element.tab_bar_m->Height()));

    element.control_m = style->NewTabWnd(GG::X0, GG::Y0, GG::X(100), element.tab_bar_m->Height() + 20,
                                         style->DefaultFont(), element.color_m, element.text_color_m,
                                         element.style_m);

    GG::Layout* layout = element.control_m->DetachLayout();
    delete layout;

    layout = new GG::Layout(GG::X0, GG::Y0,
                            element.control_m->Width(), element.control_m->Height(),
                            2, 1);
    layout->SetRowStretch(1, 1.0);
    layout->Add(element.tab_bar_m, 0, 0);
    layout->Add(new Placeholder, 1, 0);
    element.control_m->SetLayout(layout);

    GG::Connect(element.tab_bar_m->TabChangedSignal,
                boost::bind(&tab_changed, boost::ref(element), _1));

    for (tab_group_t::tab_set_t::iterator
             first(element.items_m.begin()), last(element.items_m.end());
         first != last;
         ++first) {
        element.tab_bar_m->AddTab(first->name_m);
    }

    element.color_proxy_m.initialize(
        boost::bind(&GG::TabBar::SetColor, element.tab_bar_m, _1)
    );
    element.text_color_proxy_m.initialize(
        boost::bind(&GG::TabBar::SetTextColor, element.tab_bar_m, _1)
    );

    return display.insert(parent, element.control_m);
}
platform_display_type insert<popup_t>(display_t& display, platform_display_type& parent, popup_t& element)
{
    HWND parent_hwnd(parent);

    if (element.using_label_m)
        insert(display, parent, element.name_m);

    ::initialize(element, parent_hwnd);
    ::message_menu_item_set(element);

    platform_display_type result(display.insert(parent, element.control_m));

    return result;
}
Exemplo n.º 15
0
platform_display_type insert<edit_text_t>(display_t&             display,
                                                 platform_display_type& parent,
                                                 edit_text_t&    element)
{
    HWND parent_hwnd(parent);

    if (element.using_label_m)
    {
        insert(display, parent, element.get_label());
    }

   element.initialize(parent_hwnd);

   return display.insert(parent, get_display(element));
}
Exemplo n.º 16
0
platform_display_type insert<button_t>(display_t&             display,
                                       platform_display_type& parent,
                                       button_t&              element)
{
    assert(element.control_m == 0);

    button_state_set_t::iterator state(button_default_state(element.state_set_m));

    element.control_m =
        implementation::Factory().NewButton(GG::X0, GG::Y0, GG::X1, implementation::StandardHeight(),
                                            state->name_m, implementation::DefaultFont(),
                                            element.color_m, element.text_color_m);

    element.control_m->SetUnpressedGraphic(element.unpressed_m);
    element.control_m->SetPressedGraphic(element.pressed_m);
    element.control_m->SetRolloverGraphic(element.rollover_m);

    const GG::X max_width =
        std::max(element.unpressed_m.Empty() ? GG::X0 : element.unpressed_m.Width(),
                 std::max(element.pressed_m.Empty() ? GG::X0 : element.pressed_m.Width(),
                          element.rollover_m.Empty() ? GG::X0 : element.rollover_m.Width()));
    const GG::Y max_height =
        std::max(element.unpressed_m.Empty() ? GG::Y0 : element.unpressed_m.Height(),
                 std::max(element.pressed_m.Empty() ? GG::Y0 : element.pressed_m.Height(),
                          element.rollover_m.Empty() ? GG::Y0 : element.rollover_m.Height()));
    const GG::X min_width =
        std::min(element.unpressed_m.Empty() ? GG::X0 : element.unpressed_m.Width(),
                 std::min(element.pressed_m.Empty() ? GG::X0 : element.pressed_m.Width(),
                          element.rollover_m.Empty() ? GG::X0 : element.rollover_m.Width()));
    const GG::Y min_height =
        std::min(element.unpressed_m.Empty() ? GG::Y0 : element.unpressed_m.Height(),
                 std::min(element.pressed_m.Empty() ? GG::Y0 : element.pressed_m.Height(),
                          element.rollover_m.Empty() ? GG::Y0 : element.rollover_m.Height()));
    if (max_width && max_height && min_width && min_height) {
        element.control_m->SetMaxSize(GG::Pt(max_width, max_height));
        element.control_m->SetMinSize(GG::Pt(min_width, min_height));
    }

    GG::Connect(element.control_m->ClickedSignal,
                boost::bind(&button_clicked, boost::ref(element)));

    if (!state->alt_text_m.empty())
        implementation::set_control_alt_text(element.control_m, state->alt_text_m);

    element.control_m->Disable(!element.enabled_m);

    return display.insert(parent, element.control_m);
}
platform_display_type insert<label_t>(display_t&             display,
                                             platform_display_type& parent,
                                             label_t&        element)
{
    ::HIViewRef parent_ref(parent);

    initialize(element, parent_ref);

    ::HIViewRef ref(element.control_m.get());

    platform_display_type result(display.insert(parent, ref));

    element.subevent_m.handler_m.install(ref);

    return result;
}              
Exemplo n.º 18
0
platform_display_type insert<label_t>(display_t& display,
                                      platform_display_type& parent,
                                      label_t& element)
{
    GG::X w = static_cast<int>(element.characters_m) * implementation::CharWidth();
    GG::Pt extent = implementation::DefaultFont()->TextExtent(element.name_m, element.format_m, w);
    element.window_m =
        implementation::Factory().NewTextControl(GG::X0, GG::Y0, extent.x, extent.y,
                                                 element.name_m, implementation::DefaultFont(),
                                                 GG::CLR_BLACK, element.format_m);

    if (!element.alt_text_m.empty())
        implementation::set_control_alt_text(element.window_m, element.alt_text_m);

    return display.insert(parent, get_display(element));
}
platform_display_type insert<edit_text_t>(display_t&             display,
                                                 platform_display_type& parent,
                                                 edit_text_t&    element)
{
    ::HIViewRef parent_ref(parent);

    if (element.using_label_m)
    {
        insert(display, parent, element.get_label());
    }

    initialize(element, parent_ref);

    element.edit_text_handler_m.handler_m.install(element.control_m);

    return display.insert(parent, get_display(element));
}
Exemplo n.º 20
0
platform_display_type insert<slider_t>(display_t&             display,
                                       platform_display_type& parent,
                                       slider_t&              element)
{
    assert(!element.control_m);

    boost::shared_ptr<GG::StyleFactory> style = GG::GUI::GetGUI()->GetStyleFactory();
    double min = element.format_m.at(0).cast<slider_t::model_type>();
    double max = element.format_m.at(element.format_m.size() - 1).cast<slider_t::model_type>();
    element.control_m =
        style->NewDoubleSlider(GG::X0, GG::Y0, GG::X(100), GG::Y(100),
                               min, max, element.is_vertical_m ? GG::VERTICAL : GG::HORIZONTAL,
                               GG::GROOVED, GG::CLR_GRAY, 6);

    GG::Connect(element.control_m->SlidSignal,
                boost::bind(&slider_slid, boost::ref(element), _1, _2, _3));

    return display.insert(parent, element.control_m);
}
Exemplo n.º 21
0
platform_display_type insert<button_t>(display_t&             display,
                                       platform_display_type& parent,
                                       button_t&              element)
{
    static const ::Rect bounds_s = { 0, 0, 1024, 1024 };

    assert(element.control_m == false);

    button_state_set_t::iterator state(button_default_state(element.state_set_m));
    ::HIViewRef                  parent_ref(parent);
    ::WindowRef                  window(::GetControlOwner(parent_ref));

    ADOBE_REQUIRE_STATUS(::CreatePushButtonControl(window,
                                                   &bounds_s,
                                                   explicit_cast<auto_cfstring_t>(state->name_m).get(),
                                                   &element.control_m));

    implementation::set_theme(element.control_m, element.theme_m);
    implementation::set_active(element.control_m, element.enabled_m);

    if (state->alt_text_m.empty() == false)
        implementation::set_control_alt_text(element.control_m, state->alt_text_m);

    element.hit_handler_m.handler_m.install(element.control_m);

    implementation::set_widget_data(element.control_m,
                                    kControlEntireControl,
                                    kControlPushButtonDefaultTag,
                                    static_cast< ::Boolean >(element.is_default_m));

    implementation::set_widget_data(element.control_m,
                                    kControlEntireControl,
                                    kControlPushButtonCancelTag,
                                    static_cast< ::Boolean >(element.is_cancel_m));

    assert(element.mod_key_handler_m.handler_m.is_installed() == false);

    if (element.state_set_m.size() > 1)
        element.mod_key_handler_m.handler_m.install(window);

    return display.insert(parent, element.control_m);
}
Exemplo n.º 22
0
platform_display_type insert<button_t>(display_t&             display,
                                       platform_display_type& parent,
                                       button_t&              element)
{
    assert(element.control_m == 0);

    button_state_set_t::iterator state(button_default_state(element.state_set_m));

    element.control_m =
        implementation::Factory().NewButton(GG::X0, GG::Y0, GG::X1, implementation::StandardHeight(),
                                            state->name_m, implementation::DefaultFont(), GG::CLR_GRAY);

    GG::Connect(element.control_m->ClickedSignal, Clicked(element));

    if (!state->alt_text_m.empty())
        implementation::set_control_alt_text(element.control_m, state->alt_text_m);

    element.control_m->Disable(!element.enabled_m);

    return display.insert(parent, element.control_m);
}
Exemplo n.º 23
0
    platform_display_type insert<display_text_t>(display_t& display,
                                                 platform_display_type& parent,
                                                 display_text_t& element)
    {
        element.window_m =
            implementation::Factory().NewTextControl(GG::X0, GG::Y0, GG::X1, GG::Y1,
                                                     element.name_m, implementation::DefaultFont(),
                                                     element.color_m, GG::FORMAT_LEFT | GG::FORMAT_TOP,
                                                     GG::INTERACTIVE);

        if (!element.alt_text_m.empty())
            implementation::set_control_alt_text(element.window_m, element.alt_text_m);

        element.color_proxy_m.initialize(
            boost::bind(&GG::TextControl::SetColor, element.window_m, _1)
        );
        element.label_color_proxy_m.initialize(
            boost::bind(&display_text_t::set_label_color, &element, _1)
        );

        return display.insert(parent, get_display(element));
    }
platform_display_type insert<separator_t>(display_t&             display,
                                                 platform_display_type&  parent,
                                                 separator_t&     element)
{
    HWND parent_hwnd(parent);

    assert(!element.control_m);

    element.control_m = ::CreateWindowEx(WS_EX_COMPOSITED,
                                         WC_STATIC,
                                         NULL,
                                         WS_CHILD | WS_VISIBLE | SS_ETCHEDFRAME,
                                         0, 0, 10, 10,
                                         parent_hwnd,
                                         0,
                                         ::GetModuleHandle(NULL),
                                         NULL);

    if (element.control_m == NULL)
        ADOBE_THROW_LAST_ERROR;

    return display.insert(parent, element.control_m);
}
Exemplo n.º 25
0
platform_display_type insert<panel_t>(display_t&             display,
                                             platform_display_type&  parent,
                                             panel_t&     element)
{
    HWND parent_hwnd(parent);

    assert(!element.control_m);

    element.control_m = ::CreateWindowEx(   WS_EX_CONTROLPARENT | WS_EX_COMPOSITED,
                    _T("eve_panel"),
                    NULL,
                    WS_CHILD | WS_VISIBLE,
                    0, 0, 10, 10,
                    parent_hwnd,
                    0,
                    ::GetModuleHandle(NULL),
                    NULL);

    if (element.control_m == NULL)
        ADOBE_THROW_LAST_ERROR;

    return display.insert(parent, element.control_m);
}
Exemplo n.º 26
0
platform_display_type insert(display_t& display, platform_display_type& position, DisplayElement& element)
{ return display.insert(position, element); }