Class: MyCellRendererText

Inherits:
Gtk::CellRendererText
  • Object
show all
Defined in:
lib/ListHolder/EditableList/CellRenderers/Text.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column) ⇒ MyCellRendererText

Returns a new instance of MyCellRendererText.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ListHolder/EditableList/CellRenderers/Text.rb', line 6

def initialize(column)
  @jump_to_next=false
  super()
  set_ellipsize(Pango::ELLIPSIZE_END)
  set_ellipsize_set(true)
#   set_wrap_mode(Pango::WRAP_WORD)
  signal_connect("edited") { |me,path,new_value|
    view.list_model.change_value_of_path(path,column.header['data'],new_value)
    if @jump_to_next
      if next_col=view.next_editable_column(column)
        view.set_cursor(view.list_model.iter_at_cursor.path,next_col,true)#  if next_col.header["type"]!="gtk_toggle"
      end
      @jump_to_next=false
    end
    true
  }
  signal_connect("editing-started"){|cell, editable_widget, path|
    editable_widget.signal_connect("key-press-event"){|me,event|
      @jump_to_next= Gdk::Keyval.to_name(event.keyval) == "Return"
      false
    }
  }
end

Instance Attribute Details

#model_col_numObject

Returns the value of attribute model_col_num.



29
30
31
# File 'lib/ListHolder/EditableList/CellRenderers/Text.rb', line 29

def model_col_num
  @model_col_num
end

#viewObject

Returns the value of attribute view.



30
31
32
# File 'lib/ListHolder/EditableList/CellRenderers/Text.rb', line 30

def view
  @view
end

Instance Method Details

#callerObject



45
46
47
# File 'lib/ListHolder/EditableList/CellRenderers/Text.rb', line 45

def caller
  view
end

#dataObject



42
43
44
# File 'lib/ListHolder/EditableList/CellRenderers/Text.rb', line 42

def data
  column.header["data"]
end

#set_column(column) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/ListHolder/EditableList/CellRenderers/Text.rb', line 32

def set_column(column)
  @column=column
  @view=column.list
  @model_col_num=column.colnum
  set_editable_set(column.header['editable'])
  set_editable(column.header['editable'])
#   set_mode(Gtk::CellRenderer::MODE_INERT)
#   set_sensitive(false)
end