File: GSAutoLayoutStandardManager.h

package info (click to toggle)
renaissance 0.8.0-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,484 kB
  • ctags: 389
  • sloc: objc: 10,524; makefile: 64; perl: 19; sh: 12
file content (100 lines) | stat: -rw-r--r-- 3,850 bytes parent folder | download | duplicates (2)
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
97
98
99
100
/* -*-objc-*-
   GSAutoLayoutStandardManager.h

   Copyright (C) 2002 Free Software Foundation, Inc.

   Author: Nicola Pero <n.pero@mi.flashnet.it>
   Date: April 2002

   This file is part of GNUstep Renaissance

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.
   If not, write to the Free Software Foundation,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef _GNUstep_H_GSAutoLayoutStandardManager
#define _GNUstep_H_GSAutoLayoutStandardManager

#include "GSAutoLayoutManager.h"

@class NSMutableArray;

/*
 * GSAutoLayoutStandardManager objects are layout managers which
 * layout segments one after the other.  Some segments are expanded,
 * other segments are not expanded.  The standard autolayout manager
 * guarantees that whenever there is a resize, all segments with
 * expand = YES are expanded, and that no segments with expand = NO
 * are expanded unless there is a sound reason to do so.  This
 * autolayout manager aligns segments in different lines, so that
 * segment 0 of one line is the same size of segment 0 of all other
 * lines.  By default, all 'span' attributes of all segments should be
 * 1.  If a 'span' attribute of a segment is different from 1, it is
 * interpreted as the number of slots (columns if we are laying out
 * horizontally) that the segment takes up.
 */
@interface GSAutoLayoutStandardManager : GSAutoLayoutManager
{
  /* An array of GSAutoLayoutManagerColumn (a private class) holding
   * the info about the columns.  */
  NSMutableArray *_columns;

  /* Cached number of columns with expand set to YES.  Computed during
   * minimum layout.  */
  int _numberOfExpandingColumns;
}

/*
 * The minimum layout is determined by 
 *
 * - finding how many columns we have.
 *
 * - compute the length of each column, which is the maximum length of
 * all segments contained in each column (ignoring the special case of
 * segments with span != 1 for now), and whether each column expands
 * or not (it expands if any of the segments displayed in it expands).
 *
 * - for each segment which has a span != 1, if the sum of the length
 * of columns it spans is less than the minimum size of the segment,
 * then enlarge all those columns so that their sum get to this
 * minimum length (only enlarge columns with expand = YES and all of
 * the same amount; if there is none with expand = YES, expand all of
 * an equal amount); if the segment has expand = YES and no column
 * it spans is already marked as expand = YES, then mark them all as
 * expand = YES.
 *
 * - layout each line by laying out all segments in a column to be as
 * big as that column, and segments spanning multiple columns to be as
 * big as the sum of those columns.  All segments are one after the
 * other one.
 *
 * - the biggest line length is the line length.
 *
 * - layout the segment contents inside each segment according to the
 * border for that segment, and the alignment of the segment contents.
 */
- (BOOL) internalUpdateMinimumLayout;

/*
 * The layout is determined by computing the difference between the
 * _length and the _minimumLength, and distributing the resulting
 * amount between the columns with expand = YES, then performing
 * layout.
 */
- (BOOL) internalUpdateLayout;

@end

#endif