/[hegemonie]/hegemonie/Interface/UiLabel.m
ViewVC logotype

Diff of /hegemonie/Interface/UiLabel.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by zaral, Thu May 22 08:46:17 2003 UTC revision 1.2 by dam, Tue Jun 3 23:16:44 2003 UTC
# Line 25  Line 25 
25  #include <Foundation/NSGeometry.h>  #include <Foundation/NSGeometry.h>
26    
27  #include "Interface/UiLabel.h"  #include "Interface/UiLabel.h"
28    #include "Interface/UiText.h"
29    
30    @interface UiLabel (Private)
31    + (unsigned) _textSize;
32    @end
33    
34  @implementation UiLabel  @implementation UiLabel
35    
36    + (unsigned) _textSize
37    {
38      return 18;
39    }
40    
41  /* Must crash if text is nil Must crash if width or height < 0 */  /* Must crash if text is nil Must crash if width or height < 0 */
42  - (id) initWithText: (NSString *)text  - (id) initWithText: (NSString *)text
43             position: (NSPoint)position             position: (NSPoint)position
# Line 40  Line 50 
50    if (self != nil)    if (self != nil)
51      {      {
52        _text = RETAIN (text);        _text = RETAIN (text);
53          _uiText = [UiText textWithText: text
54                                  height: [UiLabel _textSize]];
55          
56    
57        [self sizeToFit];        [self sizeToFit];
58      }      }
# Line 50  Line 63 
63  - (void) dealloc  - (void) dealloc
64  {  {
65    RELEASE(_text);    RELEASE(_text);
66      RELEASE(_uiText);
67    
68    [super dealloc];    [super dealloc];
69  }  }
# Line 66  Line 80 
80    NSParameterAssert (text);    NSParameterAssert (text);
81    NSParameterAssert ([text length] != 0);    NSParameterAssert ([text length] != 0);
82        
83    RELEASE(_text);    ASSIGN(_text, text);
84    _text = RETAIN(text);    ASSIGN(_uiText, [UiText textWithText: text
85                                    height: [UiLabel _textSize]]);
86    
87    [self sizeToFit];    [self sizeToFit];
88  }  }
# Line 75  Line 90 
90  /**  /**
91   * method who calculate the width and the height of the widget.   * method who calculate the width and the height of the widget.
92   */   */
93   - (void) sizeToFit  - (void) sizeToFit
94  {  {
95    /* FIXME - not implemented */    [self setSize: [_uiText size]];
96  }  }
97    
98    
99    - (void) display
100    {
101      [super display];
102    
103      glColor3f (0.0, 0.0, 0.0);
104      [_uiText display];
105    }
106    
107    
108  @end  @end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26