File: node15.html

package info (click to toggle)
gnustep-tutorial 1.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 772 kB
  • ctags: 194
  • sloc: makefile: 46; perl: 6
file content (96 lines) | stat: -rw-r--r-- 3,797 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 99.2beta6 (1.42)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>A Quick Introduction to Views</TITLE>
<META NAME="description" CONTENT="A Quick Introduction to Views">
<META NAME="keywords" CONTENT="WindowsAndButtons">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta6">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="WindowsAndButtons.css">

<LINK REL="next" HREF="node16.html">
<LINK REL="previous" HREF="node14.html">
<LINK REL="up" HREF="node14.html">
<LINK REL="next" HREF="node16.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<B> Next:</B> <A NAME="tex2html183"
  HREF="node16.html">Creating a Button</A>
<B> Up:</B> <A NAME="tex2html181"
  HREF="node14.html">Adding a Button in</A>
<B> Previous:</B> <A NAME="tex2html175"
  HREF="node14.html">Adding a Button in</A>
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION00031000000000000000">
A Quick Introduction to Views</A>
</H2>
<TT>NSView</TT> is a class whose objects represent a rectangular area 
in a window.  Each <TT>NSView</TT> has its own internal coordinate
system; <TT>NSView</TT> provides a complete framework for managing the
rectangle represented by the view, its coordinate system, and for
drawing and getting user events inside the view's rectangle.  

<P>
Any object which can be displayed (and/or can accept user events)
inside a window (such as a button, a text field, a scroll view, a
slider, etc) is actually an instance of a subclass of <TT>NSView</TT>.
The specific subclass (for example, <TT>NSButton</TT>) implements a
specific way of drawing and managing user events inside the view's
rectangle.  An unsubclassed <TT>NSView</TT> by default draws nothing
and reacts to no user events, even if it contains all the machinery
(ready for subclasses to use) to do both.

<P>
When you create a window, the library automatically creates an
<TT>NSView</TT> covering the whole content area of the window.  
This view is called the window's <I>content view</I>.  You can replace
the default content view (which is transparent and reacts to no user
events) with an <TT>NSView</TT> of your choice (which can be an
instance of a subclass of <TT>NSView</TT>, such as a
<TT>NSButton</TT> or a <TT>NSScrollView</TT>), but you should not change 
the rectangle it represents, which must always cover the whole window.

<P>
If you want to have a view which covers only a part of a window, you
need to add it as a <I>subview</I> of the content view.  We will
explore subviews in a forth-coming tutorial; in our first example, we
will go for the simplest possible solution avoiding use of subviews:
we will create a single <TT>NSButton</TT>, make a window to fit
exactly our button, and then replace the default window's content view
with our button.  In this way we'll get a window containing exactly
our button.  In the next tutorial, we'll learn how to enclose views
one over the other in a subview tree, so that we can put more things
in a single window.

<P>
<HR>
<!--Navigation Panel-->
<B> Next:</B> <A NAME="tex2html183"
  HREF="node16.html">Creating a Button</A>
<B> Up:</B> <A NAME="tex2html181"
  HREF="node14.html">Adding a Button in</A>
<B> Previous:</B> <A NAME="tex2html175"
  HREF="node14.html">Adding a Button in</A>
<!--End of Navigation Panel-->
<ADDRESS>
Nicola Pero
2000-07-29
</ADDRESS>
</BODY>
</HTML>