本文整理汇总了C++中wxString函数的典型用法代码示例。如果您正苦于以下问题:C++ wxString函数的具体用法?C++ wxString怎么用?C++ wxString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clang_getNumCompletionChunks
void ClangDriver::DoParseCompletionString(CXCompletionString str,
int depth,
wxString& entryName,
wxString& signature,
wxString& completeString,
wxString& returnValue)
{
bool collectingSignature = false;
int numOfChunks = clang_getNumCompletionChunks(str);
for(int j = 0; j < numOfChunks; j++) {
CXString chunkText = clang_getCompletionChunkText(str, j);
CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(str, j);
switch(chunkKind) {
case CXCompletionChunk_TypedText:
entryName = wxString(clang_getCString(chunkText), wxConvUTF8);
completeString += entryName;
break;
case CXCompletionChunk_ResultType:
completeString += wxString(clang_getCString(chunkText), wxConvUTF8);
completeString += wxT(" ");
returnValue = wxString(clang_getCString(chunkText), wxConvUTF8);
break;
case CXCompletionChunk_Optional: {
// Optional argument
CXCompletionString optStr = clang_getCompletionChunkCompletionString(str, j);
wxString optionalString;
wxString dummy;
// Once we hit the 'Optional Chunk' only the 'completeString' is matter
DoParseCompletionString(optStr, depth + 1, dummy, dummy, optionalString, dummy);
if(collectingSignature) {
signature += optionalString;
}
completeString += optionalString;
}
break;
case CXCompletionChunk_LeftParen:
collectingSignature = true;
signature += wxT("(");
completeString += wxT("(");
break;
case CXCompletionChunk_RightParen:
collectingSignature = true;
signature += wxT(")");
completeString += wxT(")");
break;
default:
if(collectingSignature) {
signature += wxString(clang_getCString(chunkText), wxConvUTF8);
}
completeString += wxString(clang_getCString(chunkText), wxConvUTF8);
break;
}
clang_disposeString(chunkText);
}
// To make this tag compatible with ctags one, we need to place
// a /^ and $/ in the pattern string (we add this only to the top level completionString)
if(depth == 0) {
completeString.Prepend(wxT("/^ "));
completeString.Append(wxT(" $/"));
}
}
示例2: pgFrame
frmDatabaseDesigner::frmDatabaseDesigner(frmMain *form, const wxString &_title, pgConn *conn)
: pgFrame(NULL, _title)
{
mainForm = form;
SetTitle(wxT("Database Designer"));
SetIcon(wxIcon(*ddmodel_32_png_ico));
loading = true;
closing = false;
RestorePosition(100, 100, 600, 500, 450, 300);
SetMinSize(wxSize(450, 300));
// connection
connection = conn;
// notify wxAUI which frame to use
manager.SetManagedWindow(this);
manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG);
wxWindowBase::SetFont(settings->GetSystemFont());
// Set File menu
fileMenu = new wxMenu();
fileMenu->Append(MNU_NEW, _("&New database design\tCtrl-N"), _("Create a new database design"));
fileMenu->AppendSeparator();
fileMenu->Append(MNU_LOADMODEL, _("&Open Model..."), _("Open an existing database design from a file"));
fileMenu->Append(MNU_SAVEMODEL, _("&Save Model"), _("Save changes at database design"));
fileMenu->Append(MNU_SAVEMODELAS, _("&Save Model As..."), _("Save database design at new file"));
fileMenu->AppendSeparator();
fileMenu->Append(CTL_IMPSCHEMA, _("&Import Tables..."), _("Import tables from database schema to database designer model"));
fileMenu->AppendSeparator();
fileMenu->Append(MNU_EXIT, _("E&xit\tCtrl-W"), _("Exit database designer window"));
// Set Diagram menu
diagramMenu = new wxMenu();
diagramMenu->Append(MNU_NEWDIAGRAM, _("&New model diagram"), _("Create a new diagram"));
diagramMenu->Append(MNU_DELDIAGRAM, _("&Delete selected model diagram..."), _("Delete selected diagram"));
diagramMenu->Append(MNU_RENDIAGRAM, _("&Rename selected model diagram..."), _("Rename selected diagram"));
// Set View menu
viewMenu = new wxMenu();
viewMenu->AppendCheckItem(MNU_TOGGLEMBROWSER, _("&Model Browser"), _("Show / Hide Model Browser Window"));
viewMenu->AppendCheckItem(MNU_TOGGLEDDSQL, _("&SQL Window"), _("Show / Hide SQL Window"));
viewMenu->Check(MNU_TOGGLEDDSQL, true);
viewMenu->Check(MNU_TOGGLEMBROWSER, true);
// Set Help menu
helpMenu = new wxMenu();
helpMenu->Append(MNU_CONTENTS, _("&Help"), _("Open the helpfile."));
helpMenu->Append(MNU_HELP, _("&SQL Help\tF1"), _("Display help on SQL commands."));
// Set menu bar
menuBar = new wxMenuBar();
menuBar->Append(fileMenu, _("&File"));
menuBar->Append(diagramMenu, _("&Diagram"));
menuBar->Append(viewMenu, _("&View"));
menuBar->Append(helpMenu, _("&Help"));
SetMenuBar(menuBar);
// Set status bar
int iWidths[6] = {0, -1, 40, 150, 80, 80};
CreateStatusBar(6);
SetStatusBarPane(-1);
SetStatusWidths(6, iWidths);
// Set toolbar
toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER);
toolBar->SetToolBitmapSize(wxSize(16, 16));
toolBar->AddTool(MNU_NEW, _("New Model"), *file_new_png_bmp, _("Create new model"), wxITEM_NORMAL);
toolBar->AddTool(MNU_NEWDIAGRAM, _("New Diagram"), *ddnewdiagram_png_bmp, _("Add new diagram"), wxITEM_NORMAL);
toolBar->AddSeparator();
toolBar->AddTool(MNU_LOADMODEL, _("Open Model"), *file_open_png_bmp, _("Open existing model"), wxITEM_NORMAL);
toolBar->AddTool(MNU_SAVEMODEL, _("Save Model"), *file_save_png_bmp, _("Save current model"), wxITEM_NORMAL);
toolBar->AddSeparator();
toolBar->AddTool(MNU_ADDTABLE, _("Add Table"), *table_png_bmp, _("Add empty table to the current model"), wxITEM_NORMAL);
toolBar->AddTool(MNU_DELETETABLE, _("Delete Table"), wxBitmap(*ddRemoveTable2_png_img), _("Delete selected table"), wxITEM_NORMAL);
toolBar->AddTool(MNU_ADDCOLUMN, _("Add Column"), *table_png_bmp, _("Add new column to the selected table"), wxITEM_NORMAL);
toolBar->AddSeparator();
toolBar->AddTool(MNU_GENERATEMODEL, _("Generate Model"), *continue_png_bmp, _("Generate SQL for the current model"), wxITEM_NORMAL);
toolBar->AddTool(MNU_GENERATEDIAGRAM, _("Generate Diagram"), *ddgendiagram_png_bmp, _("Generate SQL for the current diagram"), wxITEM_NORMAL);
toolBar->AddSeparator();
toolBar->AddTool(CTL_IMPSCHEMA, _("Import Tables from database..."), *conversion_png_ico, _("Import tables from database schema to database designer model"), wxITEM_NORMAL);
toolBar->AddSeparator();
toolBar->AddTool(MNU_HELP, _("Help"), *help_png_bmp, _("Display help"), wxITEM_NORMAL);
toolBar->Realize();
// Create notebook for diagrams
diagrams = new ctlAuiNotebook(this, CTL_DDNOTEBOOK, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS);
// Now, the scratchpad
sqltext = new ctlSQLBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2);
//Now, the Objects Browser
wxSizer *browserSizer = new wxBoxSizer(wxHORIZONTAL);
browserPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
// Add the database designer
design = new ddDatabaseDesign(diagrams, this);
// Create database model browser
//.........这里部分代码省略.........
示例3: wxString
wxString Token::GetImplFilename() const
{
if (!m_TokenTree)
return wxString(_T(""));
return m_TokenTree->GetFilename(m_ImplFileIdx);
}
示例4: Collapse
//------------------------------------------------------------------------------
void OutputTree::UpdateOutput(bool resetTree, bool removeReports, bool removePlots)
{
#if DEBUG_OUTPUT_TREE
MessageInterface::ShowMessage
("OutputTree::UpdateOutput() resetTree=%d, removeReports=%d, removePlots=%d\n",
resetTree, removeReports, removePlots);
#endif
// Collapse all reports. Consider ephemeris file as a report
if (removeReports)
{
Collapse(mReportItem);
Collapse(mEphemFileItem);
if (GmatGlobal::Instance()->IsEventLocationAvailable())
Collapse(mEventsItem);
}
// Remove all plots
if (removePlots)
{
Collapse(mOrbitViewItem);
Collapse(mGroundTrackItem);
Collapse(mXyPlotItem);
}
// Delete all reports. Consider ephemeris file as a report
if (removeReports)
{
DeleteChildren(mReportItem);
DeleteChildren(mEphemFileItem);
if (GmatGlobal::Instance()->IsEventLocationAvailable())
DeleteChildren(mEventsItem);
}
// Delete all plots
if (removePlots)
{
DeleteChildren(mOrbitViewItem);
DeleteChildren(mGroundTrackItem);
DeleteChildren(mXyPlotItem);
}
if (resetTree) // do not load subscribers
return;
// get list of report files, ephemeris files, opengl plots, and xy plots
StringArray listOfSubs = theGuiInterpreter->GetListOfObjects(Gmat::SUBSCRIBER);
// put each subscriber in the proper folder
for (unsigned int i=0; i<listOfSubs.size(); i++)
{
Subscriber *sub =
(Subscriber*)theGuiInterpreter->GetConfiguredObject(listOfSubs[i]);
wxString objName = wxString(listOfSubs[i].c_str());
wxString objTypeName = wxString(sub->GetTypeName().c_str());
objTypeName = objTypeName.Trim();
if (objTypeName == "ReportFile")
{
AppendItem(mReportItem, objName, GmatTree::OUTPUT_ICON_REPORT_FILE, -1,
new GmatTreeItemData(objName, GmatTree::OUTPUT_REPORT));
}
// Removed checking for write ephemeris flag sice ephemeris file can be
// toggled on after it is intially toggled off (LOJ: 2013.03.20)
else if (objTypeName == "EphemerisFile")
//&& sub->GetBooleanParameter("WriteEphemeris"))
{
if (sub->GetStringParameter("FileFormat") == "CCSDS-OEM")
{
AppendItem(mEphemFileItem, objName, GmatTree::OUTPUT_ICON_CCSDS_OEM_FILE, -1,
new GmatTreeItemData(objName, GmatTree::OUTPUT_CCSDS_OEM_FILE));
}
}
else if (objTypeName == "OrbitView" &&
sub->GetBooleanParameter("ShowPlot"))
{
AppendItem(mOrbitViewItem, objName, GmatTree::OUTPUT_ICON_ORBIT_VIEW, -1,
new GmatTreeItemData(objName, GmatTree::OUTPUT_ORBIT_VIEW));
}
else if (objTypeName == "GroundTrackPlot" &&
sub->GetBooleanParameter("ShowPlot"))
{
AppendItem(mGroundTrackItem, objName, GmatTree::OUTPUT_ICON_GROUND_TRACK_PLOT, -1,
new GmatTreeItemData(objName, GmatTree::OUTPUT_GROUND_TRACK_PLOT));
}
else if (objTypeName == "XYPlot" &&
sub->GetBooleanParameter("ShowPlot"))
{
AppendItem(mXyPlotItem, objName, GmatTree::OUTPUT_ICON_XY_PLOT, -1,
new GmatTreeItemData(objName, GmatTree::OUTPUT_XY_PLOT));
}
}
// get list of Event Locators
if (GmatGlobal::Instance()->IsEventLocationAvailable())
{
StringArray listOfEls = theGuiInterpreter->GetListOfObjects(Gmat::EVENT_LOCATOR);
for (UnsignedInt i = 0; i < listOfEls.size(); ++i)
//.........这里部分代码省略.........
示例5: DoSetSelection
void wxTextEntry::Remove(long from, long to)
{
DoSetSelection(from, to, SetSel_NoScroll);
WriteText(wxString());
}
示例6: wxIMPLEMENT_DYNAMIC_CLASS_XTI
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler, "wx/menu.h")
wxCOLLECTION_TYPE_INFO( wxMenuItem *, wxMenuItemList ) ;
#if wxUSE_EXTENDED_RTTI
template<> void wxCollectionToVariantArray( wxMenuItemList const &theList,
wxAnyList &value)
{
wxListCollectionToAnyList<wxMenuItemList::compatibility_iterator>( theList, value ) ;
}
#endif
wxBEGIN_PROPERTIES_TABLE(wxMenu)
wxEVENT_PROPERTY( Select, wxEVT_COMMAND_MENU_SELECTED, wxCommandEvent)
wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString(), \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
wxREADONLY_PROPERTY_FLAGS( MenuStyle, wxMenuStyle, long, GetStyle, \
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), \
wxT("group")) // style
wxPROPERTY_COLLECTION( MenuItems, wxMenuItemList, wxMenuItem*, Append, \
GetMenuItems, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
wxEND_PROPERTIES_TABLE()
wxEMPTY_HANDLERS_TABLE(wxMenu)
wxDIRECT_CONSTRUCTOR_2( wxMenu, wxString, Title, long, MenuStyle )
wxDEFINE_FLAGS( wxMenuBarStyle )
示例7: RecalculateSize
// Define a constructor
TCWin::TCWin( ChartCanvas *parent, int x, int y, void *pvIDX )
{
// As a display optimization....
// if current color scheme is other than DAY,
// Then create the dialog ..WITHOUT.. borders and title bar.
// This way, any window decorations set by external themes, etc
// will not detract from night-vision
long wstyle = wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE /*| wxRESIZE_BORDER*/ ;
if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY )
&& ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER );
#ifdef __WXOSX__
wstyle |= wxSTAY_ON_TOP;
#endif
pParent = parent;
m_x = x;
m_y = y;
m_created = false;
RecalculateSize();
wxDialog::Create( parent, wxID_ANY, wxString( _T ( "" ) ), m_position ,
m_tc_size, wstyle );
m_created = true;
wxFont *qFont = GetOCPNScaledFont(_("Dialog"));
SetFont( *qFont );
pIDX = (IDX_entry *) pvIDX;
gpIDXn++;
// Set up plot type
if( strchr( "Tt", pIDX->IDX_type ) ) {
m_plot_type = TIDE_PLOT;
SetTitle( wxString( _( "Tide" ) ) );
gpIDX = pIDX; // remember pointer for routeplan
} else {
m_plot_type = CURRENT_PLOT;
SetTitle( wxString( _( "Current" ) ) );
}
m_pTCRolloverWin = NULL;
int sx, sy;
GetClientSize( &sx, &sy );
// Figure out this computer timezone minute offset
wxDateTime this_now = wxDateTime::Now();
wxDateTime this_gmt = this_now.ToGMT();
#if wxCHECK_VERSION(2, 6, 2)
wxTimeSpan diff = this_now.Subtract( this_gmt );
#else
wxTimeSpan diff = this_gmt.Subtract ( this_now );
#endif
int diff_mins = diff.GetMinutes();
int station_offset = ptcmgr->GetStationTimeOffset( pIDX );
m_corr_mins = station_offset - diff_mins;
if( this_now.IsDST() ) m_corr_mins += 60;
// Establish the inital drawing day as today
m_graphday = wxDateTime::Now();
wxDateTime graphday_00 = wxDateTime::Today();
time_t t_graphday_00 = graphday_00.GetTicks();
// Correct a Bug in wxWidgets time support
if( !graphday_00.IsDST() && m_graphday.IsDST() ) t_graphday_00 -= 3600;
if( graphday_00.IsDST() && !m_graphday.IsDST() ) t_graphday_00 += 3600;
m_t_graphday_00_at_station = t_graphday_00 - ( m_corr_mins * 60 );
btc_valid = false;
wxString* TClist = NULL;
m_tList = new wxListBox( this, -1, wxPoint( sx * 65 / 100, 11 ),
wxSize( ( sx * 32 / 100 ), ( sy * 20 / 100 ) ), 0, TClist,
wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL );
// Measure the size of a generic button, with label
wxButton *test_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( -1, -1), wxDefaultSize );
test_button->GetSize( &m_tsx, &m_tsy );
delete test_button;
// In the interest of readability, if the width of the dialog is too narrow,
// simply skip showing the "Hi/Lo" list control.
if( (m_tsy * 15) > sx )
m_tList->Hide();
//.........这里部分代码省略.........
示例8: AppendText
void NyqRedirector::AppendText()
{
mText->AppendText(wxString(s.c_str(), wxConvISO8859_1));
s.clear();
}
示例9: wxGetApp
// show project properties
//
void CDlgItemProperties::renderInfos(PROJECT* project_in) {
std::string projectname;
//collecting infos
project_in->get_name(projectname);
//disk usage needs additional lookups
CMainDocument* pDoc = wxGetApp().GetDocument();
pDoc->CachedDiskUsageUpdate();
// CachedDiskUsageUpdate() may have invalidated our project
// pointer, so get an updated pointer to this project
PROJECT* project = pDoc->project(project_in->master_url);
if (!project) return; // TODO: display some sort of error alert?
std::vector<PROJECT*> dp = pDoc->disk_usage.projects;
double diskusage=0.0;
for (unsigned int i=0; i< dp.size(); i++) {
PROJECT* tp = dp[i];
std::string tname;
tp->get_name(tname);
wxString t1(wxString(tname.c_str(), wxConvUTF8));
if(t1.IsSameAs(wxString(projectname.c_str(), wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url, wxConvUTF8))) {
diskusage = tp->disk_usage;
break;
}
}
//set dialog title
wxString wxTitle = _("Properties of project ");
wxTitle.append(wxString(projectname.c_str(),wxConvUTF8));
SetTitle(wxTitle);
//layout controls
addSection(_("General"));
addProperty(_("URL"), wxString(project->master_url, wxConvUTF8));
addProperty(_("User name"), wxString(project->user_name.c_str(), wxConvUTF8));
addProperty(_("Team name"), wxString(project->team_name.c_str(), wxConvUTF8));
addProperty(_("Resource share"), wxString::Format(wxT("%0.0f"), project->resource_share));
if (project->min_rpc_time > dtime()) {
addProperty(_("Scheduler RPC deferred for"), FormatTime(project->min_rpc_time - dtime()));
}
if (project->download_backoff) {
addProperty(_("File downloads deferred for"), FormatTime(project->download_backoff));
}
if (project->upload_backoff) {
addProperty(_("File uploads deferred for"), FormatTime(project->upload_backoff));
}
addProperty(_("Disk usage"), FormatDiskSpace(diskusage));
addProperty(_("Computer ID"), wxString::Format(wxT("%d"), project->hostid));
if (project->non_cpu_intensive) {
addProperty(_("Non CPU intensive"), _("yes"));
}
addProperty(_("Suspended via GUI"), project->suspended_via_gui ? _("yes") : _("no"));
addProperty(_("Don't request more work"), project->dont_request_more_work ? _("yes") : _("no"));
if (project->scheduler_rpc_in_progress) {
addProperty(_("Scheduler call in progress"), _("yes"));
}
if (project->trickle_up_pending) {
addProperty(_("Trickle-up pending"), _("yes"));
}
if (strlen(project->venue)) {
addProperty(_("Host location"), wxString(project->venue, wxConvUTF8));
} else {
addProperty(_("Host location"), _("default"));
}
if (project->attached_via_acct_mgr) {
addProperty(_("Added via account manager"), _("yes"));
}
if (project->detach_when_done) {
addProperty(_("Remove when tasks done"), _("yes"));
}
if (project->ended) {
addProperty(_("Ended"), _("yes"));
}
addProperty(_("Tasks completed"), wxString::Format(wxT("%d"), project->njobs_success));
addProperty(_("Tasks failed"), wxString::Format(wxT("%d"), project->njobs_error));
addSection(_("Credit"));
addProperty(_("User"),
wxString::Format(
wxT("%0.2f total, %0.2f average"),
project->user_total_credit,
project->user_expavg_credit
)
);
addProperty(_("Host"),
wxString::Format(
wxT("%0.2f total, %0.2f average"),
project->host_total_credit,
project->host_expavg_credit
)
);
if (!project->non_cpu_intensive) {
addSection(_("Scheduling"));
addProperty(_("Scheduling priority"), wxString::Format(wxT("%0.2f"), project->sched_priority));
show_rsc(_("CPU"), project->rsc_desc_cpu);
if (pDoc->state.host_info.coprocs.have_nvidia()) {
show_rsc(
wxString(proc_type_name(PROC_TYPE_NVIDIA_GPU), wxConvUTF8),
//.........这里部分代码省略.........
示例10: NewHandleClear
void wxMenuBar::MacInstallMenuBar()
{
if ( s_macInstalledMenuBar == this )
return ;
MenuBarHandle menubar = NULL ;
#if TARGET_API_MAC_OSX
menubar = NewHandleClear( 6 /* sizeof( MenuBarHeader ) */ ) ;
#else
menubar = NewHandleClear( 12 ) ;
(*menubar)[3] = 0x0a ;
#endif
::SetMenuBar( menubar ) ;
DisposeMenuBar( menubar ) ;
MenuHandle appleMenu = NULL ;
verify_noerr( CreateNewMenu( kwxMacAppleMenuId , 0 , &appleMenu ) ) ;
verify_noerr( SetMenuTitleWithCFString( appleMenu , CFSTR( "\x14" ) ) );
// Add About/Preferences separator only on OS X
// KH/RN: Separator is always present on 10.3 but not on 10.2
// However, the change from 10.2 to 10.3 suggests it is preferred
#if TARGET_API_MAC_OSX
InsertMenuItemTextWithCFString( appleMenu,
CFSTR(""), 0, kMenuItemAttrSeparator, 0);
#endif
InsertMenuItemTextWithCFString( appleMenu,
CFSTR("About..."), 0, 0, 0);
MacInsertMenu( appleMenu , 0 ) ;
// clean-up the help menu before adding new items
static MenuHandle mh = NULL ;
if ( mh != NULL )
{
MenuItemIndex firstUserHelpMenuItem ;
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
{
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
DeleteMenuItem( mh , i ) ;
}
else
{
mh = NULL ;
}
}
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
{
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
if ( item == NULL || !(item->IsEnabled()) )
DisableMenuCommand( NULL , kHICommandPreferences ) ;
else
EnableMenuCommand( NULL , kHICommandPreferences ) ;
}
// Unlike preferences which may or may not exist, the Quit item should be always
// enabled unless it is added by the application and then disabled, otherwise
// a program would be required to add an item with wxID_EXIT in order to get the
// Quit menu item to be enabled, which seems a bit burdensome.
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macExitMenuItemId)
{
wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
if ( item != NULL && !(item->IsEnabled()) )
DisableMenuCommand( NULL , kHICommandQuit ) ;
else
EnableMenuCommand( NULL , kHICommandQuit ) ;
}
#endif
wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ;
wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ;
wxString strippedWindowMenuTitle = wxStripMenuCodes( wxString(wxT("&Window")) /* wxApp::s_macWindowMenuTitleName */ ) ;
wxString strippedTranslatedWindowMenuTitle = wxStripMenuCodes( wxString( _("&Window") ) ) ;
wxMenuList::compatibility_iterator menuIter = m_menus.GetFirst();
for (size_t i = 0; i < m_menus.GetCount(); i++, menuIter = menuIter->GetNext())
{
wxMenuItemList::compatibility_iterator node;
wxMenuItem *item;
wxMenu* menu = menuIter->GetData() , *subMenu = NULL ;
wxString strippedMenuTitle = wxStripMenuCodes(m_titles[i]);
if ( strippedMenuTitle == wxT("?") || strippedMenuTitle == strippedHelpMenuTitle || strippedMenuTitle == strippedTranslatedHelpMenuTitle )
{
for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext())
{
item = (wxMenuItem *)node->GetData();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding() );
MenuItemIndex position = CountMenuItems(mh);
::SetMenuItemHierarchicalMenu(mh, position, MAC_WXHMENU(subMenu->GetHMenu()));
}
else
{
//.........这里部分代码省略.........
示例11: GetSelectedCount
// -------------------------------------------------------------------------------- //
void guPcListBox::CreateContextMenu( wxMenu * Menu ) const
{
wxMenuItem * MenuItem;
int SelCount = GetSelectedCount();
int ContextMenuFlags = m_LibPanel->GetContextMenuFlags();
MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_PLAY,
wxString( _( "Play" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_PLAY ),
_( "Play current selected tracks" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_player_tiny_light_play ) );
Menu->Append( MenuItem );
MenuItem->Enable( SelCount );
MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_ENQUEUE_AFTER_ALL,
wxString( _( "Enqueue" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_ALL ),
_( "Add current selected tracks to playlist" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
Menu->Append( MenuItem );
MenuItem->Enable( SelCount );
wxMenu * EnqueueMenu = new wxMenu();
MenuItem = new wxMenuItem( EnqueueMenu, ID_PLAYCOUNT_ENQUEUE_AFTER_TRACK,
wxString( _( "Current Track" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_TRACK ),
_( "Add current selected tracks to playlist after the current track" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
EnqueueMenu->Append( MenuItem );
MenuItem->Enable( SelCount );
MenuItem = new wxMenuItem( EnqueueMenu, ID_PLAYCOUNT_ENQUEUE_AFTER_ALBUM,
wxString( _( "Current Album" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_ALBUM ),
_( "Add current selected tracks to playlist after the current album" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
EnqueueMenu->Append( MenuItem );
MenuItem->Enable( SelCount );
MenuItem = new wxMenuItem( EnqueueMenu, ID_PLAYCOUNT_ENQUEUE_AFTER_ARTIST,
wxString( _( "Current Artist" ) ) + guAccelGetCommandKeyCodeString( ID_TRACKS_ENQUEUE_AFTER_ARTIST ),
_( "Add current selected tracks to playlist after the current artist" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_add ) );
EnqueueMenu->Append( MenuItem );
MenuItem->Enable( SelCount );
Menu->Append( wxID_ANY, _( "Enqueue After" ), EnqueueMenu );
if( SelCount )
{
if( ContextMenuFlags & guCONTEXTMENU_EDIT_TRACKS )
{
Menu->AppendSeparator();
MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_EDITTRACKS,
wxString( _( "Edit Songs" ) ) + guAccelGetCommandKeyCodeString( ID_PLAYER_PLAYLIST_EDITTRACKS ),
_( "Edit the selected tracks" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_edit ) );
Menu->Append( MenuItem );
}
Menu->AppendSeparator();
MenuItem = new wxMenuItem( Menu, ID_PLAYCOUNT_SAVETOPLAYLIST,
wxString( _( "Save to Playlist" ) ) + guAccelGetCommandKeyCodeString( ID_PLAYER_PLAYLIST_SAVE ),
_( "Save the selected tracks to playlist" ) );
MenuItem->SetBitmap( guImage( guIMAGE_INDEX_tiny_doc_save ) );
Menu->Append( MenuItem );
if( ContextMenuFlags & guCONTEXTMENU_COPY_TO )
{
Menu->AppendSeparator();
m_LibPanel->CreateCopyToMenu( Menu );
}
}
m_LibPanel->CreateContextMenu( Menu );
}
示例12: OnDegButton
void ParamEdit::OnDegButton(wxCommandEvent &event) {
m_unit_input->WriteText(wxString(wxConvUTF8.cMB2WC(degree_char), *wxConvCurrent));
}
示例13: _T
void ParamEdit::InitWidget(wxWindow *parent) {
wxXmlResource::Get()->LoadDialog(this, parent, _T("param_edit"));
m_unit_input = XRCCTRL(*this, "text_ctrl_unit", wxTextCtrl);
assert(m_unit_input);
wxStaticText *code_editor_stub = XRCCTRL(*this, "code_editor_stub", wxStaticText);
wxSizer* stub_sizer = code_editor_stub->GetContainingSizer();
size_t i = 0;
while (stub_sizer->GetItem(i) && stub_sizer->GetItem(i)->GetWindow() != code_editor_stub)
i++;
assert(stub_sizer->GetItem(i));
wxWindow *stub_parent = code_editor_stub->GetParent();
m_formula_input = new CodeEditor(stub_parent);
m_formula_input->SetSize(code_editor_stub->GetSize());
stub_sizer->Detach(code_editor_stub);
code_editor_stub->Destroy();
stub_sizer->Insert(i, m_formula_input, 1, wxALL | wxEXPAND, 4 );
stub_sizer->Layout();
m_found_date_label = XRCCTRL(*this, "found_date_label", wxStaticText);
m_prec_spin = XRCCTRL(*this, "spin_ctrl_prec", wxSpinCtrl);
m_spin_ctrl_start_hours = XRCCTRL(*this, "spin_ctrl_start_hours", wxSpinCtrl);
m_spin_ctrl_start_minutes = XRCCTRL(*this, "spin_ctrl_start_minutes", wxSpinCtrl);
m_datepicker_ctrl_start_date = XRCCTRL(*this, "datepicker_ctrl_start_date", wxDatePickerCtrl);
m_checkbox_start = XRCCTRL(*this, "checkbox_start", wxCheckBox);
m_button_base_config = XRCCTRL(*this, "button_base_config", wxButton);
m_button_formula_undo = XRCCTRL(*this, "formula_undo_button", wxButton);
m_button_formula_redo = XRCCTRL(*this, "formula_redo_button", wxButton);
m_button_formula_new_param = XRCCTRL(*this, "formula_new_param_button", wxButton);
m_formula_type_choice = XRCCTRL(*this, "FORMULA_TYPE_CHOICE", wxChoice);
m_param_name_input = XRCCTRL(*this, "parameter_name", wxTextCtrl);
m_user_param_label = XRCCTRL(*this, "user_param_label", wxStaticText);
m_datepicker_ctrl_start_date->Enable(false);
m_datepicker_ctrl_start_date->SetValue(wxDateTime::Now());
m_spin_ctrl_start_hours->Enable(false);
m_spin_ctrl_start_minutes->Enable(false);
m_spin_ctrl_start_hours->SetValue(0);
m_spin_ctrl_start_minutes->SetValue(0);
wxButton* degree_button = XRCCTRL(*this, "button_degree", wxButton);
degree_button->SetLabel(wxString(wxConvUTF8.cMB2WC(degree_char), *wxConvCurrent));
m_inc_search = NULL;
m_error = false;
m_params_list = NULL;
SetIcon(szFrame::default_icon);
Centre();
}
示例14: ap
void ClangDriver::OnPrepareTUEnded(wxCommandEvent& e)
{
// Our thread is done
m_isBusy = false;
// Sanity
ClangThreadReply* reply = (ClangThreadReply*)e.GetClientData();
if(!reply) {
return;
}
// Make sure we delete the reply at the end...
std::auto_ptr<ClangThreadReply> ap(reply);
// Delete the fake file...
DoDeleteTempFile(reply->filename);
// Just a notification without real info?
if(reply->context == CTX_None) {
return;
}
if(reply->context == ::CTX_CachePCH || reply->context == ::CTX_ReparseTU) {
return; // Nothing more to be done
}
if(reply->context == CTX_GotoDecl || reply->context == CTX_GotoImpl) {
// Unlike other context's the 'filename' specified here
// does not belong to an editor (it could, but it is not necessarily true)
DoGotoDefinition(reply);
return;
}
// Adjust the activeEditor to fit the filename
IEditor* editor = clMainFrame::Get()->GetMainBook()->FindEditor(reply->filename);
if(!editor) {
CL_DEBUG(wxT("Could not find an editor for file %s"), reply->filename.c_str());
return;
}
m_activeEditor = editor;
// What should we do with the TU?
switch(reply->context) {
case CTX_CachePCH:
// Nothing more to be done
return;
default:
break;
}
if(!reply->results && !reply->errorMessage.IsEmpty()) {
// Notify about this error
clCommandEvent event(wxEVT_CLANG_CODE_COMPLETE_MESSAGE);
event.SetString(reply->errorMessage);
event.SetInt(1); // indicates that this is an error message
EventNotifier::Get()->AddPendingEvent(event);
return;
}
if(m_activeEditor->GetCurrentPosition() < m_position) {
CL_DEBUG(wxT("Current position is lower than the starting position, ignoring completion"));
clang_disposeCodeCompleteResults(reply->results);
return;
}
wxString typedString;
if(m_activeEditor->GetCurrentPosition() > m_position) {
// User kept on typing while the completion thread was working
typedString = m_activeEditor->GetTextRange(m_position, m_activeEditor->GetCurrentPosition());
if(typedString.find_first_not_of(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_")) !=
wxString::npos) {
// User typed some non valid identifier char, cancel code completion
CL_DEBUG(
wxT("User typed: %s since the completion thread started working until it ended, ignoring completion"),
typedString.c_str());
clang_disposeCodeCompleteResults(reply->results);
return;
}
}
// update the filter word
reply->filterWord.Append(typedString);
CL_DEBUG(wxT("clang completion: filter word is %s"), reply->filterWord.c_str());
// For the Calltip, remove the opening brace from the filter string
wxString filterWord = reply->filterWord;
if(GetContext() == CTX_Calltip && filterWord.EndsWith(wxT("("))) filterWord.RemoveLast();
wxString lowerCaseFilter = filterWord;
lowerCaseFilter.MakeLower();
unsigned numResults = reply->results->NumResults;
clang_sortCodeCompletionResults(reply->results->Results, reply->results->NumResults);
std::vector<TagEntryPtr> tags;
for(unsigned i = 0; i < numResults; i++) {
CXCompletionResult result = reply->results->Results[i];
CXCompletionString str = result.CompletionString;
CXCursorKind kind = result.CursorKind;
//.........这里部分代码省略.........
示例15: switch
void WXMSearchReplaceDialog::WXMSearchReplaceDialogKeyDown(wxKeyEvent& event)
{
int key=event.GetKeyCode();
//g_SearchReplaceDialog->SetTitle(wxString()<<key);
switch(key)
{
case WXK_ESCAPE:
g_SearchReplaceDialog->Show(false);
return;
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
if(this->GetClassInfo()->GetClassName()!=wxString(wxT("wxButton")))
{
wxCommandEvent e;
wxButton* default_btn = static_cast<wxButton*>(g_SearchReplaceDialog->GetDefaultItem());
if(default_btn == g_SearchReplaceDialog->WxButtonReplace)
return g_SearchReplaceDialog->WxButtonReplaceClick(e); // no skip
return g_SearchReplaceDialog->WxButtonFindNextClick(e); // no skip
}
break;
case WXK_DOWN:
if((MadEdit*)this==g_SearchReplaceDialog->m_FindText)
{
int x,y,w,h;
g_SearchReplaceDialog->m_FindText->GetPosition(&x, &y);
g_SearchReplaceDialog->m_FindText->GetSize(&w, &h);
g_SearchReplaceDialog->PopupMenu(&g_SearchReplaceDialog->WxPopupMenuRecentFindText, x, y+h);
return;
}
else if((MadEdit*)this==g_SearchReplaceDialog->m_ReplaceText)
{
int x,y,w,h;
g_SearchReplaceDialog->m_ReplaceText->GetPosition(&x, &y);
g_SearchReplaceDialog->m_ReplaceText->GetSize(&w, &h);
g_SearchReplaceDialog->PopupMenu(&g_SearchReplaceDialog->WxPopupMenuRecentReplaceText, x, y+h);
return;
}
break;
}
extern wxAcceleratorEntry g_AccelFindNext, g_AccelFindPrev;
int flags=wxACCEL_NORMAL;
if(event.m_altDown) flags|=wxACCEL_ALT;
if(event.m_shiftDown) flags|=wxACCEL_SHIFT;
if(event.m_controlDown) flags|=wxACCEL_CTRL;
if(g_AccelFindNext.GetKeyCode()==key && g_AccelFindNext.GetFlags()==flags)
{
wxCommandEvent e;
g_SearchReplaceDialog->WxButtonFindNextClick(e);
return; // no skip
}
if(g_AccelFindPrev.GetKeyCode()==key && g_AccelFindPrev.GetFlags()==flags)
{
wxCommandEvent e;
g_SearchReplaceDialog->WxButtonFindPrevClick(e);
return; // no skip
}
event.Skip();
}