本文整理汇总了C++中pfc::list_t::add_item方法的典型用法代码示例。如果您正苦于以下问题:C++ list_t::add_item方法的具体用法?C++ list_t::add_item怎么用?C++ list_t::add_item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pfc::list_t
的用法示例。
在下文中一共展示了list_t::add_item方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findDspNames
void dsp_preset_switcher::findDspNames( pfc::list_t<pfc::string8> &out ) const
{
// storing menu handles may not be a good idea, since the user can change DSP preset settings without notify this component
out.remove_all();
// enumerate mainmenu items
service_enum_t<mainmenu_commands> e;
service_ptr_t<mainmenu_commands_v2> ptr;
while( e.next( ptr ) )
{
for( t_uint32 i = 0 , imax = ptr->get_command_count(); i < imax; ++i )
{
// lock-on on DSP settings
pfc::string8 group_name;
ptr->get_name( i , group_name );
const char *DSP_PARENT_STR = "DSP"; // partial match, hope to work with non-English locale
if( strstr( group_name.toString() , DSP_PARENT_STR ) == nullptr )
continue;
// should be a dynamic item
if( !ptr->is_command_dynamic( i ) )
{
console::printf( CONSOLE_HEADER "%s(): item is NOT dynamic!!" , __FUNCTION__ );
continue;
}
const mainmenu_node::ptr dsp_group_node = ptr->dynamic_instantiate( i );
// should be a group node
if( dsp_group_node->get_type() != mainmenu_node::type_group )
{
console::printf( CONSOLE_HEADER "%s(): node is NOT type_group!!" , __FUNCTION__ );
continue;
}
// enumerate dsp names
for( t_size j = 0 , jmax = dsp_group_node->get_children_count(); ( j < jmax ) && ( jmax > 1 ) ; ++j ) // jmax == 1 when there only exist "Preferences" items
{
const mainmenu_node::ptr dsp_item_node = dsp_group_node->get_child( j );
if( dsp_item_node->get_type() == mainmenu_node::type_command )
{
pfc::string8 n;
t_uint32 d;
dsp_item_node->get_display( n , d );
out.add_item( n );
//console::printf( CONSOLE_HEADER "%s" , n.toString() );
}
else if( dsp_item_node->get_type() == mainmenu_node::type_separator )
{
// stop when encountered type_separator
break;
}
}
return;
}
}
return;
}
示例2: get_num_items
//public:
unsigned get_num_items()
{
//return 1;
// see if we already cached all this jazz
if ( g_mm_names.get_count() > 0 )
{
return g_mm_names.get_count();
}
unsigned total = 0;
service_enum_t<mainmenu_commands> e;
service_ptr_t<mainmenu_commands> ptr;
g_mm_names.remove_all();
g_mm_guids.remove_all();
while(e.next(ptr))
{
unsigned count = ptr->get_command_count();
for ( unsigned n = 0; n < count; n++ )
{
pfc::string8 path;
pfc::string8 name;
GUID guid;
t_uint32 p_flags;
pfc::string8 str_display;
ptr->get_display( n, str_display, p_flags );
ptr->get_name( n, name );
guid = ptr->get_command( n );
find_menu_path( ptr->get_parent(), path );
g_mm_names.add_item( name );
g_mm_guids.add_item( guid );
g_mm_paths.add_item( path );
}
total += count;
}
return total;
}
示例3: g_populate_tree
void g_populate_tree ( HWND wnd_tree, cui::fcl::group_list & list, const cui::fcl::group_list_filtered & filtered, HTREEITEM ti_parent = TVI_ROOT)
{
t_size i, count = filtered.get_count();
for (i=0; i<count; i++)
{
pfc::string8 name;
filtered[i]->get_name(name);
HTREEITEM item = treeview::insert_item(wnd_tree, name, m_nodes.get_count() , ti_parent);
m_nodes.add_item(t_node(item, filtered[i]));
TreeView_SetCheckState(wnd_tree, item, TRUE);
cui::fcl::group_list_filtered filtered2(list, filtered[i]->get_guid());
list.remove_by_guid(filtered[i]->get_guid());
g_populate_tree(wnd_tree, list, filtered2, item);
}
}
示例4: on_entry
bool directory_callback_full_impl::on_entry(filesystem * owner, abort_callback & p_abort, const char * url, bool is_subdirectory, const t_filestats & p_stats)
{
p_abort.check_e();
m_data.add_item(pfc::rcnew_t<t_entry>(url, is_subdirectory, p_stats));
if (is_subdirectory)
{
if (m_recur)
{
try
{
owner->list_directory(url, *this, p_abort);
}
catch (exception_io const &) {}
}
}
return true;
}
示例5: enum_mobile_devices
void enum_mobile_devices(pfc::list_t<device_instance_info_t> & p_out)
{
HDEVINFO di = SetupDiGetClassDevs(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
if (di != INVALID_HANDLE_VALUE)
{
SP_DEVINFO_DATA did;
memset(&did, 0, sizeof(did));
did.cbSize = sizeof(did);
DWORD i;
for (i=0; SetupDiEnumDeviceInfo(di, i, &did); i++)
{
//if (did.ClassGuid == GUID_DEVCLASS_USB)
{
ULONG DevDiskLen=0;
pfc::array_t<WCHAR> DevDisk;
if (CR_SUCCESS == CM_Get_Device_ID_Size(&DevDiskLen, did.DevInst, NULL))
{
DevDisk.set_size(DevDiskLen+1);
DevDisk.fill_null();
if (CR_SUCCESS == CM_Get_Device_ID(did.DevInst, DevDisk.get_ptr(), DevDisk.get_size(), NULL))
{
if (g_check_devid_is_mobile_device(DevDisk.get_ptr()))
{
device_instance_info_t temp;
temp.m_handle = did.DevInst;
temp.m_path = DevDisk.get_ptr();
p_out.add_item(temp);
console::formatter() << "iPod manager: USB AMD enumerator: Found " << Tu(DevDisk.get_ptr());
}
}
}
}
}
SetupDiDestroyDeviceInfoList(di);
}
if (!p_out.get_count())
console::formatter() << "iPod manager: USB AMD enumerator: No devices found!";
}
示例6: g_get_default_presets
void layout_window::g_get_default_presets(pfc::list_t<cfg_layout_t::preset> & p_out)
{
{
uie::window_ptr wnd, wnd2, wnd3;
service_ptr_t<uie::splitter_window> splitter, splitter2, splitter3;
if (uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd2))
{
if (wnd->service_query_t(splitter) && wnd2->service_query_t(splitter2))
{
uie::splitter_item_simple_t item, item2;
item.set_panel_guid(columns_ui::panels::guid_playlist_switcher);
item2.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
bool val = true;
splitter2->add_panel(&item);
stream_writer_memblock conf1;
splitter2->get_config(&conf1, abort_callback_impl());
item2.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());
t_size index = splitter->add_panel(&item2);
splitter->set_config_item(index, uie::splitter_window::bool_locked, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
val = false;
splitter->set_config_item(index, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
t_uint32 sz = 175;
splitter->set_config_item(index, uie::splitter_window::uint32_size, &stream_reader_memblock_ref(&sz, sizeof(t_uint32)), abort_callback_impl());
item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
t_size index_playlist = splitter->add_panel(&item);
splitter->set_config_item(index_playlist, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
cfg_layout_t::preset preset_default;
preset_default.m_name = "NG Playlist + Playlist Switcher";
preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;
stream_writer_memblock_ref conf(preset_default.m_val, true);
splitter->get_config(&conf, abort_callback_impl());
p_out.add_item(preset_default);
}
}
}
{
uie::window_ptr wnd, wnd2, wnd3, wnd_filter_splitter;
service_ptr_t<uie::splitter_window> splitter, splitter2, splitter3, splitter_filter;
if (uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd2) && uie::window::create_by_guid(columns_ui::panels::guid_vertical_splitter, wnd3)
&& uie::window::create_by_guid(columns_ui::panels::guid_horizontal_splitter, wnd_filter_splitter))
{
if (wnd->service_query_t(splitter) && wnd2->service_query_t(splitter2) && wnd3->service_query_t(splitter3)
&& wnd_filter_splitter->service_query_t(splitter_filter))
{
uie::splitter_item_simple_t item, item2, item3, item_filter, item_filter_splitter, item_artwork;
item.set_panel_guid(columns_ui::panels::guid_playlist_switcher);
item2.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
item3.set_panel_guid(columns_ui::panels::guid_vertical_splitter);
item_filter_splitter.set_panel_guid(columns_ui::panels::guid_horizontal_splitter);
item_filter.set_panel_guid(columns_ui::panels::guid_filter);
item_artwork.set_panel_guid(columns_ui::panels::guid_artwork_view);;
bool val = true;
splitter2->add_panel(&item);
stream_writer_memblock conf1, conf2, conf3;
splitter2->get_config(&conf1, abort_callback_impl());
item2.set_panel_config(&stream_reader_memblock_ref(conf1.m_data.get_ptr(), conf1.m_data.get_size()), conf1.m_data.get_size());
t_size index = splitter->add_panel(&item2);
splitter->set_config_item(index, uie::splitter_window::bool_locked, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
val = false;
splitter->set_config_item(index, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
t_uint32 sz = 175;
splitter->set_config_item(index, uie::splitter_window::uint32_size, &stream_reader_memblock_ref(&sz, sizeof(t_uint32)), abort_callback_impl());
t_size index_filter = splitter_filter->add_panel(&item_filter);
splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
index_filter = splitter_filter->add_panel(&item_filter);
splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
index_filter = splitter_filter->add_panel(&item_filter);
splitter_filter->set_config_item_t(index_filter, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
{
splitter_filter->get_config(&conf3, abort_callback_impl());
item_filter_splitter.set_panel_config(&stream_reader_memblock_ref(conf3.m_data.get_ptr(), conf3.m_data.get_size()), conf3.m_data.get_size());
t_size indexfs = splitter3->add_panel(&item_filter_splitter);
splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
bool temp = true;
splitter3->set_config_item_t(indexfs, uie::splitter_window::bool_locked, temp, abort_callback_dummy());
t_uint32 size = 175;
splitter3->set_config_item_t(indexfs, uie::splitter_window::uint32_size, size, abort_callback_dummy());
}
item.set_panel_guid(columns_ui::panels::guid_playlist_view_v2);
t_size index_playlist = splitter3->add_panel(&item);
splitter3->set_config_item(index_playlist, uie::splitter_window::bool_show_caption, &stream_reader_memblock_ref(&val, sizeof(bool)), abort_callback_impl());
splitter3->get_config(&conf2, abort_callback_impl());
item3.set_panel_config(&stream_reader_memblock_ref(conf2.m_data.get_ptr(), conf2.m_data.get_size()), conf2.m_data.get_size());
t_size index_splitter2 = splitter->add_panel(&item3);
splitter->set_config_item_t(index_splitter2, uie::splitter_window::bool_show_caption, val, abort_callback_dummy());
cfg_layout_t::preset preset_default;
preset_default.m_name = "NG Playlist + Playlist Switcher + Filters";
preset_default.m_guid = columns_ui::panels::guid_horizontal_splitter;
stream_writer_memblock_ref conf(preset_default.m_val, true);
splitter->get_config(&conf, abort_callback_impl());
//.........这里部分代码省略.........
示例7: on_message
LRESULT console_window::on_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
switch(msg)
{
case WM_CREATE:
{
/**
* Store a pointer to ourselve in this list, used for global notifications (in the main thread)
* which updates instances of our panel.
*/
list_wnd.add_item(this);
{
insync(sync);
/** Store a window handle in this list, used in global notifications (in any thread) which
* updates the panels */
g_notify_list.add_item(wnd);
}
long flags = 0;
if (cfg_frame == 1) flags |= WS_EX_CLIENTEDGE;
else if (cfg_frame == 2) flags |= WS_EX_STATICEDGE;
/** Create our edit window */
wnd_edit = CreateWindowEx(flags, WC_EDIT, _T(""),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOVSCROLL | WS_VSCROLL | ES_READONLY | ES_MULTILINE, 0, 0, 0, 0,
wnd, HMENU(IDC_EDIT), core_api::get_my_instance(), NULL);
if (wnd_edit)
{
if (g_font)
{
/** Nth, n>1, instance; use exisiting font handle */
SendMessage(wnd_edit,WM_SETFONT,(WPARAM)g_font,MAKELPARAM(0,0));
}
else
/** First window - create the font handle */
g_update_all_fonts();
/** Store a pointer to ourself in the user data field of the edit window */
SetWindowLongPtr(wnd_edit,GWL_USERDATA,(LPARAM)(this));
/** Subclass the edit window */
m_editproc = (WNDPROC)SetWindowLongPtr(wnd_edit,GWL_WNDPROC,(LPARAM)(hook_proc));
SendMessage(wnd, MSG_UPDATE, 0, 0);
}
}
break;
/** Update the edit window's text */
case MSG_UPDATE:
{
insync(sync);
pfc::string8_fastalloc buffer;
buffer.prealloc(1024);
unsigned n, count = g_messages.get_count();
for (n=0; n<count; n++)
{
buffer << "[" << pfc::format_int(g_messages[n].m_time.wHour, 2)
<< ":" << pfc::format_int(g_messages[n].m_time.wMinute, 2)
<< ":" << pfc::format_int(g_messages[n].m_time.wSecond, 2)
<< "] " << g_messages[n].m_message;
#if 0
buffer.add_string(pfc::string_printf("[%02u:%02u:%02u] ",(unsigned)g_messages[n].m_time.wHour
,(unsigned)g_messages[n].m_time.wMinute
,(unsigned)g_messages[n].m_time.wSecond));
buffer.add_string(g_messages[n].m_message);
//if (n != count-1)
// buffer.add_string("\r\n",2);
#endif
}
uSetWindowText(wnd_edit, buffer);
LONG_PTR len = SendMessage(wnd_edit, EM_GETLINECOUNT , 0, 0);
SendMessage(wnd_edit, EM_LINESCROLL , 0, len);
}
break;
case WM_GETMINMAXINFO:
break;
case WM_SIZE:
/** Reposition the edit window. */
SetWindowPos(wnd_edit, 0, 0, 0, LOWORD(lp), HIWORD(lp), SWP_NOZORDER);
break;
case WM_ERASEBKGND:
return FALSE;
case WM_DESTROY:
{
wnd_edit=0;
list_wnd.remove_item(this);
SendMessage(wnd_edit,WM_SETFONT,NULL,MAKELPARAM(0,0));
if (list_wnd.get_count() == 0)
{
DeleteFont(g_font);
g_font = 0;
}
{
insync(sync);
g_notify_list.remove_item(wnd);
}
}
break;
}
//.........这里部分代码省略.........