本文整理汇总了C++中browser函数的典型用法代码示例。如果您正苦于以下问题:C++ browser函数的具体用法?C++ browser怎么用?C++ browser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了browser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: browser
void FileChooser::UpdateEditor() {
int index = browser()->Selection();
if (index >= 0) {
_sedit->Message(browser()->Path(index));
browser()->UnselectAll();
} else {
_sedit->Message(browser()->Normalize(_sedit->Text()));
}
SelectFile();
}
示例2: switch
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kChooseSaveDirCmd: {
BrowserDialog browser("Select directory for savegames", true);
if (browser.runModal() > 0) {
// User made his choice...
FilesystemNode dir(browser.getResult());
_savePath->setLabel(dir.path());
draw();
// TODO - we should check if the directory is writeable before accepting it
}
break;
}
case kChooseThemeDirCmd: {
BrowserDialog browser("Select directory for GUI themes", true);
if (browser.runModal() > 0) {
// User made his choice...
FilesystemNode dir(browser.getResult());
_themePath->setLabel(dir.path());
draw();
}
break;
}
case kChooseExtraDirCmd: {
BrowserDialog browser("Select directory for extra files", true);
if (browser.runModal() > 0) {
// User made his choice...
FilesystemNode dir(browser.getResult());
_extraPath->setLabel(dir.path());
draw();
}
break;
}
case kChooseSoundFontCmd: {
BrowserDialog browser("Select SoundFont", false);
if (browser.runModal() > 0) {
// User made his choice...
FilesystemNode file(browser.getResult());
_soundFont->setLabel(file.path());
draw();
}
break;
}
#ifdef SMALL_SCREEN_DEVICE
case kChooseKeyMappingCmd:
_keysDialog->runModal();
break;
#endif
default:
OptionsDialog::handleCommand(sender, cmd, data);
}
}
示例3: browser
// ----------------------------------------------------------------------------
// ThingPropsPanel::onSpriteClicked
//
// Called when the thing type sprite canvas is clicked
// ----------------------------------------------------------------------------
void ThingPropsPanel::onSpriteClicked(wxMouseEvent& e)
{
ThingTypeBrowser browser(this, type_current_);
if (browser.ShowModal() == wxID_OK)
{
// Get selected type
type_current_ = browser.getSelectedType();
auto& tt = Game::configuration().thingType(type_current_);
// Update sprite
gfx_sprite_->setSprite(tt);
label_type_->SetLabel(tt.name());
// Update args
if (panel_args_)
{
auto& as = tt.argSpec();
panel_args_->setup(as, (MapEditor::editContext().mapDesc().format == MAP_UDMF));
}
// Update layout
Layout();
Refresh();
}
}
示例4: if
// -----------------------------------------------------------------------------
// Called when a texture canvas is clicked
// -----------------------------------------------------------------------------
void SectorPropsPanel::onTextureClicked(wxMouseEvent& e)
{
// Get canvas
FlatTexCanvas* tc = nullptr;
FlatComboBox* cb = nullptr;
if (e.GetEventObject() == gfx_floor_)
{
tc = gfx_floor_;
cb = fcb_floor_;
}
else if (e.GetEventObject() == gfx_ceiling_)
{
tc = gfx_ceiling_;
cb = fcb_ceiling_;
}
if (!tc)
{
e.Skip();
return;
}
// Browse
MapTextureBrowser browser(this, MapEditor::TextureType::Flat, tc->texName(), &MapEditor::editContext().map());
if (browser.ShowModal() == wxID_OK && browser.selectedItem())
cb->SetValue(browser.selectedItem()->name());
}
示例5: if
/* SectorPropsPanel::onTextureClicked
* Called when a texture canvas is clicked
*******************************************************************/
void SectorPropsPanel::onTextureClicked(wxMouseEvent& e)
{
// Get canvas
FlatTexCanvas* tc = NULL;
FlatComboBox* cb = NULL;
if (e.GetEventObject() == gfx_floor)
{
tc = gfx_floor;
cb = fcb_floor;
}
else if (e.GetEventObject() == gfx_ceiling)
{
tc = gfx_ceiling;
cb = fcb_ceiling;
}
if (!tc)
{
e.Skip();
return;
}
// Browse
MapTextureBrowser browser(this, 1, tc->getTexName(), &(theMapEditor->mapEditor().getMap()));
if (browser.ShowModal() == wxID_OK)
cb->SetValue(browser.getSelectedItem()->getName());
}
示例6: main
int main(int argc, char* argv[])
{
Options options;
if (!options.parse(argc, argv))
return 1;
printf("MiniBrowser: Use Alt + Left and Alt + Right to navigate back and forward. Use F5 to reload.\n");
std::string url = options.url;
if (url.empty())
url = "http://www.google.com";
else if (url.find("http") != 0 && url.find("file://") != 0) {
std::ifstream localFile(url.c_str());
url.insert(0, localFile ? "file://" : "http://");
}
GMainLoop* mainLoop = g_main_loop_new(0, false);
MiniBrowser browser(mainLoop, options.desktopModeEnabled ? MiniBrowser::DesktopMode : MiniBrowser::MobileMode, options.width, options.height, options.viewportHorizontalDisplacement, options.viewportVerticalDisplacement);
if (options.forceTouchEmulationEnabled || !options.desktopModeEnabled) {
printf("Touch Emulation Mode enabled. Hold Control key to build and emit a multi-touch event: each mouse button should be a different touch point. Release Control Key to clear all tracking pressed touches.\n");
browser.setTouchEmulationMode(true);
}
if (!options.userAgent.empty())
WKPageSetCustomUserAgent(browser.pageRef(), WKStringCreateWithUTF8CString(options.userAgent.c_str()));
if (!options.desktopModeEnabled)
printf("Use Control + mouse wheel to zoom in and out.\n");
WKPageLoadURL(browser.pageRef(), WKURLCreateWithUTF8CString(url.c_str()));
g_main_loop_run(mainLoop);
g_main_loop_unref(mainLoop);
}
示例7: browser
// -----------------------------------------------------------------------------
// Opens the texture browser for [tex_type] textures, with [init_texture]
// initially selected. Returns the selected texture
// -----------------------------------------------------------------------------
std::string MapEditor::browseTexture(
std::string_view init_texture,
TextureType tex_type,
SLADEMap& map,
std::string_view title)
{
// Unlock cursor if locked
bool cursor_locked = edit_context->mouseLocked();
if (cursor_locked)
edit_context->lockMouse(false);
// Setup texture browser
MapTextureBrowser browser(map_window, tex_type, wxString{ init_texture.data(), init_texture.size() }, &map);
browser.SetTitle(WxUtils::strFromView(title));
// Get selected texture
std::string tex;
if (browser.ShowModal() == wxID_OK)
tex = browser.selectedItem()->name();
// Re-lock cursor if needed
if (cursor_locked)
edit_context->lockMouse(true);
return tex;
}
示例8: main
int main(int argv, char** argc)
{
QApplication app(argv, argc);
app.setOrganizationName("commontk");
app.setOrganizationDomain("commontk.org");
app.setApplicationName("ctkPluginBrowser");
ctkPluginFrameworkFactory fwFactory;
ctkPluginFramework* framework = fwFactory.getFramework();
try {
framework->init();
}
catch (const ctkPluginException& exc)
{
qCritical() << "Failed to initialize the plug-in framework:" << exc;
exit(1);
}
ctkPluginBrowser browser(framework);
browser.show();
return app.exec();
}
示例9: browser
bool CServerList::NeedToRefreshCurServer ()
{
CUIListItemServer* pItem = (CUIListItemServer*)m_list[LST_SERVER].GetSelectedItem();
if(!pItem)
return false;
return browser().HasAllKeys(pItem->GetInfo()->info.Index) == false;
};
示例10: fixProblem
virtual bool fixProblem(unsigned index, unsigned fix_type, MapEditor* editor)
{
if (index >= sectors.size())
return false;
if (fix_type == 0)
{
// Browse textures
MapTextureBrowser browser(theMapEditor, 1, "", map);
if (browser.ShowModal() == wxID_OK)
{
// Set texture if one selected
string texture = browser.getSelectedItem()->getName();
editor->beginUndoRecord("Change Texture");
if (floor[index])
sectors[index]->setStringProperty("texturefloor", texture);
else
sectors[index]->setStringProperty("textureceiling", texture);
editor->endUndoRecord();
// Remove problem
sectors.erase(sectors.begin() + index);
floor.erase(floor.begin() + index);
return true;
}
return false;
}
return false;
}
示例11: strlen
void FileChooser::SelectFile() {
const char* path = _sedit->Text();
int left = strlen(browser()->ValidDirectories(path));
int right = strlen(path);
Select(left, right);
}
示例12: browser
/* ThingPropsPanel::onSpriteClicked
* Called when the thing type sprite canvas is clicked
*******************************************************************/
void ThingPropsPanel::onSpriteClicked(wxMouseEvent& e)
{
ThingTypeBrowser browser(this, type_current);
if (browser.ShowModal() == wxID_OK)
{
// Get selected type
type_current = browser.getSelectedType();
ThingType* tt = theGameConfiguration->thingType(type_current);
// Update sprite
gfx_sprite->setSprite(tt);
label_type->SetLabel(tt->getName());
// Update args
if (panel_args)
{
argspec_t as = tt->getArgspec();
panel_args->setup(&as, (theMapEditor->currentMapDesc().format == MAP_UDMF));
}
// Update layout
Layout();
Refresh();
}
}
示例13: VBox
Interactor* FileChooser::Interior(const char* acptLbl) {
const int space = Math::round(.5*cm);
VBox* titleblock = new VBox(
new HBox(title, new HGlue),
new HBox(subtitle, new HGlue)
);
return new MarginFrame(
new VBox(
titleblock,
new VGlue(space, 0),
new Frame(new MarginFrame(_sedit, 2)),
new VGlue(space, 0),
new Frame(AddScroller(browser())),
new VGlue(space, 0),
new HBox(
new VGlue(space, 0),
new HGlue,
new PushButton("Cancel", state, '\007'),
new HGlue(space, 0),
new PushButton(acptLbl, state, '\r')
)
), space, space/2, 0
);
}
示例14: strlen
void FacebookProto::OpenUrl(std::string url)
{
std::string::size_type pos = url.find(FACEBOOK_SERVER_DOMAIN);
bool isFacebookUrl = (pos != std::string::npos);
bool isRelativeUrl = (url.substr(0, 4) != "http");
if (isFacebookUrl || isRelativeUrl) {
// Make realtive url
if (!isRelativeUrl) {
url = url.substr(pos + strlen(FACEBOOK_SERVER_DOMAIN));
// Strip eventual port
pos = url.find("/");
if (pos != std::string::npos && pos != 0)
url = url.substr(pos);
}
// Make absolute url
bool useHttps = getByte(FACEBOOK_KEY_FORCE_HTTPS, 1) > 0;
url = (useHttps ? HTTP_PROTO_SECURE : HTTP_PROTO_REGULAR) + facy.get_server_type() + url;
}
ptrT data( mir_utf8decodeT(url.c_str()));
// Check if there is user defined browser for opening links
ptrT browser(getTStringA(FACEBOOK_KEY_OPEN_URL_BROWSER));
if (browser != NULL)
// If so, use it to open this link
ForkThread(&FacebookProto::OpenUrlThread, new open_url(browser, data));
else
// Or use Miranda's service
CallService(MS_UTILS_OPENURL, (WPARAM)OUF_TCHAR, (LPARAM)data);
}
示例15: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow mainWin;
mainWin.setWindowTitle(QObject::tr("Qt SQL Browser"));
Browser browser(&mainWin);
mainWin.setCentralWidget(&browser);
QMenu *fileMenu = mainWin.menuBar()->addMenu(QObject::tr("&File"));
fileMenu->addAction(QObject::tr("Add &Connection..."), &browser, SLOT(addConnection()));
fileMenu->addSeparator();
fileMenu->addAction(QObject::tr("&Quit"), &app, SLOT(quit()));
QMenu *helpMenu = mainWin.menuBar()->addMenu(QObject::tr("&Help"));
helpMenu->addAction(QObject::tr("About"), &browser, SLOT(about()));
helpMenu->addAction(QObject::tr("About Qt"), qApp, SLOT(aboutQt()));
QObject::connect(&browser, SIGNAL(statusMessage(QString)),
mainWin.statusBar(), SLOT(showMessage(QString)));
addConnectionsFromCommandline(app.arguments(), &browser);
mainWin.show();
if (QSqlDatabase::connectionNames().isEmpty())
QMetaObject::invokeMethod(&browser, "addConnection", Qt::QueuedConnection);
return app.exec();
}