From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:47:36 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>LogoExample</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none <imports></imports> <category>Examples-Help</category> <attributes> <package>Logo-Example</package> </attributes> </class> <comment> Examples.LogoExample
LogoExample shows how to achieve various effects by using label widgets. The label widgets in the example interface are: #textLogo A text label, with the label supplied by the property sheet (the usual mechanism). #release A text label, with the label supplied at startup time via #postBuildWith:. #logo A graphic label, with the graphic image supplied by a resource method (#logo) on the class side (the usual mechanism). #trademark A graphic label, with the graphic image supplied by a central registry that is maintained by ApplicationModel. This class makes an entry in that registry via the class-side #initialize method. AnimateLogo A button whose action method (#animateLogo) shows how to update a graphic label (#logo) at runtime.
</comment> <methods> Examples.LogoExample <category>actions</category>
animateLogo "Display the logo in successively larger sizes (as a way of demonstrating dynamic updating of a graphic label)." | logo widget view animationRegion | logo := self class logo. widget := self builder componentAt: #logo. animationRegion := widget bounds. view := self builder composite. 10 to: 1 by: -1 do: [ :factor | (Delay forMilliseconds: 100) wait. widget label: (logo shrunkenBy: factor @ factor). view invalidateRectangle: animationRegion repairNow: true]
</methods> <methods> Examples.LogoExample <category>interface opening</category>
postBuildWith: aBuilder "Update the slogan's text, and make the company name bold and red." | slogan txt emph label | "Insert the years-in-business into the slogan." slogan := 'Serving Shrimps For ', (Date today year - 1869) printString, ' Years'. (aBuilder componentAt: #slogan) labelString: slogan. "Make the company name bold and red." txt := 'Many Hands Shrimppickers' asText. emph := Array with: #bold with: #color->ColorValue red. txt emphasizeFrom: 1 to: 10 with: emph. label := Label with: txt attributes: (TextAttributes styleNamed: #large). (aBuilder componentAt: #textLogo) label: label.
</methods> <methods> Examples.LogoExample class <category>class initialization</category>
initialize "LogoExample initialize" "Register the graphic image for the trademark symbol." ApplicationModel visualAt: #trademark put: self trademark. "Register the textual version of the trademark symbol." ApplicationModel labelAt: #tm put: '(TM)'.
</methods> <methods> Examples.LogoExample class <category>resources</category>
logo "UIMaskEditor new openOnClass: self andSelector: #logo" <resource: #image> ^Image extent: 34@33 depth: 1 palette: MonoMappedPalette whiteBlack bits: (ByteArray fromPackedString: '@X@@@@@@@@C>_???0@@@@NYO???@@@@@9$??3<@@@@C2S_3I0@@@@OII?L''@@@@@:@''>R\@@@@BX@_9IP@@@@H C?PE@@@@@0@O3@D@@@@C@0?D@P@@@@N4;?@A@@@@@<2_3 D@@@@C3I?I@0@@@@O$&,%C@@@@@>RRRZ\@@@@C4AIII0@@@@L0@0D''@@@@@1@L@C<@@@@C MN@_0@@@@OAL M?@@@@@>D2MO<@@@@C8IIL''0@@@@O0$$2_@@@@@?-@II,@@@@C?L@$$0@@@@O<PM@S@@@@@?8AL@L@@@@C?0DPA0@@@@O? H@G@@@@@?>@P@\@@@@C?<@ C0@@@@O?????@@@@@') pad: 32
trademark "UIMaskEditor new openOnClass: self andSelector: #trademark" <resource: #image> ^Image extent: 16@16 depth: 1 palette: CoveragePalette monoMaskPalette bits: #[7 224 0 0 24 24 0 0 32 4 0 0 64 2 0 0 64 2 0 0 190 137 0 0 136 217 0 0 136 169 0 0 136 137 0 0 136 137 0 0 136 137 0 0 64 2 0 0 64 2 0 0 32 4 0 0 24 24 0 0 7 224 0 0 ] pad: 32
</methods> <methods> Examples.LogoExample class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Logo' #min: #(#Point 256 250 ) #max: #(#Point 256 250 ) #bounds: #(#Rectangle 193 217 449 467 ) ) #component: #(#SpecCollection #collection: #( #(#LabelSpec #layout: #(#AlignmentOrigin 0 0.5 46 0 0.5 0 ) #name: #logo #label: #logo #style: #default #hasCharacterOrientedLabel: false ) #(#LabelSpec #layout: #(#AlignmentOrigin 0 0.5 129 0 0.5 0 ) #name: #slogan #label: 'Serving Shrimps For 100 Years' #style: #small ) #(#ActionButtonSpec #layout: #(#LayoutFrame -65 0.5 217 0 65 0.5 242 0 ) #model: #animateLogo #label: 'Animate logo' #defaultable: true ) #(#LabelSpec #layout: #(#LayoutOrigin 85 0.5 85 0 ) #label: #trademark #hasCharacterOrientedLabel: false ) #(#LabelSpec #layout: #(#AlignmentOrigin 0 0.5 93 0 0.5 0 ) #name: #textLogo #colors: #(#LookPreferences #setForegroundColor: #(#ColorValue #black ) ) #label: 'Many Hands Shrimppickers' #style: #large ) ) ) )
</methods> <initialize> Examples.LogoExample </initialize> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>ApplicationModel</name> <environment>UI</environment> <super>UI.Model</super> <private>false</private> none builder uiSession eventHandlers savedWindowInformation <imports></imports> <category>UIBuilder-Framework</category> <attributes> <package>UIBuilder-Framework</package> </attributes> </class>