本文整理汇总了C++中wxListCtrl类的典型用法代码示例。如果您正苦于以下问题:C++ wxListCtrl类的具体用法?C++ wxListCtrl怎么用?C++ wxListCtrl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxListCtrl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxListCtrlGetSelection
// Find the selection
long wxListCtrlGetSelection(wxListCtrl& listCtrl)
{
long n = listCtrl.GetItemCount();
long i;
for (i = 0; i < n; i++)
{
if (listCtrl.GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)
{
return i;
}
}
return -1;
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:14,代码来源:ecutils.cpp
示例2: wxListCtrlSelectItem
// Select the given item
void wxListCtrlSelectItem(wxListCtrl& listCtrl, long sel, bool deselectOthers)
{
long n = listCtrl.GetItemCount();
long i;
if (deselectOthers)
{
for (i = 0; i < n; i++)
{
if (listCtrl.GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)
{
listCtrl.SetItemState(i, wxLIST_STATE_SELECTED, 0);
}
}
}
listCtrl.SetItemState(sel, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:17,代码来源:ecutils.cpp
示例3: RestoreItemData
void RestoreItemData(wxListCtrl &list, const Item *items, long count)
{
for (int ii = 0; ii < count; ++ii)
{
switch (items[ii].type)
{
case 0:
list.SetItemData(ii, 1);
break;
case 1:
list.SetItemData(ii, 0);
break;
case 2:
default:
list.SetItemData(ii, 2);
}
}
}
开发者ID:stahta01,项目名称:codeblocks_backup,代码行数:18,代码来源:ThreadSearchLoggerList.cpp
示例4: Create
// Create a drag image for the given list control item
bool wxDragImage::Create(const wxListCtrl& listCtrl, long id)
{
if ( m_hImageList )
ImageList_Destroy(GetHimageList());
POINT pt;
pt.x = 0; pt.y = 0;
m_hImageList = (WXHIMAGELIST) ListView_CreateDragImage((HWND) listCtrl.GetHWND(), id, & pt);
return true;
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:10,代码来源:dragimag.cpp
示例5: wxListCtrlGetItemTextColumn
// Find the text of the list control item at the given column
wxString wxListCtrlGetItemTextColumn(wxListCtrl& listCtrl, long item, int col)
{
wxListItem listItem;
listItem.m_mask = wxLIST_MASK_TEXT;
listItem.m_itemId = item;
listItem.m_col = col;
if (listCtrl.GetItem(listItem))
return listItem.m_text;
else
return wxEmptyString;
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:13,代码来源:ecutils.cpp
示例6: wxPanel
wxPanel* SjViewSettingsPage::CreateSkinPage(wxWindow* parent)
{
// save given objects
m_skinEnumerator = NULL;
m_skinChangeFromMe = 0;
m_loadSkinsMenuButton = NULL;
// init dialog
wxPanel* page = new wxPanel(parent, -1);
wxSizer* sizer1 = new wxBoxSizer(wxVERTICAL);
page->SetSizer(sizer1);
sizer1->Add(SJ_DLG_SPACE, SJ_DLG_SPACE); // some space
wxStaticText* staticText = new wxStaticText(page, -1,
wxString::Format(_("With different skins you can change the \"look and feel\" of %s. Just\nselect the skin to use from the list above. You'll find more skins on the web."), SJ_PROGRAM_NAME));
sizer1->Add(staticText,
0, wxALL, SJ_DLG_SPACE);
/* add list control
*/
m_listCtrl = new wxListCtrl(page, IDC_SKINLIST, wxDefaultPosition, wxSize(200, 100),
wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxSUNKEN_BORDER);
m_listCtrl->SetImageList(g_tools->GetIconlist(FALSE), wxIMAGE_LIST_SMALL);
//m_listCtrl->SetImageList(g_tools->GetIconlist(TRUE), wxIMAGE_LIST_NORMAL);
m_listCtrl->InsertColumn(0, _("Name"));
sizer1->Add(m_listCtrl, 1, wxGROW|wxALL, SJ_DLG_SPACE);
wxSizer* sizer3 = new wxBoxSizer(wxHORIZONTAL);
sizer1->Add(sizer3, 0, wxLEFT|wxRIGHT|wxBOTTOM, SJ_DLG_SPACE);
m_loadSkinsMenuButton = new wxButton(page, IDC_LOADSKINSMENUBUTTON, _("Options")+wxString(SJ_BUTTON_MENU_ARROW));
sizer3->Add(m_loadSkinsMenuButton, 0, wxRIGHT, SJ_DLG_SPACE);
// init data
m_orgSkinPath = g_mainFrame->GetSkinUrl();
UpdateSkinList(m_orgSkinPath);
return page;
}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:40,代码来源:viewsettings.cpp
示例7: wxPanel
wxPanel* SjMyMusicConfigPage::CreatePage(wxWindow* parent)
{
wxPanel* page = new wxPanel(parent, -1);
wxSizer* sizer1 = new wxBoxSizer(wxVERTICAL);
page->SetSizer(sizer1);
sizer1->Add(1, SJ_DLG_SPACE); // some space
wxStaticText* staticText = new wxStaticText(page, -1, _("Read music-files from the following folders and sources:"));
sizer1->Add(staticText, 0, wxALL, SJ_DLG_SPACE);
m_listCtrl = new wxListCtrl(page, IDC_IDXLIST, wxPoint(-1, -1), wxSize(200, 80),
wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxSUNKEN_BORDER
);
m_listCtrl->SetImageList(g_tools->GetIconlist(FALSE), wxIMAGE_LIST_SMALL);
//m_listCtrl->SetImageList(g_tools->GetIconlist(TRUE), wxIMAGE_LIST_NORMAL);
m_listCtrl->InsertColumn(0, _("Read music-files from the following sources:"));
sizer1->Add(m_listCtrl, 1, wxGROW|wxLEFT|wxRIGHT|wxTOP, SJ_DLG_SPACE);
wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
sizer1->Add(buttonSizer, 0, wxRIGHT|wxGROW, SJ_DLG_SPACE);
m_addButton = new wxButton(page, IDC_IDXADDSOURCES, _("Add source")+wxString(SJ_BUTTON_MENU_ARROW), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
buttonSizer->Add(m_addButton, 0, wxLEFT|wxTOP|wxBOTTOM, SJ_DLG_SPACE);
m_removeButton = new wxButton(page, IDC_IDXDELSOURCE, _("Remove source"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
buttonSizer->Add(m_removeButton, 0, wxLEFT|wxTOP|wxBOTTOM, SJ_DLG_SPACE);
m_configMenuButton = new wxButton(page, IDC_IDXCONFIGSOURCEMENU, _("Options")+wxString(SJ_BUTTON_MENU_ARROW), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
buttonSizer->Add(m_configMenuButton, 0, wxLEFT|wxTOP|wxBOTTOM, SJ_DLG_SPACE);
m_updateButton = new wxButton(page, IDC_IDXUPDATEMENU, wxString::Format(" %s%s ", _("Update music library"), SJ_BUTTON_MENU_ARROW), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
buttonSizer->Add(m_updateButton, 0, wxALL, SJ_DLG_SPACE);
return page;
}
开发者ID:r10s,项目名称:silverjuke,代码行数:36,代码来源:mymusic.cpp
示例8: SetItemType
void SetItemType(Item &item, wxListCtrl &list, long index, long &searchIndex)
{
switch (list.GetItemData(index))
{
case 0:
item.type = 1;
break;
case 1:
item.type = 0;
++searchIndex;
break;
case 2:
default:
item.type = 2;
}
}
开发者ID:stahta01,项目名称:codeblocks_backup,代码行数:16,代码来源:ThreadSearchLoggerList.cpp
示例9: Create
// Create a drag image for the given list control item
bool wxDragImage::Create(const wxListCtrl& listCtrl, long id)
{
if ( m_hImageList )
ImageList_Destroy(GetHimageList());
POINT pt;
pt.x =
pt.y = 0;
m_hImageList = (WXHIMAGELIST)
ListView_CreateDragImage(GetHwndOf(&listCtrl), id, &pt);
if ( !m_hImageList )
{
// as for wxTreeCtrl, fall back on dragging just the item text
return Create(listCtrl.GetItemText(id));
}
return true;
}
开发者ID:NullNoname,项目名称:dolphin,代码行数:19,代码来源:dragimag.cpp
示例10: wxListCtrlFindColumn
// Find which column the cursor is on
int wxListCtrlFindColumn(wxListCtrl& listCtrl, int noCols, int x)
{
int col = 0;
// Find which column we're on
int width = 0;
int i;
for (i = 0; i < noCols; i++)
{
width += listCtrl.GetColumnWidth(i);
if (x <= width)
{
col = i;
break;
}
}
return col;
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:19,代码来源:ecutils.cpp
示例11: ConvertViewCtrlToTrackData
void ConvertViewCtrlToTrackData(const wxListCtrl &listctrl, const std::map< wxString, long > &mapping, std::vector<lfmt::TrackData> &tracklist, wxDateTime offset)
{
auto row_count = listctrl.GetItemCount();
if (row_count < 1)
return;
// grab column indices from string-long-map which we have just for purpose of dynamic indices (ie. changing column order is easy)
auto idx_artist = mapping.find("Artist")->second;
auto idx_tname = mapping.find("Trackname")->second;
auto idx_album = mapping.find("Album")->second;
auto idx_time = mapping.find("Time")->second;
wxDateTime last_time = offset;
// last track on the list is the most recentry track that was listened to;
// moving up the list successive tracks will get earlier times
for (int row = row_count-1; row >= 0; --row)
{
lfmt::TrackData td;
// is there a better way of getting the info out of the listviewctrl?
// it's questionable if I would have gotten it without the wxforum :(
wxListItem item;
item.SetId(row);
item.SetMask(wxLIST_MASK_TEXT);
// "unrolled loop" for all columns
item.SetColumn(idx_artist);
listctrl.GetItem(item);
td.artist = item.GetText();
item.SetColumn(idx_tname);
listctrl.GetItem(item);
td.trackname = item.GetText();
item.SetColumn(idx_album);
listctrl.GetItem(item);
td.album = item.GetText();
td.timestamp = last_time.GetTicks(); // set time *before* calculating the descendant
item.SetColumn(idx_time);
listctrl.GetItem(item);
{
// now calculate 'last_time' offset according to playtime of the current track
// defaults to 3 minutes if we don't know the track's length
wxArrayString time_str = wxStringTokenize(item.GetText(), ":");
long minutes, seconds;
bool success = true;
success &= time_str[0].ToLong(&minutes);
success &= time_str[1].ToLong(&seconds);
if (success)
last_time -= wxTimeSpan(0, minutes, seconds);
else
{
wxLogWarning("Could not parse timespan " + item.GetText() + ". Assuming track length of 3 minutes.");
last_time -= wxTimeSpan(0, 3, 0);
}
}
tracklist.push_back(td);
wxLogDebug("Converted track " + td.ToString() + " from row %d.", row);
}
}
开发者ID:sperrholz,项目名称:lfmt,代码行数:66,代码来源:lfmt_util.cpp
示例12: Create
// Create a drag image for the given list control item
bool wxGenericDragImage::Create(const wxListCtrl& listCtrl, long id)
{
wxString str = listCtrl.GetItemText(id);
return Create(str);
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:6,代码来源:dragimgg.cpp
示例13: getFleetData
void getFleetData(wxListCtrl& listCtrl)
{
DataPoll poll;
string data = poll.getFleetData(1, LogInHandler::mUsername, LogInHandler::mPassword);
if(!poll.getState())
{
return;
}
istringstream input(data);
jsonxx::Object o;
assert(jsonxx::Object::parse(input, o));
assert(o.has<jsonxx::Array>("data"));
long long int profit = 0;
double distance = 0,
velocity = 0;
stringstream sstream;
string finalString;
//wxString tempHabitable;
for(int i = 0; i < o.get<jsonxx::Array>("data").size(); ++i)
{
profit = o.get<jsonxx::Array>("data").get<jsonxx::Object>(i).get<jsonxx::number>("profit");
velocity = o.get<jsonxx::Array>("data").get<jsonxx::Object>(i).get<jsonxx::number>("velocity");
distance = o.get<jsonxx::Array>("data").get<jsonxx::Object>(i).get<jsonxx::number>("distance");
cout << profit;
cout << endl;
int minutesToTarget = floor(distance / velocity);
if(velocity == 0)
{
minutesToTarget = 0;
}
wxString sProfit;
sProfit << profit;
//wxString sProfit(wxT("4"), wxConvUTF8);
wxString sVelocity;
sVelocity << velocity;
wxString sDistance;
sDistance << distance;
wxString sMinToTarget;
sMinToTarget << minutesToTarget;
wxString tempName(o.get<jsonxx::Array>("data").get<jsonxx::Object>(i).get<string>("name").c_str(), wxConvUTF8);
wxString tempStatus(o.get<jsonxx::Array>("data").get<jsonxx::Object>(i).get<string>("status").c_str(), wxConvUTF8);
//bool y = o.get<jsonxx::Array>("data").get<jsonxx::Object>(i).get<bool>("hasHabitable");
//if(y)
// tempHabitable = wxString("Yes");
//else
// tempHabitable = wxString("No");
wxListItem item;
item.SetId(i);
long index = listCtrl.InsertItem(item);
listCtrl.SetItem(index, 0, tempName);
listCtrl.SetItem(index, 1, tempStatus);
listCtrl.SetItem(index, 2, sProfit);
listCtrl.SetItem(index, 3, sDistance);
listCtrl.SetItem(index, 4, sVelocity);
listCtrl.SetItem(index, 5, sMinToTarget);
//listCtrl.SetItem(index, 2, tempHabitable);
sstream.str("");
}
}
开发者ID:dormedas,项目名称:SpaceGameDesktop,代码行数:77,代码来源:fleetFrame.cpp
示例14: OnSize
void SjViewSettingsPage::OnSize(wxSizeEvent& event)
{
wxSize size = m_listCtrl->GetClientSize();
m_listCtrl->SetColumnWidth(0, size.x-8);
SjDialog::EnsureSelListCtrlItemVisible(m_listCtrl);
event.Skip(); // forward event to the next handler
}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:8,代码来源:viewsettings.cpp
示例15: GetSelFromDialog
SjSettingsSourceItem* SjMyMusicConfigPage::GetSelFromDialog()
{
long i = SjDialog::GetSelListCtrlItem(m_listCtrl);
if( i >= 0 )
{
return (SjSettingsSourceItem*)m_listCtrl->GetItemData(i);
}
return NULL;
}
开发者ID:r10s,项目名称:silverjuke,代码行数:10,代码来源:mymusic.cpp
示例16: UpdateSelection
void VirtListCtrlTestCase::UpdateSelection()
{
m_list->SetItemCount(10);
CPPUNIT_ASSERT_EQUAL( 0, m_list->GetSelectedItemCount() );
m_list->SetItemState(7, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
CPPUNIT_ASSERT_EQUAL( 1, m_list->GetSelectedItemCount() );
m_list->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
CPPUNIT_ASSERT_EQUAL( 2, m_list->GetSelectedItemCount() );
// The item 7 is now invalid and so shouldn't be counted as selected any
// more.
m_list->SetItemCount(5);
CPPUNIT_ASSERT_EQUAL( 1, m_list->GetSelectedItemCount() );
}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:16,代码来源:virtlistctrltest.cpp
示例17: OnColClick
void SjMyMusicConfigPage::OnColClick(wxListEvent& event)
{
int newCol = event.GetColumn();
if( m_currSortCol == newCol )
{
m_currSortCol = newCol | 0x00001000; /* toggle! */;
}
else
{
m_currSortCol = newCol;
}
m_listCtrl->SortItems(ListCtrlCompareFunction, m_currSortCol); // this may unselect Items on GTK, however, this should be fixed in wxWidgets/GTK
}
开发者ID:r10s,项目名称:silverjuke,代码行数:15,代码来源:mymusic.cpp
示例18: GetSkinFromDialog
SjSkinEnumeratorItem* SjViewSettingsPage::GetSkinFromDialog()
{
long i = SjDialog::GetSelListCtrlItem(m_listCtrl);
if( i >= 0 )
{
i = m_listCtrl->GetItemData(i);
wxASSERT(m_skinEnumerator);
SjSkinEnumeratorItem* currSkin = m_skinEnumerator->GetSkin(i);
wxASSERT(currSkin);
return currSkin;
}
return NULL;
}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:16,代码来源:viewsettings.cpp
示例19: UpdateSkinList
void SjViewSettingsPage::UpdateSkinList(const wxString& selSkin)
{
m_skinChangeFromMe++;
m_listCtrl->Freeze();
m_listCtrl->DeleteAllItems();
if( m_skinEnumerator )
{
delete m_skinEnumerator;
m_skinEnumerator = NULL;
}
m_skinEnumerator = new SjSkinEnumerator();
if( m_skinEnumerator )
{
int currSkinIndex, new_i;
for( currSkinIndex = 0; currSkinIndex < m_skinEnumerator->GetCount(); currSkinIndex++ )
{
SjSkinEnumeratorItem* currSkin = m_skinEnumerator->GetSkin(currSkinIndex);
wxListItem item;
item.m_mask = wxLIST_MASK_IMAGE | wxLIST_MASK_TEXT | wxLIST_MASK_DATA;
item.m_itemId = currSkinIndex;
item.m_text = currSkin->m_name;
item.m_data = currSkinIndex;
item.m_image = SJ_ICON_SKIN_FILE;
new_i = m_listCtrl->InsertItem(item);
if( currSkin->m_url == selSkin )
{
m_listCtrl->SetItemState(new_i, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
}
}
wxSize size = m_listCtrl->GetClientSize();
m_listCtrl->SetColumnWidth(0, size.x-8);
}
m_listCtrl->Thaw();
m_skinChangeFromMe--;
}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:42,代码来源:viewsettings.cpp
示例20: InitPage
void SjMyMusicConfigPage::InitPage(const wxString& selSourceUrl)
{
// create index list
m_listOfSources.Clear();
m_listOfSources.DeleteContents(TRUE);
SjModuleList* list = g_mainFrame->m_moduleSystem.GetModules(SJ_MODULETYPE_SCANNER);
wxASSERT(list);
SjModuleList::Node* moduleNode = list->GetFirst();
SjScannerModule* scannerModule;
while( moduleNode )
{
scannerModule = (SjScannerModule*)moduleNode->GetData();
wxASSERT(scannerModule);
wxASSERT(scannerModule->IsLoaded());
long sourceCount = scannerModule->GetSourceCount();
long currSourceIndex;
for( currSourceIndex = 0; currSourceIndex < sourceCount; currSourceIndex++ )
{
SjSettingsSourceItem* item = new SjSettingsSourceItem(scannerModule, currSourceIndex, scannerModule->GetSourceUrl(currSourceIndex), scannerModule->GetSourceIcon(currSourceIndex));
m_listOfSources.Append(item);
}
// next
moduleNode = moduleNode->GetNext();
}
// get list control
m_listCtrl->Freeze();
m_listCtrl->DeleteAllItems();
// go through all search directories
SjSettingsSourceItem* item;
SjSettingsSourceItemList::Node* itemnode = m_listOfSources.GetFirst();
int i = 0;
wxString sourceNotes;
while( itemnode )
{
item = itemnode->GetData();
wxASSERT(item);
wxListItem listitem;
listitem.m_mask = wxLIST_MASK_IMAGE | wxLIST_MASK_TEXT | wxLIST_MASK_DATA;
listitem.m_itemId = i;
listitem.m_text = item->GetUrl();
listitem.SetData((void*)item);
listitem.m_image = item->GetScannerModule()->GetSourceIcon(item->GetIndex());
sourceNotes = item->GetScannerModule()->GetSourceNotes(item->GetIndex());
if( !sourceNotes.IsEmpty() )
{
listitem.m_text.Append(" (");
listitem.m_text.Append(sourceNotes);
listitem.m_text.Append(')');
}
m_listCtrl->InsertItem(listitem);
itemnode = itemnode->GetNext();
i++;
}
m_listCtrl->SortItems(ListCtrlCompareFunction, m_currSortCol);
m_listCtrl->Thaw();
// select the correct item
// (should be done after SortItems() on GTK this may remove the selection ...)
int i_cnt = m_listCtrl->GetItemCount();
for( i = 0; i < i_cnt; i ++ )
{
item = (SjSettingsSourceItem*)m_listCtrl->GetItemData(i);
if( item->GetUrl() == selSourceUrl ) {
m_listCtrl->SetItemState(i, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
break;
}
}
UpdateButtons();
}
开发者ID:r10s,项目名称:silverjuke,代码行数:82,代码来源:mymusic.cpp
注:本文中的wxListCtrl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论