void wxGxContentView::SetStyle(wxGISEnumContentsViewStyle style)
{
    if(m_current_style == style)
        return;


    if(m_current_style == enumGISCVReport)
    {
        //store values
        m_anWidth.Clear();
        for (int i = 0; i < GetColumnCount(); ++i)
        {
            m_anWidth.Add( GetColumnWidth(i) );
        }
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
        m_anOrder = GetColumnsOrder();
#endif
    }
    m_current_style = style;

	switch(m_current_style)
	{
	case enumGISCVReport:
        SetSingleStyle(wxLC_REPORT);

        InitColumns();

        for(size_t i = 0; i < m_anWidth.GetCount(); ++i)
            SetColumnWidth(i, m_anWidth[i]);
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
        SetColumnsOrder(m_anOrder);
#endif

        SetColumnImage(m_currentSortCol, m_bSortAsc ? 0 : 1);

		break;
	case enumGISCVSmall:
        SetSingleStyle(wxLC_SMALL_ICON);
		break;
	case enumGISCVLarge:
        SetSingleStyle(wxLC_ICON);
		break;
	case enumGISCVList:
        SetSingleStyle(wxLC_LIST);
		break;
	}

    RefreshAll();
}
void wxFileCtrl::ChangeToReportMode()
{
    ClearAll();
    SetSingleStyle( wxLC_REPORT );

    // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy
    // don't hardcode since mm/dd is dd/mm elsewhere
    int w, h;
    wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22);
    wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p"));
    GetTextExtent(txt, &w, &h);

    InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w );
    InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 );
    InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 );
    InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w );
#if defined(__UNIX__)
    GetTextExtent(wxT("Permissions 2"), &w, &h);
    InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w );
#elif defined(__WIN32__)
    GetTextExtent(wxT("Attributes 2"), &w, &h);
    InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w );
#endif

    UpdateFiles();
}
Exemple #3
0
// ----------------------------------------------------------------------------
// ArchiveEntryList::ArchiveEntryList
//
// ArchiveEntryList class constructor
// ----------------------------------------------------------------------------
 ArchiveEntryList::ArchiveEntryList(wxWindow* parent) : VirtualListView(parent)
{
	// Init variables
	archive = nullptr;
	filter_category = "";
	current_dir = nullptr;
	show_dir_back = false;
	undo_manager = nullptr;
	entries_update = true;

	// Create dummy 'up folder' entry
	entry_dir_back = new ArchiveEntry();
	entry_dir_back->setType(EntryType::folderType());
	entry_dir_back->setState(0);
	entry_dir_back->setName("..");

	// Setup columns
	setupColumns();

	// Setup entry icons
	wxImageList* image_list = new wxImageList(16, 16, false, 0);

	wxArrayString et_icon_list = EntryType::getIconList();
	for (size_t a = 0; a < et_icon_list.size(); a++)
	{
		if (image_list->Add(Icons::getIcon(Icons::ENTRY, et_icon_list[a])) < 0)
			image_list->Add(Icons::getIcon(Icons::ENTRY, "default"));
	}

	SetImageList(image_list, wxIMAGE_LIST_SMALL);

	// Bind events
	Bind(wxEVT_LIST_COL_RIGHT_CLICK, &ArchiveEntryList::onColumnHeaderRightClick, this);
	Bind(wxEVT_LIST_COL_END_DRAG, &ArchiveEntryList::onColumnResize, this);
	Bind(wxEVT_LIST_ITEM_ACTIVATED, &ArchiveEntryList::onListItemActivated, this);

	// Setup flags
	SetSingleStyle(wxLC_HRULES, elist_hrules);
	SetSingleStyle(wxLC_VRULES, elist_vrules);
}
void wxFileCtrl::ChangeToSmallIconMode()
{
    ClearAll();
    SetSingleStyle( wxLC_SMALL_ICON );
    UpdateFiles();
}
void wxFileCtrl::ChangeToListMode()
{
    ClearAll();
    SetSingleStyle( wxLC_LIST );
    UpdateFiles();
}
Exemple #6
0
// ----------------------------------------------------------------------------
// ArchiveEntryList::handleAction
//
// Handles the action [id].
// Returns true if the action was handled, false otherwise
// ----------------------------------------------------------------------------
bool ArchiveEntryList::handleAction(string id)
{
	// Don't handle action if hidden
	if (!IsShown())
		return false;

	// Only interested in actions beginning with aelt_
	if (!id.StartsWith("aelt_"))
		return false;

	if (id == "aelt_sizecol")
	{
		elist_colsize_show = !elist_colsize_show;
		setupColumns();
		updateWidth();
		updateList();
		if (GetParent())
			GetParent()->Layout();
	}
	else if (id == "aelt_typecol")
	{
		elist_coltype_show = !elist_coltype_show;
		setupColumns();
		updateWidth();
		updateList();
		if (GetParent())
			GetParent()->Layout();
	}
	else if (id == "aelt_indexcol")
	{
		elist_colindex_show = !elist_colindex_show;
		setupColumns();
		updateWidth();
		updateList();
		if (GetParent())
			GetParent()->Layout();
	}
	else if (id == "aelt_hrules")
	{
		elist_hrules = !elist_hrules;
		SetSingleStyle(wxLC_HRULES, elist_hrules);
		Refresh();
	}
	else if (id == "aelt_vrules")
	{
		elist_vrules = !elist_vrules;
		SetSingleStyle(wxLC_VRULES, elist_vrules);
		Refresh();
	}
	else if (id == "aelt_bgcolour")
	{
		elist_type_bgcol = !elist_type_bgcol;
		Refresh();
	}
	else if (id == "aelt_bgalt")
	{
		elist_alt_row_colour = !elist_alt_row_colour;
		Refresh();
	}

	// Unknown action
	else
		return false;

	// Action handled, return true
	return true;
}