module Gdk::Coordinate

Messageをレンダリングする際の、各パーツの座標の取得設定のためのモジュール

Constants

CoordinateStruct
DEPTH

Attributes

color[RW]
icon_height[RW]
icon_margin[RW]
icon_width[RW]
width[RW]

Public Instance Methods

height() click to toggle source

高さを計算して返す

# File core/mui/cairo_coordinate_module.rb, line 42
def height
  @height ||= Hash.new
  @height[width] ||=
    [(main_message.size[1] + header_left.size[1]) / Pango::SCALE, icon_height].max + icon_margin*2 + subparts_height
end
mainpart_height() click to toggle source
# File core/mui/cairo_coordinate_module.rb, line 48
def mainpart_height
  @minpart_height ||= Hash.new
  @minpart_height[width] ||= height - subparts_height - icon_margin
end
reset_height() click to toggle source
# File core/mui/cairo_coordinate_module.rb, line 53
def reset_height
  if(@height and defined?(@minpart_height) and tree)
    sid = ssc(:modified, tree){
      tree.get_column(0).queue_resize
      signal_handler_disconnect(sid) if signal_handler_is_connected?(sid)
      false }
    @height = @minpart_height = nil
    on_modify end
  self end
width=(new) click to toggle source
# File core/mui/cairo_coordinate_module.rb, line 63
def width=(new)
  if(@width != new)
    @width = [new, 1].max
    on_modify(true) end
  new
end

Protected Instance Methods

coordinate() click to toggle source

座標系を構造体にまとめて返す

# File core/mui/cairo_coordinate_module.rb, line 78
def coordinate
  @coordinate ||= CoordinateStruct.new(Region.new(icon_margin, # メインアイコン
                                                  icon_margin,
                                                  icon_width,
                                                  icon_height),
                                       Region.new(icon_width + icon_margin * 2, # つぶやき本文
                                                  lambda{ pos.header_text.bottom },
                                                  width - icon_width - icon_margin * 4,
                                                  0),
                                       Region.new(icon_width + icon_margin * 2, # ヘッダ
                                                  icon_margin,
                                                  width - (icon_width + icon_margin * 4),
                                                  lambda{ header_left.size[1] / Pango::SCALE })
                                       )
end
Also aliased as: pos
coordinator(width) click to toggle source

寸法の初期化

# File core/mui/cairo_coordinate_module.rb, line 73
def coordinator(width)
  @width, @color, @icon_width, @icon_height, @icon_margin = [width, 1].max, DEPTH, 48, 48, 2
end
pos()
Alias for: coordinate