~kalon33/corsix-th/master

« back to all changes in this revision

Viewing changes to CorsixTH/Lua/dialogs/tree_ctrl.lua

  • Committer: corsixth.bot at gmail
  • Date: 2014-03-31 23:30:23 UTC
  • Revision ID: svn-v4:c39591fa-788f-11de-a72b-d90af8dea425:trunk:2687
Remove trailing whitespaces in .h, .cpp, .c and .lua files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
437
437
  self.width = width
438
438
  self.height = height
439
439
  self.y_offset = y_offset or 0
440
 
  
 
440
 
441
441
  -- Load the graphical resources
442
442
  local gfx = TheApp.gfx
443
443
  if not has_font then
447
447
  end
448
448
  self.tree_sprites = gfx:loadSpriteTable("Bitmap", "tree_ctrl", true,
449
449
    gfx:loadPalette("Bitmap", "tree_ctrl.pal"))
450
 
    
 
450
 
451
451
  -- Calculate sizes and counts
452
452
  local scrollbar_width = 20
453
453
  self.row_height = 14
591
591
function TreeControl:draw(canvas, x, y)
592
592
  Window.draw(self, canvas, x, y)
593
593
  x, y = self.x + x, self.y + y + self.y_offset
594
 
  
 
594
 
595
595
  local node = self.first_visible_node
596
596
  local num_nodes_drawn = 0
597
597
  local y = y + self.tree_rect.y
601
601
    for i = 0, level - 1 do
602
602
      self.tree_sprites:draw(canvas, 1, x + i * 14, y)
603
603
    end
604
 
    
 
604
 
605
605
    if node == self.highlighted_node then
606
606
      local offset = (level + 1) * 14
607
607
      local colour = node:getHighlightColour(canvas) or self.scrollbar.slider.colour
612
612
      local colour = node:getSelectColour(canvas) or self.scrollbar.slider.colour
613
613
      canvas:drawRect(colour, x + offset - 1, y, self.tree_rect.w - offset - 1, self.row_height)
614
614
    end
615
 
    
 
615
 
616
616
    local icon
617
617
    if not node:hasChildren() then
618
618
      icon = 2