Monday, December 13, 2010

Curl BaseFrame

The Curl class BaseFrame is declared as
public BaseFrame {inherits BasicBox}
and is not abstract. Frame inherits from it as
public Frame {inherits BaseFrame}
and is certainly not abstract. But a RootFrame to root a graphic hierarchy is declared as
public abstract sealed RootFrame {inherits Frame}
and is abstract -yet its immediate subclass View is declared as
public View {inherits GuiRangeSelectionContext, RootFrame}
and is a very common class for concrete instances.  GuiSelectionRange is also abstract and is declared as
public abstract GuiRangeSelectionContext {inherits TextSelectionContext, BaseGuiRangeSelectionContext, ContainerDragScroller, OptionListInterface}
RootFrame and GuiRangeSelectionContext are performing a special role that Traits or Mixins might perform in another language.

View has a need to have its visibility specified as a property, which can be a stumbling block in first experiments with Curl. Here is an example:

{curl 7.0 applet}
{import WindowVisibility from CURL.GRAPHICS.WINDOW}
{View visibility=WindowVisibility.normal,
   {text Some text that will appear in a freestanding window}
}

View has an interesting subclass which is rather like the first window one used to create for MS Windows back in the days of C using only a frame: OutlineOnlyView.

BaseFrame is a usable class, which is not what the name would suggest in some other languages: it is usable in the sense that a subclass can make immediate use of its constructor in a class declaration as shown in the Curl docs:
{constructor {default}
     {construct-super.BaseFrame
which the docs say can be used as a special frame destined to have only one child graphic or visual object.

No comments: