summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/apps/uidesigner/uidesigner.lpi9
-rw-r--r--examples/gui/calendar/calendartest.lpi10
-rw-r--r--prototypes/fpgui2/tests/edittest.lpi7
-rw-r--r--src/corelib/gdi/gfx_gdi.pas110
-rw-r--r--src/corelib/gfx_popupwindow.pas4
-rw-r--r--src/corelib/gfx_widget.pas3
-rw-r--r--src/gui/gui_combobox.pas16
-rw-r--r--src/gui/gui_edit.pas17
-rw-r--r--src/gui/gui_listbox.pas18
-rw-r--r--src/gui/gui_listview.pas2
-rw-r--r--src/gui/gui_menu.pas5
-rw-r--r--src/gui/gui_popupcalendar.pas10
-rw-r--r--src/gui/gui_trackbar.pas2
13 files changed, 147 insertions, 66 deletions
diff --git a/examples/apps/uidesigner/uidesigner.lpi b/examples/apps/uidesigner/uidesigner.lpi
index 683e219a..cd6e7a2d 100644
--- a/examples/apps/uidesigner/uidesigner.lpi
+++ b/examples/apps/uidesigner/uidesigner.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="/"/>
- <Version Value="6"/>
+ <PathDelim Value="\"/>
+ <Version Value="5"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value="./"/>
+ <IconPath Value=".\"/>
<TargetFileExt Value=""/>
<Title Value="uiDesigner"/>
</General>
@@ -24,7 +24,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -108,6 +108,7 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
+ <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<AllowLabel Value="False"/>
diff --git a/examples/gui/calendar/calendartest.lpi b/examples/gui/calendar/calendartest.lpi
index 431c61ee..6ea63de8 100644
--- a/examples/gui/calendar/calendartest.lpi
+++ b/examples/gui/calendar/calendartest.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="/"/>
- <Version Value="6"/>
+ <PathDelim Value="\"/>
+ <Version Value="5"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value="./"/>
+ <IconPath Value=".\"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
@@ -17,13 +17,14 @@
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
+ <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -42,6 +43,7 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
+ <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi
index 9bb5af05..4184dcf4 100644
--- a/prototypes/fpgui2/tests/edittest.lpi
+++ b/prototypes/fpgui2/tests/edittest.lpi
@@ -32,7 +32,7 @@
<MinVersion Minor="5" Valid="True"/>
</Item1>
</RequiredPackages>
- <Units Count="3">
+ <Units Count="2">
<Unit0>
<Filename Value="edittest.lpr"/>
<IsPartOfProject Value="True"/>
@@ -43,11 +43,6 @@
<IsPartOfProject Value="True"/>
<UnitName Value="uhelpers"/>
</Unit1>
- <Unit2>
- <Filename Value="edittest.dpr"/>
- <IsPartOfProject Value="True"/>
- <UnitName Value="edittest"/>
- </Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas
index e0f44349..a4cd2308 100644
--- a/src/corelib/gdi/gfx_gdi.pas
+++ b/src/corelib/gdi/gfx_gdi.pas
@@ -1,3 +1,20 @@
+{
+ fpGUI - Free Pascal GUI Library
+
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
+ distribution, for details of the copyright.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ Description:
+ This defines the CoreLib backend interface to the Windows GDI API.
+}
+
unit gfx_gdi;
{$mode objfpc}{$H+}
@@ -15,7 +32,7 @@ uses
{ Constants missing on windows unit }
const
- WM_MOUSEWHEEL = $020a;
+ WM_MOUSEWHEEL = $020a; // we could remove this since FPC 2.0.4
VER_PLATFORM_WIN32_CE = 3;
{ Unicode selection variables }
@@ -498,7 +515,6 @@ begin
end;
end;
-
WM_SETCURSOR:
begin
// {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
@@ -509,14 +525,25 @@ begin
Windows.DefWindowProc(hwnd, uMsg, wParam, lParam);
end;
+ WM_LBUTTONDBLCLK:
+ begin
+ {$IFDEF DEBUG}
+ writeln('fpGFX/GDI:', w.ClassName + ': MouseButton DoubleClick event');
+ {$ENDIF}
+ end;
WM_MOUSEMOVE,
WM_LBUTTONDOWN,
WM_LBUTTONUP,
-// WM_LBUTTONDBLCLK,
+ WM_MBUTTONDOWN,
+ WM_MBUTTONUP,
WM_RBUTTONDOWN,
WM_RBUTTONUP:
begin
+ {$IFDEF DEBUG}
+ if not uMsg = WM_MOUSEMOVE then
+ writeln('fpGFX/GDI: Found a mouse button event');
+ {$ENDIF}
// {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
// {$IFDEF DEBUG} writeln('Mouse Move or Button Click'); {$ENDIF}
msgp.mouse.x := smallint(lParam and $FFFF);
@@ -557,21 +584,32 @@ begin
blockmsg := True;
end;
+ // Is message blocked by a modal form?
if not blockmsg then
begin
case uMsg of
WM_MOUSEMOVE:
mcode := FPGM_MOUSEMOVE;
+
WM_LBUTTONDOWN,
+ WM_MBUTTONDOWN,
WM_RBUTTONDOWN:
begin
+ {$IFDEF DEBUG}
+ writeln('fpGFX/GDI:', w.ClassName + ': MouseButtonDown event');
+ {$ENDIF}
mcode := FPGM_MOUSEDOWN;
if PopupListFirst = nil then
SetCapture(w.WinHandle);
end;
+
WM_LBUTTONUP,
+ WM_MBUTTONUP,
WM_RBUTTONUP:
begin
+ {$IFDEF DEBUG}
+ writeln('fpGFX/GDI:', w.ClassName + ': MouseButtonUp event');
+ {$ENDIF}
mcode := FPGM_MOUSEUP;
if PopupListFirst = nil then
ReleaseCapture;
@@ -597,12 +635,15 @@ begin
WM_LBUTTONDOWN,
WM_LBUTTONUP:
- //WM_LBUTTONDBLCLK:
- msgp.mouse.Buttons := MOUSE_LEFT;
+ msgp.mouse.Buttons := MOUSE_LEFT;
+
+ WM_MBUTTONDOWN,
+ WM_MBUTTONUP:
+ msgp.mouse.Buttons := MOUSE_MIDDLE;
WM_RBUTTONDOWN,
WM_RBUTTONUP:
- msgp.mouse.Buttons := MOUSE_RIGHT;
+ msgp.mouse.Buttons := MOUSE_RIGHT;
end;
msgp.mouse.shiftstate := GetKeyboardShiftState;
@@ -627,8 +668,10 @@ begin
msgp.rect.Width := smallint(lParam and $FFFF);
msgp.rect.Height := smallint((lParam and $FFFF0000) shr 16);
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_SIZE: width=',msgp.rect.width, ' height=',msgp.rect.height); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_SIZE: width=',msgp.rect.width, ' height=',msgp.rect.height);
+ {$ENDIF}
// skip minimize...
if lparam <> 0 then
fpgSendMessage(nil, w, FPGM_RESIZE, msgp);
@@ -636,8 +679,10 @@ begin
WM_MOVE:
begin
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_MOVE'); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_MOVE');
+ {$ENDIF}
// window decoration correction ...
if (GetWindowLong(w.WinHandle, GWL_STYLE) and WS_CHILD) = 0 then
begin
@@ -656,8 +701,10 @@ begin
WM_MOUSEWHEEL:
begin
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_MOUSEWHEEL: wp=',IntToHex(wparam,8), ' lp=',IntToHex(lparam,8)); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_MOUSEWHEEL: wp=',IntToHex(wparam,8), ' lp=',IntToHex(lparam,8));
+ {$ENDIF}
pt.x := LoWord(lparam);
pt.y := HiWord(lparam);
mw := nil;
@@ -687,8 +734,10 @@ begin
WM_ACTIVATE:
begin
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_ACTIVATE'); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_ACTIVATE');
+ {$ENDIF}
if ((wParam and $FFFF) = WA_INACTIVE) then
fpgSendMessage(nil, w, FPGM_DEACTIVATE)
else
@@ -703,24 +752,33 @@ begin
WM_NCACTIVATE:
begin
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_NCACTIVATE'); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_NCACTIVATE');
+ {$ENDIF}
if (wapplication.TopModalForm <> nil) then
begin
if (wParam = 0) and (wapplication.TopModalForm = w) then
begin
+ {$IFDEF DEBUG}
+ writeln(' Blockmsg = True (part 1)');
+ {$ENDIF}
blockmsg := True;
end
else if (wParam <> 0) and (wapplication.TopModalForm <> w) then
begin
+ {$IFDEF DEBUG}
+ writeln(' Blockmsg = True (part 2)');
+ {$ENDIF}
blockmsg := True;
end;
end;
- if (PopupListFirst <> nil) and (PopupListFirst.Visible) then
- begin
- blockmsg := True;
- end;
+ //if (PopupListFirst <> nil) and (PopupListFirst.Visible) then
+ //begin
+ //writeln(' Blockmsg = True (part 3)');
+ //blockmsg := True;
+ //end;
if not blockmsg then
Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam);
@@ -728,15 +786,19 @@ begin
WM_CLOSE:
begin
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_Close'); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_Close');
+ {$ENDIF}
fpgSendMessage(nil, w, FPGM_CLOSE, msgp);
end;
WM_PAINT:
begin
- {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
- {$IFDEF DEBUG} writeln('WM_PAINT'); {$ENDIF}
+ {$IFDEF DEBUG}
+ write(w.ClassName + ': ');
+ writeln('WM_PAINT');
+ {$ENDIF}
Windows.BeginPaint(w.WinHandle, @PaintStruct);
fpgSendMessage(nil, w, FPGM_PAINT, msgp);
Windows.EndPaint(w.WinHandle, @PaintStruct);
diff --git a/src/corelib/gfx_popupwindow.pas b/src/corelib/gfx_popupwindow.pas
index 5dafb5fd..6c42d171 100644
--- a/src/corelib/gfx_popupwindow.pas
+++ b/src/corelib/gfx_popupwindow.pas
@@ -222,12 +222,12 @@ end;
procedure TfpgPopupWindow.HandleShow;
begin
inherited HandleShow;
- CaptureMouse;
+// CaptureMouse;
end;
procedure TfpgPopupWindow.HandleHide;
begin
- ReleaseMouse;
+// ReleaseMouse;
inherited HandleHide;
end;
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index 6f2d0f78..dbf6505d 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -567,7 +567,7 @@ begin
dir := -1
else
dir := 1;
-
+{
keyReturn,
keyDown,
keyRight:
@@ -576,6 +576,7 @@ begin
keyUp,
keyLeft:
dir := -1;
+}
end;
{$Note Optimize this code. Constantly setting ActiveWidget causes RePaint to be called!}
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index b313db5f..1380d382 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -158,13 +158,11 @@ end;
procedure TDropDownWindow.HandleShow;
begin
- FocusRootWidget := ListBox;
- ListBox.Left := 0;
- ListBox.Top := 0;
- ListBox.Width := Width;
- ListBox.Height := Height;
+// FocusRootWidget := ListBox;
+ ListBox.SetPosition(0, 0, Width, Height);
inherited HandleShow;
- FocusRootWidget.CaptureMouse; // for internal ListBox
+// FocusRootWidget.CaptureMouse; // for internal ListBox
+ ActiveWidget := ListBox;
end;
procedure TDropDownWindow.HandleHide;
@@ -401,9 +399,9 @@ begin
tmp := PrintCallTrace(Classname, 'HandleLMouseDown');
inherited HandleLMouseDown(x, y, shiftstate);
// button state is down only if user clicked in the button rectangle.
- if PtInRect(FInternalBtnRect, Point(x, y)) then
- FBtnPressed := True;
+ FBtnPressed := PtInRect(FInternalBtnRect, Point(x, y));
PaintInternalButton;
+ DoDropDown;
end;
procedure TfpgAbstractComboBox.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
@@ -413,7 +411,7 @@ begin
tmp := PrintCallTrace(Classname, 'HandleLMouseUp');
inherited HandleLMouseUp(x, y, shiftstate);
FBtnPressed := False;
- DoDropDown;
+// DoDropDown;
PaintInternalButton;
end;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index 369379ba..fd9a6fd5 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -212,11 +212,18 @@ var
procedure DrawSelection;
var
lcolor: TfpgColor;
+ r: TfpgRect;
begin
if Focused then
- lcolor := clSelection
+ begin
+ lcolor := clSelection;
+ Canvas.SetTextColor(clSelectionText);
+ end
else
+ begin
lcolor := clInactiveSel;
+ Canvas.SetTextColor(clText1);
+ end;
len := FSelOffset;
st := FSelStart;
@@ -229,6 +236,14 @@ var
tw2 := FFont.TextWidth(UTF8copy(dtext, 1, st + len));
Canvas.XORFillRectangle(fpgColorToRGB(lcolor) xor $FFFFFF,
-FDrawOffset + FSideMargin + tw, 3, tw2 - tw, FFont.Height);
+
+{ // This migt be used in the future
+ Canvas.SetColor(lcolor);
+ Canvas.FillRectangle(-FDrawOffset + FSideMargin + tw, 3, tw2 - tw, FFont.Height);
+ r.SetRect(-FDrawOffset + FSideMargin + tw, 3, tw2 - tw, FFont.Height);
+ Canvas.AddClipRect(r);
+ fpgStyle.DrawString(Canvas, -FDrawOffset + FSideMargin, 3, dtext, Enabled);
+}
end;
begin
diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas
index 9b141ed7..696c43e3 100644
--- a/src/gui/gui_listbox.pas
+++ b/src/gui/gui_listbox.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -398,8 +398,8 @@ begin
Exit; //==>
{ User clicked outside listbox bounds. ComboBox requires this check. }
- if y < 0 then
- Exit; //==>
+ //if y < 0 then
+ //Exit; //==>
FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight);
if FFocusItem > ItemCount then
@@ -423,12 +423,12 @@ begin
FMouseDragging := False;
{ User clicked outside listbox bounds. ComboBox requires this check. }
- if PtInRect(r, Point(x, y)) then
- begin
- FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight);
- if FFocusItem > ItemCount then
- FFocusItem := ItemCount;
- end;
+ //if PtInRect(r, Point(x, y)) then
+ //begin
+ //FFocusItem := FFirstItem + Trunc((y - FMargin) / RowHeight);
+ //if FFocusItem > ItemCount then
+ //FFocusItem := ItemCount;
+ //end;
FollowFocus;
Repaint;
diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas
index 0a2ff4f8..1ff923a0 100644
--- a/src/gui/gui_listview.pas
+++ b/src/gui/gui_listview.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index 4c7550f9..62aa5b62 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -81,6 +81,9 @@ type
// Actual Menu Items are stored in TComponent's Components property
// Visible only items are stored in FItems just before a paint
+
+ { TfpgPopupMenu }
+
TfpgPopupMenu = class(TfpgPopupWindow)
private
FBackgroundColor: TfpgColor;
@@ -923,6 +926,7 @@ procedure TfpgPopupMenu.HandleShow;
begin
PrepareToShow;
inherited HandleShow;
+ CaptureMouse;
end;
function TfpgPopupMenu.VisibleCount: integer;
@@ -1166,6 +1170,7 @@ end;
destructor TfpgPopupMenu.Destroy;
begin
+ ReleaseMouse;
FItems.Free;
inherited Destroy;
end;
diff --git a/src/gui/gui_popupcalendar.pas b/src/gui/gui_popupcalendar.pas
index 4e90c4a5..254b9abf 100644
--- a/src/gui/gui_popupcalendar.pas
+++ b/src/gui/gui_popupcalendar.pas
@@ -481,10 +481,12 @@ procedure TfpgPopupCalendar.AfterCreate;
begin
{@VFD_BODY_BEGIN: fpgPopupCalendar}
Name := 'fpgPopupCalendar';
- SetPosition(285, 249, 233, 142);
- // WindowTitle := 'fpgPopupCalendar';
- // WindowPosition := wpUser;
- // Sizeable := False;
+ Width := 233;
+ Height := 142;
+// SetPosition(285, 249, 233, 142);
+// WindowTitle := 'fpgPopupCalendar';
+// WindowPosition := wpUser;
+// Sizeable := False;
edtYear := TfpgEdit.Create(self);
with edtYear do
diff --git a/src/gui/gui_trackbar.pas b/src/gui/gui_trackbar.pas
index 73c7a027..dc47ee00 100644
--- a/src/gui/gui_trackbar.pas
+++ b/src/gui/gui_trackbar.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,