ODFDraw: see CShapeTracker::BeginTracking and CShapeTracker::ContinueTracking. A CShapeTracker is used during the creation of a new shape. See also CResizeTracker::BeginTracking and CResizeTracker::ContinueTracking. CResizeTracker is used during the resizing of a shape.
ODFContainer: see CResizeTracker::BeginTracking and CResizeTracker::ContinueTracking. (ODFContainer is a stripped down version of ODFDraw).
See the engineering note Scrolling for the autoscroll API.
Controls
ODFForm: this is the showcase example for controls and other views. The scrolling form contains every type of control: push buttons, radio buttons, check boxes, popup menus and scroll bars. See views.fr for the control resource definition. See CFormFrame::CreateSubViews and CFormView::CreateOwnSubViews for creating controls by program.
See CFormFrame::HandleNotification in frame.cpp for the code to respond to the controls' notifications. In addition to the push buttons that always perform some action we have added examples of popup menu and radio button notifications.
ODFButton: displays a simple push button on which a script or sound file can be dropped, to be run when the button is pressed.
Scroll bar controls are also used in ODFDraw and ODFContainer.
FW_CControl classes are described in the engineering note Using Controls.
Edit Views
ODFForm: The scrolling form contains several edit views, including a custom class CScrollEdit that supports scrolling and undo/redo commands (see ScrollEd.cpp and EditCmd.cpp). See views.fr for the edit views resource definition. See CFormView::CreateOwnSubViews for creating edit views by program.
The password dialog contains two custom edit views, CPwdEditView, used to hide the characters being typed. See Dialog.cpp.
FW_CEditView is described in the engineering note Using Edit Views.
Layout Management
ODFDraw & ODFContainer: both samples are similar in the way the content view is layed out as the frame is resized, see CContainerFrame::AdjustContentViewSize and CDrawView::AdjustToNewLayout. The other views, the scroll bars, the grow box and the rulers, use the default behavior provided by their bindings resource field (see Views.fr).
ODFForm: its content view is centered inside the frame, with a shadow border drawn around it. See CFormView::AdjustToNewLayout in FormView.cpp
See the engineering note Layout Management for more information.
List Boxes
ODFForm: The scrolling form contains a list box with a list of platforms. It responds to double-clicks in the first item. You can make multiple selections and add or remove items. See views.fr for the list view resource definition. In FormView.cpp see CFormView::CreateOwnSubViews for creating the list box by program. See also the CMouseUpBehavior class that allows to detect selections after clicking in the list box.
FW_CListBox is described in the engineering note Using List Boxes.
Mapping
ODFClock: FW_kCustomConstrained mapping is used by ODFClock to display the analog clock scaled to its frame size even though all drawing is performed in a fixed coordinate space. The mapping object is created and used within the Draw method of CAnalogView. The logical extent is set to 2000 by 2000, the device extent to the current frame extent, and the origin to the middle of the logical coordinate space. This makes it possible to draw the clock in logical coordinates with X and Y between -1000 and +1000.
Modal Dialogs
ODFForm: This samples contains a moveable modal dialog to enter a password. See views.fr for the dialog resource definition and Dialog.cpp for the source code.
All samples use FW_CAboutFrame, a subclass of FW_CDialogFrame, to display their About box.
FW_CDialogFrame is described in the engineering note Using Diaiogs.
Pictures & Bitmaps
ODFBitmap: uses FW_CPicture on Mac and FW_CBitmap on Windows. See CBitmapContent::UseDefaultBitmap and CBitmapFrame::Draw. You can use cut/copy/paste and drag & drop to modify the picture.
ODFDraw: uses the FW_CPicture and FW_CPictureContext to render its shapes into a Macintosh picture during clipboard operations. See CDrawSelectionPromise::FulfillPromise in DrwPrmse.cpp. The picture is created only when the promise must be fulfilled, i.e. when somebody else wants to paste the current Draw selection.
ODFForm: should be using FW_CPicture as well for the background picture of its form view. Instead the current version loads the picture manually in CFormPart::InitPicture and draws it in CFormView::Draw.
Printing
ODFDraw: lets the user print its content when there is at least 1 shape drawn. It defines its own print handler in PrintHdl.cpp and adds a progress dialog by linking FWPrint.r to the project.
ODFForm: supports content printing by just creating a FW_CPrintHandler object in CFormFrame::NewPrintHandler.
The Printing API is described in the engineering note Printing
.
Scaling
ODFDraw & ODFContainer: both samples let the user change a zoom factor between 50%, 100% and 200% through the Zoom menu command. See ChangeZoomFactor called by DoMenu. Scaling is implemented in the FW_CScroller::ScaleBy method by modifying the frame internal transform.
Scroller
ODFDraw & ODFContainer: both samples use an FW_CScrollBarScroller object and two scroll bar views. Scrolling of the content view is handled automatically by ODF. Scroll bars are removed when the frame is embedded , i.e. when it is not the root frame. There is additional code to implement trackers and turn auto scrolling on.
ODFForm: this sample also uses a scroller and scroll bar views. However the scroll bars are not removed when the frame is embedded. Form also contain a subclass of FW_CEditView, CScrollEdit, implementing a scrolling edit view (we can't use FW_CScroller because it is limited to scrolling the content view).
FW_CScroller and FW_CScrollBarScroller are described in the engineering note Scrolling.
View Resources
All samples containing views show how to define them in resources in the file Views.fr. The source code of the frame's CreateSubViews method is still there but commented out.
ODFForm, ODFDraw & ODFContainer: these samples contain the greatest number of views. Their Views.fr files also contain a few custom view resource types.
See also the engineering notes on each type of views.
View Tabber
ODFForm: An FW_CViewTabber object is created in CFormFrame::PostCreateViewFromStream to allow tabbing between views that can accept the keyboard focus (i.e. edit views and list boxes). The view tabber is created automatically in Form's modal dialog by the FW_CDialogFrame class.
FW_CViewTabber is described in the engineering note Using Edit Views.