Exemplo n.º 1
0
void wxMenuBar::RebuildAccelTable()
{
    // merge the accelerators of all menus into one accel table
    size_t nAccelCount = 0;
    size_t i, count = GetMenuCount();
    wxMenuList::iterator it;
    for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
    {
        nAccelCount += (*it)->GetAccelCount();
    }

    if ( nAccelCount )
    {
        wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];

        nAccelCount = 0;
        for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
        {
            nAccelCount += (*it)->CopyAccels(&accelEntries[nAccelCount]);
        }

        SetAcceleratorTable(wxAcceleratorTable(nAccelCount, accelEntries));

        delete [] accelEntries;
    }
    else // No (more) accelerators.
    {
        SetAcceleratorTable(wxAcceleratorTable());
    }
}
Exemplo n.º 2
0
FileViewer::FileViewer(wxWindow *parent,
                       const wxString& basePath,
                       const wxArrayString& references,
                       int startAt)
        : wxFrame(parent, -1, _("Source file")),
          m_references(references)
{
    m_basePath = basePath;

    SetName("fileviewer");

    wxPanel *panel = new wxPanel(this, -1);
    wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
    panel->SetSizer(sizer);

    wxSizer *barsizer = new wxBoxSizer(wxHORIZONTAL);
    sizer->Add(barsizer, wxSizerFlags().Expand().Border());

    barsizer->Add(new wxStaticText(panel, wxID_ANY,
                                   _("Source file occurrence:")),
                  wxSizerFlags().Center().Border(wxRIGHT));

    wxChoice *choice = new wxChoice(panel, wxID_ANY);
    barsizer->Add(choice, wxSizerFlags(1).Center());

    for (size_t i = 0; i < references.Count(); i++)
        choice->Append(references[i]);
    choice->SetSelection(startAt);

    wxButton *edit = new wxButton(panel, wxID_ANY, _("Open In Editor"));
    barsizer->Add(edit, wxSizerFlags().Center().Border(wxLEFT, 10));

    m_text = new wxStyledTextCtrl(panel, wxID_ANY,
                                  wxDefaultPosition, wxDefaultSize,
                                  wxBORDER_THEME);
    SetupTextCtrl();
    sizer->Add(m_text, 1, wxEXPAND);

    RestoreWindowState(this, wxSize(600, 400));

    wxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
    topsizer->Add(panel, wxSizerFlags(1).Expand());
    SetSizer(topsizer);
    Layout();

    choice->Bind(wxEVT_CHOICE, &FileViewer::OnChoice, this);
    edit->Bind(wxEVT_BUTTON, &FileViewer::OnEditFile, this);

    ShowReference(m_references[startAt]);

#ifdef __WXOSX__
    wxAcceleratorEntry entries[] = {
        { wxACCEL_CMD,  'W', wxID_CLOSE }
    };
    wxAcceleratorTable accel(WXSIZEOF(entries), entries);
    SetAcceleratorTable(accel);

    Bind(wxEVT_MENU, [=](wxCommandEvent&){ Destroy(); }, wxID_CLOSE);
#endif
}
Exemplo n.º 3
0
SjVisFrame::SjVisFrame( wxWindow* parent, wxWindowID id, const wxString& title,
                        const wxPoint& pos, const wxSize& size,
                        long style)
	: wxFrame(parent, id, title, pos, size, style)
{
	SetAcceleratorTable(g_accelModule->GetAccelTable(SJA_MAIN));
}
Exemplo n.º 4
0
// Define my frame constructor
MyFrame::MyFrame(wxWindow *parent,
                 const wxWindowID id,
                 const wxString& title,
                 const wxPoint& pos,
                 const wxSize& size,
                 const long style)
       : wxMDIParentFrame(parent, id, title, pos, size,
                          style | wxNO_FULL_REPAINT_ON_RESIZE)
{
    textWindow = new wxTextCtrl(this, wxID_ANY, _T("A help window"),
                                wxDefaultPosition, wxDefaultSize,
                                wxTE_MULTILINE | wxSUNKEN_BORDER);

#if wxUSE_TOOLBAR
    CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
    InitToolBar(GetToolBar());
#endif // wxUSE_TOOLBAR

    // Accelerators
    wxAcceleratorEntry entries[3];
    entries[0].Set(wxACCEL_CTRL, (int) 'N', MDI_NEW_WINDOW);
    entries[1].Set(wxACCEL_CTRL, (int) 'X', MDI_QUIT);
    entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT);
    wxAcceleratorTable accel(3, entries);
    SetAcceleratorTable(accel);
}
Exemplo n.º 5
0
void FeedPanel::CreateAccelerators()
{
	wxAcceleratorEntry entries[1];
	entries[0].Set(wxACCEL_CTRL, (int)'C', ID_COPYTEXT);
	wxAcceleratorTable accel(1, entries);
	SetAcceleratorTable(accel);
}
Exemplo n.º 6
0
bool wxFrame::Create(wxWindow *parent,
                     wxWindowID id,
                     const wxString& title,
                     const wxPoint& pos,
                     const wxSize& size,
                     long style,
                     const wxString& name)
{
    if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
        return false;

    SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));

