/////////////////////// // Apply the given tag void CListview::ApplyTag(xmlNodePtr node) { CContainerWidget::ApplyTag(node); // Listview properties if (xmlPropExists(node, "showselect")) bShowSelect.set(xmlGetBool(node, "showselect", bShowSelect), TAG_ATTR_PRIORITY); if (xmlPropExists(node, "scrollalways")) bAlwaysVisibleScrollbar.set(xmlGetBool(node, "scrollalways"), TAG_ATTR_PRIORITY); if (xmlPropExists(node, "showcolumns")) bShowColumnHeaders.set(xmlGetBool(node, "showcolumns"), TAG_ATTR_PRIORITY); // Columns and items xmlNodePtr child = node->children; while (child) { // Column if (!xmlStrcasecmp(child->name, (const xmlChar *)"column")) { std::string text = xmlGetString(child, "caption"); int width = xmlGetInt(child, "width", -1); if (width == -1) AddColumn(text); else AddColumn(text, width); } // Item else if (!xmlStrcasecmp(child->name, (const xmlChar *)"item")) { CListviewItem item(this); item.ApplyTag(child); AddItem(item); } child = child->next; } }
NickListCtrl::NickListCtrl( wxWindow* parent, bool show_header, NickListCtrl::UserMenu* popup, bool singleSelectList, const wxString& name, bool highlight ) : NickListCtrl::BaseType( parent, NICK_LIST, wxDefaultPosition, wxDefaultSize, wxLC_VIRTUAL | wxSUNKEN_BORDER | wxLC_REPORT | ( int )( !show_header ) * wxLC_NO_HEADER | ( int )( singleSelectList ) * wxLC_SINGLE_SEL, name, 3, &NickListCtrl::CompareOneCrit, highlight, UserActions::ActHighlight, true /*periodic sort*/ ), m_menu( popup ) { AddColumn( 0, 20, _( "s" ), _T( "Status" ) ); AddColumn( 1, 20, _( "c" ), _T( "Country" ) ); AddColumn( 2, 20, _( "r" ), _T( "Rank" ) ); AddColumn( 3, 180, _( "Nickname" ), _T( "Nickname" ) ); if ( m_sortorder.size() == 0 ) { m_sortorder[0].col = 0; m_sortorder[0].direction = -1; m_sortorder[1].col = 3; m_sortorder[1].direction = 1; m_sortorder[2].col = 2; m_sortorder[2].direction = 1; m_sortorder[3].col = 1; m_sortorder[3].direction = 1; } }
void mitk::cl::FeatureResultWritter::AddSubjectInformation(std::string value) { if ((m_Mode == 0) || (m_Mode == 1)) { AddColumn(value); } else { if (m_UsedSubjectInformation) { m_SubjectInformation = ""; } m_SubjectInformation += value + m_Separator; m_UsedSubjectInformation = false; } }
WDbgArkAnalyzeCallback::WDbgArkAnalyzeCallback(const std::shared_ptr<WDbgArkSymCache> &sym_cache) : WDbgArkAnalyzeBase(sym_cache) { // width = 180 AddColumn("Address", 18); AddColumn("Type", 25); AddColumn("Symbol", 86); AddColumn("Module", 16); AddColumn("Suspicious", 10); AddColumn("Info", 25); }
WDbgArkAnalyzeIDT::WDbgArkAnalyzeIDT(const std::shared_ptr<WDbgArkSymCache> &sym_cache) : WDbgArkAnalyzeBase(sym_cache) { // width = 160 AddColumn("Address", 18); AddColumn("CPU / Idx", 11); AddColumn("Symbol", 80); AddColumn("Module", 16); AddColumn("Suspicious", 10); AddColumn("Info", 25); }
// Adds a column to the table. bool ElementDataGrid::AddColumn(const Rocket::Core::String& fields, const Rocket::Core::String& formatter, float initial_width, const Rocket::Core::String& header_rml) { Core::Element* header_element = Core::Factory::InstanceElement(this, "datagridcolumn", "datagridcolumn", Rocket::Core::XMLAttributes()); if (header_element == NULL) return false; if (!Core::Factory::InstanceElementText(header_element, header_rml)) { header_element->RemoveReference(); return false; } AddColumn(fields, formatter, initial_width, header_element); header_element->RemoveReference(); return true; }
bool DataChart::AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError, bool bDoNotInit) { std::string strType = Std_CheckString(strItemType); if(strType == "DATACOLUMN") { AddColumn(strXml, bDoNotInit); return true; } //If it was not one of those above then we have a problem. if(bThrowError) THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType); return false; }
void mitk::cl::FeatureResultWritter::NewRow(std::string endName) { AddColumn(endName); if ((m_Mode == 0) || (m_Mode == 2)) { m_CurrentRow++; while (m_List.size() <= m_CurrentRow) { std::string str; m_List.push_back(str); } } else { m_CurrentRow = 0; } }
// Create a new row as a copy of a row in another value table. The layouts of the value tables // must not match, since only matching Columns will be considered. // NOTE: the user data will be initialised to NULL for the new row. int CValueTable::CopyExtRow(CValueTable* pOther, int OtherRowIdx, bool CreateMissingCols) { n_assert(pOther); n_assert(OtherRowIdx < pOther->GetRowCount()); int MyRowIdx = AddRow(); CData Value; for (int OtherColIdx = 0; OtherColIdx < pOther->GetNumColumns(); OtherColIdx++) { CAttrID AttrID = pOther->GetColumnID(OtherColIdx); if (CreateMissingCols) AddColumn(AttrID); pOther->GetValue(OtherColIdx, OtherRowIdx, Value); SetValue(AttrID, MyRowIdx, Value); //???do we already know col idx if just added col? } return MyRowIdx; }
void CViewTransfers::DemandLoadView() { wxASSERT(!m_bViewLoaded); CTaskViewBase::DemandLoadView(ID_TASK_TRANSFERSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_TRANSFERSVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS); CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; wxASSERT(m_pTaskPane); wxASSERT(m_pListPane); // Setup View pGroup = new CTaskItemGroup(_("Commands")); m_TaskGroups.push_back(pGroup); pItem = new CTaskItem(_("Retry Now"), _("Click 'Retry now' to transfer the file now"), ID_TASK_TRANSFERS_RETRYNOW); pGroup->m_Tasks.push_back(pItem); pItem = new CTaskItem(_("Abort Transfer"), _("Click 'Abort transfer' to delete the file from the transfer queue. " "This will prevent you from being granted credit for this result."), ID_TASK_TRANSFERS_ABORT); pGroup->m_Tasks.push_back(pItem); // Create Task Pane Items m_pTaskPane->UpdateControls(); // Create List Pane Items AddColumn(COLUMN_PROJECT, _T("Project"), wxLIST_FORMAT_LEFT, 125); AddColumn(COLUMN_FILE, _T("File"), wxLIST_FORMAT_LEFT, 205); AddColumn(COLUMN_PROGRESS, _T("Progress"), wxLIST_FORMAT_CENTRE, 60); AddColumn(COLUMN_SIZE, _T("Size"), wxLIST_FORMAT_LEFT, 80); AddColumn(COLUMN_TIME, _T("Elapsed Time"), wxLIST_FORMAT_LEFT, 80); AddColumn(COLUMN_SPEED, _T("Speed"), wxLIST_FORMAT_LEFT, 80); AddColumn(COLUMN_STATUS, _T("Status"), wxLIST_FORMAT_LEFT, 150); m_iProgressColumn = COLUMN_PROGRESS; // Needed by static sort routine; MyCViewTransfers = this; m_funcSortCompare = CompareViewTransferItems; RestoreState(); UpdateSelection(); }
TeamListView::TeamListView(BRect frame, const char *name, CLVContainerView **s) : ColumnListView(frame, s, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_NAVIGABLE|B_FRAME_EVENTS, B_MULTIPLE_SELECTION_LIST, true, true, true, false, B_FANCY_BORDER) { // add Columns... AddColumn(new CLVColumn(NULL, 20.0, CLV_EXPANDER|CLV_LOCK_AT_BEGINNING|CLV_NOT_MOVABLE)); AddColumn(new CLVColumn(NULL, 20.0, CLV_LOCK_AT_BEGINNING|CLV_NOT_RESIZABLE| CLV_NOT_MOVABLE|CLV_MERGE_WITH_RIGHT)); AddColumn(new CLVColumn("Name", 100.0, CLV_LOCK_AT_BEGINNING|CLV_NOT_MOVABLE)); AddColumn(new CLVColumn("Id", 40.0)); AddColumn(new CLVColumn("Priority", 50.0)); AddColumn(new CLVColumn("State", 60.0)); AddColumn(new CLVColumn("Memory", 60.0)); AddColumn(new CLVColumn("CPU", 60.0)); SetInvocationMessage(new BMessage(TEAM_INV)); // create the PopUpMenu BMenuItem *inv; operationMenu = new BPopUpMenu("operationMenu", false, false); operationMenu->AddItem((inv = new BMenuItem("Kill", new BMessage(IE_MAINWINDOW_MAINKILL)))); inv->SetTarget(slayer->mainWindow); operationMenu->AddItem((inv = new BMenuItem("Suspend", new BMessage(IE_MAINWINDOW_MAINSUSPEND)))); inv->SetTarget(slayer->mainWindow); operationMenu->AddItem((inv = new BMenuItem("Resume", new BMessage(IE_MAINWINDOW_MAINRESUME)))); inv->SetTarget(slayer->mainWindow); operationMenu->AddSeparatorItem(); priorityMenu = new BMenu("PriorityMenu"); BMenuItem *pr = new BMenuItem(priorityMenu); //, new BMessage('tmpj')); pr->SetLabel("Set priority"); operationMenu->AddItem(pr); ItemsToPopUpPriorityMenu(); // MakeFocus(true); // = new BMenu("Set priority"); // operationMenu->AddItem(setPriorityMenu); // operationMenu->AddSeparator }
void ListView1::SetAudioCDList() { while (CountRows()>0) RemoveRow(0); while (CountColumns()>0) { BColumn *col=ColumnAt(0); //SetColumnVisible(col, true); RemoveColumn(col);/* switch(col->LogicalFieldNum()) { case FILENAME_FIELD: { ((Application1 *)be_app)->CM->SetInt16(FILENAMECOLUMN_WIDTH, (int16)col->Width()); break; } case SIZE_FIELD: { ((Application1 *)be_app)->CM->SetInt16(SIZECOLUMN_WIDTH, (int16)col->Width()); break; } default: { break; } }*/ delete col; } SetSortingEnabled(false); AddColumn(new BIntegerColumn(_T("Track"), // "TRACKNUMBERCOLUMN_TITLE" 30.0, 30.0, 55.0, B_ALIGN_RIGHT), TRACKNUMBER_FIELD); AddColumn(new BStringColumn(_T("Pause"), // "PREGAPCOLUMN_TITLE" 50.0, 50.0, 50.0,1, B_ALIGN_RIGHT), PREGAP_FIELD); AddColumn(new BStringColumn(_T("File name"), // "TRACKNAMECOLUMN_TITLE" 120.0, 60.0, 900.0,0), TRACKNAME_FIELD); AddColumn(new BStringColumn(_T("Duration"), // "LENGTHCOLUMN_TITLE" 80.0, 70.0, 90.0,0, B_ALIGN_RIGHT), LENGTH_FIELD); AddColumn(new BSizeColumn(_T("Size"), // "BYTESCOLUMN_TITLE" 50.0, 30.0, 70.0,B_ALIGN_RIGHT), BYTES_FIELD); AddColumn(new BStringColumn(_T("Indices"), // "INDEXCOLUMN_TITLE" 120.0, 50.0, 250.0,0), INDEX_FIELD); AddColumn(new BStringColumn(_T("CD text"), // "CDTEXTCOLUMN_TITLE" 120.0, 50.0, 250.0,0), CDTEXT_FIELD); for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), false); } for (int32 i=0; i<CountColumns(); i++) { SetColumnVisible(ColumnAt(i), true); } }
void wxMacDataItemBrowserControl::InsertColumn(int col, DataBrowserPropertyType colType, const wxString& title, SInt16 just, int defaultWidth) { DataBrowserListViewColumnDesc columnDesc; columnDesc.headerBtnDesc.titleOffset = 0; columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; columnDesc.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask; columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly; columnDesc.headerBtnDesc.btnFontStyle.just = just; columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; columnDesc.headerBtnDesc.btnFontStyle.style = normal; // TODO: Why is m_font not defined when we enter wxLC_LIST mode, but is // defined for other modes? wxFontEncoding enc; if ( m_font.IsOk() ) enc = m_font.GetEncoding(); else enc = wxLocale::GetSystemEncoding(); wxCFStringRef cfTitle( title, enc ); columnDesc.headerBtnDesc.titleString = cfTitle; columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.maximumWidth = 30000; DataBrowserPropertyID id = kMinColumnId + column_id_counter; column_id_counter++; columnDesc.propertyDesc.propertyID = id; columnDesc.propertyDesc.propertyType = colType; columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn; columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; verify_noerr( AddColumn( &columnDesc, col ) ); if (defaultWidth > 0){ SetColumnWidth(col, defaultWidth); } }
void CQueueViewBase::CreateColumns(const wxString& lastColumnName) { const unsigned long widths[6] = { 180, 60, 180, 80, 60, 150 }; AddColumn(_("Server/Local file"), wxLIST_FORMAT_LEFT, widths[0]); AddColumn(_("Direction"), wxLIST_FORMAT_CENTER, widths[1]); AddColumn(_("Remote file"), wxLIST_FORMAT_LEFT, widths[2]); AddColumn(_("Size"), wxLIST_FORMAT_RIGHT, widths[3]); AddColumn(_("Priority"), wxLIST_FORMAT_LEFT, widths[4]); if (lastColumnName != _T("")) AddColumn(lastColumnName, wxLIST_FORMAT_LEFT, widths[5]); LoadColumnSettings(OPTION_QUEUE_COLUMN_WIDTHS, -1, -1); }
PlaybackListCtrl<PlaybackType>::PlaybackListCtrl( wxWindow* parent ): PlaybackListCtrl::BaseType(parent, RLIST_LIST, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT, _T("PlaybackListCtrl"), 4, &PlaybackListCtrl::CompareOneCrit ) { #ifdef __WXMSW__ const int hd = wxLIST_AUTOSIZE_USEHEADER; const int widths[8] = {80,140,141,hd,160,hd,70,180}; #else const int widths[8] = {80,140,141,50,160,50,70,180}; #endif AddColumn( 0, widths[0], _("Date"), _("Date of recording") ); AddColumn( 1, widths[1], _("Mod"), _("Modname") ); AddColumn( 2, widths[2], _("Map"), _("Mapname") ); AddColumn( 3, widths[3], _("Players"), _("Number of players") ); AddColumn( 4, widths[4], _("Duration"), _T("Duration") ); AddColumn( 5, widths[5], _("Spring Version"), _("Spring Version") ); AddColumn( 6, widths[6], _("Filesize"), _("Filesize in kilobyte") ); AddColumn( 7, widths[7], _("File"), _T("Filename") ); if ( m_sortorder.size() == 0 ) { m_sortorder[0].col = 0; m_sortorder[0].direction = true; m_sortorder[1].col = 1; m_sortorder[1].direction = true; m_sortorder[2].col = 2; m_sortorder[2].direction = true; m_sortorder[3].col = 3; m_sortorder[3].direction = true; Sort( ); } m_popup = new wxMenu( _T("") ); // &m enables shortcout "alt + m" and underlines m m_popup->Append( RLIST_DLMAP, _("Download &map") ); m_popup->Append( RLIST_DLMOD, _("Download m&od") ); }
PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode) : Inherited(frame, "storagelist", resizeMode, 0, B_NO_BORDER, true) { AddColumn(new PartitionColumn(B_TRANSLATE("Device"), 150, 50, 500, B_TRUNCATE_MIDDLE), kDeviceColumn); AddColumn(new PartitionColumn(B_TRANSLATE("File system"), 100, 50, 500, B_TRUNCATE_MIDDLE), kFilesystemColumn); AddColumn(new PartitionColumn(B_TRANSLATE("Volume name"), 130, 50, 500, B_TRUNCATE_MIDDLE), kVolumeNameColumn); AddColumn(new PartitionColumn(B_TRANSLATE("Mounted at"), 100, 50, 500, B_TRUNCATE_MIDDLE), kMountedAtColumn); AddColumn(new PartitionColumn(B_TRANSLATE("Size"), 100, 50, 500, B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn); AddColumn(new PartitionColumn(B_TRANSLATE("Parameters"), 100, 50, 500, B_TRUNCATE_END), kParametersColumn); AddColumn(new PartitionColumn(B_TRANSLATE("Partition type"), 200, 50, 500, B_TRUNCATE_END), kPartitionTypeColumn); SetSortingEnabled(false); }
/*------------------------------------------------------------------------------*\ () - \*------------------------------------------------------------------------------*/ BmSendAccView::BmSendAccView( int32 width, int32 height) : inherited( BRect(0,0,float(width-1),float(height-1)), "Beam_SendAccView", B_SINGLE_SELECTION_LIST, false, true) { int32 flags = CLV_SORT_KEYABLE; SetViewColor( B_TRANSPARENT_COLOR); if (ThePrefs->GetBool("StripedListView")) SetStripedBackground( true); else flags |= CLV_TELL_ITEMS_WIDTH; AddColumn( new CLVColumn( "Account", 80.0, flags, 50.0)); AddColumn( new CLVColumn( "Server", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Encryption", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Auth-Method", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "User", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Pwd", 50.0, flags, 40.0)); AddColumn( new CLVColumn( "Domain", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Port", 40.0, 0, 40.0)); SetSortFunction( CLVEasyItem::CompareItems); SetSortKey( COL_KEY); }
/*------------------------------------------------------------------------------*\ () - \*------------------------------------------------------------------------------*/ BmRecvIdentView::BmRecvIdentView( int32 width, int32 height) : inherited( BRect(0,0,float(width-1),float(height-1)), "Beam_IdentView", B_SINGLE_SELECTION_LIST, false, true) { int32 flags = CLV_SORT_KEYABLE; SetViewColor( B_TRANSPARENT_COLOR); if (ThePrefs->GetBool("StripedListView")) SetStripedBackground( true); else flags |= CLV_TELL_ITEMS_WIDTH; AddColumn( new CLVColumn( "Identity", 80.0, flags, 50.0)); AddColumn( new CLVColumn( "Real Name", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Mailaddress", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Aliases", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Receiving Account", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "F", 20.0, flags, 20.0, "(F)allback Identity?")); AddColumn( new CLVColumn( "Signature", 80.0, flags, 40.0)); AddColumn( new CLVColumn( "Sending Account", 80.0, flags, 40.0)); SetSortFunction( CLVEasyItem::CompareItems); SetSortKey( COL_KEY); }
void mitk::cl::FeatureResultWritter::AddResult(std::string desc, int slice, mitk::AbstractGlobalImageFeature::FeatureListType stats, bool, bool withDescription) { if (m_Mode == 2) { for (std::size_t i = 0; i < stats.size(); ++i) { if (withDescription) { AddColumn(desc); } if (slice >= 0) { AddColumn(slice); } AddColumn(m_SubjectInformation + stats[i].first); AddColumn(stats[i].second); NewRow(""); ++m_CurrentElement; } m_UsedSubjectInformation = true; } else { if (withDescription) { AddColumn(desc); } if (slice >= 0) { AddColumn(slice); } for (std::size_t i = 0; i < stats.size(); ++i) { AddColumn(stats[i].second); } NewRow("EndOfMeasurement"); ++m_CurrentElement; } }
/** \brief Loads a data column. \author dcofer \date 3/18/2011 \param [in,out] oXml The xml to use when loading the data column. \return Pointer to the new DataColumn. \exception Throws an exception if there is an error creating or loading the DataColumn. **/ DataColumn *DataChart::LoadDataColumn(CStdXml &oXml) { DataColumn *lpColumn=NULL; std::string strModuleName, strType; try { oXml.IntoElem(); //Into Column Element strModuleName = oXml.GetChildString("ModuleName", ""); strType = oXml.GetChildString("Type"); oXml.OutOfElem(); //OutOf Column Element lpColumn = dynamic_cast<DataColumn *>(m_lpSim->CreateObject(strModuleName, "DataColumn", strType)); if(!lpColumn) THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType, "DataColumn"); lpColumn->SetSystemPointers(m_lpSim, NULL, NULL, NULL, this, true); lpColumn->Load(oXml); AddColumn(lpColumn); return lpColumn; } catch(CStdErrorInfo oError) { if(lpColumn) delete lpColumn; RELAY_ERROR(oError); return NULL; } catch(...) { if(lpColumn) delete lpColumn; THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError); return NULL; } }
TorrentListCtrl::TorrentListCtrl( wxWindow* parent ) : TorrentListCtrl::BaseType( parent, TLIST_CLICK, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT, _T("TorrentListCtrl"), 10, &TorrentListCtrl::CompareOneCrit ) , m_popup(0) { #if defined(__WXMAC__) /// on mac, autosize does not work at all const int widths[10] = { 200, 80, 100, 80, 80, 80, 80, 80, 80, 80 }; #else const int widths[10] = { 200, wxLIST_AUTOSIZE_USEHEADER, wxLIST_AUTOSIZE_USEHEADER, wxLIST_AUTOSIZE_USEHEADER, 80, wxLIST_AUTOSIZE_USEHEADER, 80, 80, 80, wxLIST_AUTOSIZE_USEHEADER }; #endif AddColumn(0, widths[0], _T("Name"), _T("Name")); AddColumn(1, widths[1], _T("Numcopies"), _T("# complete copies")); AddColumn(2, widths[2], _T("Status"), _T("Status")); AddColumn(3, widths[3], _T("% complete"), _T("% complete")); AddColumn(4, widths[4], _T("KB/s down"), _T("KB/s download")); AddColumn(5, widths[5], _T("ETA"), _T("Estimated time remaining")); AddColumn(6, widths[6], _T("Filesize (MB)"), _T("Filesize")); // sortorder: name --> percent completed --> mb donwloaded if ( m_sortorder.size() == 0 ) { m_sortorder[0].col = 0; m_sortorder[0].direction = 1; m_sortorder[1].col = 5; m_sortorder[1].direction = 1; m_sortorder[2].col = 2; m_sortorder[2].direction = 1; } Sort( ); }
CFileListManager::CFileListManager( vgui::Panel *parent ) : BaseClass( parent, "FileListManager" ) { SetMultiselectEnabled( true ); SetVisible( true ); m_bRefreshRequired = false; SetSize( 800, 200 ); SetPos( 100, 100 ); AddColumn( this, CI_FILENAME ); AddColumn( this, CI_PATH ); AddColumn( this, CI_LOADED ); AddColumn( this, CI_NUMELEMENTS ); AddColumn( this, CI_CHANGED ); AddColumn( this, CI_INPERFORCE ); AddColumn( this, CI_OPENFOREDIT ); SetSortColumn( 0 ); Refresh(); SetScheme( vgui::scheme()->LoadSchemeFromFile( "Resource/BoxRocket.res", "BoxRocket" ) ); // LoadControlSettings( "resource/BxFileListManager.res" ); }
void ColumnSet::AddPaddingColumn(float resize_percent, int width) { AddColumn(GridLayout::FILL, GridLayout::FILL, resize_percent, GridLayout::FIXED, width, width, true); }
void CViewMessages::DemandLoadView() { wxASSERT(!m_bViewLoaded); CTaskViewBase::DemandLoadView( ID_TASK_MESSAGESVIEW, DEFAULT_TASK_FLAGS, ID_LIST_MESSAGESVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS ); wxASSERT(m_pTaskPane); wxASSERT(m_pListPane); // Initialize variables used in later parts of the class m_iPreviousDocCount = 0; m_maxFilteredIndex = 0; // Setup View CTaskItemGroup* pGroup = new CTaskItemGroup( _("Commands") ); m_TaskGroups.push_back( pGroup ); CTaskItem* pItem = new CTaskItem( _("Copy all messages"), _("Copy all the messages to the clipboard."), ID_TASK_MESSAGES_COPYALL ); pGroup->m_Tasks.push_back( pItem ); pItem = new CTaskItem( _("Copy selected messages"), #ifdef __WXMAC__ _("Copy the selected messages to the clipboard. " "You can select multiple messages by holding down the shift " "or command key while clicking on messages."), #else _("Copy the selected messages to the clipboard. " "You can select multiple messages by holding down the shift " "or control key while clicking on messages."), #endif ID_TASK_MESSAGES_COPYSELECTED ); pGroup->m_Tasks.push_back( pItem ); pItem = new CTaskItem(_("Edit message filter"), _("Edit the settings of the message filter."), ID_TASK_MESSAGES_EDIT_FILTER); pGroup->m_Tasks.push_back(pItem); pItem = new CTaskItem(_("Enable message filter"), _("Enable message filtering based on the current filter settings."), ID_TASK_MESSAGES_ENABLE_FILTER); pGroup->m_Tasks.push_back(pItem); // Create Task Pane Items m_pTaskPane->UpdateControls(); // Create List Pane Items AddColumn(COLUMN_PROJECT, _T("Project"), wxLIST_FORMAT_LEFT, 115); AddColumn(COLUMN_TIME, _T("Time"), wxLIST_FORMAT_LEFT, 145); AddColumn(COLUMN_MESSAGE, _T("Message"), wxLIST_FORMAT_LEFT, 550); m_pMessageInfoAttr = new wxListItemAttr(*wxBLACK, *wxWHITE, wxNullFont); m_pMessageErrorAttr = new wxListItemAttr(*wxRED, *wxWHITE, wxNullFont); RestoreState(); UpdateSelection(); }
BattleListCtrl::BattleListCtrl( wxWindow* parent ) : CustomVirtListCtrl< IBattle *,BattleListCtrl>(parent, BLIST_LIST, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT, _T("BattleListCtrl"), 4, &BattleListCtrl::CompareOneCrit, true /*highlight*/, UserActions::ActHighlight, true /*periodic sort*/ ), m_popup( 0 ) { GetAui().manager->AddPane( this, wxLEFT, _T("battlelistctrl") ); #if defined(__WXMAC__) /// on mac, autosize does not work at all const int widths[12] = {20,20,20,170,140,130,110,28,28,28,30,30}; #else const int hd = wxLIST_AUTOSIZE_USEHEADER; const int widths[12] = {hd,hd,hd,170,140,130,110,hd,hd,hd,hd,hd}; #endif AddColumn( 0, widths[0], _("Status"), _("Status") ); AddColumn( 1, widths[1], _("Country"), _("Country") ); AddColumn( 2, widths[2], _("Rank"), _("Minimum rank to join") ); AddColumn( 3, widths[3], _("Description"), _("Battle description") ); AddColumn( 4, widths[4], _("Map"), _("Mapname") ); AddColumn( 5, widths[5], _("Game"), _("Gamename") ); AddColumn( 6, widths[6], _("Host"), _("Name of the Host") ); AddColumn( 7, widths[7], _("Spectators"), _("Number of Spectators") ); AddColumn( 8, widths[8], _("Players"), _("Number of Players joined") ); AddColumn( 9, widths[9], _("Max"), _("Maximum number of Players that can join") ); AddColumn( 10, widths[10], _("Running"), _("How long the game has been running for") ); AddColumn( 11, widths[11], _("Version"), _("Version of the engine") ); if ( m_sortorder.size() == 0 ) { m_sortorder[0].col = 0; m_sortorder[0].direction = true; m_sortorder[1].col = 5; m_sortorder[1].direction = true; m_sortorder[2].col = 9; m_sortorder[2].direction = true; m_sortorder[3].col = 4; m_sortorder[3].direction = true; } }
BattleListCtrl::BattleListCtrl( wxWindow* parent ) : CustomVirtListCtrl< IBattle *,BattleListCtrl>(parent, BLIST_LIST, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT, _T("BattleListCtrl"), 4, &BattleListCtrl::CompareOneCrit, true /*highlight*/, UserActions::ActHighlight, true /*periodic sort*/ ), m_popup( 0 ) { GetAui().manager->AddPane( this, wxLEFT, _T("battlelistctrl") ); AddColumn( 0, wxLIST_AUTOSIZE, _("Status"), _("Status") ); AddColumn( 1, wxLIST_AUTOSIZE, _("Country"), _("Country") ); AddColumn( 2, wxLIST_AUTOSIZE, _("Rank"), _("Minimum rank to join") ); AddColumn( 3, wxLIST_AUTOSIZE, _("Description"), _("Battle description") ); AddColumn( 4, wxLIST_AUTOSIZE, _("Map"), _("Mapname") ); AddColumn( 5, wxLIST_AUTOSIZE, _("Game"), _("Gamename") ); AddColumn( 6, wxLIST_AUTOSIZE, _("Host"), _("Name of the Host") ); AddColumn( 7, wxLIST_AUTOSIZE, _("Spectators"), _("Number of Spectators") ); AddColumn( 8, wxLIST_AUTOSIZE, _("Players"), _("Number of Players joined") ); AddColumn( 9, wxLIST_AUTOSIZE, _("Max"), _("Maximum number of Players that can join") ); AddColumn( 10, wxLIST_AUTOSIZE, _("Running"), _("How long the game has been running for") ); AddColumn( 11, wxLIST_AUTOSIZE, _("Version"), _("Version of the engine") ); if ( m_sortorder.size() == 0 ) { m_sortorder[0].col = 0; m_sortorder[0].direction = true; m_sortorder[1].col = 5; m_sortorder[1].direction = true; m_sortorder[2].col = 9; m_sortorder[2].direction = true; m_sortorder[3].col = 4; m_sortorder[3].direction = true; } }
// 根据参数,隐藏或者显示Column void CLogViewDlg::FilterColumn(const ColumnTypeVector& vctColumn) { if(vctColumn.size() == 0) { return; } CConfig::GetConfig().SetShowType(vctColumn); ColumnTypeVector curVctColumn; GetColumn(curVctColumn); ColumnTypeVector backupColumn = vctColumn; // 找到差异的项 ColumnType type; ColumnTypeVector::iterator IteCurColumn; ColumnTypeVector::iterator IteColumn; ColumnTypeVector vctAdd; ColumnTypeVector vctDel; // 找到应该被删除的项目 for(IteCurColumn=curVctColumn.begin(); IteCurColumn != curVctColumn.end(); ++ IteCurColumn) { type = *IteCurColumn; IteColumn = std::find(backupColumn.begin(), backupColumn.end(), type); if(IteColumn == backupColumn.end()) { // 该项应该被删除 vctDel.push_back(type); } else { // 该项目被保留 backupColumn.erase(IteColumn); } } // 找到应该添加的项目 for(IteColumn = backupColumn.begin(); IteColumn != backupColumn.end(); ++IteColumn) { type = *IteColumn; vctAdd.push_back(type); } std::sort(vctAdd.begin(), vctAdd.end()); m_LogList.SetRedraw(FALSE); // 逐个删除 for(size_t i=0; i < vctDel.size(); ++i) { type = vctDel[i]; DelColumn(type); } size_t nHeaderCount = m_LogList.GetHeaderCtrl()->GetItemCount(); // 逐个添加 for(size_t i=0; i < vctAdd.size(); ++i) { type = vctAdd[i]; AddColumn(nHeaderCount + i, type); } m_LogList.SetRedraw(TRUE); m_LogList.Invalidate(TRUE); m_LogList.UpdateWindow(); }
BattleroomListCtrl::BattleroomListCtrl( wxWindow* parent, IBattle* battle, bool readonly, bool showingame ) : CustomVirtListCtrl< User *,BattleroomListCtrl>(parent, BRLIST_LIST, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL, _T("BattleroomListCtrl"), 3, &BattleroomListCtrl::CompareOneCrit, true /*highlight*/, UserActions::ActHighlight, !readonly /*periodic sort*/ ), m_battle(battle), m_popup(0), m_sel_user(0), m_sides(0), m_spec_item(0), m_handicap_item(0), m_ro(readonly), m_showingame(showingame), m_status_column_index(-1), m_ingame_column_index(-1), m_faction_column_index(-1), m_colour_column_index(-1), m_country_column_index(-1), m_rank_column_index(-1), m_nick_column_index(-1), m_team_column_index(-1), m_ally_column_index(-1), m_resourcebonus_column_index(-1) { GetAui().manager->AddPane( this, wxLEFT, _T("battleroomlistctrl") ); wxListItem col; const int hd = wxLIST_AUTOSIZE_USEHEADER; #if defined(__WXMAC__) /// on mac, autosize does not work at all const int widths[11] = {20,20,20,20,170,140,130,110,28,28,28}; //!TODO revise plox #else const int widths[11] = {hd,hd,hd,hd,hd,hd,170,hd,hd,80,130}; #endif int count = 0; AddColumn( count, widths[count], _T("Status"), _T("Player/Bot") ); m_status_column_index = count; count++; if ( m_showingame ) { AddColumn( count, widths[count], _T("Ingame"), _T("Battleroom status") ); m_ingame_column_index = count; count++; } AddColumn( count, widths[count], _T("Faction"), _T("Faction icon") ); m_faction_column_index = count; count++; AddColumn( count, widths[count], _T("Colour"), _T("Teamcolour") ); m_colour_column_index = count; count++; AddColumn( count, widths[count], _T("Country"), _T("Country") ); m_country_column_index = count; count++; AddColumn( count, widths[count], _T("Rank"), _T("Rank") ); m_rank_column_index = count; count++; AddColumn( count, widths[count], _("Nickname"), _T("Ingame name")); m_nick_column_index = count; count++; AddColumn( count, widths[count], _("Team"), _T("Team number") ); m_team_column_index = count; count++; AddColumn( count, widths[count], _("Ally"), _T("Ally number") ); m_ally_column_index = count; count++; AddColumn( count, widths[count], _("Resource Bonus"), _T("Resource Bonus") ); m_resourcebonus_column_index = count; if ( m_sortorder.size() == 0 ) { m_sortorder[0].col = m_team_column_index; m_sortorder[0].direction = true; m_sortorder[1].col = m_ally_column_index; m_sortorder[1].direction = true; m_sortorder[2].col = m_nick_column_index; m_sortorder[2].direction = true; } if ( !m_ro ) { m_popup = new UserMenu(this, this); wxMenu* m_teams; m_teams = new wxMenu(); for ( unsigned int i = 0; i < SPRING_MAX_TEAMS; i++ ) { wxMenuItem* team = new wxMenuItem( m_teams, BRLIST_TEAM + i, wxFormat( _T("%d") ) % (i+1), wxEmptyString, wxITEM_NORMAL ); m_teams->Append( team ); Connect( BRLIST_TEAM + i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( BattleroomListCtrl::OnTeamSelect ) ); } m_popup->Append( -1, _("Team"), m_teams ); wxMenu* m_allies = new wxMenu(); for ( unsigned int i = 0; i < SPRING_MAX_ALLIES; i++ ) { wxMenuItem* ally = new wxMenuItem( m_allies, BRLIST_ALLY + i, wxFormat( _T("%d") ) % (i+1), wxEmptyString, wxITEM_NORMAL ); m_allies->Append( ally ); Connect( BRLIST_ALLY + i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( BattleroomListCtrl::OnAllySelect ) ); } m_popup->Append( -1, _("Ally"), m_allies ); m_sides = new wxMenu(); SetBattle( battle ); m_popup->Append( -1, _("Side"), m_sides ); m_popup->AppendSeparator(); wxMenuItem* m_colours = new wxMenuItem( m_popup, BRLIST_COLOUR, _("Set color"), wxEmptyString, wxITEM_NORMAL ); m_popup->Append( m_colours ); m_popup->AppendSeparator(); m_handicap_item = new wxMenuItem( m_popup, BRLIST_HANDICAP, _("Set Resource Bonus"), wxEmptyString, wxITEM_NORMAL ); m_popup->Append( m_handicap_item ); m_popup->AppendSeparator(); m_spec_item = new wxMenuItem( m_popup, BRLIST_SPEC, wxString( _("Spectator") ) , wxEmptyString, wxITEM_CHECK ); m_popup->Append( m_spec_item ); m_popup->AppendSeparator(); wxMenuItem* kick = new wxMenuItem( m_popup, BRLIST_KICK, wxString( _("Kick") ) , wxEmptyString, wxITEM_NORMAL ); m_popup->Append( kick ); wxMenuItem* ring = new wxMenuItem( m_popup, BRLIST_RING, wxString( _("Ring") ) , wxEmptyString, wxITEM_NORMAL ); m_popup->Append( ring ); } }
wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style) : wxMacDataItemBrowserControl( peer, pos, size, style ) { m_nextColumnId = 0 ; OSStatus err = noErr; m_clientDataItemsType = wxClientData_None; if ( style & wxLB_SORT ) m_sortOrder = SortOrder_Text_Ascending; DataBrowserSelectionFlags options = kDataBrowserDragSelect; if ( style & wxLB_MULTIPLE ) { options |= kDataBrowserAlwaysExtendSelection | kDataBrowserCmdTogglesSelection; } else if ( style & wxLB_EXTENDED ) { options |= kDataBrowserCmdTogglesSelection; } else { options |= kDataBrowserSelectOnlyOne; } err = SetSelectionFlags( options ); verify_noerr( err ); DataBrowserListViewColumnDesc columnDesc; columnDesc.headerBtnDesc.titleOffset = 0; columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; columnDesc.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask; columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent; columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault; columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; columnDesc.headerBtnDesc.btnFontStyle.style = normal; columnDesc.headerBtnDesc.titleString = NULL; /* columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.maximumWidth = 10000; columnDesc.propertyDesc.propertyID = kTextColumnId; columnDesc.propertyDesc.propertyType = kDataBrowserTextType; columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); */ columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.maximumWidth = 0; columnDesc.propertyDesc.propertyID = kNumericOrderColumnId; columnDesc.propertyDesc.propertyType = kDataBrowserPropertyRelevanceRankPart; columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); /* SetDataBrowserSortProperty( m_controlRef , kTextColumnId); if ( m_sortOrder == SortOrder_Text_Ascending ) { SetDataBrowserSortProperty( m_controlRef , kTextColumnId); SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing); } else */ { SetDataBrowserSortProperty( m_controlRef , kNumericOrderColumnId); SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing); } verify_noerr( AutoSizeColumns() ); verify_noerr( SetHiliteStyle(kDataBrowserTableViewFillHilite ) ); verify_noerr( SetHeaderButtonHeight( 0 ) ); err = SetHasScrollBars( (style & wxHSCROLL) != 0 , true ); #if 0 // shouldn't be necessary anymore under 10.2 GetPeer()->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false ); GetPeer()->SetNeedsFocusRect( true ); #endif }
// ============================================================================ // uwHexCtrl // ============================================================================ bool uwHexCtrl::Create ( wxWindow* parent , wxWindowID id , const wxPoint& pos , const wxSize& size , long style , const wxString& name ) { bool result = wxScrolledWindow::Create(parent,id,pos,size,style,name); // Init margins ColumnMarginX = 3; ColumnMarginY = 1; ItemMarginY = 2; // Init font Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); Font.SetPointSize( Font.GetPointSize() + FontDelta ); SetFont(Font); // Init format strings FmtHexByte = GNamedFormat(wxT("HexByte")); FmtOffset = GNamedFormat(wxT("Offset")); // Init hex char table HexStrings.reserve(256); HexStrings.resize(256); for( dword i=0; i!=256; ++i ) { HexStrings[i] = wxString::Format( FmtHexByte, i ); } // Init ascii char table AsciiStrings.reserve(256); AsciiStrings.resize(256); for( dword i=0; i!=256; ++i ) { AsciiStrings[i] = wxChar(i); } // Init font sizes wxClientDC dc(this); dc.SetFont(Font); dc.GetTextExtent(wxT("9"),&HexCharWidth,&HexCharHeight); dc.GetTextExtent(wxString::Format(FmtHexByte,0x99),&HexByteWidth,NULL); dc.GetTextExtent(wxString::Format(FmtOffset,0x99999999),&HexOffsetWidth,NULL); // Init item heights ColumnHeight = ColumnMarginY + HexCharHeight + ColumnMarginY; ItemHeight = ItemMarginY + HexCharHeight + ItemMarginY; // Add columns AddColumn( wxT("Abs Offset"), wxALIGN_LEFT, HexOffsetWidth ); AddColumn( wxT("Rel Offset"), wxALIGN_LEFT, HexOffsetWidth ); AddColumn( wxT(""), wxALIGN_LEFT, HexCharWidth ); for( dword i=0; i!=HexWidth; ++i ) AddColumn( wxString::Format( wxT("%X"), i%0x10 ), wxALIGN_CENTER, HexByteWidth ); AddColumn( wxT(""), wxALIGN_LEFT, HexCharWidth ); for( dword i=0; i!=HexWidth; ++i ) AddColumn( wxString::Format( wxT("%X"), i%0x10 ), wxALIGN_CENTER, HexByteWidth ); // Set column indices ColHexBegin = 3; ColHexEnd = ColHexBegin + HexWidth; ColAsciiBegin = ColHexEnd + 1; ColAsciiEnd = ColAsciiBegin + HexWidth; // Load data DataCache.reserve(DataSize); DataCache.resize(DataSize); HexLines = (DataSize/HexWidth)+1; //HexLines = static_cast<dword>(ceil(static_cast<double>(DataSize)/static_cast<double>(HexWidth))); File->Seek(DataOffset); File->Read(&DataCache.at(0),DataSize); // Init background SetBackgroundStyle(wxBG_STYLE_CUSTOM); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); // Set virtual height VirtualHeight = ColumnHeight + ( ItemHeight * HexLines ); VirtualWidth = Columns.back().BoxRect.x + Columns.back().BoxRect.width; SetVirtualSize( VirtualWidth, VirtualHeight ); //SetVirtualSizeHints( Columns.at(0).BoxRect.width, ColumnHeight + ItemHeight ); SetScrollRate( ColumnMarginX + HexByteWidth + ColumnMarginX, ItemHeight ); return result; }