gwenhywfar
5.12.0
gui
cocoa
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
30
c_textChangedActionPtr
= nil;
31
c_textChangedActionData
= nil;
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 {
53
c_textChangedActionPtr
= ptr;
54
c_textChangedActionData
= data;
55
}
56
57
-(void) textChanged:(
id
)sender {
58
if
(
c_actionPtr
) {
59
c_actionPtr
(
self
,
c_actionData
);
60
}
61
}
62
63
- (void)textDidChange:(NSNotification *)aNotification {
64
//NSLog(@"textDidChange");
65
if
(
c_textChangedActionPtr
) {
66
c_textChangedActionPtr
(
self
,
c_textChangedActionData
);
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
CocoaLineTextField.h
gwenTextFieldActionPtr
void(* gwenTextFieldActionPtr)(NSTextField *textField, void *data)
Definition
CocoaLineTextField.h:16
CocoaLabel::minWidth
CGFloat minWidth
Definition
CocoaLabel.h:22
CocoaLineTextField
Definition
CocoaLineTextField.h:20
CocoaLineTextField::c_textChangedActionPtr
gwenTextFieldActionPtr c_textChangedActionPtr
Definition
CocoaLineTextField.h:24
CocoaLineTextField::c_textChangedActionData
void * c_textChangedActionData
Definition
CocoaLineTextField.h:25
CocoaLineTextField::c_actionData
void * c_actionData
Definition
CocoaLineTextField.h:22
CocoaLineTextField::c_actionPtr
gwenTextFieldActionPtr c_actionPtr
Definition
CocoaLineTextField.h:21
-[CocoaGwenGUIProtocol-p minSize]
NSSize minSize()
Generated by
1.14.0