diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-09-12 00:52:18 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-09-12 00:52:18 +0200 |
commit | 19eb36215fe16cae9cd40ca4684109c51d5bb0b6 (patch) | |
tree | e9e70413f700058dc35e2236f50ffa98093d588c /src | |
parent | 57ec7dcca6de86a7b88a12fb4fcd7639445ed0f6 (diff) | |
download | fpGUI-19eb36215fe16cae9cd40ca4684109c51d5bb0b6.tar.xz |
treeview: bug fix in node painting.
* fixed offset that node image was painted
* fixed offset that node text was painted
* fixed offset that selected node rectangle was painted
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_tree.pas | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gui/fpg_tree.pas b/src/gui/fpg_tree.pas index e3bc5646..f092ef48 100644 --- a/src/gui/fpg_tree.pas +++ b/src/gui/fpg_tree.pas @@ -1538,25 +1538,26 @@ begin Canvas.SetColor(h.ParentInactSelColor); Canvas.SetTextColor(h.ParentInActSelTextColor); end; - Canvas.FillRectangle(w - FXOffset, YPos - FYOffset + col - GetNodeHeight + FFont.Ascent div 2 - 2, GetNodeWidth(h), GetNodeHeight); + // draw selection rectangle + Canvas.FillRectangle(w - FXOffset, ACenterPos - (GetNodeHeight div 2), GetNodeWidth(h), GetNodeHeight); if (ImageList <> nil) and ShowImages then begin AImageItem := ImageList.Item[h.ImageIndex]; if AImageItem <> nil then begin - Canvas.DrawImagePart(w - FXOffset + 1, ACenterPos - 4, AImageItem.Image, 0, 0, 16, 16); - Canvas.DrawString(w - FXOffset + 1 + AImageItem.Image.Width + 2, ACenterPos - FFont.Ascent div 2, h.text); + Canvas.DrawImagePart(w - FXOffset + 1, ACenterPos - 8, AImageItem.Image, 0, 0, 16, 16); + Canvas.DrawString(w - FXOffset + 1 + AImageItem.Image.Width + 2, ACenterPos - (GetNodeHeight div 2), h.text); end else begin if FIndentNodeWithNoImage then - Canvas.DrawString(w - FXOffset + 1 + FNoImageIndent + 2 {spacer}, ACenterPos - FFont.Ascent div 2, h.text) + Canvas.DrawString(w - FXOffset + 1 + FNoImageIndent + 2 {spacer}, ACenterPos - (GetNodeHeight div 2), h.text) else - Canvas.DrawString(w - FXOffset + 1, ACenterPos - FFont.Ascent div 2, h.text); + Canvas.DrawString(w - FXOffset + 1, ACenterPos - (GetNodeHeight div 2), h.text); end; end else - Canvas.DrawString(w - FXOffset + 1, ACenterPos - FFont.Ascent div 2, h.text); + Canvas.DrawString(w - FXOffset + 1, ACenterPos - (GetNodeHeight div 2), h.text); Canvas.SetTextColor(h.ParentTextColor); end else @@ -1566,19 +1567,19 @@ begin AImageItem := ImageList.Item[h.ImageIndex]; if AImageItem <> nil then begin - Canvas.DrawImagePart(w - FXOffset + 1, ACenterPos - 4, AImageItem.Image, 0, 0, 16, 16); - Canvas.DrawString(w - FXOffset + 1 + AImageItem.Image.Width + 2, ACenterPos - FFont.Ascent div 2, h.text); + Canvas.DrawImagePart(w - FXOffset + 1, ACenterPos - 8, AImageItem.Image, 0, 0, 16, 16); + Canvas.DrawString(w - FXOffset + 1 + AImageItem.Image.Width + 2, ACenterPos - (GetNodeHeight div 2), h.text); end else begin if FIndentNodeWithNoImage then - Canvas.DrawString(w - FXOffset + 1 + FNoImageIndent + 2 {spacer}, ACenterPos - FFont.Ascent div 2, h.text) + Canvas.DrawString(w - FXOffset + 1 + FNoImageIndent + 2 {spacer}, ACenterPos - (GetNodeHeight div 2), h.text) else - Canvas.DrawString(w - FXOffset + 1, ACenterPos - FFont.Ascent div 2, h.text); + Canvas.DrawString(w - FXOffset + 1, ACenterPos - (GetNodeHeight div 2), h.text); end end else - Canvas.DrawString(w - FXOffset + 1, ACenterPos - FFont.Ascent div 2, h.text); + Canvas.DrawString(w - FXOffset + 1, ACenterPos - (GetNodeHeight div 2), h.text); end; { if/else } Canvas.SetLineStyle(1, FTreeLineStyle); |