home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-03-19 | 3.2 KB | 177 lines | [TEXT/CWIE] |
- // CTabbedPanel.cp -- window methods
- // Created 3/19/96 12:49 PM by AppMaker
-
- #include "CTabbedPanel.h"
-
- #include <UReanimator.h>
- #include <URegistrar.h>
- #include <LStream.h>
- #include <CTabPanel.h>
- #include "CGadgetsData.h"
- #include "CmdCodes.h"
-
- #define PPob_TabbedPanelID 201
- #define RidL_TabbedPanelID 201
-
- Boolean CTabbedPanel::sIsRegistered = false;
-
- //----------
- void
- CTabbedPanel::RegisterClass ()
- {
- URegistrar::RegisterClass ('Tabl', (ClassCreatorFunc)CTabbedPanel::CreateTabbedPanelStream);
-
- // register the pane classes we use
- CTabPanel::RegisterClass ();
-
- sIsRegistered = true;
- }
-
- //----------
- CTabbedPanel*
- CTabbedPanel::CreateTabbedPanel(
- LCommander *inSuperCommander,
- CGadgetsData *inData)
- {
- if (!sIsRegistered) {
- RegisterClass ();
- }
-
- CTabbedPanel *window;
-
- window = (CTabbedPanel *)LWindow::CreateWindow(PPob_TabbedPanelID, inSuperCommander);
- window->ConnectToData (inData);
-
- return window;
- }
-
- //----------
- // This is the function you register with URegistrar to create a
- // CTabbedPanel from a resource
-
- CTabbedPanel*
- CTabbedPanel::CreateTabbedPanelStream(
- LStream *inStream)
- {
- return (new CTabbedPanel(inStream));
- }
-
- //----------
- CTabbedPanel::CTabbedPanel()
- {
- }
-
- //----------
- CTabbedPanel::CTabbedPanel(
- LStream *inStream)
- : LWindow(inStream)
- {
- }
-
- //----------
- CTabbedPanel::~CTabbedPanel()
- {
- }
-
- //----------
- // This member function gets called once the containment hierarchy that contains
- // this pane has been built. It gives us a chance to get data members for
- // interesting subviews, and to do other operations now that our subviews exist.
- void
- CTabbedPanel::FinishCreateSelf()
- {
- mTabPanelPanel = (CTabPanel *)FindPaneByID ('Tabl');
-
- UReanimator::LinkListenerToControls(this, this, RidL_TabbedPanelID);
- // the purpose is to "connect" self to whatever controls
- // that we want to "listen" to
-
- // any additional initialization for your window:
-
- }
-
- //----------
- void
- CTabbedPanel::ConnectToData (CGadgetsData *inData)
- {
- mData = inData;
- inData->AddListener (this);
- }
-
- //----------
- void
- CTabbedPanel::ListenToMessage(
- MessageT inMessage,
- void *ioParam)
- {
- switch (inMessage) {
-
- default:
- break;
- }
- }
-
- //----------
- Boolean
- CTabbedPanel::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
- // Remember to add same cases to FindCommandStatus below
- // to enable/disable the commands
-
- default:
- cmdHandled = LWindow::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- //----------
- void
- CTabbedPanel::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- default:
- LWindow::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- //----------
- Boolean
- CTabbedPanel::FocusDraw()
- {
- Boolean focused = LView::FocusDraw();
-
- if (focused) {
- AuxWinHandle awHndl;
- CTabHandle awCTable;
- ColorSpec contentSpec;
-
- GetAuxWin(GetMacPort(), &awHndl);
- awCTable = (**awHndl).awCTable;
- contentSpec = (**awCTable).ctTable [wContentColor]; // should search vs. index
- ::RGBBackColor(&contentSpec.rgb);
- }
-
- return focused;
- }
-