summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/gfxbase.pas6
-rw-r--r--src/corelib/x11/fpgfx_package.lpk4
-rw-r--r--src/gui/fpgui_package.lpk2
-rw-r--r--src/gui/gui_combobox.pas71
-rw-r--r--src/gui/gui_edit.pas3
-rw-r--r--src/gui/gui_scrollbar.pas16
6 files changed, 68 insertions, 34 deletions
diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas
index 0cac008d..cfe60c45 100644
--- a/src/corelib/gfxbase.pas
+++ b/src/corelib/gfxbase.pas
@@ -291,6 +291,7 @@ type
procedure BeginDraw; overload;
procedure BeginDraw(ABuffered: boolean); overload;
procedure EndDraw(x, y, w, h: TfpgCoord); overload;
+ procedure EndDraw(ARect: TfpgRect); overload;
procedure EndDraw; overload;
procedure FreeResources;
property Color: TfpgColor read FColor write SetColor;
@@ -1051,6 +1052,11 @@ begin
end; { if }
end;
+procedure TfpgCanvasBase.EndDraw(ARect: TfpgRect);
+begin
+ EndDraw(ARect.Left, ARect.Top, ARect.Width, ARect.Height);
+end;
+
procedure TfpgCanvasBase.EndDraw;
begin
EndDraw(0, 0, FWindow.Width, FWindow.Height);
diff --git a/src/corelib/x11/fpgfx_package.lpk b/src/corelib/x11/fpgfx_package.lpk
index 887a3443..a3a9b033 100644
--- a/src/corelib/x11/fpgfx_package.lpk
+++ b/src/corelib/x11/fpgfx_package.lpk
@@ -8,7 +8,7 @@
<SearchPaths>
<IncludeFiles Value="../"/>
<OtherUnitFiles Value="../;../../gui/"/>
- <UnitOutputDirectory Value="../../../lib/"/>
+ <UnitOutputDirectory Value="../../../lib"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
@@ -23,7 +23,7 @@
"/>
<License Value="Modified LGPL
"/>
- <Version Minor="5"/>
+ <Version Minor="5" Release="1"/>
<Files Count="15">
<Item1>
<Filename Value="x11_xft.pas"/>
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk
index 9cf68939..45d475ca 100644
--- a/src/gui/fpgui_package.lpk
+++ b/src/gui/fpgui_package.lpk
@@ -25,7 +25,7 @@
"/>
<License Value="Modified LGPL
"/>
- <Version Minor="5"/>
+ <Version Minor="5" Release="1"/>
<Files Count="23">
<Item1>
<Filename Value="gui_button.pas"/>
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index 4437126f..94ecf178 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -35,7 +35,7 @@ type
FFocusItem: integer;
FFont: TfpgFont;
FInternalBtnRect: TfpgRect;
- FInternalBtnDown: boolean;
+ FBtnPressed: Boolean;
FItems: TStringList;
FOnChange: TNotifyEvent;
function GetFontDesc: string;
@@ -57,6 +57,7 @@ type
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
procedure HandleResize(awidth, aheight: TfpgCoord); override;
procedure HandlePaint; override;
+ procedure PaintInternalButton; virtual;
property Items: TStringList read FItems; {$Note Make this read/write }
property FocusItem: integer read FFocusItem write SetFocusItem;
property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
@@ -252,7 +253,7 @@ begin
end
else
begin
- FInternalBtnDown := False;
+ FBtnPressed := False;
FDropDown.Close;
FreeAndNil(FDropDown);
end;
@@ -332,19 +333,21 @@ begin
FInternalBtnRect.SetRect(Width - Min(Height, 20), 2, Min(Height, 20)-2, Height-4);
end;
-procedure TfpgCustomComboBox.HandleLMouseDown(x, y: integer;
- shiftstate: TShiftState);
+procedure TfpgCustomComboBox.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleLMouseDown(x, y, shiftstate);
- FInternalBtnDown := True;
+ // botton down only if user clicked on the button.
+ if PtInRect(FInternalBtnRect, Point(x, y)) then
+ FBtnPressed := True;
+ PaintInternalButton;
end;
-procedure TfpgCustomComboBox.HandleLMouseUp(x, y: integer;
- shiftstate: TShiftState);
+procedure TfpgCustomComboBox.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
begin
- FInternalBtnDown := False;
inherited HandleLMouseUp(x, y, shiftstate);
+ FBtnPressed := False;
DoDropDown;
+ PaintInternalButton;
end;
procedure TfpgCustomComboBox.HandleResize(awidth, aheight: TfpgCoord);
@@ -356,11 +359,8 @@ end;
procedure TfpgCustomComboBox.HandlePaint;
var
r: TfpgRect;
- ar: TfpgRect;
- btnflags: TFButtonFlags;
begin
Canvas.BeginDraw;
- btnflags := [];
// inherited HandlePaint;
Canvas.ClearClipRect;
r.SetRect(0, 0, Width, Height);
@@ -378,21 +378,7 @@ begin
Canvas.FillRectangle(r);
// paint the fake dropdown button
- if FInternalBtnDown then
- Include(btnflags, btnIsPressed);
- fpgStyle.DrawButtonFace(Canvas,
- FInternalBtnRect.Left,
- FInternalBtnRect.Top,
- FInternalBtnRect.Width,
- FInternalBtnRect.Height, btnflags);
- ar := FInternalBtnRect;
- InflateRect(ar, -1, -1);
- if Enabled then
- Canvas.SetColor(clText1)
- else
- Canvas.SetColor(clShadow2);
- fpgStyle.DrawDirectionArrow(Canvas,
- ar.Left, ar.Top, ar.Width, ar.Height, 1);
+ PaintInternalButton;
Dec(r.Width, FInternalBtnRect.Width);
Canvas.SetFont(Font);
@@ -420,6 +406,37 @@ begin
Canvas.EndDraw;
end;
+procedure TfpgCustomComboBox.PaintInternalButton;
+var
+ ar: TfpgRect;
+ btnflags: TFButtonFlags;
+begin
+ Canvas.BeginDraw;
+ btnflags := [];
+ ar := FInternalBtnRect;
+ InflateRect(ar, -2, -2);
+ if FBtnPressed then
+ begin
+ Include(btnflags, btnIsPressed);
+ OffsetRect(ar, 1, 1);
+ end;
+ // paint button face
+ fpgStyle.DrawButtonFace(Canvas,
+ FInternalBtnRect.Left,
+ FInternalBtnRect.Top,
+ FInternalBtnRect.Width,
+ FInternalBtnRect.Height, btnflags);
+ if Enabled then
+ Canvas.SetColor(clText1)
+ else
+ begin
+ Canvas.SetColor(clShadow1);
+ end;
+ // paint arrow
+ fpgStyle.DrawDirectionArrow(Canvas, ar.Left, ar.Top, ar.Width, ar.Height, 1);
+ Canvas.EndDraw(FInternalBtnRect);
+end;
+
constructor TfpgCustomComboBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -430,7 +447,7 @@ begin
FFocusItem := 0; // nothing is selected
FMargin := 3;
FFocusable := True;
- FInternalBtnDown := False;
+ FBtnPressed := False;
FFont := fpgGetFont('#List');
FItems := TStringList.Create;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index c94e2bca..ad04f01d 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -546,7 +546,8 @@ begin
inherited HandleMouseEnter;
if (csDesigning in ComponentState) then
Exit;
- MouseCursor := mcIBeam;
+ if Enabled then
+ MouseCursor := mcIBeam;
end;
procedure TfpgEdit.HandleMouseExit;
diff --git a/src/gui/gui_scrollbar.pas b/src/gui/gui_scrollbar.pas
index 64e9ff45..45bd12bb 100644
--- a/src/gui/gui_scrollbar.pas
+++ b/src/gui/gui_scrollbar.pas
@@ -37,7 +37,7 @@ type
FSliderPos: TfpgCoord;
FSliderLength: TfpgCoord;
FSliderDragging: boolean;
- FStartBtnPressed,
+ FStartBtnPressed: Boolean;
FEndBtnPressed: Boolean;
FSliderDragPos: TfpgCoord;
FSliderDragStart: TfpgCoord;
@@ -187,15 +187,25 @@ end;
procedure TfpgScrollBar.DrawButton(x, y, w, h: TfpgCoord; const imgname: string; Pressed: Boolean = False);
var
img: TfpgImage;
+ dx: integer;
+ dy: integer;
begin
if Pressed then
- Canvas.DrawButtonFace(x, y, w, h, [btnIsEmbedded, btnIsPressed])
+ begin
+ Canvas.DrawButtonFace(x, y, w, h, [btnIsEmbedded, btnIsPressed]);
+ dx := 1;
+ dy := 1;
+ end
else
+ begin
Canvas.DrawButtonFace(x, y, w, h, [btnIsEmbedded]);
+ dx := 0;
+ dy := 0;
+ end;
Canvas.SetColor(clText1);
img := fpgImages.GetImage(imgname);
if img <> nil then
- Canvas.DrawImage(x + w div 2 - (img.Width div 2), y + h div 2 - (img.Height div 2), img);
+ Canvas.DrawImage(x + w div 2 - (img.Width div 2) + dx, y + h div 2 - (img.Height div 2) + dy, img);
end;
procedure TfpgScrollBar.DrawSlider(recalc: boolean);