Class: KeepYourHead::DialogEditText
- Inherits:
-
Object
- Object
- KeepYourHead::DialogEditText
- Defined in:
- lib/Keepyourhead/gui/DialogEditText.rb
Constant Summary collapse
- Widgets =
["viewport_edit", "labelName" ]
Instance Attribute Summary collapse
-
#changeProc ⇒ Object
Returns the value of attribute changeProc.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(name) ⇒ DialogEditText
constructor
A new instance of DialogEditText.
- #name ⇒ Object
- #name=(o) ⇒ Object
- #run ⇒ Object
- #text ⇒ Object
- #text=(t) ⇒ Object
Constructor Details
#initialize(name) ⇒ DialogEditText
Returns a new instance of DialogEditText.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 25 def initialize( name ) @glade = GladeXML.new(Resources::system("glade/DialogEditText.glade")) { |handler| method(handler) } @window = @glade.("dialog_edit_text") Widgets.each { |name| = @glade.(name) assert eval("@#{name} = widget") } self.name = name @window.title = "editieren" language = Gtk::SourceLanguagesManager.new.get_language("text/x-tex") @edit_buffer = Gtk::SourceBuffer.new language @edit_buffer.set_property( "check-brackets", true ) @edit_buffer.set_property( "highlight", true ) # @edit_buffer.set_property( "max-undo-levels", 20 ) @textview_latex = Gtk::SourceView.new @edit_buffer @textview_latex.set_property( "auto-indent", true) @textview_latex.set_property( "insert-spaces-instead-of-tabs", false) # @textview_latex.set_property( "margin", 10) @textview_latex.set_property( "show-line-markers", true) @textview_latex.set_property( "show-line-numbers", true) @textview_latex.set_property( "show-margin", true) @textview_latex.set_property( "smart-home-end", true) @textview_latex.set_property( "tabs-width", 4) @viewport_edit.add @textview_latex @textview_latex.show @window. Gtk::Stock::APPLY, Gtk::Dialog::RESPONSE_APPLY @window. Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL end |
Instance Attribute Details
#changeProc ⇒ Object
Returns the value of attribute changeProc.
21 22 23 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 21 def changeProc @changeProc end |
Instance Method Details
#destroy ⇒ Object
98 99 100 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 98 def destroy @window.destroy end |
#name ⇒ Object
63 64 65 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 63 def name @labelName.text end |
#name=(o) ⇒ Object
66 67 68 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 66 def name=(o) @labelName.text=o end |
#run ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 79 def run @window.show ret = nil while ret == nil do response = @window.run case response when Gtk::Dialog::RESPONSE_APPLY ret = true when Gtk::Dialog::RESPONSE_CANCEL ret = false end end ret end |
#text ⇒ Object
70 71 72 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 70 def text @edit_buffer.text end |
#text=(t) ⇒ Object
74 75 76 |
# File 'lib/Keepyourhead/gui/DialogEditText.rb', line 74 def text=(t) @edit_buffer.text = t end |