summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui_combobox.pas19
-rw-r--r--src/gui/gui_edit.pas7
-rw-r--r--src/gui/gui_memo.pas45
-rw-r--r--src/gui/gui_scrollbar.pas6
4 files changed, 40 insertions, 37 deletions
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index 35bb39e7..c5b35342 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -35,6 +35,7 @@ type
procedure SetFocusItem(const AValue: integer);
protected
FMargin: integer;
+ procedure SetEnabled(const AValue: boolean); override;
property DropDownCount: integer read FDropDownCount write SetDropDownCount default 8;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandlePaint; override;
@@ -247,6 +248,12 @@ begin
FFocusItem := AValue;
end;
+procedure TfpgCustomComboBox.SetEnabled(const AValue: boolean);
+begin
+ inherited SetEnabled(AValue);
+ FInternalBtn.Enabled := AValue;
+end;
+
procedure TfpgCustomComboBox.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleLMouseDown(x, y, shiftstate);
@@ -257,13 +264,14 @@ procedure TfpgCustomComboBox.HandlePaint;
var
r: TRect;
begin
- inherited HandlePaint;
Canvas.BeginDraw;
+// inherited HandlePaint;
Canvas.ClearClipRect;
+ r := Rect(0, 0, Width-1, Height-1);
Canvas.DrawControlFrame(0, 0, Width, Height);
// internal background rectangle (without frame)
- r := Rect(2, 2, Width-2, Height-2);
+ InflateRect(r, -2, -2);
Canvas.SetClipRect(r);
if Enabled then
@@ -283,14 +291,17 @@ begin
end
else
begin
- Canvas.SetColor(FBackgroundColor);
+ if Enabled then
+ Canvas.SetColor(FBackgroundColor)
+ else
+ Canvas.SetColor(clWindowBackground);
Canvas.SetTextColor(clText1);
end;
Canvas.FillRectangle(r);
// Draw select item's text
if FocusItem > -1 then
- Canvas.DrawString(FMargin+1, FMargin, Text);
+ fpgStyle.DrawString(Canvas, FMargin+1, FMargin, Text, Enabled);
Canvas.EndDraw;
end;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index 02710088..2597f976 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -207,17 +207,18 @@ var
begin
Canvas.BeginDraw;
Canvas.ClearClipRect;
+ r := Rect(0, 0, Width-1, Height-1);
Canvas.DrawControlFrame(0, 0, Width, Height);
- r := Rect(2, 2, Width-2, Height-2);
+ InflateRect(r, -2, -2);
Canvas.SetClipRect(r);
if Enabled then
Canvas.SetColor(FBackgroundColor)
else
Canvas.SetColor(clWindowBackground);
-
Canvas.FillRectAngle(r);
+
dtext := GetDrawText;
Canvas.SetTextColor(clText1);
Canvas.SetFont(FFont);
@@ -244,7 +245,7 @@ begin
// drawing cursor
tw := FFont.TextWidth(UTF8copy(dtext, 1, FCursorPos));
- fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, 3, 2, FFont.Height - 1);
+ fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, 3, fpgCaret.Width, FFont.Height);
end
else
fpgCaret.UnSetCaret(Canvas);
diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas
index d3ff7864..8beb96cf 100644
--- a/src/gui/gui_memo.pas
+++ b/src/gui/gui_memo.pas
@@ -155,6 +155,7 @@ begin
FVScrollBar.Top := 2;
FVScrollBar.Left := Width - FVScrollBar.Width - 2;
FVScrollBar.Height := VHeight;
+
FVScrollBar.UpdateWindowPosition;
FHScrollBar.UpdateWindowPosition;
end;
@@ -167,12 +168,12 @@ begin
FHeight := FFont.Height * 3 + 4;
FWidth := 120;
FLineHeight := FFont.Height + 2;
-
FSelecting := False;
FSideMargin := 3;
FMaxLength := 0;
-
- FOnChange := nil;
+ FWrapping := False;
+ FOnChange := nil;
+ FBackgroundColor := clBoxColor;
FLines := TStringList.Create;
FFirstLine := 1;
@@ -184,8 +185,6 @@ begin
FSelStartLine := 0;
FSelEndLine := 0;
- FBackgroundColor := clBoxColor;
-
FDrawOffset := 0;
FMouseDragging := False;
@@ -197,8 +196,6 @@ begin
FHScrollBar.Orientation := orHorizontal;
FHScrollBar.OnScroll := @HScrollBarMove;
FHScrollBar.ScrollStep := 5;
-
- FWrapping := False;
end;
destructor TfpgMemo.Destroy;
@@ -424,7 +421,6 @@ begin
end;
// vertical adjust
-
if FCursorLine < FFirstLine then
FFirstLine := FCursorLine;
if FCursorline - FFirstLine + 1 > VisibleLines then
@@ -590,9 +586,6 @@ end;
procedure TfpgMemo.HandleShow;
begin
- // FVScrollBar.SetDimensions(width-18,0,18,height);
- // FHScrollBar.SetDimensions(0,height-18,width-18,18);
- // FHScrollBar.Visible := false;
inherited HandleShow;
RecalcLongestLine;
UpdateScrollBar;
@@ -628,20 +621,18 @@ var
begin
Canvas.BeginDraw;
Canvas.ClearClipRect;
- fpgStyle.DrawControlFrame(Canvas, 0, 0, Width, Height);
+ r := Rect(0, 0, Width-1, Height-1);
+ Canvas.DrawControlFrame(0, 0, Width, Height);
- r.Left := 2;
- r.Top := 2;
- r.Right := Width - 4;
- r.Bottom := Height - 4;
+ InflateRect(r, -2, -2);
Canvas.SetClipRect(r);
-
+
if Enabled then
Canvas.SetColor(FBackgroundColor)
else
Canvas.SetColor(clWindowBackground);
+ Canvas.FillRectAngle(r);
- Canvas.FillRectAngle(2, 2, Width - 4, Height - 4);
Canvas.SetFont(FFont);
if (FSelStartLine shl 16) + FSelStartPos <= (FSelEndLine shl 16) + FSelEndPos then
@@ -690,21 +681,20 @@ begin
begin
// drawing cursor
tw := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos));
- fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, yp, 1, FFont.Height);
+ fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, yp, fpgCaret.Width, FFont.Height);
end;
-
- end;
+ end; { if }
yp := yp + LineHeight;
-
if yp > Height then
Break;
- end;
+ end; { for }
if not Focused then
fpgCaret.UnSetCaret(Canvas);
- if FHScrollBar.Visible and FVScrollBar.Visible then begin
+ if FHScrollBar.Visible and FVScrollBar.Visible then
+ begin
Canvas.SetColor(clWindowBackground);
Canvas.FillRectangle(FHScrollBar.Left + FHScrollBar.Width,
FVScrollBar.Top + FVScrollBar.Height,
@@ -1203,14 +1193,15 @@ begin
begin
if FSelOffset < 0 then
begin
- Result := Copy16(FText,1+FSelStart + FSelOffset,-FSelOffset);
+ Result := Copy(FText,1+FSelStart + FSelOffset,-FSelOffset);
end
else
begin
- result := Copy16(FText,1+FSelStart,FSelOffset);
+ result := Copy(FText,1+FSelStart,FSelOffset);
end;
end
- else Result := '';
+ else
+ Result := '';
}
end;
diff --git a/src/gui/gui_scrollbar.pas b/src/gui/gui_scrollbar.pas
index a76e9f9a..67716276 100644
--- a/src/gui/gui_scrollbar.pas
+++ b/src/gui/gui_scrollbar.pas
@@ -99,7 +99,7 @@ begin
if Orientation = orVertical then
begin
- DrawButton(0, 0, Width, Width, 'sys.sb.up' ,FStartBtnPressed);
+ DrawButton(0, 0, Width, Width, 'sys.sb.up', FStartBtnPressed);
DrawButton(0, Height - Width, Width, Width, 'sys.sb.down', FEndBtnPressed);
end
else
@@ -165,12 +165,12 @@ begin
if Orientation = orVertical then
begin
- Canvas.FillRectangle(0, Width-1, Width-1, Height - (2*Width)-2);
+ Canvas.FillRectangle(0, Width, Width-1, Height-1 - Width);
area := Height - (Width shl 1);
end
else
begin
- Canvas.FillRectangle(Height-1, 0, Width - (2*Height)-2, Height-1);
+ Canvas.FillRectangle(Height, 0, Width - Height-1, Height);
area := Width - (Height shl 1);
end;