gwenhywfar  4.7.0beta
CocoaLineTextField.m
Go to the documentation of this file.
1 //
2 // CocoaLineTextField.m
3 //
4 //
5 // Created by Samuel Strupp on 10.08.10.
6 //
7 
8 #ifdef HAVE_CONFIG_H
9 # include <config.h>
10 #endif
11 
12 
13 #import "CocoaLineTextField.h"
14 
15 #ifndef COCOA_LINE_TEXTFIELD_MM
16 #define COCOA_LINE_TEXTFIELD_MM
17 
18 @implementation CocoaLineTextField
19 
20 - (id)initWithFrame:(NSRect)frame {
21  self = [super initWithFrame:frame];
22  if (self) {
23  [self setTarget:self];
24  [self setAction:@selector(textChanged:)];
25  c_actionPtr = nil;
26  c_actionData = nil;
27 
28  minWidth = 32.0;
29 
32  }
33  return self;
34 }
35 
36 -(void) dealloc {
37  [super dealloc];
38 }
39 
40 -(void) computeMinWidth {
41  NSSize size = [self neededTextSize];
42  if (size.width > 32.0)
43  minWidth = size.width;
44  else minWidth = 32.0;
45 }
46 
47 -(void) setC_ActionPtr:(gwenTextFieldActionPtr)ptr Data:(void*)data {
48  c_actionPtr = ptr;
49  c_actionData = data;
50 }
51 
52 -(void) setC_TextChanged_ActionPtr:(gwenTextFieldActionPtr)ptr Data:(void*)data {
55 }
56 
57 -(void) textChanged:(id)sender {
58  if (c_actionPtr) {
60  }
61 }
62 
63 - (void)textDidChange:(NSNotification *)aNotification {
64  //NSLog(@"textDidChange");
67  }
68  [super textDidChange:aNotification];
69 }
70 
71 - (void)setStringValue:(NSString *)aString {
72  [super setStringValue:aString]; //damit hebeln wir die automatische Größen Berechnung vom CocoaLabel aus.
73 }
74 
75 #pragma mark Protocoll Methods
76 
77 - (NSSize) minSize {
78  return NSMakeSize(minWidth, 22.0);
79 }
80 
81 @end
82 
83 #endif