Exemplo n.º 1
0
/*virtual*/ void mainrect_c::created()
{
    defaultthrdraw = DTHRO_BORDER | /*DTHRO_CENTER_HOLE |*/ DTHRO_CAPTION | DTHRO_CAPTION_TEXT;
    set_theme_rect(CONSTASTR("mainrect"), false);
    __super::created();
    gui->make_app_buttons( m_rid );

    auto uiroot = [](RID p)->RID
    {
        gui_hgroup_c &g = MAKE_VISIBLE_CHILD<gui_hgroup_c>(p);
        g.allow_move_splitter(true);
        g.leech(TSNEW(leech_fill_parent_s));
        g.leech(TSNEW(leech_save_proportions_s, CONSTASTR("main_splitter"), CONSTASTR("7060,12940")));
        return g.getrid();
    };

    RID hg = uiroot(m_rid);
    RID cl = MAKE_CHILD<gui_contactlist_c>( hg );
    RID chat = MAKE_CHILD<gui_conversation_c>( hg );
    hg.call_restore_signal();
    
    gmsg<ISOGM_SELECT_CONTACT>(&contacts().get_self(), 0).send(); // 1st selected item, yo

    g_app->F_ALLOW_AUTOUPDATE = !g_app->F_READONLY_MODE;


    if (const theme_rect_s *tr = themerect())
    {
        if (tr->captextadd.x >= 18)
        {
            int sz = tr->captextadd.x - 2;
            ts::bitmap_c icon, rsz;
            if (icon.load_from_file(CONSTWSTR("icon.png")))
            {
                rsz.create_ARGB(ts::ivec2(sz));
                icon.resize_to( rsz.extbody(), ts::FILTER_BOX_LANCZOS3 );
                rsz.premultiply();
                icons[0] = rsz;
            }

            if (icon.load_from_file(CONSTWSTR("icon-offline.png")))
            {
                rsz.create_ARGB(ts::ivec2(sz));
                icon.resize_to(rsz.extbody(), ts::FILTER_BOX_LANCZOS3);
                rsz.premultiply();
                icons[1] = rsz;
            }
        }
    }
}