Add Context Menu and full path tooltip to tabs
This commit is contained in:
parent
61a4adeebb
commit
c39dd8b9ac
@ -1,9 +1,8 @@
|
||||
#include "EditPane.h"
|
||||
|
||||
EditPane::EditPane(
|
||||
wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||
const wxSize &size, long style
|
||||
) : wxStyledTextCtrl (parent, id, pos, size, style)
|
||||
wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size
|
||||
) : wxStyledTextCtrl (parent, id, pos, size, wxBORDER_NONE)
|
||||
{
|
||||
#include <config/languages_json.h>
|
||||
lang_config = new TyroConfig();
|
||||
|
@ -13,12 +13,7 @@ public:
|
||||
wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint &post = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style =
|
||||
#ifndef __WXMAC__
|
||||
wxSUNKEN_BORDER |
|
||||
#endif
|
||||
wxVSCROLL
|
||||
const wxSize &size = wxDefaultSize
|
||||
);
|
||||
~EditPane();
|
||||
wxFileName fileName;
|
||||
@ -37,6 +32,7 @@ private:
|
||||
enum
|
||||
{
|
||||
MARGIN_FOLD,
|
||||
MARGIN_SYMBOL,
|
||||
MARGIN_LINE_NUMBERS
|
||||
};
|
||||
bool FileReadable();
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "MainFrame.h"
|
||||
|
||||
// Top level menus
|
||||
enum {
|
||||
enum myMenuIds {
|
||||
myFILE_MENU,
|
||||
myEDIT_MENU,
|
||||
myVIEW_MENU,
|
||||
@ -13,7 +13,7 @@ enum {
|
||||
};
|
||||
|
||||
// Menu ids
|
||||
enum {
|
||||
enum myMenuItemIds {
|
||||
myID_VIEW_WHITESPACE = wxID_HIGHEST
|
||||
};
|
||||
|
||||
@ -188,6 +188,7 @@ void MainFrame::BindEvents()
|
||||
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditUndo, this, wxID_UNDO);
|
||||
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditRedo, this, wxID_REDO);
|
||||
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnToggleWhitespace, this, myID_VIEW_WHITESPACE);
|
||||
Bind(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, &MainFrame::OnTabContextMenu, this, wxID_ANY);
|
||||
}
|
||||
|
||||
void MainFrame::OnNew(wxCommandEvent &WXUNUSED(event))
|
||||
@ -417,3 +418,12 @@ void MainFrame::EnableEditControls(bool enable)
|
||||
this->toolBar->EnableTool(wxID_CUT, enable);
|
||||
this->toolBar->EnableTool(wxID_PASTE, enable);
|
||||
}
|
||||
|
||||
void MainFrame::OnTabContextMenu(wxAuiNotebookEvent &WXUNUSED(event))
|
||||
{
|
||||
// Create Menu
|
||||
wxMenu *contextMenu = new wxMenu();
|
||||
contextMenu->Append(wxID_CLOSE, "&Close\tCtrl+W", "Close the current tab");
|
||||
|
||||
this->PopupMenu(contextMenu);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class MainFrame: public wxFrame
|
||||
void BindEvents();
|
||||
void EnableEditControls(bool enable=true);
|
||||
|
||||
// Event handlers
|
||||
// Main Menu Event handlers
|
||||
void OnNew(wxCommandEvent &event);
|
||||
void OnOpen(wxCommandEvent &event);
|
||||
void OnClose(wxAuiNotebookEvent &event);
|
||||
@ -52,6 +52,9 @@ class MainFrame: public wxFrame
|
||||
void OnToggleWhitespace(wxCommandEvent &event);
|
||||
void OnQuit(wxCommandEvent &event);
|
||||
void OnAbout(wxCommandEvent &event);
|
||||
|
||||
// Tab Context Menu Event handlers
|
||||
void OnTabContextMenu(wxAuiNotebookEvent &event);
|
||||
};
|
||||
|
||||
|
||||
|
@ -53,6 +53,8 @@ void TabContainer::AddTab(wxString filePath)
|
||||
{
|
||||
this->AddPage(editor, caption, true);
|
||||
|
||||
this->SetPageToolTip(this->GetPageIndex(this->GetCurrentPage()), fileName.GetFullPath());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "EditPane.h"
|
||||
|
||||
|
||||
static long tab_style = wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS
|
||||
| wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS
|
||||
| wxAUI_NB_MIDDLE_CLICK_CLOSE | wxAUI_NB_TOP;
|
||||
static long tab_style = wxBORDER_NONE | wxAUI_NB_TAB_SPLIT |wxAUI_NB_TAB_MOVE
|
||||
| wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON
|
||||
| wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_MIDDLE_CLICK_CLOSE | wxAUI_NB_TOP;
|
||||
|
||||
class TabContainer: public wxAuiNotebook
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user