eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FontPanel':

Home

everywhere
www.exept.de
for:
[back]

Class: FontPanel


Inheritance:

   Object
   |
   +--GraphicsContext
      |
      +--DeviceGraphicsContext
         |
         +--GraphicsMedium
            |
            +--DisplaySurface
               |
               +--SimpleView
                  |
                  +--View
                     |
                     +--TopView
                        |
                        +--StandardSystemView
                           |
                           +--ModalBox
                              |
                              +--DialogBox
                                 |
                                 +--FontPanel

Package:
stx:libwidg
Category:
Views-DialogBoxes
Version:
rev: 1.105 date: 2010/04/13 14:32:34
user: cg
file: FontPanel.st directory: libwidg
module: stx stc-classLibrary: libwidg
Author:
Claus Gittinger

Description:


this class implements a font chooser.

Notice: 
    this is a very old dialog; 
    it was written before the UI-framework was available and is completely
    setup manually (initialize method).
    Therefore, it desperately asks to be rewritten using the UIPainter...


Related information:

    Font
    FontDescription
    View
    Dialog

Class protocol:

defaults
o  defaultAsciiSampleString

o  defaultExtent
return the default extent of my instances.
The value returned here is usually ignored, and
the value from preferredExtent taken instead.

o  defaultJIS0201SampleString
return the sample jis preview text

o  defaultJISSampleString
return the sample jis preview text

o  defaultLatin1SampleString
return the sample latin1 preview text

o  defaultSampleStringForEncoding: enc

o  defaultUnicodeSampleString
return the sample unicode preview text

o  sampleStringWithAllLetters

menu specs
o  previewMenu
This resource specification was automatically generated
by the MenuEditor of ST/X.

startup
o  fontFromUser
open a fontPanel and return the selected font, or nil
if abort is pressed

o  fontFromUserInitial: aFont
open a fontPanel showing aFont initially,
and return the selected font, or nil if abort is pressed

o  fontFromUserInitial: aFont title: someTitle
open a fontPanel with title and return the selected font,
or nil if abort is pressed

o  fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed

o  fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed

o  fontFromUserInitial: initialFont title: someTitle filter: aFilterBlock encoding: encoding enabled: enabled
open a fontPanel with title and font-filter
and return the selected font, or nil if abort is pressed

o  openOn: aFont
open a fontPanel showing aFont initially.
This panel is for information only - no font selection is possible.


Instance protocol:

accessing
o  action: aFourArgBlock
set the action to be evaluated on ok.
The block will be evaluated with family, face, style, size and encoding.

o  encoding: aPattern
set the encoding goal

o  filter: aOneArgBlock
set a filter; if non-nil, only fonts for which the filterBlock
returns true will be offered

o  initialFont: aFont
set the font to be selected initially

initialization
o  enabled: aBoolean

o  initialize

o  listOfEncodingsInFilterCombo

o  postRealize
kludge for sco - xlsfont fails sometimes - try again here

o  previewMenu

o  showEncodingFilter

private
o  clearPreview
clear the preview subview

o  extractFaceAndStyleFrom: aString
given a string, extract currentFace and currentStyle

o  fontForPreview
get the preview font

o  getFacesForFamily: aFamilyName filtering: filter
the list of font faces for a given family

o  getFamilyList
the list of font families

o  getSizesInFamily: aFamilyName face: face style: style filtering: filter

o  getStylesInFamily: aFamilyName face: aFace filtering: filter
the list of font styles for a given family-face

o  showPreview
show the preview text

o  showSelectedFont

o  updateFamilyList
update the list of font families

queries
o  characterSetViewClassAvailable

o  characterSetViewClassAvailableOrOSIsUNIX

o  osIsUNIX

o  preferredExtent
return the boxes preferredExtent

user interaction
o  copyFontName

o  encodingFilterSelected: anEncodingPattern
another encoding was selected; find available fonts and update lists

o  faceSelected: aFaceAndStyleName
a fonts face was selected; find available sizes and update lists

o  faceSelected: aFaceAndStyleName showPreview: showPreview
a fonts face was selected; find available sizes and update lists

o  familySelected: aFamilyName
a fonts family was selected; find available faces and update lists

o  familySelected: aFamilyName showPreview: showPreview
a fonts family was selected; find available faces and update lists

o  okPressed
ok was pressed; hide myself and evaluate the okAction, passing
family, face, style and size as arguments

o  previewCopySelection

o  previewInspectFont

o  previewShowCharacterSet

o  previewShowCharacterSetUsingXFD

o  sizeSelected: aNumberOrString
a size was selected; update preview

o  sizeSelected: aNumberOrString showPreview: showPreview
a size was selected; update preview

o  sizeUnitSelected: unitSymbol

o  updateSizeList


Examples:


very simple:


    |font|
    
    font := FontPanel fontFromUser.
    Transcript showCR:font
with initial font:


    |font|

    font := FontPanel 
                fontFromUserInitial:(Font 
                                        family:'courier'
                                        size:12).
    Transcript showCR:font
with initial font & title:


    |font|

    font := FontPanel 
                fontFromUserInitial:(Font 
                                        family:'courier'
                                        size:12)
                              title:'select a fooBar font'.
    Transcript showCR:font
full setup; setting a filter to only present iso fonts and callBack action:



    |panel|

    panel := FontPanel new.
    panel label:'hi there - which iso font ?'.
    panel filter:[:fd | fd encoding notNil
                        and:[fd encoding startsWith:'iso']].
    panel action:[:family :face :style :size | 
                    Transcript showCR:'family:' , family.
                    Transcript showCR:'face:' , face.
                    Transcript showCR:'style:' , style.
                    Transcript showCR:'size:' , size printString.
                 ].
    panel open


ST/X 6.1.1; WebServer 1.620 at exept:8081; Mon, 21 May 2012 16:40:12 GMT