Beispiel #1
0
void PoeditListCtrl::OnSize(wxSizeEvent& event)
{
    wxWindowUpdateLocker lock(this);

    SizeColumns();
    event.Skip();
}
Beispiel #2
0
void PoeditListCtrl::CreateColumns()
{
    DeleteAllColumns();

    int curr = 0;
    m_colSource = (int)InsertColumn(curr++, _("Source text"));
    if (m_catalog && m_catalog->HasCapability(Catalog::Cap::Translations))
        m_colTrans = (int)InsertColumn(curr++, _("Translation"));
    else
        m_colTrans = -1;
    if (m_displayIDs)
        m_colId = (int)InsertColumn(curr++, _("ID"), wxLIST_FORMAT_RIGHT);
    else
        m_colId = -1;

#ifdef __WXMSW__
    if (m_appIsRTL)
    {
        // another wx quirk: if we truly need left alignment, we must lie under RTL locales
        wxListItem colInfoOrig;
        colInfoOrig.SetAlign(wxLIST_FORMAT_RIGHT);
        SetColumn(m_colSource, colInfoOrig);
    }
#endif

    SizeColumns();
}
Beispiel #3
0
void PoeditListCtrl::CreateColumns()
{
    DeleteAllColumns();
    InsertColumn(0, _("Source text"));
    InsertColumn(1, _("Translation"));
    if (m_displayLines)
        InsertColumn(2, _("Line"), wxLIST_FORMAT_RIGHT);
    SizeColumns();
}
Beispiel #4
0
void PoeditListCtrl::CreateColumns()
{
    DeleteAllColumns();
    InsertColumn(0, _("Source text"));
    InsertColumn(1, _("Translation"));
    if (m_displayIDs)
        InsertColumn(2, _("ID"), wxLIST_FORMAT_RIGHT);

#ifdef __WXMSW__
    if (m_appIsRTL)
    {
        // another wx quirk: if we truly need left alignment, we must lie under RTL locales
        wxListItem colInfoOrig;
        colInfoOrig.SetAlign(wxLIST_FORMAT_RIGHT);
        SetColumn(0, colInfoOrig);
    }
#endif

    SizeColumns();
}
Beispiel #5
0
void PoeditListCtrl::OnSize(wxSizeEvent& event)
{
    SizeColumns();
    event.Skip();
}
 void OnSize(wxSizeEvent& event)
 {
     SizeColumns();
     event.Skip();
 }
 void CreateColumns()
 {
     InsertColumn(0, wxT("item"));
     SizeColumns();
 }
Beispiel #8
0
void
ListBox::DrawContent(const Rect& ctrl_rect)
{
    SizeColumns();

    Rect item_rect = ctrl_rect;
    item_rect.h = line_height;

    int h = rect.h;

    // draw headings at top, if needed:
    if (show_headings) {
        Color save_color = back_color;
        back_color = ShadeColor(back_color, 1.3);
        font->SetColor(fore_color);

        int max_column = columns.size()-1;
        item_rect.h += HEADING_EXTRA;

        page_size = (h-item_rect.h) / (line_height + leading);

        for (int column = 0; column <= max_column; column++) {
            item_rect.w = GetColumnWidth(column);

            // draw heading button
            FillRect(item_rect, back_color);
            DrawStyleRect(item_rect, WIN_RAISED_FRAME);

            Rect title_rect = item_rect;
            title_rect.Deflate(3,3);

            DrawText(GetColumnTitle(column),
            0,
            title_rect,
            DT_CENTER|DT_SINGLELINE);

            item_rect.x += item_rect.w;
        }

        item_rect.y += item_rect.h;
        back_color = save_color;
        item_rect.h = line_height;
    }

    int index = 0;
    ListIter<ListBoxItem> iter = items;

    while (++iter && item_rect.y < h) {
        ListBoxItem* item = iter.value();

        if (index++ >= top_index) {
            // draw main item:
            int column = 0;
            item_rect.x = ctrl_rect.x;
            item_rect.w = GetColumnWidth(column) - 2;

            if (item_rect.y + item_rect.h > h) {
                item_rect.h = h - item_rect.y - 1;
            }

            Color item_color = GetItemColor(index-1, 0);

            if (item->selected) {
                font->SetColor(selected_color);

                if (seln_style == LIST_ITEM_STYLE_FILLED_BOX)
                FillRect(item_rect, selected_color * 0.25);

                if (seln_style >= LIST_ITEM_STYLE_BOX)
                DrawRect(item_rect, selected_color);
            }
            else {
                font->SetColor(item_color);

                if (item_style == LIST_ITEM_STYLE_FILLED_BOX)
                FillRect(item_rect, item_color * 0.25);

                if (item_style >= LIST_ITEM_STYLE_BOX)
                DrawRect(item_rect, item_color);
            }

            Rect text_rect = item_rect;

            if (item->image && item->image->Width() > 0 && item->image->Height() > 0) {
                DrawBitmap(text_rect.x, text_rect.y, text_rect.x + text_rect.w, text_rect.y + line_height, item->image);
            }
            else {
                text_rect.Deflate(2,0);
                DrawText(item->text.data(), 
                item->text.length(),
                text_rect,
                GetColumnAlign(column)|DT_SINGLELINE);
            }

            // draw subitems:
            ListIter<ListBoxCell> sub_iter = item->subitems;
            while (++sub_iter) {
                ListBoxCell* sub = sub_iter.value();

                column++;
                item_rect.x += item_rect.w + 2;
                item_rect.w = GetColumnWidth(column) - 2;

                if (item->selected) {
                    if (seln_style == LIST_ITEM_STYLE_FILLED_BOX)
                    FillRect(item_rect, selected_color * 0.25);

                    if (seln_style >= LIST_ITEM_STYLE_BOX)
                    DrawRect(item_rect, selected_color);
                }
                else {
                    if (item_style == LIST_ITEM_STYLE_FILLED_BOX)
                    FillRect(item_rect, item_color * 0.25);

                    if (item_style >= LIST_ITEM_STYLE_BOX)
                    DrawRect(item_rect, item_color);
                }

                if (item->selected)
                font->SetColor(selected_color);
                else
                font->SetColor(GetItemColor(index-1, column));

                Rect text_rect = item_rect;
                if (sub->image && sub->image->Width() > 0 && sub->image->Height() > 0) {
                    DrawBitmap(text_rect.x, text_rect.y, text_rect.x + text_rect.w, text_rect.y + line_height, sub->image);
                }
                else {
                    text_rect.Deflate(2,0);
                    DrawText(sub->text.data(),
                    sub->text.length(),
                    text_rect,
                    GetColumnAlign(column)|DT_SINGLELINE);
                }
            }

            item_rect.y += line_height + leading;
        }
    }
}