carbon: using WindowGroups instead of WindowClass for switching between FormStyles

git-svn-id: trunk@25744 -
This commit is contained in:
dmitry 2010-05-29 05:36:31 +00:00
parent a02a463fb7
commit f3c468d0f5
2 changed files with 18 additions and 9 deletions

View File

@ -1128,6 +1128,7 @@ procedure TCarbonWindow.CreateWindow(const AParams: TCreateParams);
var
AWindow: WindowRef;
NewWindowClass: Integer;
GroupClass: Integer;
MinSize, MaxSize: HISize;
Attributes: WindowAttributes;
begin
@ -1135,7 +1136,7 @@ begin
if csDesigning in LCLObject.ComponentState then
begin
NewWindowClass := kDocumentWindowClass;
GroupClass := kDocumentWindowClass;
Attributes := kWindowInWindowMenuAttribute or
GetBorderWindowAttrs(bsSizeable, [biMaximize, biMinimize, biSystemMenu]);
end
@ -1144,24 +1145,27 @@ begin
Attributes := 0;
case (LCLObject as TCustomForm).FormStyle of
fsStayOnTop, fsSplash:
NewWindowClass := kFloatingWindowClass;
GroupClass := kFloatingWindowClass;
fsSystemStayOnTop:
GroupClass := kUtilityWindowClass;
else
NewWindowClass := kDocumentWindowClass;
GroupClass := kDocumentWindowClass;
Attributes := kWindowInWindowMenuAttribute;
end;
Attributes := Attributes or
GetBorderWindowAttrs((LCLObject as TCustomForm).BorderStyle,
(LCLObject as TCustomForm).BorderIcons);
case NewWindowClass of
{case NewWindowClass of
kMovableModalWindowClass:
Attributes := Attributes and (not kWindowInWindowMenuAttribute);
kFloatingWindowClass:
Attributes := Attributes and (not (kWindowInWindowMenuAttribute or kWindowCollapseBoxAttribute));
end;
end;}
end;
//DebugLn('TCarbonWindow.CreateWidget ' + DbgS(ParamsToCarbonRect(AParams)));
NewWindowClass:=kDocumentWindowClass;
if OSError(
CreateNewWindow(NewWindowClass,
Attributes or kWindowCompositingAttribute or kWindowStandardHandlerAttribute
@ -1177,6 +1181,10 @@ begin
fWindowRef := AWindow;
OSError(
SetWindowGroup(fWindowRef, GetWindowGroupOfClass(GroupClass)), Self,
SCreateWidget, 'SetWindowGroup');
// creating wrapped views
if OSError(
HIViewFindByID(HIViewGetRoot(fWindowRef), kHIViewWindowContentID, fWinContent),

View File

@ -234,18 +234,19 @@ end;
class procedure TCarbonWSCustomForm.SetFormStyle(const ACustomForm:TCustomForm;
const ANewFormStyle,AOldFormStyle:TFormStyle);
var
newClass : WindowClass;
newClass : WindowClass;
begin
if not CheckHandle(ACustomForm, Self, 'SetFormStyle') then Exit;
case ANewFormStyle of
fsStayOnTop: newClass:=kFloatingWindowClass;
fsSplash: newClass:=kUtilityWindowClass;
fsStayOnTop, fsSplash: newClass:=kFloatingWindowClass;
fsSystemStayOnTop: newClass:=kUtilityWindowClass;
else
newClass:=kDocumentWindowClass;
end;
HIWindowChangeClass( TCarbonWindow(ACustomForm.Handle).Window, newClass);
OSError(
SetWindowGroup( TCarbonWindow(ACustomForm.Handle).Window, GetWindowGroupOfClass(newClass)),
Self, 'SetFormStyle', 'SetWindowGroup');
end;
{ TCarbonWSHintWindow }