本文整理汇总了C++中SArray::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ SArray::push_back方法的具体用法?C++ SArray::push_back怎么用?C++ SArray::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SArray
的用法示例。
在下文中一共展示了SArray::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHKPTR
void
MainWindow::add_toolbar_button(DebuggerCommand* cmd,
const string& tip,
const char* stock,
SArray& pixmap,
Properties& prop)
{
ToolBar* toolbar = get_toolbar(prop);
if (pixmap.empty())
{
pixmap.push_back("");
}
SArray noArg;
Widget* btn =
CHKPTR(toolbar)->add_button(
pixmap.cstrings(),
tip.c_str(),
Gtk_BIND(Gtk_SLOT(this, &MainWindow::run_macro), cmd, noArg),
uisAttachedThreadStop, // FIXME: let the caller specify it
cmd->name(),
stock);
btn->show_all();
commandMap_[cmd] = btn;
}
示例2: dialog
void
MainWindow::toolbar_entry_dialog(DebuggerCommand* command,
Properties* cmdProperties)
{
const string msg = cmdProperties->get_string("message", "");
EntryDialog dialog(msg, debugger().properties(), command->name());
SArray args;
string userString = dialog.run();
if (!userString.empty())
{
args.push_back(userString);
run_macro(command, args);
}
}
示例3: add_command
void MainWindow::add_command(DebuggerCommand* cmd)
{
if (!is_ui_thread())
{
run_on_ui_thread(command(&MainWindow::add_command, this, cmd));
}
else
{
dbgout(0) << __func__ << ": " << cmd->name() << endl;
//
// The command object may implement a Properties interface,
// (a dictionary, essentially) which allows the various
// CommandCenter implementations to extract the parameters
// that apply.
//
// In this particular case, we look for params that tell:
// 1) whether the command to be added is a toolbar button
// (other types are not supported yet, but things such as
// menu items may are on the drawing board and may be added soon),
// and:
// 2) if a toolbar button, what are its attributes (tooltip
// text, what pixmap or stock image to show, etc).
//
if (Properties* prop = interface_cast<Properties*>(cmd))
{
SArray pixmap;
string tip = prop->get_string("tooltip", "");
const char* stock = prop->get_string("stock");
if (const char* xpm = prop->get_string("pixmap"))
{
typedef boost::char_separator<char> Delim;
typedef boost::tokenizer<Delim> Tokenizer;
string tmp(xpm);
Tokenizer tok(tmp, Delim("\n"));
Tokenizer::iterator i = tok.begin();
for (; i != tok.end(); ++i)
{
pixmap.push_back(*i);
}
}
if (const char* type = prop->get_string("type"))
{
if (strcmp(type, "tool") == 0)
{
add_toolbar_button(cmd, tip, stock, pixmap, *prop);
}
else if (strcmp(type, "tool-dialog") == 0)
{
add_toolbar_dialog(cmd, tip, stock, pixmap, *prop);
}
else
{
throw runtime_error("pluggable command type \""
+ string(type)
+ "\" not supported");
}
}
}
}
}