#if defined(__SMARTPHONE__)
    SetLeftMenu(wxID_EXIT, _("Done"));
#endif

#if wxUSE_ACCEL && defined(__POCKETPC__)
    // The guidelines state that Ctrl+Q should quit the app.
    // Let's define an accelerator table to send wxID_EXIT.
    wxAcceleratorEntry entries[1];
    entries[0].Set(wxACCEL_CTRL,   'Q',         wxID_EXIT);
    wxAcceleratorTable accel(1, entries);
    SetAcceleratorTable(accel);
#endif // wxUSE_ACCEL && __POCKETPC__

    return true;
}
Exemplo n.º 7
0
// -------------------------------------------------------------------------------- //
void guAlListBox::CreateAcceleratorTable( void )
{
    wxAcceleratorTable AccelTable;
    wxArrayInt AliasAccelCmds;
    wxArrayInt RealAccelCmds;

    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_SAVE );
    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_EDITLABELS );
    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_EDITTRACKS );
    AliasAccelCmds.Add( ID_TRACKS_PLAY );
    AliasAccelCmds.Add( ID_TRACKS_ENQUEUE_AFTER_ALL );
    AliasAccelCmds.Add( ID_TRACKS_ENQUEUE_AFTER_TRACK );
    AliasAccelCmds.Add( ID_TRACKS_ENQUEUE_AFTER_ALBUM );
    AliasAccelCmds.Add( ID_TRACKS_ENQUEUE_AFTER_ARTIST );
    AliasAccelCmds.Add( ID_PLAYER_PLAYLIST_SEARCH );

    RealAccelCmds.Add( ID_ALBUM_SAVETOPLAYLIST );
    RealAccelCmds.Add( ID_ALBUM_EDITLABELS );
    RealAccelCmds.Add( ID_ALBUM_EDITTRACKS );
    RealAccelCmds.Add( ID_ALBUM_PLAY );
    RealAccelCmds.Add( ID_ALBUM_ENQUEUE_AFTER_ALL );
    RealAccelCmds.Add( ID_ALBUM_ENQUEUE_AFTER_TRACK );
    RealAccelCmds.Add( ID_ALBUM_ENQUEUE_AFTER_ALBUM );
    RealAccelCmds.Add( ID_ALBUM_ENQUEUE_AFTER_ARTIST );
    RealAccelCmds.Add( ID_LIBRARY_SEARCH );

    if( guAccelDoAcceleratorTable( AliasAccelCmds, RealAccelCmds, AccelTable ) )
    {
        SetAcceleratorTable( AccelTable );
    }
}
Exemplo n.º 8
0
bool wxFrame::ShowFullScreen(bool show, long style)
{
    if (!wxFrameBase::ShowFullScreen(show, style))
        return false;

#if wxUSE_MENUS && wxUSE_ACCEL
    if (show && GetMenuBar())
    {
        wxAcceleratorTable table(wxCreateAcceleratorTableForMenuBar(GetMenuBar()));
        if (table.IsOk())
            SetAcceleratorTable(table);
    }
#endif // wxUSE_MENUS && wxUSE_ACCEL

    wxWindow* const bar[] = {
#if wxUSE_MENUS
        m_frameMenuBar,
#else
        NULL,
#endif
#if wxUSE_TOOLBAR
        m_frameToolBar,
#else
        NULL,
#endif
#if wxUSE_STATUSBAR
        m_frameStatusBar,
#else
        NULL,
#endif
    };
    const long fsNoBar[] = {
        wxFULLSCREEN_NOMENUBAR, wxFULLSCREEN_NOTOOLBAR, wxFULLSCREEN_NOSTATUSBAR
    };
    for (int i = 0; i < 3; i++)
    {
        if (show)
        {
            if (bar[i] && (style & fsNoBar[i]))
            {
                if (bar[i]->IsShown())
                    bar[i]->Show(false);
                else
                    style &= ~fsNoBar[i];
            }
        }
        else
        {
            if (bar[i] && (m_fsSaveFlag & fsNoBar[i]))
                bar[i]->Show(true);
        }
    }
    if (show)
        m_fsSaveFlag = style;

    return true;
}
Exemplo n.º 9
0
SjVisFrame::SjVisFrame( wxWindow* parent, const wxPoint& pos, const wxSize& size, bool fullscreen)
	: wxFrame(parent, wxID_ANY, _("Video screen"), pos, size,
				fullscreen? (wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxFULL_REPAINT_ON_RESIZE|wxFRAME_NO_TASKBAR) : (wxCLIP_CHILDREN|wxFULL_REPAINT_ON_RESIZE|wxFRAME_NO_TASKBAR))
{
	SetAcceleratorTable(g_accelModule->GetAccelTable(SJA_MAIN));
	if( fullscreen ) {
        ShowFullScreen(true);
	}
}
Exemplo n.º 10
0
void SearchPanel::InitAcceleratorTable() {
	const unsigned int accelcount = 3;
	wxAcceleratorEntry entries[accelcount];
	entries[0].Set(wxACCEL_ALT, (int)'R', REPLACE_REPLACE);
	entries[1].Set(wxACCEL_ALT, (int)'A', REPLACE_ALL);
	entries[2].Set(wxACCEL_NORMAL, WXK_ESCAPE, SEARCH_CLOSE);
	wxAcceleratorTable accel(accelcount, entries);
	SetAcceleratorTable(accel);
}
Exemplo n.º 11
0
FindFrame::FindFrame(wxWindow *parent,
                     PoeditListCtrl *list,
                     Catalog *c,
                     wxTextCtrl *textCtrlOrig,
                     wxTextCtrl *textCtrlTrans,
                     wxTextCtrl *textCtrlComments,
                     wxTextCtrl *textCtrlAutoComments)
        : m_listCtrl(list),
          m_catalog(c),
          m_position(-1),
          m_textCtrlOrig(textCtrlOrig),
          m_textCtrlTrans(textCtrlTrans),
          m_textCtrlComments(textCtrlComments),
          m_textCtrlAutoComments(textCtrlAutoComments)
{
    wxXmlResource::Get()->LoadDialog(this, parent, "find_frame");

    m_textField = XRCCTRL(*this, "string_to_find", wxTextCtrl);

    SetEscapeId(wxID_CLOSE);

    RestoreWindowState(this, wxDefaultSize, WinState_Pos);

    m_btnNext = XRCCTRL(*this, "find_next", wxButton);
    m_btnPrev = XRCCTRL(*this, "find_prev", wxButton);

    if ( !ms_text.empty() )
    {
        m_textField->SetValue(ms_text);
        m_textField->SelectAll();
    }

    Reset(c);

    XRCCTRL(*this, "in_orig", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("find_in_orig", true));
    XRCCTRL(*this, "in_trans", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("find_in_trans", true));
    XRCCTRL(*this, "in_comments", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("find_in_comments", true));
    XRCCTRL(*this, "in_auto_comments", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("find_in_auto_comments", true));
    XRCCTRL(*this, "case_sensitive", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("find_case_sensitive", false));
    XRCCTRL(*this, "from_first", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("find_from_first", true));
    XRCCTRL(*this, "whole_words", wxCheckBox)->SetValue(
        wxConfig::Get()->ReadBool("whole_words", false));

#ifdef __WXOSX__
    wxAcceleratorEntry entries[] = {
        { wxACCEL_CMD,  'W', wxID_CLOSE }
    };
    wxAcceleratorTable accel(WXSIZEOF(entries), entries);
    SetAcceleratorTable(accel);
#endif
}
Exemplo n.º 12
0
wxExListView::wxExListView(wxWindow* parent,
  wxWindowID id,
  const wxPoint& pos,
  const wxSize& size,
  long style,
  wxExImageType image_type,
  const wxValidator& validator,
  const wxString &name)
  : wxListView(parent, id, pos, size, style, validator, name)
  , m_FieldSeparator('\t')
  , m_ImageType(image_type)
  , m_ImageHeight(16)
  , m_ImageWidth(16)
  , m_SortedColumnNo(-1)
{
#if wxUSE_DRAG_AND_DROP
  SetDropTarget(new ListViewDropTarget(this));
#endif

  if (image_type != IMAGE_NONE)
  {
    if (image_type == IMAGE_ART || image_type == IMAGE_OWN)
    {
      AssignImageList(
        new wxImageList(
          m_ImageWidth, 
          m_ImageHeight, true, 0), 
        wxIMAGE_LIST_SMALL);
    }
    else if (image_type == IMAGE_FILE_ICON)
    {
      SetImageList(
        wxTheFileIconsTable->GetSmallImageList(), 
        wxIMAGE_LIST_SMALL);
    }
    else
    {
      wxFAIL;
    }
  }

  SetFont(wxConfigBase::Get()->ReadObject(
    _("List Font"), wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT)));

  wxAcceleratorEntry entries[4];

  entries[0].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_DELETE);
  entries[1].Set(wxACCEL_CTRL, WXK_INSERT, wxID_COPY);
  entries[2].Set(wxACCEL_SHIFT, WXK_INSERT, wxID_PASTE);
  entries[3].Set(wxACCEL_SHIFT, WXK_DELETE, wxID_CUT);

  wxAcceleratorTable accel(WXSIZEOF(entries), entries);
  SetAcceleratorTable(accel);
}
Exemplo n.º 13
0
void wxGISApplicationEx::Customize(void)
{
	wxGISCustomizeDlg dialog(this);
	if(dialog.ShowModal() == wxID_OK )
	{
		if(m_pGISAcceleratorTable->HasChanges())
			SetAcceleratorTable(m_pGISAcceleratorTable->GetAcceleratorTable());
		wxGISToolBarMenu* pToolBarMenu =  static_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME));
		if(pToolBarMenu)
			pToolBarMenu->Update();
	}
}
Exemplo n.º 14
0
    MainFrame() {
        SetBackgroundColour(GetChildren()[0]->GetBackgroundColour());
        createProgramsPage();
        populateActivationKeyList();
        sendOptionsToControls(options);
        KeyList->SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT));

        wxAcceleratorEntry entries[2];
        entries[0].Set(wxACCEL_NORMAL, WXK_ESCAPE, CancelButton->GetId());
        entries[1].Set(wxACCEL_NORMAL, WXK_F1, HelpButton->GetId());
        wxAcceleratorTable accel(2, entries);
        SetAcceleratorTable(accel);
    };
