Top Level Namespace

Defined Under Namespace

Modules: TkExtensions, TkWrapper, Util

Constant Summary collapse

LIB_DIR =
__dir__

Instance Method Summary collapse

Instance Method Details

#cell_bboxObject

returns the bounding box of the tk_widget



133
134
135
136
137
138
139
140
141
142
143
# File 'lib/widgets/base/widget.rb', line 133

def cell_bbox
  return unless (container = get_container_parent)

  grid_info = TkGrid.info(tk_widget)
  start_col = grid_info['column']
  end_col = start_col + grid_info['columnspan'] - 1
  start_row = grid_info['row']
  end_row = start_row + grid_info['rowspan'] - 1

  TkGrid.bbox(container.tk_widget, start_col, start_row, end_col, end_row)
end

#get_container_parentObject

the first parent, which contains a tk_widget, which is really different from self.tk_widget



122
123
124
125
126
127
128
129
130
# File 'lib/widgets/base/widget.rb', line 122

def get_container_parent
  container = @parent
  while container.tk_widget == tk_widget
    return unless container.parent # not in a grid?

    container = container.parent
  end
  container
end