Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Headers/Window.h
/* |
File: Window.h |
Contains: TWindow is a Window wrapper class that handles most of the basic window functionality. |
Window.h contains the TWindow class definition. |
Written by: |
Copyright: Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved. |
You may incorporate this Apple sample source code into your program(s) without |
restriction. This Apple sample source code has been provided "AS IS" and the |
responsibility for its operation is yours. You are not permitted to redistribute |
this Apple sample source code as "Apple sample source code" after having made |
changes. If you're going to re-distribute the source, we require that you make |
it clear in the source that the code was descended from Apple sample source |
code, but that you've made changes. |
Change History (most recent first): |
8/18/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 |
*/ |
// Declare label for this header file |
#ifndef _WINDOW_ |
#define _WINDOW_ |
#ifndef _DTSCPLUSLIBRARY_ |
#include "DTSCPlusLibrary.h" |
#endif |
#ifndef __WINDOWS__ |
#include <Windows.h> |
#endif |
#ifndef _ENVIRONMENT_ |
#include "Environment.h" |
#endif |
// _________________________________________________________________________________________________________ // |
// TWindow Class Interface. |
class TWindow |
// TWindow is a simple Window class that could be used to produce simple window objects. |
{ |
public: |
// TYPEDEFS AND ENUMS |
enum ECoordinates // used to define the default window size/position |
{ |
kTop = 50, kLeft = 50, kBottom = 275, kRight = 275 |
}; |
// CONSTRUCTORS AND DESTRUCTORS |
TWindow(); // default constructor |
TWindow(short windowID); // create a window based on a resource ID |
virtual~ TWindow(); // default destructor |
virtual void Initialize(); // initialize fields to known values |
// MAIN INTERFACE |
virtual void Draw(); // the main drawing routine |
virtual void DoClick(); // handle mouse clicks inside window |
virtual void Show(); // show window |
virtual void Hide(); // hide window |
// GET/SET FUNCTIONS |
virtual WindowPtr GetWindowPtr() const; // get the object's WindowPtr |
virtual void SetTitle(const Str255* title); // set window title |
virtual void GetTitle(Str255* result) const;// get window title |
virtual Rect GetExtent() const; // get window interior rect |
virtual Rect GetFrame() const; // get window frame rect |
virtual Boolean Contains(Point test) const; // test if point is inside window |
virtual Boolean IsColorWindow() const; // color window or not? |
// FIELDS |
protected: |
WindowPtr fWindow; // our single WindowPtr |
WindowPeek fWindowRecord; // pointer to the window record |
Str255 fWindowTitle; // out window title |
Rect fRect; // the rect for the window |
Boolean fColorWindow; // enabled if the window supports Color QD |
}; |
#endif |
// _________________________________________________________________________________________________________ // |
/* Change History (most recent last): |
No Init. Date Comment |
1 khs 11/7/92 New file |
2 khs 1/7/93 Cleanup |
*/ |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14