aboutsummaryrefslogtreecommitdiffhomepage
path: root/core
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-14 15:14:37 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-14 15:14:37 -0500
commit8ea898e863c8c62fc0230d1c76d58bc477a16d14 (patch)
tree3ef140fd116b037041a77ad69b1da45dde38d4d3 /core
parent95aca18efb8ace6d241070f52e3b092396d90aad (diff)
Added textadept.context_menu field for a custom popup context menu.
Diffstat (limited to 'core')
-rw-r--r--core/.textadept.lua3
-rw-r--r--core/ext/menu.lua12
2 files changed, 14 insertions, 1 deletions
diff --git a/core/.textadept.lua b/core/.textadept.lua
index 3a0442fa..d46f6331 100644
--- a/core/.textadept.lua
+++ b/core/.textadept.lua
@@ -15,6 +15,7 @@ module('textadept')
-- @field focused_doc_pointer The pointer to the document associated with the
-- buffer of the currently focused view. (Used internally; read-only)
-- @field menubar A table of GTK menus defining a menubar (write-only).
+-- @field context_menu A GTK menu defining the editor's context menu.
-- @field clipboard_text The text on the clipboard (read-only).
-- @field statusbar_text The text displayed by the statusbar (write-only).
-- @field docstatusbar_text The text displayed by the doc statusbar
@@ -22,7 +23,7 @@ module('textadept')
-- @field size The size of the Textadept window ({ width, height}).
textadept = {
title = nil, focused_doc_pointer = nil, clipboard_text = nil, menubar = nil,
- statusbar_text = nil, docstatusbar_text = nil, size = nil
+ context_menu = nil, statusbar_text = nil, docstatusbar_text = nil, size = nil
}
---
diff --git a/core/ext/menu.lua b/core/ext/menu.lua
index 1a2b06ed..3b3ec7ef 100644
--- a/core/ext/menu.lua
+++ b/core/ext/menu.lua
@@ -585,3 +585,15 @@ t.events.add_handler('menu_clicked',
end
end
end)
+
+t.context_menu = gtkmenu {
+ { l.MENU_EDIT_UNDO, ID.UNDO },
+ { l.MENU_EDIT_REDO, ID.REDO },
+ { SEPARATOR, ID.SEPARATOR },
+ { l.MENU_EDIT_CUT, ID.CUT },
+ { l.MENU_EDIT_COPY, ID.COPY },
+ { l.MENU_EDIT_PASTE, ID.PASTE },
+ { l.MENU_EDIT_DELETE, ID.DELETE },
+ { SEPARATOR, ID.SEPARATOR },
+ { l.MENU_EDIT_SELECT_ALL, ID.SELECT_ALL }
+}