From 7b59ec93df0a0a181096a408e9e47f3a5658ca77 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 30 Apr 2013 14:11:45 -0700 Subject: [PATCH 1/5] Fixed: Windows with toolbars do not display correctly as sheets Previously it wasn't possible to display a toolbar in a sheet window. Now, a toobar is displayed well in a window. This PR allows every sheet window to have a toolbar, with the PR #1918 just the CPTitleWindow/HUD sheet could have a toolbar as in cocoa. Fixes #1863 --- AppKit/CPWindow/_CPStandardWindowView.j | 44 +++++++++++++++--- ...tandard-head-sheet-solid-bottom-center.png | Bin 0 -> 82 bytes ...-standard-head-sheet-solid-bottom-left.png | Bin 0 -> 76 bytes ...standard-head-sheet-solid-bottom-right.png | Bin 0 -> 76 bytes ...tandard-head-sheet-solid-center-center.png | Bin 0 -> 82 bytes ...-standard-head-sheet-solid-center-left.png | Bin 0 -> 76 bytes ...standard-head-sheet-solid-center-right.png | Bin 0 -> 76 bytes ...w-standard-head-sheet-solid-top-center.png | Bin 0 -> 993 bytes ...dow-standard-head-sheet-solid-top-left.png | Bin 0 -> 996 bytes ...ow-standard-head-sheet-solid-top-right.png | Bin 0 -> 996 bytes AppKit/Themes/Aristo2/ThemeDescriptors.j | 9 ++++ 11 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-center.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-left.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-right.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-center.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-left.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-right.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-center.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-left.png create mode 100644 AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-right.png diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index b2c68ef6a..c9d981880 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -29,6 +29,8 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; @implementation _CPTexturedWindowHeadView : CPView { + BOOL _isSheet @accessors(setter=setSheet:); + _CPWindowView _parentView; CPView _gradientView; CPView _solidView; @@ -69,7 +71,11 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; bounds = [self bounds]; [_gradientView setFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), gradientHeight)]; - [_gradientView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"bezel-head-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]]; + + if (_isSheet) + [_gradientView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"bezel-head-sheet-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]]; + else + [_gradientView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"bezel-head-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]]; [_solidView setFrame:CGRectMake(0.0, gradientHeight, CGRectGetWidth(bounds), CGRectGetHeight(bounds) - gradientHeight)]; [_solidView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"solid-color" forClass:_CPStandardWindowView]]; @@ -97,6 +103,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; CPButton _minimizeButton; BOOL _isDocumentEdited; + BOOL _isSheet; } + (CPString)defaultThemeClass @@ -110,6 +117,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; @"gradient-height": [CPNull null], @"solid-color": [CPNull null], @"bezel-head-color": [CPNull null], + @"bezel-head-sheet-color": [CPNull null], @"divider-color": [CPColor blackColor], @"body-color": [CPColor whiteColor], @"title-bar-height": 32, @@ -224,7 +232,14 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; width = CGRectGetWidth(bounds), headHeight = [self toolbarMaxY]; + if (_isSheet && _toolbarView && [self showsToolbar]) + { + headHeight = [_toolbarView frameSize].height; + [_toolbarView setFrameOrigin:CGPointMake(0.0, 0.0)]; + } + [_headView setFrameSize:CGSizeMake(width, headHeight)]; + [_dividerView setFrame:CGRectMake(0.0, headHeight, width, _CPStandardWindowViewDividerViewHeight)]; var dividerMinY = 0, @@ -312,12 +327,26 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; { [super _enableSheet:enable inWindow:parentWindow]; - [_headView setHidden:enable]; - [_dividerView setHidden:enable]; + _isSheet = enable; + [_headView setSheet:enable]; + + if (_toolbarView && [self showsToolbar]) + { + [_headView setHidden:NO]; + [_dividerView setHidden:NO]; + } + else + { + [_headView setHidden:enable]; + [_dividerView setHidden:enable]; + } + [_closeButton setHidden:enable]; [_minimizeButton setHidden:enable]; [_titleField setHidden:enable]; + [[self window] setMovable:!enable]; + if (enable) { [_bodyView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"body-color" forClass:_CPDocModalWindowView]]; @@ -333,12 +362,13 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; var theWindow = [self window], frame = [theWindow frame], dividerHeight = [_dividerView frame].size.height, - dy; + dy = [self toolbarMaxY] + dividerHeight; + + if (_toolbarView && [self showsToolbar]) + dy = [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView]; if (enable) - dy = -[_headView frame].size.height; - else - dy = [self toolbarMaxY] + dividerHeight; + dy = -dy; var newHeight = CGRectGetHeight(frame) + dy, newWidth = CGRectGetWidth(frame); diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-center.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-center.png new file mode 100644 index 0000000000000000000000000000000000000000..1a86f0428a70fb06dfa8465a81e6f5b265307857 GIT binary patch literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?jt}kA^u=u+^2gv2}ba4#f ckWEeivY8kd&z~@T3S=>Oy85}Sb4q9e0H(1L{r~^~ literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-left.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-left.png new file mode 100644 index 0000000000000000000000000000000000000000..93aad32e69f977282b03c0a9ce3bc51e9fcb2991 GIT binary patch literal 76 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1j!3HG7{-t~dQo^1tjv*Yf$q5Mw0o5NL9j#B{ ZVQ7fwXWsh4{WVaU!PC{xWt~$(697>i6FvX{ literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-right.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-bottom-right.png new file mode 100644 index 0000000000000000000000000000000000000000..201e8fd643e1b0f0899990198e46e157008021bb GIT binary patch literal 76 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1j!3HG7{-t~dQo^1tjv*Yf$rT?T9j#9}bKt-N ZHin(~{LJP3;d_A644$rjF6*2UngDkL6hr_3 literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-center.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-center.png new file mode 100644 index 0000000000000000000000000000000000000000..1a86f0428a70fb06dfa8465a81e6f5b265307857 GIT binary patch literal 82 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?jt}kA^u=u+^2gv2}ba4#f ckWEeivY8kd&z~@T3S=>Oy85}Sb4q9e0H(1L{r~^~ literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-left.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-left.png new file mode 100644 index 0000000000000000000000000000000000000000..93aad32e69f977282b03c0a9ce3bc51e9fcb2991 GIT binary patch literal 76 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1j!3HG7{-t~dQo^1tjv*Yf$q5Mw0o5NL9j#B{ ZVQ7fwXWsh4{WVaU!PC{xWt~$(697>i6FvX{ literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-right.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-center-right.png new file mode 100644 index 0000000000000000000000000000000000000000..201e8fd643e1b0f0899990198e46e157008021bb GIT binary patch literal 76 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1j!3HG7{-t~dQo^1tjv*Yf$rT?T9j#9}bKt-N ZHin(~{LJP3;d_A644$rjF6*2UngDkL6hr_3 literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-center.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-center.png new file mode 100644 index 0000000000000000000000000000000000000000..408bbde4938cd7b226d40fd0975b71a165430069 GIT binary patch literal 993 zcmbVL&u-H&7!R5R)1-+L2M`igb^ruTY^P0{Xkp5dhE*b?>MGG2brW}uw#32lXg0xx z+g@fbz<~=Kcm+eFHx>tMCKiNK#Y@5!7-^xb#5tte~rbTk&@=#>+*Oe3|9R%L}m zE6VmxRgn0I3NWRIY3{1OK7Ua`nz-tlP6VUEr}K30jMIa&{ZV{&6x)fq^8##FjwHya zAfU>Q^U|qYb;;|0^q`7h0oCrVK1C}olX zT9Wn;$}9-anLuN97N?f{8GpUZ&j||rGXkrdrZ*2=smOK?AGgWmypDXjG!t*ng7=}@CP}%^EMzKgmP&U$H zw`Ooz5$16wVxFRkF&Oiiuw?Lb6+)8v{xxx0tP=$(Q_CPziGtN6sp48{7h=HvxN)O) zFA#V8aHr{c#-T$!+H`eWUSp&G$(jnzs8xIX)h@LNda&AFH$NP%$A_gbGdT>$ t^oo6l!Mfjb?P2+C9G#x_!{?jQ#+G#FleG8dF}|wiuGc+wKOUaG{|(ZSET8}Y literal 0 HcmV?d00001 diff --git a/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-right.png b/AppKit/Themes/Aristo2/Resources/window-standard-head-sheet-solid-top-right.png new file mode 100644 index 0000000000000000000000000000000000000000..a772da25293e4c7538fe5b485a8712a23c5b12d1 GIT binary patch literal 996 zcmbVLO>fgM7|xiO(4<{BAb~ho*=0yHvE9~fqGcmX8diyns;fjVNOKdfjkd(W@o2Uq zH~tK8=YTk}pTM8sz#ZXq%>ZfIfhdXX*YESZ-|q(p&o|Z|t!tXL(ckxnYQ3wzm3wRI z|KL~rQ!Ni=Z!8b_v7A%EG&klG2Kp(TvLU1K`I~QSThmr&$!ILc;R`$BsX;3pqfB#! z*0k;2GN;iAlVHN8N#^K3K7Y|c5Zk$%c?jqZYYgLah^$9HnL)~ zX7E`Ni6oZ^&p^dUC;Uu0y7KfYgftJsYvQa}CQ7BuENN~c1Da`C#kJ5b Date: Tue, 30 Apr 2013 14:35:01 -0700 Subject: [PATCH 2/5] Refactor code --- AppKit/CPWindow/_CPStandardWindowView.j | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index c9d981880..b7aedf1ce 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -68,14 +68,11 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; [super layoutSubviews]; var gradientHeight = [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView], - bounds = [self bounds]; + bounds = [self bounds], + bezelHeadColor = [[CPTheme defaultTheme] valueForAttributeWithName:_isSheet ? @"bezel-head-sheet-color" : @"bezel-head-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]; [_gradientView setFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), gradientHeight)]; - - if (_isSheet) - [_gradientView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"bezel-head-sheet-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]]; - else - [_gradientView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"bezel-head-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]]; + [_gradientView setBackgroundColor:bezelHeadColor]; [_solidView setFrame:CGRectMake(0.0, gradientHeight, CGRectGetWidth(bounds), CGRectGetHeight(bounds) - gradientHeight)]; [_solidView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"solid-color" forClass:_CPStandardWindowView]]; From 747729464875c5dddc42dfb2844f93ec7fcb6dc0 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 30 Apr 2013 14:39:31 -0700 Subject: [PATCH 3/5] Added test for toolbar sheet --- Tests/Manual/AttachedSheet/AppController.j | 51 +++++++++++++++++- .../Resources/CPImageNameColorPanel.png | Bin 0 -> 1767 bytes Tests/Manual/AttachedSheet/Resources/New.png | Bin 0 -> 455 bytes 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Tests/Manual/AttachedSheet/Resources/CPImageNameColorPanel.png create mode 100644 Tests/Manual/AttachedSheet/Resources/New.png diff --git a/Tests/Manual/AttachedSheet/AppController.j b/Tests/Manual/AttachedSheet/AppController.j index 4b48a33cb..dc39da44f 100644 --- a/Tests/Manual/AttachedSheet/AppController.j +++ b/Tests/Manual/AttachedSheet/AppController.j @@ -13,6 +13,7 @@ CPWindow wind; CPWindow sheet; CPTextField textField; + CPToolbar toolbar; } - (void)applicationDidFinishLaunching:(CPNotification)aNotification @@ -21,10 +22,14 @@ [wind setMinSize:CGSizeMake(300, 200)]; [wind setTitle:@"Untitled"]; - sheet = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 300, 100) styleMask:CPDocModalWindowMask | CPResizableWindowMask]; + sheet = [[CPWindow alloc] initWithContentRect:CGRectMake(50, 50, 300, 100) styleMask:CPTitledWindowMask | CPResizableWindowMask]; [sheet setMinSize:CGSizeMake(300, 100)]; [sheet setMaxSize:CGSizeMake(600, 300)]; + toolbar = [CPToolbar new]; + [toolbar setDisplayMode:CPToolbarDisplayModeIconAndLabel] + [toolbar setDelegate:self]; + var sheetContent = [sheet contentView]; textField = [[CPTextField alloc] initWithFrame:CGRectMake(10, 30, 280, 30)]; @@ -57,13 +62,30 @@ [displayButton setAction:@selector(displaySheet:)]; [[wind contentView] addSubview:displayButton]; + var displayButton = [[CPButton alloc] initWithFrame:CGRectMake(160, 180, 180, buttonHeight)]; + [displayButton setTitle:"Display Sheet with toolbar"]; + [displayButton setTarget:self]; + [displayButton setAction:@selector(displaySheetWithToolBar:)]; + [[wind contentView] addSubview:displayButton]; + [wind orderFront:self] } +- (void)displaySheetWithToolBar:(id)sender +{ + [textField setStringValue:""]; + [sheet makeFirstResponder:textField]; + [sheet setToolbar:toolbar]; + + [CPApp beginSheet:sheet modalForWindow:wind modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:nil]; + +} + - (void)displaySheet:(id)sender { [textField setStringValue:""]; [sheet makeFirstResponder:textField]; + [sheet setToolbar:nil]; [CPApp beginSheet:sheet modalForWindow:wind modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:nil]; } @@ -83,4 +105,31 @@ [wind setTitle:str]; } +- (CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)toolbar +{ + return ["item1", "item2"]; +} + +- (CPArray)toolbarAllowedItemIdentifiers:(CPToolbar)toolbar +{ + return ["item1", "item2"]; +} + +- (CPToolbarItem)toolbar:(CPToolbar)toolbar itemForItemIdentifier:(CPString)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag +{ + var toolbarItem = [[CPToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; + if (itemIdentifier == "item1") + { + [toolbarItem setLabel:@"Color"]; + [toolbarItem setImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"CPImageNameColorPanel.png"] size:CGSizeMake(26, 29)]]; + return toolbarItem; + } + else if (itemIdentifier == "item2") + { + [toolbarItem setLabel:@"Small New"]; + [toolbarItem setImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"New.png"] size:CGSizeMake(16, 16)]]; + return toolbarItem; + } +} + @end diff --git a/Tests/Manual/AttachedSheet/Resources/CPImageNameColorPanel.png b/Tests/Manual/AttachedSheet/Resources/CPImageNameColorPanel.png new file mode 100644 index 0000000000000000000000000000000000000000..a18918665d2f2357b452299130590124b30c6839 GIT binary patch literal 1767 zcmV6?000KANkloTnG@2Mq z+E~*smJe#8Vl1wd6t3)!J21%L0|s1-jd1W_Ir9dU^c6nIl=UAx(Tve&>0g z5A*)^|ICM3g-@u>&yB8%?eyW;PVP(Wv@fyJ^{F8+jp&qR1`XTvUn9SN?V;~p#Q#&< zfAI3gtv`C{_+u{|Y5d|ZXFi&!yY2H~7`P&$IUfeWgj;L>a`NQ#Y-fQ|qGyRQH!fdfGvDN0bVA$YfbzIyQF zi(XA;Usj0rjc)r@ctg>nPmK?xmK@%2+p?99KQyx12UM9a-vVNi+JNM=D20KD#IV>M zNinGMC;;-Ci31nj`S`>~N}`7AU(w zD*%E7NWc=pN=e9fhoXvd@d3)Xf|`1CWcTp4HCsOgiC+E2k!{Wbk&5K`&#ztHf5(R5 z6_Xc%nKIC612HAqV5ER41oKIuNP>t$53{J^94_Gt!}lz|bH$wlO2X%_6Mb{n(UB!R zYRA1_y6x8gT;RGW@hD03?ji~_6j>S}(1=FMNWv+k%0(S>OgE*zGO~TufHAP+k;5BD zz_JKbm_EDd%Xg@$DVWtJkW!y30ftSqB%vS%>?{@aL?7hN8?zn{S;oFz>&8 zry4!++_M1gwf5Zi()zwWwYJ!I)8N#Hf;dsI3lv#^3Mk1_5^+w6aLzQ6iBu+vGf|3w zk4KugdFjoAORS-_PmHc#ZyAy7`pn3%KYbA@>L|dVz#@@OlO;(gA^B`|1_V4J&Jv|s zbS;%W1)L*H(dTTADIo>Uju0rqndGUl ziJ4(TNW#fQ3p40lIgqzS?y}5C)>wYAV6`bI0fm?#!=OMh4M@s!wmz$yCQByW93+JS zR))^xp-}8A*}xjhj%BDZX&G??=vfJrD032^DC}TY>;|P~SK<&$UkqKs$7DD7C;}od zkpKu0;A41}pDVx|vh@B7lys&5zr_U0DWTBRDQrr#Sf|kv%4~Eoq4*ft#VG(E3EGHI z;WW+j425&((QD?(qODwt{gP!C7wff@LMCgoI~3-aL_>jNcg3bjYwE+wM=(sE5|6Y1 zbfDM`xSS*8AqY6xe$a7Xx2+<~bD>{bz0@u)RtW_$1*8<5& z#T1BXciOOW9hj7x@F@#4T8I*#$;qb6L~k1|0FUtCi41Gk-r`iIdec{YQISN8Iji0 zBH@#g3NMg7GI8p$v!e&M9tX=HC<6P+<@fv01Fts)avgzc`9QP76pe0zDw9+yK)I|t z`CqRxU9Fq8)$FEA66nQWJk{>A#oTvI^x!`qnCOjiV{cwLb{0bbf&gf>^oO%GRWnif zdRaLWRrMNcgfce(%q2MXyYgfK$b~TPBuDoTa}ZS{%{&AEe|CVQY&YP zx`G8zB4s8rih#AuAOHE(>H6hrS^Rj*wr`DlH~Qy9y|C*0`E|~!pLKHe&9|=T?F;d|%^k37n=TFVd6!T8{`rj_MpZdw+vjG6fxK3nd z*u>g@%eTLHi|KsNH=C<-1779R%WP+{6Xu2nOG9AI)+*I%=mn=bGkznf4VVS_;7XAG z_=m?nd<#HGViJ)=GhdV=4k?lz(n}U?Dz5(Q?S;Y3Lw33@MXOXY{hJbasHwP;=HX6D zJo%4S_{QHW-WdQ5(k88}yTl`*g-@tA-3!y?j{x4$Vp1Xn;%67u$yK7r4QswA$?P$4 zNj*zhn1`M%&Aiow#LEatv~YC`{|dE$ZW;6EtP4Tb)9dDi;J=5vj7HpxcYy!^002ov JPDHLkV1oKSVgdjF literal 0 HcmV?d00001 diff --git a/Tests/Manual/AttachedSheet/Resources/New.png b/Tests/Manual/AttachedSheet/Resources/New.png new file mode 100644 index 0000000000000000000000000000000000000000..2ca371152ed836c53047310d1dcf00bdec112e22 GIT binary patch literal 455 zcmV;&0XY7NP)uK#$*rX+aO|KV?ShU!G%7hAKATytpxJCPbX|vBE=MDtWE+|13T)eEG#U*k zm&>3i3S=@FkYyRN*({xo3OmRWSI}y;7>?tBWm&9Huh*ekt92NH&XKx93bY38$#J*Q< z1C`ag<#&%@Fc^3^eu~0_UHn6~@(dDqzC>Q=zKL@!0aqXQ5GlmIMo+;01tgAKAW0s< xq~MT1ya^c8@%)WLNeBt^5GB7!W!jx}Fu&6+3H5P(-f{o{002ovPDHLkV1gV-#7qDH literal 0 HcmV?d00001 From e5fc4520635d54fb315ba67d7a1671b791de3725 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 30 Apr 2013 14:43:47 -0700 Subject: [PATCH 4/5] Added theme for Arsito1 --- AppKit/Themes/Aristo/ThemeDescriptors.j | 1 + 1 file changed, 1 insertion(+) diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index ed9f0cc15..d7c47c1eb 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -2687,6 +2687,7 @@ var themedButtonValues = nil, [ [@"gradient-height", 31.0], [@"bezel-head-color", bezelHeadColor], + [@"bezel-head-sheet-color", solidColor], [@"solid-color", solidColor], [@"title-font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize]], From 30e9389a92c5b34a6107a8c98364fc17f13c9507 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 30 Apr 2013 15:25:23 -0700 Subject: [PATCH 5/5] Updated test --- Tests/Manual/AttachedSheet/AppController.j | 40 +++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/Tests/Manual/AttachedSheet/AppController.j b/Tests/Manual/AttachedSheet/AppController.j index dc39da44f..b91f6c2b2 100644 --- a/Tests/Manual/AttachedSheet/AppController.j +++ b/Tests/Manual/AttachedSheet/AppController.j @@ -12,8 +12,8 @@ { CPWindow wind; CPWindow sheet; + CPWindow secondSheet; CPTextField textField; - CPToolbar toolbar; } - (void)applicationDidFinishLaunching:(CPNotification)aNotification @@ -26,9 +26,14 @@ [sheet setMinSize:CGSizeMake(300, 100)]; [sheet setMaxSize:CGSizeMake(600, 300)]; + secondSheet = [[CPWindow alloc] initWithContentRect:CGRectMake(50, 50, 300, 50) styleMask:CPTitledWindowMask | CPResizableWindowMask]; + [secondSheet setMinSize:CGSizeMake(300, 100)]; + [secondSheet setMaxSize:CGSizeMake(600, 300)]; + toolbar = [CPToolbar new]; [toolbar setDisplayMode:CPToolbarDisplayModeIconAndLabel] [toolbar setDelegate:self]; + [secondSheet setToolbar:toolbar]; var sheetContent = [sheet contentView]; @@ -56,6 +61,25 @@ [sheetContent addSubview:okButton]; [sheetContent addSubview:cancelButton]; + var secondSheetContent = [secondSheet contentView]; + + var okButton2 = [[CPButton alloc] initWithFrame:CGRectMake(180, 25, 50, buttonHeight)]; + [okButton2 setTitle:"OK"]; + [okButton2 setTarget:self]; + [okButton2 setTag:1]; + [okButton2 setAction:@selector(closeSecondSheet:)]; + [okButton2 setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin]; + + var cancelButton2 = [[CPButton alloc] initWithFrame:CGRectMake(70, 25, 100, buttonHeight)]; + [cancelButton2 setTitle:"Cancel"]; + [cancelButton2 setTarget:self]; + [cancelButton2 setTag:0]; + [cancelButton2 setAction:@selector(closeSecondSheet:)]; + [cancelButton2 setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin]; + + [secondSheetContent addSubview:okButton2]; + [secondSheetContent addSubview:cancelButton2]; + var displayButton = [[CPButton alloc] initWithFrame:CGRectMake(200, 150, 100, buttonHeight)]; [displayButton setTitle:"Display Sheet"]; [displayButton setTarget:self]; @@ -73,12 +97,7 @@ - (void)displaySheetWithToolBar:(id)sender { - [textField setStringValue:""]; - [sheet makeFirstResponder:textField]; - [sheet setToolbar:toolbar]; - - [CPApp beginSheet:sheet modalForWindow:wind modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:nil]; - + [CPApp beginSheet:secondSheet modalForWindow:wind modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:nil]; } - (void)displaySheet:(id)sender @@ -95,11 +114,16 @@ [CPApp endSheet:sheet returnCode:[sender tag]]; } +- (void)closeSecondSheet:(id)sender +{ + [CPApp endSheet:secondSheet returnCode:0]; +} + - (void)didEndSheet:(CPWindow)aSheet returnCode:(int)returnCode contextInfo:(id)contextInfo { var str = [textField stringValue]; - [sheet orderOut:self]; + [aSheet orderOut:self]; if (returnCode == CPOKButton && [str length] > 0) [wind setTitle:str];