Exemplo n.º 15
0
DialogWithHelp::DialogWithHelp(frmMain *frame) : pgDialog()
{
	mainForm = frame;

	wxAcceleratorEntry entries[2];
	entries[0].Set(wxACCEL_NORMAL, WXK_F1, MNU_HELP);
// this is for GTK because Meta (usually Numlock) is interpreted like Alt
// there are too many controls to reset m_Meta in all of them
	entries[1].Set(wxACCEL_ALT, WXK_F1, MNU_HELP);
	wxAcceleratorTable accel(2, entries);

	SetAcceleratorTable(accel);
}
Exemplo n.º 16
0
SaveMgrWindow::SaveListCtrl::SaveListCtrl(wxWindow *parent, Instance *inst)
	: wxListCtrl(parent, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_VIRTUAL | wxLC_VRULES)
{
	m_inst = inst;
	UpdateListItems();

	const int accelCount = 3;
	wxAcceleratorEntry entries[accelCount];
	entries[0].Set(wxACCEL_NORMAL,	WXK_DELETE,	wxID_DELETE);
	entries[1].Set(wxACCEL_CTRL,	(int) 'C',	wxID_COPY);
	entries[2].Set(wxACCEL_CTRL,	(int) 'V',	wxID_PASTE);
	wxAcceleratorTable accel(accelCount, entries);
	SetAcceleratorTable(accel);
}
Exemplo n.º 17
0
MainWindow::MainWindow() {
	this->Create((wxFrame*)NULL, wxID_ANY, SkinSystem::GetSkinSystem()->GetWindowTitle(),
		wxDefaultPosition, wxSize(WINDOW_WIDTH, 550), MAINWINDOW_STYLE);
	
	SkinSystem::RegisterTCSkinChanged(this);

	this->FS2_pid = 0;
	this->FRED2_pid = 0;

	this->SetFont(SkinSystem::GetSkinSystem()->GetFont());
	this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));

	this->SetStatusBar(new StatusBar(this));

