home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-20 | 2.3 KB | 84 lines | [TEXT/CWIE] |
- #include "ocheaders.h"
- #include "CBaseControl.h"
-
- #include "CTestView.h"
- #include <URegistrar.h>
- #include <LCaption.h>
- #include <LEditField.h>
- #include <LPicture.h>
- #include <LStdControl.h>
- #include <LView.h>
- #include <UAttachments.h>
-
- #include "CDirectoryTable.h"
- #include "CFixedScroller.h"
- #include "CCFragResource.h"
-
- #include <LString.h>
-
- const PaneIDT kEditField = 1;
-
- void InitPowerPlantControl();
-
- // --
- // We include this because the CPPActiveX control expects it to exist.
- // Without it, things get deadstripped and this custom view would never
- // be created.
- // --
-
- void InitPowerPlantControl()
- {
- URegistrar::RegisterClass(CTestView::class_ID, (ClassCreatorFunc) CTestView::CreateFromStream);
- URegistrar::RegisterClass(LCaption::class_ID, (ClassCreatorFunc) LCaption::CreateCaptionStream);
- URegistrar::RegisterClass(LEditField::class_ID, (ClassCreatorFunc) LEditField::CreateEditFieldStream);
- URegistrar::RegisterClass(LPicture::class_ID, (ClassCreatorFunc) LPicture::CreatePictureStream);
- URegistrar::RegisterClass(LStdButton::class_ID, (ClassCreatorFunc) LStdButton::CreateStdButtonStream);
- URegistrar::RegisterClass(LStdCheckBox::class_ID, (ClassCreatorFunc) LStdCheckBox::CreateStdCheckBoxStream);
-
- // ----------
- // Register the custom ones we're throwing in for show...
- // ----------
-
- URegistrar::RegisterClass(CDirectoryTable::class_ID, (ClassCreatorFunc) CDirectoryTable::CreateFromStream);
- URegistrar::RegisterClass(CFixedScroller::class_ID, (ClassCreatorFunc) CFixedScroller::CreateFromStream);
- }
-
- CTestView*
- CTestView::CreateFromStream(
- LStream *inStream)
- {
- return (new CTestView(inStream));
- }
-
- CTestView::CTestView(LStream *inStream)
- : LView(inStream)
- {
-
- short AppResFile = ::CurResFile();
- CCFragResource ResourceSetter;
- short CFragResFile = ::CurResFile();
-
- }
-
- void
- CTestView::FinishCreateSelf()
- {
- CDirectoryTable *table = (CDirectoryTable*) FindPaneByID('dirr');
- if (table != nil)
- {
- FSSpec fs;
- FindFolder(kOnSystemDisk, 'macs', false, &fs.vRefNum, &fs.parID);
- LString::CopyPStr("\pPreferences", fs.name);
- table->BuildList(fs, 0);
- }
-
- LEditField* editField = (LEditField*) FindPaneByID(kEditField);
- if (editField != nil)
- {
- LEraseAttachment* theAttachment;
- theAttachment = new LEraseAttachment();
- if (theAttachment)
- editField->AddAttachment(theAttachment, nil, true);
- }
- }
-