GNU Smalltalk Library Reference ******************************* This document describes the class libraries that are distributed together with the GNU Smalltalk programming language. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". 1 Graphical users interfaces with BLOX ************************************** 1.1 BLOX.BArc ============= Defined in namespace BLOX Superclass: BLOX.BOval Category: Graphics-Windows I can draw arcs, pie slices (don't eat them!!), chords, and... nothing more. 1.1.1 BLOX.BArc: accessing -------------------------- endAngle Answer the ending of the angular range that is occupied by the arc, expressed in degrees endAngle: angle Set the ending of the angular range that is occupied by the arc, expressed in degrees fillChord Specify that the arc will be filled by painting an area delimited by the arc and the chord that joins the arc's endpoints. fillSlice Specify that the arc will be filled by painting an area delimited by the arc and the two radii joins the center of the arc with each of the endpoints (that is, that a pie slice will be drawn). from Answer the starting point of the arc in cartesian coordinates from: aPoint Set the starting point of the arc in cartesian coordinates from: start to: end Set the two starting points of the arc in cartesian coordinates startAngle Answer the beginning of the angular range that is occupied by the arc, expressed in degrees startAngle: angle Set the beginning of the angular range that is occupied by the arc, expressed in degrees sweepAngle Answer the size of the angular range that is occupied by the arc, expressed in degrees sweepAngle: angle Set the size of the angular range that is occupied by the arc, expressed in degrees to Answer the ending point of the arc in cartesian coordinates to: aPoint Set the ending point of the arc in cartesian coordinates 1.2 BLOX.BBalloon ================= Defined in namespace BLOX Superclass: BLOX.BEventSet Category: Graphics-Examples This event set allows a widget to show explanatory information when the mouse lingers over it for a while. 1.2.1 BLOX.BBalloon class: accessing ------------------------------------ balloonDelayTime Answer the time after which the balloon is shown (default is half a second). balloonDelayTime: milliseconds Set the time after which the balloon is shown. shown Answer whether a balloon is displayed 1.2.2 BLOX.BBalloon: accessing ------------------------------ shown Answer whether the receiver's balloon is displayed text Answer the text displayed in the balloon text: aString Set the text displayed in the balloon to aString 1.2.3 BLOX.BBalloon: initializing --------------------------------- initialize: aBWidget Initialize the event sets for the receiver 1.3 BLOX.BBoundingBox ===================== Defined in namespace BLOX Superclass: BLOX.BCanvasObject Category: Graphics-Windows I am the ultimate ancestor of all items that you can put in a BCanvas and which are well defined by their bounding box - i.e. everything except BPolylines and BSplines. 1.3.1 BLOX.BBoundingBox: accessing ---------------------------------- boundingBox Answer a Rectangle enclosing all of the receiver center Answer the center point of the receiver center: center extent: extent Move the object so that it is centered around the center Point and its size is given by the extent Point. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. corner Answer the Point specifying the lower-right corner of the receiver corner: pointOrArray Set the Point specifying the lower-right corner of the receiver; pointOrArray can be a Point or a two-item Array. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. extent Answer a Point specifying the size of the receiver extent: pointOrArray Set the Point specifying the size of the receiver; pointOrArray can be a Point or a two-item Array. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. moveBy: pointOrArray Move the object by the amount indicated by pointOrArray: that is, its whole bounding box is shifted by that amount. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. origin Answer the Point specifying the top-left corner of the receiver origin: pointOrArray Set the Point specifying the top-left corner of the receiver; pointOrArray can be a Point or a two-item Array. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. origin: originPointOrArray corner: cornerPointOrArray Set the bounding box of the object, based on a Point specifying the top-left corner of the receiver and another specifying the bottom-right corner; the two parameters can both be Points or two-item Arrays. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. origin: originPointOrArray extent: extentPointOrArray Set the bounding box of the object, based on a Point specifying the top-left corner of the receiver and another specifying its size; the two parameters can both be Points or two-item Arrays. No changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. 1.4 BLOX.BButton ================ Defined in namespace BLOX Superclass: BLOX.BPrimitive Category: Graphics-Windows I am a button that a user can click. In fact I am at the head of a small hierarchy of objects which exhibit button-like look and behavior 1.4.1 BLOX.BButton class: instance creation ------------------------------------------- new: parent label: label Answer a new BButton widget laid inside the given parent widget, showing by default the `label' String. 1.4.2 BLOX.BButton: accessing ----------------------------- backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. callback Answer a DirectedMessage that is sent when the receiver is clicked, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is clicked. If the method accepts an argument, the receiver is passed. font Answer the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: value Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. invokeCallback Generate a synthetic callback label Answer the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. label: value Set the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. 1.5 BLOX.BButtonLike ==================== Defined in namespace BLOX Superclass: BLOX.BExtended Category: Graphics-Examples I am an object whose 3-D appearance resembles that of buttons. 1.5.1 BLOX.BButtonLike: accessing --------------------------------- callback Answer a DirectedMessage that is sent when the receiver is clicked, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is clicked. If the method accepts an argument, the receiver is passed. invokeCallback Generate a synthetic callback pressed This is the default callback for the widget; it does nothing if you don't override it. Of course if a subclass overriddes this you (user of the class) might desire to call this method from your own callback. 1.6 BLOX.BCanvas ================ Defined in namespace BLOX Superclass: BLOX.BViewport Category: Graphics-Windows I am an host for whatever geometric shape you want. If you want to do some fancy graphics with Smalltalk, I'll be happy to help. My friends derived from BCanvasObject ask me all sort of things to do, so I am the real worker, not they! BCanvasObject: I am BCanvas: No I am BCanvasObject: No I am BCanvas: No I am well, you know, he always has something to object. 1.6.1 BLOX.BCanvas: accessing ----------------------------- backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. 1.6.2 BLOX.BCanvas: geometry management --------------------------------------- addChild: child The widget identified by child has been added to the receiver. This method is public not because you can call it, but because it can be useful to override it, not forgetting the call to either the superclass implementation or #basicAddChild:, to perform some initialization on the children just added. Answer the new child. child: child height: value Set the given child's height. child: child heightOffset: value Offset the given child's height by value pixels. child: child width: value Set the given child's width. child: child widthOffset: value Offset the given child's width by value pixels. child: child x: value Set the given child's top-left corner's x coordinate, in pixels in the canvas' coordinate system. child: child xOffset: value Offset the given child's top-left x by value pixels. child: child y: value Set the given child's top-left corner's y coordinate, in pixels in the canvas' coordinate system. child: child yOffset: value Offset the given child's top-left y by value pixels. heightChild: child Answer the given child's height in pixels. widthChild: child Answer the given child's width in pixels. xChild: child Answer the given child's top-left corner's x coordinate, in pixels in the canvas' coordinate system. yChild: child Answer the given child's top-left corner's y coordinate, in pixels in the canvas' coordinate system. 1.6.3 BLOX.BCanvas: widget protocol ----------------------------------- at: aPoint Selects the topmost item in the canvas overlapping the point given by aPoint. between: origin and: corner do: aBlock Evaluate aBlock for each item whose bounding box intersects the rectangle between the two Points, origin and corner. Pass the item to the block. boundingBox Answer the bounding box of all the items in the canvas destroyed The widget has been destroyed. Tell all of its items about this fact. do: aBlock Evaluate aBlock, passing each item to it. empty Remove all the items from the canvas, leaving it empty extraSpace Answer the amount of space that is left as a border around the canvas items. extraSpace: aPoint Set the amount of space that is left as a border around the canvas items. items Answer an Array containing all the items in the canvas mapPoint: aPoint Given aPoint, a point expressed in window coordinates, answer the corresponding canvas coordinates that are displayed at that location. 1.7 BLOX.BCanvasObject ====================== Defined in namespace BLOX Superclass: BLOX.BEventTarget Category: Graphics-Windows I am the ultimate ancestor of all items that you can put in a BCanvas. I provide some general methods to my concrete offspring. 1.7.1 BLOX.BCanvasObject class: instance creation ------------------------------------------------- new This method should not be called for instances of this class. new: parentCanvas Answer a new instance of the receiver, displayed into the given parentCanvas. 1.7.2 BLOX.BCanvasObject: accessing ----------------------------------- blox Answer the parent canvas of the receiver boundingBox Answer a Rectangle enclosing all of the receiver color Answer the color to be used to fill this item's area. color: color Set the color to be used to fill this item's area. copyInto: newCanvas Answer a new BCanvasObject identical to this but displayed into another canvas, newCanvas. The new instance is not created at the time it is returned. copyObject Answer a new BCanvasObject identical to this. Unlike #copy, which merely creates a new Smalltalk object with the same data and referring to the same canvas item, the object created with #copyObject is physically distinct from the original. The new instance is not created at the time it is returned. createCopy Answer a new BCanvasObject identical to this. Unlike #copy, which merely creates a new Smalltalk object with the same data and referring to the same canvas item, the object created with #copyObject is physically distinct from the original. The new instance has already been created at the time it is returned. createCopyInto: newCanvas Answer a new BCanvasObject identical to this but displayed into another canvas, newCanvas. The new instance has already been created at the time it is returned. deepCopy It does not make sense to make a copy, because it would make data inconsistent across different objects; so answer the receiver grayOut Apply a 50% gray stippling pattern to the object shallowCopy It does not make sense to make a copy, because it would make data inconsistent across different objects; so answer the receiver 1.7.3 BLOX.BCanvasObject: widget protocol ----------------------------------------- create If the object has not been created yet and has been initialized correctly, insert it for real in the parent canvas created Answer whether the object is just a placeholder or has already been inserted for real in the parent canvas lower Move the item to the lowest position in the display list. Child widgets always obscure other item types, and the stacking order of window items is determined by sending methods to the widget object directly. raise Move the item to the highest position in the display list. Child widgets always obscure other item types, and the stacking order of window items is determined by sending methods to the widget object directly. redraw Force the object to be displayed in the parent canvas, creating it if it has not been inserted for real in the parent, and refresh its position if it has changed. remove Remove the object from the canvas show Ensure that the object is visible in the center of the canvas, scrolling it if necessary. 1.8 BLOX.BCheckMenuItem ======================= Defined in namespace BLOX Superclass: BLOX.BMenuItem Category: Graphics-Windows I am a menu item which can be toggled between two states, marked and unmarked. 1.8.1 BLOX.BCheckMenuItem class: instance creation -------------------------------------------------- new: parent This method should not be called for instances of this class. 1.8.2 BLOX.BCheckMenuItem: accessing ------------------------------------ invokeCallback Generate a synthetic callback value Answer whether the menu item is in a selected (checked) state. value: aBoolean Set whether the button is in a selected (checked) state and generates a callback accordingly. 1.9 BLOX.BColorButton ===================== Defined in namespace BLOX Superclass: BLOX.BButtonLike Category: Graphics-Examples I am a button that shows a color and that, unless a different callback is used, lets you choose a color when it is clicked. 1.9.1 BLOX.BColorButton: accessing ---------------------------------- color Set the color that the receiver is painted in. color: aString Set the color that the receiver is painted in. pressed This is the default callback; it brings up a `choose-a-color' window and, if `Ok' is pressed in the window, sets the receiver to be painted in the chosen color. 1.10 BLOX.BContainer ==================== Defined in namespace BLOX Superclass: BLOX.BForm Category: Graphics-Windows I am used to group many widgets together. I can perform simple management by putting widgets next to each other, from left to right or from top to bottom. 1.10.1 BLOX.BContainer: accessing --------------------------------- setVerticalLayout: aBoolean Answer whether the container will align the widgets vertically or horizontally. Horizontal alignment means that widgets are packed from left to right, while vertical alignment means that widgets are packed from the top to the bottom of the widget. Widgets that are set to be "stretched" will share all the space that is not allocated to non-stretched widgets. The layout of the widget can only be set before the first child is inserted in the widget. 1.11 BLOX.BDialog ================= Defined in namespace BLOX Superclass: BLOX.BForm Category: Graphics-Windows I am a facility for implementing dialogs with many possible choices and requests. In addition I provide support for a few platform native common dialog boxes, such as choose-a-file and choose-a-color. 1.11.1 BLOX.BDialog class: instance creation -------------------------------------------- new: parent Answer a new dialog handler (containing a label widget and some button widgets) laid out within the given parent window. The label widget, when it is created, is empty. new: parent label: aLabel Answer a new dialog handler (containing a label widget and some button widgets) laid out within the given parent window. The label widget, when it is created, contains aLabel. new: parent label: aLabel prompt: aString Answer a new dialog handler (containing a label widget, some button widgets, and an edit window showing aString by default) laid out within the given parent window. The label widget, when it is created, contains aLabel. 1.11.2 BLOX.BDialog class: prompters ------------------------------------ chooseColor: parent label: aLabel default: color Prompt for a color. The dialog box is created with the given parent window and with aLabel as its title bar text, and initially it selects the color given in the color parameter. If the dialog box is canceled, nil is answered, else the selected color is returned as a String with its RGB value. chooseFileToOpen: parent label: aLabel default: name defaultExtension: ext types: typeList Pop up a dialog box for the user to select a file to open. Its purpose is for the user to select an existing file only. If the user enters an non-existent file, the dialog box gives the user an error prompt and requires the user to give an alternative selection or to cancel the selection. If an application allows the user to create new files, it should do so by providing a separate New menu command. If the dialog box is canceled, nil is answered, else the selected file name is returned as a String. The dialog box is created with the given parent window and with aLabel as its title bar text. The name parameter indicates which file is initially selected, and the default extension specifies a string that will be appended to the filename if the user enters a filename without an extension. The typeList parameter is an array of arrays, like #(('Text files' '.txt' '.diz') ('Smalltalk files' '.st')), and is used to construct a listbox of file types. When the user chooses a file type in the listbox, only the files of that type are listed. Each item in the array contains a list of strings: the first one is the name of the file type described by a particular file pattern, and is the text string that appears in the File types listbox, while the other ones are the possible extensions that belong to this particular file type. chooseFileToSave: parent label: aLabel default: name defaultExtension: ext types: typeList Pop up a dialog box for the user to select a file to save; this differs from the file open dialog box in that non-existent file names are accepted and existing file names trigger a confirmation dialog box, asking the user whether the file should be overwritten or not. If the dialog box is canceled, nil is answered, else the selected file name is returned as a String. The dialog box is created with the given parent window and with aLabel as its title bar text. The name parameter indicates which file is initially selected, and the default extension specifies a string that will be appended to the filename if the user enters a filename without an extension. The typeList parameter is an array of arrays, like #(('Text files' '.txt' '.diz') ('Smalltalk files' '.st')), and is used to construct a listbox of file types. When the user chooses a file type in the listbox, only the files of that type are listed. Each item in the array contains a list of strings: the first one is the name of the file type described by a particular file pattern, and is the text string that appears in the File types listbox, while the other ones are the possible extensions that belong to this particular file type. 1.11.3 BLOX.BDialog: accessing ------------------------------ addButton: aLabel receiver: anObject index: anInt Add a button to the dialog box that, when clicked, will cause the #dispatch: method to be triggered in anObject, passing anInt as the argument of the callback. The caption of the button is set to aLabel. addButton: aLabel receiver: anObject message: aSymbol Add a button to the dialog box that, when clicked, will cause the aSymbol unary selector to be sent to anObject. The caption of the button is set to aLabel. addButton: aLabel receiver: anObject message: aSymbol argument: arg Add a button to the dialog box that, when clicked, will cause the aSymbol one-argument selector to be sent to anObject, passing arg as the argument of the callback. The caption of the button is set to aLabel. contents Answer the text that is displayed in the entry widget associated to the dialog box. contents: newText Display newText in the entry widget associated to the dialog box. 1.11.4 BLOX.BDialog: widget protocol ------------------------------------ center Center the dialog box's parent window in the screen centerIn: view Center the dialog box's parent window in the given widget destroyed Private - The receiver has been destroyed, clear the corresponding Tcl variable to avoid memory leaks. invokeCallback: index Generate a synthetic callback corresponding to the index-th button being pressed, and destroy the parent window (triggering its callback if one was established). loop Map the parent window modally. In other words, an event loop is started that ends only after the window has been destroyed. For more information on the treatment of events for modal windows, refer to BWindow>>#modalMap. 1.12 BLOX.BDropDown =================== Defined in namespace BLOX Superclass: BLOX.BExtended Category: Graphics-Examples This class is an abstract superclass for widgets offering the ability to pick items from a pre-built list. The list is usually hidden, but a button on the right of this widgets makes it pop up. This widget is thus composed of three parts: an unspecified text widget (shown on the left of the button and always visible), the button widget (shown on the right, it depicts a down arrow, and is always visible), and the pop-up list widget. 1.12.1 BLOX.BDropDown: accessing -------------------------------- backgroundColor Answer the value of the backgroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well. Specifies the normal background color to use when displaying the widget. backgroundColor: aColor Set the value of the backgroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well. Specifies the normal background color to use when displaying the widget. droppedRows Answer the number of items that are visible at any time in the listbox. droppedRows: anInteger Set the number of items that are visible at any time in the listbox. font Answer the value of the font option for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: value Set the value of the font option for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor Answer the value of the foregroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well. Specifies the normal foreground color to use when displaying the widget. foregroundColor: aColor Set the value of the foregroundColor for the widget, which in this class is only set for the list widget (that is, the pop-up widget). Subclasses should override this method so that the color is set properly for the text widget as well. Specifies the normal foreground color to use when displaying the widget. highlightBackground Answer the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the list widget. highlightBackground: aColor Set the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the list widget. highlightForeground Answer the value of the highlightForeground option for the widget. Specifies the foreground color to use when displaying selected items in the list widget. highlightForeground: aColor Set the value of the highlightForeground option for the widget. Specifies the foreground color to use when displaying selected items in the list widget. 1.12.2 BLOX.BDropDown: callbacks -------------------------------- callback Answer a DirectedMessage that is sent when the receiver is clicked, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is clicked. If the method accepts an argument, the receiver is passed. invokeCallback Generate a synthetic callback 1.12.3 BLOX.BDropDown: flexibility ---------------------------------- createList Create the popup widget to be used for the `drop-down list'. It is a BList by default, but you can use any other widget, overriding the `list box accessing' methods if necessary. createTextWidget Create the widget that will hold the string chosen from the list box and answer it. The widget must be a child of `self primitive'. itemHeight Answer the height of an item in the drop-down list. The default implementation assumes that the receiver understands #font, but you can modify it if you want. listCallback Called when an item of the listbox is highlighted. Do nothing by default listSelectAt: aPoint Select the item lying at the given position in the list box. The default implementation assumes that list is a BList, but you can modify it if you want. listText Answer the text currently chosen in the list box. The default implementation assumes that list is a BList, but you can modify it if you want. text Answer the text that the user has picked from the widget and/or typed in the control (the exact way the text is entered will be established by subclasses, since this is an abstract method). text: aString Set the text widget to aString 1.12.4 BLOX.BDropDown: list box accessing ----------------------------------------- add: anObject afterIndex: index Add an element with the given value after another element whose index is contained in the index parameter. The label displayed in the widget is anObject's displayString. Answer anObject. add: aString element: anObject afterIndex: index Add an element with the aString label after another element whose index is contained in the index parameter. This method allows the client to decide autonomously the label that the widget will display. If anObject is nil, then string is used as the element as well. If aString is nil, then the element's displayString is used as the label. Answer anObject or, if it is nil, aString. addLast: anObject Add an element with the given value at the end of the listbox. The label displayed in the widget is anObject's displayString. Answer anObject. addLast: aString element: anObject Add an element with the given value at the end of the listbox. This method allows the client to decide autonomously the label that the widget will display. If anObject is nil, then string is used as the element as well. If aString is nil, then the element's displayString is used as the label. Answer anObject or, if it is nil, aString. associationAt: anIndex Answer an association whose key is the item at the given position in the listbox and whose value is the label used to display that item. at: anIndex Answer the element displayed at the given position in the list box. contents: stringCollection Set the elements displayed in the listbox, and set the labels to be their displayStrings. contents: stringCollection elements: elementList Set the elements displayed in the listbox to be those in elementList, and set the labels to be the corresponding elements in stringCollection. The two collections must have the same size. do: aBlock Iterate over each element of the listbox and pass it to aBlock. elements: elementList Set the elements displayed in the listbox, and set the labels to be their displayStrings. index: newIndex Highlight the item at the given position in the listbox, and transfer the text in the list box to the text widget. labelAt: anIndex Answer the label displayed at the given position in the list box. labelsDo: aBlock Iterate over the labels in the list widget and pass each of them to aBlock. numberOfStrings Answer the number of items in the list box would removeAtIndex: index Remove the item at the given index in the list box, answering the object associated to the element (i.e. the value that #at: would have returned for the given index) size Answer the number of items in the list box 1.12.5 BLOX.BDropDown: widget protocol -------------------------------------- dropRectangle Answer the rectangle in which the list widget will pop-up. If possible, this is situated below the drop-down widget's bottom side, but if the screen space there is not enough it could be above the drop-down widget's above side. If there is no screen space above as well, we pick the side where we can offer the greatest number of lines in the pop-up widget. dropdown Force the pop-up list widget to be visible. isDropdownVisible Answer whether the pop-up widget is visible toggle Toggle the visibility of the pop-up widget. unmapList Unmap the pop-up widget from the screen, transfer its selected item to the always visible text widget, and generate a callback. 1.13 BLOX.BDropDownEdit ======================= Defined in namespace BLOX Superclass: BLOX.BDropDown Category: Graphics-Examples This class resembles an edit widget, but it has an arrow button that allows the user to pick an item from a pre-built list. 1.13.1 BLOX.BDropDownEdit: accessing ------------------------------------ backgroundColor: aColor Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. font: aString Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor: aColor Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. highlightBackground: aColor Set the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the list widget and the selection in the text widget. highlightForeground: aColor Set the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the list widget and the selection in the text widget. 1.13.2 BLOX.BDropDownEdit: accessing-overrides ---------------------------------------------- text Answer the text shown in the widget 1.13.3 BLOX.BDropDownEdit: text accessing ----------------------------------------- insertAtEnd: aString Clear the selection and append aString at the end of the text widget. replaceSelection: aString Insert aString in the text widget at the current insertion point, replacing the currently selected text (if any), and leaving the text selected. selectAll Select the whole contents of the text widget selectFrom: first to: last Sets the selection of the text widget to include the characters starting with the one indexed by first (the very first character in the widget having index 1) and ending with the one just before last. If last refers to the same character as first or an earlier one, then the text widget's selection is cleared. selection Answer an empty string if the text widget has no selection, else answer the currently selected text selectionRange Answer nil if the text widget has no selection, else answer an Interval object whose first item is the index of the first character in the selection, and whose last item is the index of the character just after the last one in the selection. text: aString Set the contents of the text widget and select them. 1.14 BLOX.BDropDownList ======================= Defined in namespace BLOX Superclass: BLOX.BDropDown Category: Graphics-Examples This class resembles a list box widget, but its actual list shows up only when you click the arrow button beside the currently selected item. 1.14.1 BLOX.BDropDownList: accessing ------------------------------------ backgroundColor: aColor Set the value of the backgroundColor for the widget, which in this class is set for the list widget and, when the focus is outside the control, for the text widget as well. Specifies the normal background color to use when displaying the widget. font: aString Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor: aColor Set the value of the foregroundColor for the widget, which in this class is set for the list widget and, when the focus is outside the control, for the text widget as well. Specifies the normal foreground color to use when displaying the widget. highlightBackground: aColor Answer the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the list widget and, when the focus is inside the control, for the text widget as well. highlightForeground: aColor Answer the value of the highlightForeground option for the widget. Specifies the foreground color to use when displaying selected items in the list widget and, when the focus is inside the control, for the text widget as well. text Answer the text that the user has picked from the widget and/or typed in the control (the exact way the text is entered will be established by subclasses, since this is an abstract method). 1.14.2 BLOX.BDropDownList: callbacks ------------------------------------ callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a selector with at most two arguemtnts) when the active item in the receiver changegs. If the method accepts two arguments, the receiver is passed as the first parameter. If the method accepts one or two arguments, the selected index is passed as the last parameter. invokeCallback Generate a synthetic callback. 1.14.3 BLOX.BDropDownList: list box accessing --------------------------------------------- index Answer the value of the index option for the widget. Since it is not possible to modify an item once it has been picked from the list widget, this is always defined for BDropDownList widgets. 1.15 BLOX.BEdit =============== Defined in namespace BLOX Superclass: BLOX.BPrimitive Category: Graphics-Windows I am a widget showing one line of modifiable text. 1.15.1 BLOX.BEdit class: instance creation ------------------------------------------ new: parent contents: aString Answer a new BEdit widget laid inside the given parent widget, with a default content of aString 1.15.2 BLOX.BEdit: accessing ---------------------------- backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. callback Answer a DirectedMessage that is sent when the receiver is modified, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is modified. If the method accepts an argument, the receiver is passed. contents Return the contents of the widget contents: newText Set the contents of the widget font Answer the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: value Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. selectBackground Answer the value of the selectBackground option for the widget. Specifies the background color to use when displaying selected parts of the widget. selectBackground: value Set the value of the selectBackground option for the widget. Specifies the background color to use when displaying selected parts of the widget. selectForeground Answer the value of the selectForeground option for the widget. Specifies the foreground color to use when displaying selected parts of the widget. selectForeground: value Set the value of the selectForeground option for the widget. Specifies the foreground color to use when displaying selected parts of the widget. 1.15.3 BLOX.BEdit: widget protocol ---------------------------------- destroyed Private - The receiver has been destroyed, clear the corresponding Tcl variable to avoid memory leaks. hasSelection Answer whether there is selected text in the widget insertAtEnd: aString Clear the selection and append aString at the end of the widget. insertText: aString Insert aString in the widget at the current insertion point, replacing the currently selected text (if any). invokeCallback Generate a synthetic callback. nextPut: aCharacter Clear the selection and append aCharacter at the end of the widget. nextPutAll: aString Clear the selection and append aString at the end of the widget. nl Clear the selection and append a linefeed character at the end of the widget. replaceSelection: aString Insert aString in the widget at the current insertion point, replacing the currently selected text (if any), and leaving the text selected. selectAll Select the whole contents of the widget. selectFrom: first to: last Sets the selection to include the characters starting with the one indexed by first (the very first character in the widget having index 1) and ending with the one just before last. If last refers to the same character as first or an earlier one, then the widget's selection is cleared. selection Answer an empty string if the widget has no selection, else answer the currently selected text selectionRange Answer nil if the widget has no selection, else answer an Interval object whose first item is the index of the first character in the selection, and whose last item is the index of the character just after the last one in the selection. space Clear the selection and append a space at the end of the widget. 1.16 BLOX.BEmbeddedImage ======================== Defined in namespace BLOX Superclass: BLOX.BBoundingBox Category: Graphics-Windows I can draw a colorful image inside the canvas. 1.16.1 BLOX.BEmbeddedImage: accessing ------------------------------------- copyInto: aBlox Answer a new BCanvasObject identical to this but displayed into another canvas, newCanvas. The new instance is not created at the time it is returned. data Answer the data of the image. The result will be a String containing image data either as Base-64 encoded GIF data, as XPM data, or as PPM data. data: aString Set the data of the image. aString may contain the data either as Base-64 encoded GIF data, as XPM data, or as PPM data. No changes are visible until you toggle a redraw using the appropriate method. redraw Force the object to be displayed in the parent canvas, creating it if it has not been inserted for real in the parent, and refresh its position and image data if it has changed. 1.17 BLOX.BEmbeddedText ======================= Defined in namespace BLOX Superclass: BLOX.BBoundingBox Category: Graphics-Windows I can draw text in all sorts of colors, sizes and fonts. 1.17.1 BLOX.BEmbeddedText: accessing ------------------------------------ font Answer the value of the font option for the canvas object. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: font Set the value of the font option for the canvas object. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. justify Answer how to justify the text within its bounding region. justify: aSymbol Sets how to justify the text within its bounding region. Can be #left, #right or #center (the default). redraw Force the object to be displayed in the parent canvas, creating it if it has not been inserted for real in the parent, and refresh its position. text Answer the text that is printed by the object text: aString Set the text that is printed by the object 1.18 BLOX.BEventSet =================== Defined in namespace BLOX Superclass: BLOX.BEventTarget Category: Graphics-Windows I combine event handlers and let you apply them to many objects. Basically, you derive a class from me, override the #initialize: method to establish the handlers, then use the #addEventSet: method understood by every Blox class to add the event handlers specified by the receiver to the object. 1.18.1 BLOX.BEventSet class: initializing ----------------------------------------- new This method should not be called for instances of this class. new: widget Private - Create a new event set object that will attach to the given widget. Answer the object. Note: this method should be called by #addEventSet:, not directly 1.18.2 BLOX.BEventSet: accessing -------------------------------- widget Answer the widget to which the receiver is attached. 1.18.3 BLOX.BEventSet: initializing ----------------------------------- initialize: aBWidget Initialize the receiver's event handlers to attach to aBWidget. You can override this of course, but don't forget to call the superclass implementation first. 1.19 BLOX.BEventTarget ====================== Defined in namespace BLOX Superclass: Object Category: Graphics-Windows I track all the event handling procedures that you apply to an object. 1.19.1 BLOX.BEventTarget: intercepting events --------------------------------------------- addEventSet: aBEventSetSublass Add to the receiver the event handlers implemented by an instance of aBEventSetSubclass. Answer the new instance of aBEventSetSublass. onAsciiKeyEventSend: aSelector to: anObject When an ASCII key is pressed and the receiver has the focus, send the 1-argument message identified by aSelector to anObject, passing to it a Character. onDestroySend: aSelector to: anObject When the receiver is destroyed, send the unary message identified by aSelector to anObject. onFocusEnterEventSend: aSelector to: anObject When the focus enters the receiver, send the unary message identified by aSelector to anObject. onFocusLeaveEventSend: aSelector to: anObject When the focus leaves the receiver, send the unary message identified by aSelector to anObject. onKeyEvent: key send: aSelector to: anObject When the given key is pressed and the receiver has the focus, send the unary message identified by aSelector to anObject. Examples for key are: 'Ctrl-1', 'Alt-X', 'Meta-plus', 'enter'. The last two cases include example of special key identifiers; these include: 'backslash', 'exclam', 'quotedbl', 'dollar', 'asterisk', 'less', 'greater', 'asciicircum' (caret), 'question', 'equal', 'parenleft', 'parenright', 'colon', 'semicolon', 'bar' (pipe sign), 'underscore', 'percent', 'minus', 'plus', 'BackSpace', 'Delete', 'Insert', 'Return', 'End', 'Home', 'Prior' (Pgup), 'Next' (Pgdn), 'F1'..'F24', 'Caps_Lock', 'Num_Lock', 'Tab', 'Left', 'Right', 'Up', 'Down'. There are in addition four special identifiers which map to platform-specific keys: '', '', '', '' (all with the angular brackets!). test onKeyEventSend: aSelector to: anObject When a key is pressed and the receiver has the focus, send the 1-argument message identified by aSelector to anObject. The pressed key will be passed as a String parameter; some of the keys will send special key identifiers such as those explained in the documentation for #onKeyEvent:send:to: Look at the #eventTest test program in the BloxTestSuite to find out the parameters passed to such an event procedure test onKeyUpEventSend: aSelector to: anObject When a key has been released and the receiver has the focus, send the 1-argument message identified by aSelector to anObject. The released key will be passed as a String parameter; some of the keys will send special key identifiers such as those explained in the documentation for #onKeyEvent:send:to: Look at the #eventTest test program in the BloxTestSuite to find out the parameters passed to such an event procedure onMouseDoubleEvent: button send: aSelector to: anObject When the given button is double-clicked on the mouse, send the 1-argument message identified by aSelector to anObject. The mouse position will be passed as a Point. onMouseDoubleEventSend: aSelector to: anObject When a button is double-clicked on the mouse, send the 2-argument message identified by aSelector to anObject. The mouse position will be passed as a Point in the first parameter, the button number will be passed as an Integer in the second parameter. onMouseDownEvent: button send: aSelector to: anObject When the given button is pressed on the mouse, send the 1-argument message identified by aSelector to anObject. The mouse position will be passed as a Point. onMouseDownEventSend: aSelector to: anObject When a button is pressed on the mouse, send the 2-argument message identified by aSelector to anObject. The mouse position will be passed as a Point in the first parameter, the button number will be passed as an Integer in the second parameter. onMouseEnterEventSend: aSelector to: anObject When the mouse enters the widget, send the unary message identified by aSelector to anObject. onMouseLeaveEventSend: aSelector to: anObject When the mouse leaves the widget, send the unary message identified by aSelector to anObject. onMouseMoveEvent: button send: aSelector to: anObject When the mouse is moved while the given button is pressed on the mouse, send the 1-argument message identified by aSelector to anObject. The mouse position will be passed as a Point. onMouseMoveEventSend: aSelector to: anObject When the mouse is moved, send the 1-argument message identified by aSelector to anObject. The mouse position will be passed as a Point. onMouseTripleEvent: button send: aSelector to: anObject When the given button is triple-clicked on the mouse, send the 1-argument message identified by aSelector to anObject. The mouse position will be passed as a Point. onMouseTripleEventSend: aSelector to: anObject When a button is triple-clicked on the mouse, send the 2-argument message identified by aSelector to anObject. The mouse position will be passed as a Point in the first parameter, the button number will be passed as an Integer in the second parameter. onMouseUpEvent: button send: aSelector to: anObject When the given button is released on the mouse, send the 1-argument message identified by aSelector to anObject. The mouse position will be passed as a Point. onMouseUpEventSend: aSelector to: anObject When a button is released on the mouse, send the 2-argument message identified by aSelector to anObject. The mouse position will be passed as a Point in the first parameter, the button number will be passed as an Integer in the second parameter. onResizeSend: aSelector to: anObject When the receiver is resized, send the 1-argument message identified by aSelector to anObject. The new size will be passed as a Point. 1.20 BLOX.BExtended =================== Defined in namespace BLOX Superclass: BLOX.BWidget Category: Graphics-Windows Just like Gui, I serve as a base for complex objects which expose an individual protocol but internally use a Blox widget for creating their user interface. Unlike Gui, however, the instances of my subclasses understand the standard widget protocol. Just override my newPrimitive method to return another widget, and you'll get a class which interacts with the user like that widget (a list box, a text box, or even a label) but exposes a different protocol. 1.20.1 BLOX.BExtended: accessing -------------------------------- asPrimitiveWidget Answer the primitive widget that implements the receiver. 1.20.2 BLOX.BExtended: customization ------------------------------------ create After this method is called (the call is made automatically) the receiver will be attached to a `primitive' widget (which can be in turn another extended widget). This method is public not because you can call it, but because it can be useful to override it, not forgetting the call to super (which only calls #newPrimitive and saves the result), to perform some initialization on the primitive widget just created; overriding #create is in fact more generic than overriding #newPrimitive. For an example of this, see the implementation of BButtonLike. newPrimitive Create and answer a new widget on which the implementation of the receiver will be based. You should not call this method directly; instead you must override it in BExtended's subclasses. 1.21 BLOX.BForm =============== Defined in namespace BLOX Superclass: BLOX.BPrimitive Category: Graphics-Windows I am used to group many widgets together. I leave the heavy task of managing their position to the user. 1.21.1 BLOX.BForm: accessing ---------------------------- backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. defaultHeight Answer the value of the defaultHeight option for the widget. Specifies the desired height for the form in pixels. If this option is less than or equal to zero then the window will not request any size at all. defaultHeight: value Set the value of the defaultHeight option for the widget. Specifies the desired height for the form in pixels. If this option is less than or equal to zero then the window will not request any size at all. defaultWidth Answer the value of the defaultWidth option for the widget. Specifies the desired width for the form in pixels. If this option is less than or equal to zero then the window will not request any size at all. defaultWidth: value Set the value of the defaultWidth option for the widget. Specifies the desired width for the form in pixels. If this option is less than or equal to zero then the window will not request any size at all. 1.22 BLOX.BImage ================ Defined in namespace BLOX Superclass: BLOX.BPrimitive Category: Graphics-Windows I can display colorful images. 1.22.1 BLOX.BImage class: arrows -------------------------------- downArrow Answer the XPM representation of a 12x12 arrow pointing downwards. leftArrow Answer the XPM representation of a 12x12 arrow pointing leftwards. rightArrow Answer the XPM representation of a 12x12 arrow pointing rightwards. upArrow Answer the XPM representation of a 12x12 arrow pointing upwards. 1.22.2 BLOX.BImage class: GNU ----------------------------- gnu Answer the XPM representation of a 48x48 GNU. 1.22.3 BLOX.BImage class: icons ------------------------------- exclaim Answer the XPM representation of a 32x32 exclamation mark icon. info Answer the XPM representation of a 32x32 `information' icon. question Answer the XPM representation of a 32x32 question mark icon. stop Answer the XPM representation of a 32x32 `critical stop' icon. 1.22.4 BLOX.BImage class: instance creation ------------------------------------------- new: parent data: aString Answer a new BImage widget laid inside the given parent widget, loading data from the given string (Base-64 encoded GIF, XPM, PPM are supported). new: parent image: aFileStream Answer a new BImage widget laid inside the given parent widget, loading data from the given file (GIF, XPM, PPM are supported). new: parent size: aPoint Answer a new BImage widget laid inside the given parent widget, showing by default a transparent image of aPoint size. 1.22.5 BLOX.BImage class: small icons ------------------------------------- directory Answer the Base-64 GIF representation of a `directory folder' icon. file Answer the Base-64 GIF representation of a `file' icon. 1.22.6 BLOX.BImage: accessing ----------------------------- backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. displayHeight Answer the value of the displayHeight option for the widget. Specifies the height of the image in pixels. This is not the height of the widget, but specifies the area of the widget that will be taken by the image. displayHeight: value Set the value of the displayHeight option for the widget. Specifies the height of the image in pixels. This is not the height of the widget, but specifies the area of the widget that will be taken by the image. displayWidth Answer the value of the displayWidth option for the widget. Specifies the width of the image in pixels. This is not the width of the widget, but specifies the area of the widget that will be taken by the image. displayWidth: value Set the value of the displayWidth option for the widget. Specifies the width of the image in pixels. This is not the width of the widget, but specifies the area of the widget that will be taken by the image. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. gamma Answer the value of the gamma option for the widget. Specifies that the colors allocated for displaying the image widget should be corrected for a non-linear display with the specified gamma exponent value. (The intensity produced by most CRT displays is a power function of the input value, to a good approximation; gamma is the exponent and is typically around 2). The value specified must be greater than zero. The default value is one (no correction). In general, values greater than one will make the image lighter, and values less than one will make it darker. gamma: value Set the value of the gamma option for the widget. Specifies that the colors allocated for displaying the image widget should be corrected for a non-linear display with the specified gamma exponent value. (The intensity produced by most CRT displays is a power function of the input value, to a good approximation; gamma is the exponent and is typically around 2). The value specified must be greater than zero. The default value is one (no correction). In general, values greater than one will make the image lighter, and values less than one will make it darker. 1.22.7 BLOX.BImage: image management ------------------------------------ blank Blank the corresponding image data: aString Set the image to be drawn to aString, which can be a GIF in Base-64 representation or an X pixelmap. dither Recalculate the dithered image in the window where the image is displayed. The dithering algorithm used in displaying images propagates quantization errors from one pixel to its neighbors. If the image data is supplied in pieces, the dithered image may not be exactly correct. Normally the difference is not noticeable, but if it is a problem, this command can be used to fix it. fillFrom: origin extent: extent color: color Fill a rectangle with the given origin and extent, using the given color. fillFrom: origin to: corner color: color Fill a rectangle between the given corners, using the given color. fillRectangle: rectangle color: color Fill a rectangle having the given bounding box, using the given color. image: aFileStream Read a GIF or XPM image from aFileStream. The whole contents of the file are read, not only from the file position. imageHeight Specifies the height of the image, in pixels. This option is useful primarily in situations where you wish to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink vertically to fit the data stored in it. imageWidth Specifies the width of the image, in pixels. This option is useful primarily in situations where you wish to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink horizontally to fit the data stored in it. lineFrom: origin extent: extent color: color Draw a line with the given origin and extent, using the given color. lineFrom: origin to: corner color: color This method's functionality has not been implemented yet. lineFrom: origin toX: endX color: color Draw an horizontal line between the given corners, using the given color. lineFrom: origin toY: endY color: color Draw a vertical line between the given corners, using the given color. lineInside: rectangle color: color Draw a line having the given bounding box, using the given color. 1.22.8 BLOX.BImage: widget protocol ----------------------------------- destroyed Private - The receiver has been destroyed, clear the corresponding Tcl image to avoid memory leaks. 1.23 BLOX.BLabel ================ Defined in namespace BLOX Superclass: BLOX.BPrimitive Category: Graphics-Windows I am a label showing static text. 1.23.1 BLOX.BLabel class: initialization ---------------------------------------- initialize Private - Initialize the receiver's class variables. 1.23.2 BLOX.BLabel class: instance creation ------------------------------------------- new: parent label: label Answer a new BLabel widget laid inside the given parent widget, showing by default the `label' String. 1.23.3 BLOX.BLabel: accessing ----------------------------- alignment Answer the value of the anchor option for the widget. Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the symbols #topLeft, #topCenter, #topRight, #leftCenter, #center, #rightCenter, #bottomLeft, #bottomCenter, #bottomRight. For example, #topLeft means display the information such that its top-left corner is at the top-left corner of the widget. alignment: aSymbol Set the value of the anchor option for the widget. Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the symbols #topLeft, #topCenter, #topRight, #leftCenter, #center, #rightCenter, #bottomLeft, #bottomCenter, #bottomRight. For example, #topLeft means display the information such that its top-left corner is at the top-left corner of the widget. backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. font Answer the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: value Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. label Answer the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. label: value Set the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. 1.24 BLOX.BLine =============== Defined in namespace BLOX Superclass: BLOX.BBoundingBox Category: Graphics-Windows I only draw straight lines but I can do that very well, even without a ruler... 1.24.1 BLOX.BLine: accessing ---------------------------- cap Answer the way in which caps are to be drawn at the endpoints of the line. The answer may be #butt (the default), #projecting, or #round). cap: aSymbol Set the way in which caps are to be drawn at the endpoints of the line. aSymbol may be #butt (the default), #projecting, or #round). width Answer the width with which the line is drawn. width: pixels Set the width with which the line is drawn. 1.25 BLOX.BList =============== Defined in namespace BLOX Superclass: BLOX.BViewport Category: Graphics-Windows I represent a list box from which you can choose one or more elements. 1.25.1 BLOX.BList: accessing ---------------------------- add: anObject afterIndex: index Add an element with the given value after another element whose index is contained in the index parameter. The label displayed in the widget is anObject's displayString. Answer anObject. add: aString element: anObject afterIndex: index Add an element with the aString label after another element whose index is contained in the index parameter. This method allows the client to decide autonomously the label that the widget will display. If anObject is nil, then string is used as the element as well. If aString is nil, then the element's displayString is used as the label. Answer anObject or, if it is nil, aString. addLast: anObject Add an element with the given value at the end of the listbox. The label displayed in the widget is anObject's displayString. Answer anObject. addLast: aString element: anObject Add an element with the given value at the end of the listbox. This method allows the client to decide autonomously the label that the widget will display. If anObject is nil, then string is used as the element as well. If aString is nil, then the element's displayString is used as the label. Answer anObject or, if it is nil, aString. associationAt: anIndex Answer an association whose key is the item at the given position in the listbox and whose value is the label used to display that item. at: anIndex Answer the element displayed at the given position in the list box. backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. contents: elementList Set the elements displayed in the listbox, and set the labels to be their displayStrings. contents: stringCollection elements: elementList Set the elements displayed in the listbox to be those in elementList, and set the labels to be the corresponding elements in stringCollection. The two collections must have the same size. do: aBlock Iterate over each element of the listbox and pass it to aBlock. elements Answer the collection of objects that represent the elements displayed by the list box. elements: elementList Set the elements displayed in the listbox, and set the labels to be their displayStrings. font Answer the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: value Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. highlightBackground Answer the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the widget. highlightBackground: value Set the value of the highlightBackground option for the widget. Specifies the background color to use when displaying selected items in the widget. highlightForeground Answer the value of the highlightForeground option for the widget. Specifies the foreground color to use when displaying selected items in the widget. highlightForeground: value Set the value of the highlightForeground option for the widget. Specifies the foreground color to use when displaying selected items in the widget. index Answer the value of the index option for the widget. Indicates the element that has the location cursor. This item will be displayed in the highlightForeground color, and with the corresponding background color. indexAt: point Answer the index of the element that covers the point in the listbox window specified by x and y (in pixel coordinates). If no element covers that point, then the closest element to that point is used. isSelected: index Answer whether the element indicated by index is currently selected. label Return nil, it is here for Gtk+ support label: aString Do nothing, it is here for Gtk+ support labelAt: anIndex Answer the label displayed at the given position in the list box. labels Answer the labels displayed by the list box. labelsDo: aBlock Iterate over each listbox element's label and pass it to aBlock. mode Answer the value of the mode option for the widget. Specifies one of several styles for manipulating the selection. The value of the option may be either single, browse, multiple, or extended. If the selection mode is single or browse, at most one element can be selected in the listbox at once. Clicking button 1 on an unselected element selects it and deselects any other selected item, while clicking on a selected element has no effect. In browse mode it is also possible to drag the selection with button 1. That is, moving the mouse while button 1 is pressed keeps the item under the cursor selected. If the selection mode is multiple or extended, any number of elements may be selected at once, including discontiguous ranges. In multiple mode, clicking button 1 on an element toggles its selection state without affecting any other elements. In extended mode, pressing button 1 on an element selects it, deselects everything else, and sets the anchor to the element under the mouse; dragging the mouse with button 1 down extends the selection to include all the elements between the anchor and the element under the mouse, inclusive. In extended mode, the selected range can be adjusted by pressing button 1 with the Shift key down: this modifies the selection to consist of the elements between the anchor and the element under the mouse, inclusive. The un-anchored end of this new selection can also be dragged with the button down. Also in extended mode, pressing button 1 with the Control key down starts a toggle operation: the anchor is set to the element under the mouse, and its selection state is reversed. The selection state of other elements is not changed. If the mouse is dragged with button 1 down, then the selection state of all elements between the anchor and the element under the mouse is set to match that of the anchor element; the selection state of all other elements remains what it was before the toggle operation began. Most people will probably want to use browse mode for single selections and extended mode for multiple selections; the other modes appear to be useful only in special situations. mode: value Set the value of the mode option for the widget. Specifies one of several styles for manipulating the selection. The value of the option may be either single, browse, multiple, or extended. If the selection mode is single or browse, at most one element can be selected in the listbox at once. Clicking button 1 on an unselected element selects it and deselects any other selected item, while clicking on a selected element has no effect. In browse mode it is also possible to drag the selection with button 1. That is, moving the mouse while button 1 is pressed keeps the item under the cursor selected. If the selection mode is multiple or extended, any number of elements may be selected at once, including discontiguous ranges. In multiple mode, clicking button 1 on an element toggles its selection state without affecting any other elements. In extended mode, pressing button 1 on an element selects it, deselects everything else, and sets the anchor to the element under the mouse; dragging the mouse with button 1 down extends the selection to include all the elements between the anchor and the element under the mouse, inclusive. In extended mode, the selected range can be adjusted by pressing button 1 with the Shift key down: this modifies the selection to consist of the elements between the anchor and the element under the mouse, inclusive. The un-anchored end of this new selection can also be dragged with the button down. Also in extended mode, pressing button 1 with the Control key down starts a toggle operation: the anchor is set to the element under the mouse, and its selection state is reversed. The selection state of other elements is not changed. If the mouse is dragged with button 1 down, then the selection state of all elements between the anchor and the element under the mouse is set to match that of the anchor element; the selection state of all other elements remains what it was before the toggle operation began. Most people will probably want to use browse mode for single selections and extended mode for multiple selections; the other modes appear to be useful only in special situations. numberOfStrings Answer the number of items in the list box would removeAtIndex: index Remove the item at the given index in the list box, answering the object associated to the element (i.e. the value that #at: would have returned for the given index) size Answer the number of items in the list box 1.25.2 BLOX.BList: widget protocol ---------------------------------- callback Answer a DirectedMessage that is sent when the active item in the receiver changes, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a selector with at most two arguemtnts) when the active item in the receiver changegs. If the method accepts two arguments, the receiver is passed as the first parameter. If the method accepts one or two arguments, the selected index is passed as the last parameter. highlight: index Highlight the item at the given position in the listbox. invokeCallback Generate a synthetic callback. select: index Highlight the item at the given position in the listbox, without unhighlighting other items. This is meant for multiple- or extended-mode listboxes, but can be used with other selection mode in particular cases. show: index Ensure that the item at the given position in the listbox is visible. unhighlight Unhighlight all the items in the listbox. unselect: index Unhighlight the item at the given position in the listbox, without affecting the state of the other items. 1.26 BLOX.Blox ============== Defined in namespace BLOX Superclass: BLOX.BEventTarget Category: Graphics-Windows I am the superclass for every visible user interface object (excluding canvas items, which are pretty different). I provide common methods and a simple Tcl interface for internal use. In addition, I expose class methods that do many interesting event-handling things. NOTE: some of the methods (notably geometry methods) may not be suitable for all Blox subclasses and may be included only for backwards compatibility towards 1.1.5 BLOX. You should use geometry methods only for subclasses of BWidget. 1.26.1 BLOX.Blox class: C call-outs ----------------------------------- evalIn: interp tcl: cmd Not commented. idle Not commented. resultIn: interp Not commented. tclInit Not commented. 1.26.2 BLOX.Blox class: event dispatching ----------------------------------------- balances dispatchEvents If this is the outermost dispatching loop that is started, dispatch events until the number of calls to #terminateMainLoop balances the number of calls to #dispatchEvents; return instantly if this is not the outermost dispatching loop that is started. dispatchEvents: mainWindow Dispatch some events; return upon destruction of the `mainWindow' widget (which can be any kind of BWidget, but will be typically a BWindow). balances terminateMainLoop Terminate the event dispatching loop if this call to #terminateMainLoop balances the number of calls to #dispatchEvents. update: aspect Initialize the Tcl and Blox environments; executed automatically on startup. 1.26.3 BLOX.Blox class: instance creation ----------------------------------------- new This method should not be called for instances of this class. new: parent Create a new widget of the type identified by the receiver, inside the given parent widget. Answer the new widget 1.26.4 BLOX.Blox class: utility ------------------------------- active Answer the currently active Blox, or nil if the focus does not belong to a Smalltalk window. at: aPoint Answer the Blox containing the given point on the screen, or nil if no Blox contains the given point (either because no Smalltalk window is there or because it is covered by another window). atMouse Answer the Blox under the mouse cursor's hot spot, or nil if no Blox contains the given point (either because no Smalltalk window is there or because it is covered by another window). beep Produce a bell clearClipboard Clear the clipboard, answer its old contents. clipboard Retrieve the text in the clipboard. clipboard: aString Set the contents of the clipboard to aString (or empty the clipboard if aString is nil). createColor: red green: green blue: blue Answer a color that can be passed to methods such as `backgroundColor:'. The color will have the given RGB components (range is 0~65535). createColor: cyan magenta: magenta yellow: yellow Answer a color that can be passed to methods such as `backgroundColor:'. The color will have the given CMY components (range is 0~65535). createColor: cyan magenta: magenta yellow: yellow black: black Answer a color that can be passed to methods such as `backgroundColor:'. The color will have the given CMYK components (range is 0~65535). createColor: hue saturation: sat value: value Answer a color that can be passed to methods such as `backgroundColor:'. The color will have the given HSV components (range is 0~65535). defaultFont Answer the default font used by Blox. fonts Answer the names of the font families in the system. Additionally, `Times', `Courier' and `Helvetica' are always made available. mousePointer If the mouse pointer is on the same screen as the application's windows, returns a Point containing the pointer's x and y coordinates measured in pixels in the screen's root window (under X, if a virtual root window is in use on the screen, the position is computed in the whole desktop, not relative to the top-left corner of the currently shown portion). If the mouse pointer isn't on the same screen as window then answer nil. platform Answer the platform on which Blox is running; it can be either #unix, #macintosh or #windows. screenOrigin Answer a Point indicating the coordinates of the upper left point of the screen in the virtual root window on which the application's windows are drawn (under Windows and the Macintosh, that's always 0 @ 0) screenResolution Answer a Point containing the resolution in dots per inch of the screen, in the x and y directions. screenSize Answer a Point containing the size of the virtual root window on which the application's windows are drawn (under Windows and the Macintosh, that's the size of the screen) 1.26.5 BLOX.Blox: accessing --------------------------- state Answer the value of the state option for the widget. Specifies one of three states for the button: normal, active, or disabled. In normal state the button is displayed using the foreground and background options. The active state is typically used when the pointer is over the button. In active state the button is displayed using the activeForeground and activeBackground options. Disabled state means that the button should be insensitive: the application will refuse to activate the widget and will ignore mouse button presses. state: value Set the value of the state option for the widget. Specifies one of three states for the button: normal, active, or disabled. In normal state the button is displayed using the foreground and background options. The active state is typically used when the pointer is over the button. In active state the button is displayed using the activeForeground and activeBackground options. Disabled state means that the button should be insensitive: the application will refuse to activate the widget and will ignore mouse button presses. 1.26.6 BLOX.Blox: basic ----------------------- deepCopy It does not make sense to make a copy, because it would make data inconsistent across different objects; so answer the receiver release Destroy the receiver if it still exists, then perform the usual task of removing the dependency links shallowCopy It does not make sense to make a copy, because it would make data inconsistent across different objects; so answer the receiver 1.26.7 BLOX.Blox: creating children ----------------------------------- make: array Create children of the receiver. Answer a Dictionary of the children. Each element of array is an Array including: a string which becomes the Dictionary's key, a binding like #{Blox.BWindow} identifying the class name, an array with the parameters to be set (for example #(#width: 50 #height: 30 #backgroundColor: 'blue')), and afterwards the children of the widget, described as arrays with this same format. make: array on: result Private - Create children of the receiver, adding them to result; answer result. array has the format described in the comment to #make: makeChild: each on: result Private - Create a child of the receiver, adding them to result; each is a single element of the array described in the comment to #make: 1.26.8 BLOX.Blox: customization ------------------------------- addChild: child The widget identified by child has been added to the receiver. This method is public not because you can call it, but because it can be useful to override it, not forgetting the call to either the superclass implementation or #basicAddChild:, to perform some initialization on the children just added. Answer the new child. basicAddChild: child The widget identified by child has been added to the receiver. Add it to the children collection and answer the new child. This method is public because you can call it from #addChild:. 1.26.9 BLOX.Blox: widget protocol --------------------------------- asPrimitiveWidget Answer the primitive widget that implements the receiver. childrenCount Answer how many children the receiver has childrenDo: aBlock Evaluate aBlock once for each of the receiver's child widgets, passing the widget to aBlock as a parameter destroy Destroy the receiver drawingArea Answer a Rectangle identifying the receiver's drawing area. The rectangle's corners specify the upper-left and lower-right corners of the client area. Because coordinates are relative to the upper-left corner of a window's drawing area, the coordinates of the rectangle's corner are (0,0). enabled Answer whether the receiver is enabled to input. Although defined here, this method is only used for widgets that define a #state method enabled: enabled Set whether the receiver is enabled to input (enabled is a boolean). Although defined here, this method is only used for widgets that define a #state: method exists Answer whether the receiver has been destroyed or not (answer false in the former case, true in the latter). fontHeight: aString Answer the height of aString in pixels, when displayed in the same font as the receiver. Although defined here, this method is only used for widgets that define a #font method fontWidth: aString Answer the width of aString in pixels, when displayed in the same font as the receiver. Although defined here, this method is only used for widgets that define a #font method isWindow Answer whether the receiver represents a window on the screen. parent Answer the receiver's parent (or nil for a top-level window). toplevel Answer the top-level object (typically a BWindow or BPopupWindow) connected to the receiver. window Answer the window in which the receiver stays. Note that while #toplevel won't answer a BTransientWindow, this method will. withChildrenDo: aBlock Evaluate aBlock passing the receiver, and then once for each of the receiver's child widgets. 1.27 BLOX.BMenu =============== Defined in namespace BLOX Superclass: BLOX.BMenuObject Category: Graphics-Windows I am a Menu that is part of a menu bar. 1.27.1 BLOX.BMenu class: instance creation ------------------------------------------ new: parent label: label Add a new menu to the parent window's menu bar, with `label' as its caption (for popup menus, parent is the widget over which the menu pops up as the right button is pressed). 1.27.2 BLOX.BMenu: accessing ---------------------------- label Answer the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. label: value Set the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. 1.27.3 BLOX.BMenu: callback registration ---------------------------------------- addLine Add a separator item at the end of the menu addMenuItemFor: anArray notifying: receiver Add a menu item described by anArray at the end of the menu. If anArray is empty, insert a separator line. If anArray has a single item, a menu item is created without a callback. If anArray has two or three items, the second one is used as the selector sent to receiver, and the third one (if present) is passed to the selector. callback: receiver using: selectorPairs Add menu items described by anArray at the end of the menu. Each element of selectorPairs must be in the format described in BMenu>>#addMenuItemFor:notifying:. All the callbacks will be sent to receiver. destroy Destroy the menu widget; that is, simply remove ourselves from the parent menu bar. empty Empty the menu widget; that is, remove all the children 1.28 BLOX.BMenuBar ================== Defined in namespace BLOX Superclass: BLOX.BMenuObject Category: Graphics-Windows I am the Menu Bar, the top widget in a full menu structure. 1.28.1 BLOX.BMenuBar: accessing ------------------------------- add: aMenu Add aMenu to the menu bar remove: aMenu Remove aMenu from the menu bar 1.29 BLOX.BMenuItem =================== Defined in namespace BLOX Superclass: BLOX.BMenuObject Category: Graphics-Windows I am the tiny and humble Menu Item, a single command choice in the menu structure. But if it wasn't for me, nothing could be done... eh eh eh!! 1.29.1 BLOX.BMenuItem class: instance creation ---------------------------------------------- new: parent Add a new separator item to the specified menu. new: parent label: label Add a new menu item to the specified menu (parent) , with `label' as its caption. 1.29.2 BLOX.BMenuItem: accessing -------------------------------- label Answer the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. label: value Set the value of the label option for the widget. Specifies a string to be displayed inside the widget. The way in which the string is displayed depends on the particular widget and may be determined by other options, such as anchor. For windows, this is the title of the window. 1.30 BLOX.BMenuObject ===================== Defined in namespace BLOX Superclass: BLOX.Blox Category: Graphics-Windows I am an abstract superclass for widgets which make up a menu structure. 1.30.1 BLOX.BMenuObject: accessing ---------------------------------- activeBackground Answer the value of the activeBackground option for the widget. Specifies background color to use when drawing active elements. An element (a widget or portion of a widget) is active if the mouse cursor is positioned over the element and pressing a mouse button will cause some action to occur. For some elements on Windows and Macintosh systems, the active color will only be used while mouse button 1 is pressed over the element. activeBackground: value Set the value of the activeBackground option for the widget. Specifies background color to use when drawing active elements. An element (a widget or portion of a widget) is active if the mouse cursor is positioned over the element and pressing a mouse button will cause some action to occur. For some elements on Windows and Macintosh systems, the active color will only be used while mouse button 1 is pressed over the element. activeForeground Answer the value of the activeForeground option for the widget. Specifies foreground color to use when drawing active elements. See above for definition of active elements. activeForeground: value Set the value of the activeForeground option for the widget. Specifies foreground color to use when drawing active elements. See above for definition of active elements. asPrimitiveWidget Answer the primitive widget that implements the receiver. backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. 1.30.2 BLOX.BMenuObject: callback --------------------------------- callback Answer a DirectedMessage that is sent when the receiver is modified, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is clicked. If the method accepts an argument, the receiver is passed. callback: aReceiver message: aSymbol argument: anObject Set up so that aReceiver is sent the aSymbol message (the name of a one- or two-argument selector) when the receiver is clicked. If the method accepts two argument, the receiver is passed together with anObject; if it accepts a single one, instead, only anObject is passed. invokeCallback Generate a synthetic callback 1.31 BLOX.BOval =============== Defined in namespace BLOX Superclass: BLOX.BRectangle Category: Graphics-Windows I can draw ovals (ok, if you're a mathematic, they're really ellipses), or even circles. 1.32 BLOX.BPolyline =================== Defined in namespace BLOX Superclass: BLOX.BCanvasObject Category: Graphics-Windows I can draw closed or open polylines, and even fill them! 1.32.1 BLOX.BPolyline: accessing -------------------------------- boundingBox Answer `boundingBox'. cap Answer the way in which caps are to be drawn at the endpoints of the line. This option is only available for open polylines. If you want to set it for a closed polylines, draw an open one on top of it. cap: aSymbol Set the way in which caps are to be drawn at the endpoints of the line. aSymbol may be #butt (the default), #projecting, or #round). This option is only available for open polylines. If you want to set it for a closed polylines, draw an open one on top of it. closed Answer whether the polyline is an open or a closed one. closed: aBoolean Set whether the polyline is an open or a closed one. This option may be set only once. join Answer the way in which joints are to be drawn at the vertices of the line. This option is only available for open polylines. If you want to set it for a closed polylines, draw an open one on top of it. join: aSymbol Answer the way in which joints are to be drawn at the vertices of the line. aSymbol can be #bevel, #miter (the default) or #round. This option is only available for open polylines. If you want to set it for a closed polylines, draw an open one on top of it. outlineColor Answer the color with which the outline of the polyline is drawn. This option is only available for closed polylines. outlineColor: color Set the color with which the outline of the polyline is drawn. This option is only available for closed polylines. points Answer the points that are vertices of the polyline. method points: arrayOfPointsOrArrays Set the points that are vertices of the polyline. Each of the items of arrayOfPointsOrArrays can be a Point or a two-element Array. Note that no changes take place until you invoke the #create (if the object has not been inserted in the canvas yet) or the #redraw method. width Answer the width with which the polyline (or its outline if it is a closed one) is drawn. width: pixels Set the width with which the polyline (or its outline if it is a closed one) is drawn. 1.33 BLOX.BPopupMenu ==================== Defined in namespace BLOX Superclass: BLOX.BMenu Category: Graphics-Windows I am a class that provides the ability to show popup menus when the right button (Button 3) is clicked on another window. 1.33.1 BLOX.BPopupMenu: widget protocol --------------------------------------- popup Generate a synthetic menu popup event 1.34 BLOX.BPopupWindow ====================== Defined in namespace BLOX Superclass: BLOX.BWindow Category: Graphics-Windows I am a pseudo-window that has no decorations and no ability to interact with the user. My main usage, as my name says, is to provide pop-up functionality for other widgets. Actually there should be no need to directly use me - always rely on the #new and #popup: class methods. 1.34.1 BLOX.BPopupWindow: geometry management --------------------------------------------- addChild: w Private - The widget identified by child has been added to the receiver. This method is public not because you can call it, but because it can be useful to override it, not forgetting the call to either the superclass implementation or #basicAddChild:, to perform some initialization on the children just added. Answer the new child. child: child height: value Set the given child's height. This is done by setting its parent window's (that is, our) height. child: child heightOffset: value This method should not be called for instances of this class. child: child width: value Set the given child's width. This is done by setting its parent window's (that is, our) width. child: child widthOffset: value This method should not be called for instances of this class. child: child x: value Set the x coordinate of the given child's top-left corner. This is done by setting its parent window's (that is, our) x. child: child xOffset: value This method should not be called for instances of this class. child: child y: value Set the y coordinate of the given child's top-left corner. This is done by setting its parent window's (that is, our) y. child: child yOffset: value This method should not be called for instances of this class. heightChild: child Answer the given child's height, which is the height that was imposed on the popup window. widthChild: child Answer the given child's width in pixels, which is the width that was imposed on the popup window. xChild: child Answer the x coordinate of the given child's top-left corner, which is desumed by the position of the popup window. yChild: child Answer the y coordinate of the given child's top-left corner, which is desumed by the position of the popup window. 1.35 BLOX.BPrimitive ==================== Defined in namespace BLOX Superclass: BLOX.BWidget Category: Graphics-Windows I am the superclass for every widget (except menus) directly provided by the underlying GUI system. 1.35.1 BLOX.BPrimitive: accessing --------------------------------- asPrimitiveWidget Answer the primitive widget that implements the receiver. 1.36 BLOX.BProgress =================== Defined in namespace BLOX Superclass: BLOX.BExtended Category: Graphics-Examples I show how much of a task has been completed. 1.36.1 BLOX.BProgress: accessing -------------------------------- backgroundColor Answer the background color of the widget. This is used for the background of the non-filled part, as well as for the foreground of the filled part. backgroundColor: aColor Set the background color of the widget. This is used for the background of the non-filled part, as well as for the foreground of the filled part. filledColor Answer the background color of the widget's filled part. filledColor: aColor Set the background color of the widget's filled part. foregroundColor Set the foreground color of the widget. This is used for the non-filled part, while the background color also works as the foreground of the filled part. foregroundColor: aColor Set the foreground color of the widget. This is used for the non-filled part, while the background color also works as the foreground of the filled part. value Answer the filled percentage of the receiver (0..1) value: newValue Set the filled percentage of the receiver and update the appearance. newValue must be between 0 and 1. 1.37 BLOX.BRadioButton ====================== Defined in namespace BLOX Superclass: BLOX.BButton Category: Graphics-Windows I am just one in a group of mutually exclusive buttons. 1.37.1 BLOX.BRadioButton: accessing ----------------------------------- callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a selector accepting at most two arguments) when the receiver is clicked. If the method accepts two arguments, the receiver is passed as the first parameter. If the method accepts one or two arguments, true is passed as the last parameter for interoperability with BToggle widgets. value Answer whether this widget is the selected one in its radio button group. value: aBoolean Answer whether this widget is the selected one in its radio button group. Setting this property to false for a group's currently selected button unhighlights all the buttons in that group. 1.38 BLOX.BRadioGroup ===================== Defined in namespace BLOX Superclass: BLOX.BContainer Category: Graphics-Windows I am used to group many mutually-exclusive radio buttons together. In addition, just like every BContainer I can perform simple management by putting widgets next to each other, from left to right or (which is more useful in this particular case...) from top to bottom. 1.38.1 BLOX.BRadioGroup: accessing ---------------------------------- value Answer the index of the button that is currently selected, 1 being the first button added to the radio button group. 0 means that no button is selected value: value Force the value-th button added to the radio button group to be the selected one. 1.38.2 BLOX.BRadioGroup: widget protocol ---------------------------------------- destroyed Private - The receiver has been destroyed, clear the corresponding Tcl variable to avoid memory leaks. 1.39 BLOX.BRectangle ==================== Defined in namespace BLOX Superclass: BLOX.BBoundingBox Category: Graphics-Windows I only draw rectangles but I can do that very well. 1.39.1 BLOX.BRectangle: accessing --------------------------------- outlineColor Answer the color with which the outline of the rectangle is drawn. outlineColor: color Set the color with which the outline of the rectangle is drawn. width Answer the width with which the outline of the rectangle is drawn. width: pixels Set the width with which the outline of the rectangle is drawn. 1.40 BLOX.BScrolledCanvas ========================= Defined in namespace BLOX Superclass: BLOX.BCanvas Category: Graphics-Windows I am much similar to BCanvas, but I sport, in addition, two fancy scroll bars. This is just a convenience, since it could be easily done when creating the canvas... 1.41 BLOX.BSpline ================= Defined in namespace BLOX Superclass: BLOX.BPolyline Category: Graphics-Windows Unlike my father BPolyline, I am more smooth at doing my job. 1.41.1 BLOX.BSpline: accessing ------------------------------ smoothness Answer the degree of smoothness desired for curves. Each spline will be approximated with this number of line segments. smoothness: anInteger Set the degree of smoothness desired for curves. Each spline will be approximated with this number of line segments. 1.42 BLOX.BText =============== Defined in namespace BLOX Superclass: BLOX.BViewport Category: Graphics-Windows I represent a text viewer with pretty good formatting options. 1.42.1 BLOX.BText class: accessing ---------------------------------- emacsLike Answer whether we are using Emacs or Motif key bindings. emacsLike: aBoolean Set whether we are using Emacs or Motif key bindings. 1.42.2 BLOX.BText class: instance creation ------------------------------------------ newReadOnly: parent Answer a new read-only text widget (read-only is achieved simply by setting its state to be disabled) 1.42.3 BLOX.BText: accessing ---------------------------- backgroundColor Answer the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. backgroundColor: value Set the value of the backgroundColor option for the widget. Specifies the normal background color to use when displaying the widget. callback Answer a DirectedMessage that is sent when the receiver is modified, or nil if none has been set up. callback: aReceiver message: aSymbol Set up so that aReceiver is sent the aSymbol message (the name of a zero- or one-argument selector) when the receiver is modified. If the method accepts an argument, the receiver is passed. contents Return the contents of the widget contents: aString Set the contents of the widget font Answer the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. font: value Set the value of the font option for the widget. Specifies the font to use when drawing text inside the widget. The font can be given as either an X font name or a Blox font description string. X font names are given as many fields, each led by a minus, and each of which can be replaced by an * to indicate a default value is ok: foundry, family, weight, slant, setwidth, addstyle, pixel size, point size (the same as pixel size for historical reasons), horizontal resolution, vertical resolution, spacing, width, charset and character encoding. Blox font description strings have three fields, which must be separated by a space and of which only the first is mandatory: the font family, the font size in points (or in pixels if a negative value is supplied), and a number of styles separated by a space (valid styles are normal, bold, italic, underline and overstrike). Examples of valid fonts are "Helvetica 10 Bold", "Times -14", "Futura Bold Underline". You must enclose the font family in braces if it is made of two or more words. foregroundColor Answer the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. foregroundColor: value Set the value of the foregroundColor option for the widget. Specifies the normal foreground color to use when displaying the widget. getSelection Answer an empty string if the widget has no selection, else answer the currently selected text selectBackground Answer the value of the selectBackground option for the widget. Specifies the background color to use when displaying selected parts of the widget. selectBackground: value Set the value of the selectBackground option for the widget. Specifies the background color to use when displaying selected parts of the widget. selectForeground Answer the value of the selectForeground option for the widget. Specifies the foreground color to use when displaying selected parts of the widget. selectForeground: value Set the value of the selectForeground option for the widget. Specifies the foreground color to use when displaying selected parts of the widget. wrap Answer the value of the wrap option for the widget. Specifies how to handle lines in the text that are too long to be displayed in a single line of the text's window. The value must be #none or #char or #word. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that do not fit on the screen are not displayed. In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. In char mode a screen line break may occur after any character; in word mode a line break will only be made at word boundaries. wrap: value Set the value of the wrap option for the widget. Specifies how to handle lines in the text that are too long to be displayed in a single line of the text's window. The value must be #none or #char or #word. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that do not fit on the screen are not displayed. In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. In char mode a screen line break may occur after any character; in word mode a line break will only be made at word boundaries. 1.42.4 BLOX.BText: attributes ----------------------------- insertAtEnd: aString attribute: attr Clear the selection and append aString at the end of the widget. Use the given attributes to format the text. insertText: aString attribute: attr Insert aString in the widget at the current insertion point, replacing the currently selected text (if any). Use the given attributes to format the text. removeAttributes Remove any kind of formatting from the text in the widget removeAttributesFrom: aPoint to: endPoint Remove any kind of formatting from the text in the widget between the given endpoints. The two endpoints are Point objects in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1. setAttributes: attr from: aPoint to: endPoint Add the formatting given by attr to the text in the widget between the given endpoints. The two endpoints are Point objects in which both coordinates are 1-based: the first line is line 1, and the first character in the first line is character 1. 1.42.5 BLOX.BText: geometry management -------------------------------------- child: child height: value Set the height of the given child to be `value' pixels. child: child heightOffset: value Adjust the height of the given child to be given by `value' more pixels. child: child width: value Set the width of the given child to be `value' pixels. child: child widthOffset: value Adjust the width of the given child to be given by `value' more pixels. child: child x: value Never fail and do nothing, the children stay where the text ended at the time each child was added in the widget chi