#if IS_WIN32 || IS_LINUX
	this->SetIcon(SkinSystem::GetSkinSystem()->GetWindowIcon());
#endif

	// setup keyboard shortcuts
	wxAcceleratorEntry entries[1];
	entries[0].Set(wxACCEL_NORMAL, WXK_F3, ID_F3_PRESSED);
	wxAcceleratorTable accel(1, entries);
	SetAcceleratorTable(accel);
	
	// setup tabs

	this->mainTab = new wxNotebook();
	this->mainTab->Create(this, ID_MAINTAB, wxPoint(0,0), wxSize(WINDOW_WIDTH,-1), wxNB_TOP);

	this->mainTab->AddPage(new WelcomePage(this->mainTab), _("Welcome"), true);
	this->mainTab->AddPage(new ModsPage(this->mainTab), _("Mods"), false);
	this->mainTab->AddPage(new BasicSettingsPage(this->mainTab), _("Basic Settings"), false);
	this->mainTab->AddPage(new AdvSettingsPage(this->mainTab), _("Advanced Settings"), false);
#if 0
	this->mainTab->AddPage(new InstallPage(this->mainTab), _("Install/Update"), false);
#endif
	wxPoint bbpoint(0, -1);
	wxSize bbsize(WINDOW_WIDTH, -1);
	BottomButtons* bb = new BottomButtons(this, bbpoint, bbsize);

	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);

	sizer->Add(this->mainTab);
	sizer->Add(bb, wxSizerFlags().Expand());

	sizer->SetSizeHints(this);
	this->SetSizerAndFit(sizer);
	this->Layout();
	this->Center();
}
Exemplo n.º 18
0
bool wxGISApplication::CreateApp(void)
{
	CreateStatusBar();
	wxFrame::GetStatusBar()->SetStatusText(_("Ready"));

    if(!wxGISApplicationBase::CreateApp())
        return false;
    //load commandbars
	SerializeCommandBars();

	//load accelerators
    m_pGISAcceleratorTable = new wxGISAcceleratorTable(this);


    wxGISAppConfig oConfig = GetConfig();
	if(!oConfig.IsOk())
		return false;
    // create MenuBar
	wxXmlNode* pMenuBarNode = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/frame/menubar")));

    m_pMenuBar = new wxGISMenuBar(wxMB_DOCKABLE, this, pMenuBarNode); //wxMB_DOCKABLE
    SetMenuBar(static_cast<wxMenuBar*>(m_pMenuBar));

	//mark menues from menu bar as enumGISTAMMenubar
	for(size_t i = 0; i < m_CommandBarArray.GetCount(); ++i)
		if(m_pMenuBar->IsMenuBarMenu(m_CommandBarArray[i]->GetName()))
			m_CommandBarArray[i]->SetType(enumGISCBMenubar);

    // min size for the frame itself isn't completely done.
    // see the end up wxAuiManager::Update() for the test
    // code. For now, just hard code a frame minimum size
    SetMinSize(wxSize(800,480));

	SerializeFramePos(false);
	SetAcceleratorTable(m_pGISAcceleratorTable->GetAcceleratorTable());
    SetApplication( this );

//    wxHtmlWindow *pHtmlText = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_DEFAULT_STYLE | wxBORDER_THEME);
//    pHtmlText->SetPage(wxT("<html><body><h1>Error</h1>Some error occurred :-H)</body></hmtl>"));
//    pHtmlText->Show(false);
//    RegisterChildWindow(pHtmlText->GetId());
//
//#ifdef __WXGTK__
// //   wxGISToolBarMenu* pToolBarMenu =  dynamic_cast<wxGISToolBarMenu*>(GetCommandBar(TOOLBARMENUNAME));
//	//if(pToolBarMenu)
//	//    PushEventHandler(pToolBarMenu);
////	m_pMenuBar->PushEventHandler(this);
//#endif
    return true;
}
Exemplo n.º 19
0
ModEditWindow::ModListCtrl::ModListCtrl(wxWindow *parent, int id, Instance *inst)
	: wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize, 
				 wxLC_REPORT | wxLC_VIRTUAL | wxLC_VRULES)
{
	m_inst = inst;
	m_insMarkIndex = -1;

	const int accelCount = 3;
	wxAcceleratorEntry entries[accelCount];
	entries[0].Set(wxACCEL_NORMAL,	WXK_DELETE,	wxID_DELETE);
	entries[1].Set(wxACCEL_CTRL,	(int) 'C',	wxID_COPY);
	entries[2].Set(wxACCEL_CTRL,	(int) 'V',	wxID_PASTE);
	wxAcceleratorTable accel(accelCount, entries);
	SetAcceleratorTable(accel);
}
Exemplo n.º 20
0
void wxExFrame::Initialize()
{
#if wxUSE_DRAG_AND_DROP
    SetDropTarget(new FileDropTarget(this));
#endif

    wxAcceleratorEntry entries[4];
    entries[0].Set(wxACCEL_NORMAL, WXK_F5, wxID_FIND);
    entries[1].Set(wxACCEL_NORMAL, WXK_F6, wxID_REPLACE);
    entries[2].Set(wxACCEL_CTRL, (int)'I', ID_VIEW_MENUBAR);
    entries[3].Set(wxACCEL_CTRL, (int)'T', ID_VIEW_TITLEBAR);

    wxAcceleratorTable accel(WXSIZEOF(entries), entries);
    SetAcceleratorTable(accel);
}
Exemplo n.º 21
0
// Define my frame constructor
csFrame::csFrame(wxDocManager* manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
  wxDocMDIParentFrame(manager, parent, id, title, pos, size, style, _T("frame"))
{
    CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL);
    wxGetApp().InitToolBar(GetToolBar());

    // Accelerators
    wxAcceleratorEntry entries[4];

    entries[0].Set(wxACCEL_NORMAL,  WXK_F1,        wxID_HELP);
    entries[1].Set(wxACCEL_CTRL,   'O',            wxID_OPEN);
    entries[2].Set(wxACCEL_CTRL,   'N',            wxID_NEW);
    entries[3].Set(wxACCEL_CTRL,   'P',            wxID_PRINT);

    wxAcceleratorTable accel(4, entries);
    SetAcceleratorTable(accel);
}
Exemplo n.º 22
0
wxExFindTextCtrl::wxExFindTextCtrl(
  wxWindow* parent,
  wxExFrame* frame,
  wxWindowID id,
  const wxPoint& pos,
  const wxSize& size)
  : wxTextCtrl(parent, 
      id,
      wxExFindReplaceData::Get()->GetFindString(), 
      pos, size, wxTE_PROCESS_ENTER)
  , m_Frame(frame)
{
  const int accels = 1;
  wxAcceleratorEntry entries[accels];
  entries[0].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_DELETE);
  wxAcceleratorTable accel(accels, entries);
  SetAcceleratorTable(accel);
  
  Bind(wxEVT_CHAR, [=](wxKeyEvent& event) {
    if (!wxExFindReplaceData::Get()->m_FindStrings.Set(event.GetKeyCode(), this))
    {
      event.Skip();
    }});
  
  Bind(wxEVT_SET_FOCUS, [=](wxFocusEvent& event) {
    wxExSTC* stc = m_Frame->GetSTC();
    if (stc != nullptr)
    {
      stc->PositionSave();
    }
    event.Skip();});

  Bind(wxEVT_TEXT, [=](wxCommandEvent& event) {
    event.Skip();
    Find(true, true);});

  Bind(wxEVT_TEXT_ENTER, [=](wxCommandEvent& event) {
    event.Skip();
    if (!GetValue().empty())
    {
      wxExFindReplaceData::Get()->SetFindString(GetValue().ToStdString());
      Find();
    }});
}
Exemplo n.º 23
0
csLabelEditingDialog::csLabelEditingDialog(wxWindow* parent)
{
    wxLoadFromResource(this, parent, _T("shape_label_dialog"));

    // Accelerators
    wxAcceleratorEntry entries[1];
    entries[0].Set(wxACCEL_CTRL, WXK_RETURN, wxID_OK);
    wxAcceleratorTable accel(1, entries);
    SetAcceleratorTable(accel);

    Centre();

    wxTextCtrl* textCtrl = (wxTextCtrl*) FindWindow(ID_LABELTEXT);
    wxASSERT( (textCtrl != NULL) );

//    textCtrl->SetAcceleratorTable(accel);

    textCtrl->SetFocus();
}
Exemplo n.º 24
0
bool wxDialogEx::Load(wxWindow* pParent, const wxString& name)
{
	SetParent(pParent);
	if (!wxXmlResource::Get()->LoadDialog(this, pParent, name))
		return false;

	//GetSizer()->Fit(this);
	//GetSizer()->SetSizeHints(this);

#ifdef __WXMAC__
	wxAcceleratorEntry entries[2];
	entries[0].Set(wxACCEL_CMD, 'V', pasteId);
	entries[1].Set(wxACCEL_CMD, 'A', selectAllId);
	wxAcceleratorTable accel(sizeof(entries) / sizeof(wxAcceleratorEntry), entries);
	SetAcceleratorTable(accel);
#endif

	return true;
}
Exemplo n.º 25
0
csLabelEditingDialog::csLabelEditingDialog(wxWindow* parent)
{
    //wxLoadFromResource(this, parent, wxT("shape_label_dialog"));

    // Accelerators
    const wxAcceleratorEntry accel[] =
    {
        wxAcceleratorEntry(wxACCEL_CTRL, WXK_RETURN, wxID_OK)
    };
    SetAcceleratorTable(wxAcceleratorTable(WXSIZEOF(accel), accel));

    Centre();

    wxTextCtrl* textCtrl = XRCCTRL(*this, "text", wxTextCtrl);
    wxASSERT(textCtrl);

//    textCtrl->SetAcceleratorTable(accel);

    textCtrl->SetFocus();
}
Exemplo n.º 26
0
myGotoDlg::myGotoDlg (wxWindow *parent,
                      long style)
         : wxScrollingDialog (parent, -1, _("Goto line"),
                     wxDefaultPosition, wxDefaultSize,
                     style | wxDEFAULT_DIALOG_STYLE) {

    //accelerators (for help)
    const int nEntries = 1 ;
    wxAcceleratorEntry entries[nEntries];
    entries[0].Set (wxACCEL_NORMAL, WXK_F1, wxID_HELP);
    wxAcceleratorTable accel (nEntries, entries);
    SetAcceleratorTable (accel);

    // goto
    wxBoxSizer *gotopane = new wxBoxSizer (wxHORIZONTAL);
    gotopane->Add (new wxStaticText (this, -1, _("Go to:"),
                                     wxDefaultPosition, wxSize(60, -1)),
                   0, wxALIGN_TOP | wxALIGN_LEFT);
    gotopane->Add (6, 0);
    m_position = new wxTextCtrl (this, -1, _T(""),
                                 wxDefaultPosition, wxSize(60, -1));
    gotopane->Add (m_position, 0, wxALIGN_TOP | wxALIGN_RIGHT);

    // buttons
    wxBoxSizer *buttonpane = new wxBoxSizer (wxVERTICAL);
    m_gotoButton = new wxButton (this, wxID_OK, _("&Goto"));
    m_gotoButton->SetDefault();
    buttonpane->Add (m_gotoButton, 0, wxEXPAND | wxALIGN_TOP | wxBOTTOM, 6);
    m_cancelButton = new wxButton (this, wxID_CANCEL, _("Cancel"));
    buttonpane->Add (m_cancelButton, 0, wxEXPAND | wxALIGN_BOTTOM);

    wxBoxSizer *totalpane = new wxBoxSizer (wxHORIZONTAL);
    totalpane->Add (gotopane, 0, wxEXPAND | wxALL, 10);
    totalpane->Add (buttonpane, 0, wxEXPAND | wxALL, 10);

    m_position->SetFocus();
    m_position->SetSelection (-1, -1);
    SetSizerAndFit (totalpane);

}
Exemplo n.º 27
0
wxMaximaFrame::wxMaximaFrame(wxWindow* parent, int id, const wxString& title,
                             const wxPoint& pos, const wxSize& size,
                             long style):
    wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
{
  m_manager.SetManagedWindow(this);
  // console
  m_console = new MathCtrl(this, -1, wxDefaultPosition, wxDefaultSize);

  // history
  m_history = new History(this, -1);

  m_plotSlider = NULL;

  SetupMenu();
#if defined (__WXMSW__) || defined (__WXGTK20__) || defined (__WXMAC__)
  SetupToolBar();
#endif


  CreateStatusBar(2);
  int widths[] =
    {
      -1, 300
    };
  SetStatusWidths(2, widths);

#if defined __WXMSW__
  wxAcceleratorEntry entries[0];
  entries[0].Set(wxACCEL_CTRL,  WXK_RETURN, menu_evaluate);
  wxAcceleratorTable accel(1, entries);
  SetAcceleratorTable(accel);
#endif

  set_properties();
  do_layout();

  m_console->SetFocus();
}
MetadataItemPropertiesPanel::MetadataItemPropertiesPanel(
    MetadataItemPropertiesFrame* parent, MetadataItem* object)
    : wxPanel(parent, wxID_ANY), pageTypeM(ptSummary), objectM(object),
      htmlReloadRequestedM(false)
{
    wxASSERT(object);
    mipPanels.push_back(this);

    html_window = new PrintableHtmlWindow(this, wxID_ANY);
    parent->SetTitle(object->getName_());

    wxBoxSizer* bSizer2 = new wxBoxSizer( wxVERTICAL );
    bSizer2->Add(html_window, 1, wxEXPAND, 0 );
    SetSizer( bSizer2 );
    Layout();

    wxAcceleratorEntry entries[4];
    entries[0].Set(wxACCEL_CMD, (int) 'W', wxID_CLOSE_FRAME);
    entries[1].Set(wxACCEL_CMD, (int) 'R', wxID_REFRESH);
    // MSW only
    entries[2].Set(wxACCEL_CTRL, WXK_F4, wxID_CLOSE_FRAME);
    entries[3].Set(wxACCEL_NORMAL, WXK_F5, wxID_REFRESH);

    bool isMSW =
        (wxPlatformInfo::Get().GetOperatingSystemId() & wxOS_WINDOWS) != 0;
    wxAcceleratorTable acct(isMSW ? 4 : 2, entries);
    SetAcceleratorTable(acct);

    Connect(wxID_CLOSE_FRAME, wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(MetadataItemPropertiesPanel::OnCloseFrame));
    Connect(wxID_ANY, wxEVT_COMMAND_HTML_CELL_HOVER,
            wxHtmlCellEventHandler(MetadataItemPropertiesPanel::OnHtmlCellHover));
    Connect(wxID_REFRESH, wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(MetadataItemPropertiesPanel::OnRefresh));

    // request initial rendering
    requestLoadPage(true);
    objectM->attachObserver(this, true);
}
Exemplo n.º 29
0
ctlSQLGrid::ctlSQLGrid(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
	: wxGrid(parent, id, pos, size, wxWANTS_CHARS | wxVSCROLL | wxHSCROLL)
{
	// Set cells font
	wxFont fntCells(settings->GetSQLFont());
	SetDefaultCellFont(fntCells);
	// Set labels font
	wxFont fntLabel(settings->GetSystemFont());
	fntLabel.SetWeight(wxBOLD);
	SetLabelFont(fntLabel);
	SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
	SetRowLabelSize(50);
	SetDefaultRowSize(fntCells.GetPointSize() * 2);
	SetColLabelSize(fntLabel.GetPointSize() * 4);
	SetDefaultCellOverflow(false);

	wxAcceleratorEntry entries[1];
	entries[0].Set(wxACCEL_CTRL,                (int)'C',      MNU_COPY);
	wxAcceleratorTable accel(1, entries);
	SetAcceleratorTable(accel);

	Connect(wxID_ANY, wxEVT_GRID_LABEL_LEFT_DCLICK, wxGridEventHandler(ctlSQLGrid::OnLabelDoubleClick));
}
Exemplo n.º 30
0
csMDIChildFrame::csMDIChildFrame(wxDocument* doc, wxView* view, wxMDIParentFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
  wxDocMDIChildFrame(doc, view, parent, id, title, pos, size, style)
{
    // Accelerators
    wxAcceleratorEntry entries[18];

    // Usual editing functions
    entries[0].Set(wxACCEL_NORMAL,  WXK_DELETE,     wxID_CLEAR);
    entries[1].Set(wxACCEL_CTRL,    'X',            wxID_CUT);
    entries[2].Set(wxACCEL_CTRL,    'C',            wxID_COPY);
    entries[3].Set(wxACCEL_SHIFT,   WXK_INSERT,     wxID_PASTE);
    entries[4].Set(wxACCEL_CTRL,    'V',            wxID_PASTE);
    entries[5].Set(wxACCEL_CTRL,    'A',            ID_CS_SELECT_ALL);

    // Undo/redo
    entries[6].Set(wxACCEL_CTRL,    'Z',            wxID_UNDO);
    entries[7].Set(wxACCEL_CTRL,    'Y',            wxID_REDO);

    // Other
    entries[8].Set(wxACCEL_NORMAL,  WXK_RETURN,     ID_CS_EDIT_PROPERTIES);
    entries[9].Set(wxACCEL_ALT,     WXK_RETURN,     ID_CS_EDIT_PROPERTIES);
    entries[10].Set(wxACCEL_CTRL,   'D',            wxID_DUPLICATE);
    entries[11].Set(wxACCEL_NORMAL,  WXK_F1,        wxID_HELP);

    // File handling
    entries[12].Set(wxACCEL_CTRL,   'S',            wxID_SAVE);
    entries[13].Set(wxACCEL_NORMAL,  WXK_F12,       wxID_SAVEAS);
    entries[14].Set(wxACCEL_CTRL,   'O',            wxID_OPEN);
    entries[15].Set(wxACCEL_CTRL,   'N',            wxID_NEW);
    entries[16].Set(wxACCEL_CTRL,   'P',            wxID_PRINT);
    entries[17].Set(wxACCEL_CTRL,   'W',            wxID_CLOSE);


    wxAcceleratorTable accel(18, entries);
    SetAcceleratorTable(accel);
}