3 * The Cheat - The legendary universal game trainer for Mac OS X.
4 * http://www.dogcows.com/chaz/wiki/TheCheat
6 * Copyright (c) 2003-2010, Charles McGarvey et al.
8 * Distributable under the terms and conditions of the 2-clause BSD
9 * license; see the file COPYING for the legal text of the license.
12 #import "StatusTextField.h"
15 @interface StatusTextField ( Private
)
17 - (void)doTimer
:(NSTimer
*)timer
;
22 @implementation StatusTextField
27 if ( self = [super init
] ) {
35 [myDefaultStatus release
];
43 - (void)setDefaultStatus
:(NSString
*)message
45 [self setDefaultStatus
:message color
:[NSColor blackColor
]];
48 - (void)setDefaultStatus
:(NSString
*)message color
:(NSColor
*)color
51 message
= [NSString stringWithString
:@
""];
54 color
= [NSColor blackColor
];
56 // save the new values
58 [myDefaultStatus release
];
59 myDefaultStatus
= message
;
60 // save the new values
62 [myDefaultColor release
];
63 myDefaultColor
= color
;
64 // set the new default if there isn't already a temp showing
66 [self setStringValue
:myDefaultStatus
];
67 [self setTextColor
:myDefaultColor
];
72 - (void)setTemporaryStatus
:(NSString
*)message
74 [self setTemporaryStatus
:message color
:[NSColor blackColor
]];
77 - (void)setTemporaryStatus
:(NSString
*)message color
:(NSColor
*)color
79 [self setTemporaryStatus
:message color
:color duration
:4.0];
82 - (void)setTemporaryStatus
:(NSString
*)message duration
:(NSTimeInterval
)duration
84 [self setTemporaryStatus
:message color
:[NSColor blackColor
] duration
:duration
];
87 - (void)setTemporaryStatus
:(NSString
*)message color
:(NSColor
*)color duration
:(NSTimeInterval
)duration
89 // stop any current temporary status
94 message
= [NSString stringWithString
:@
""];
97 color
= [NSColor blackColor
];
99 // set the new temporary status
100 [self setStringValue
:message
];
101 [self setTextColor
:color
];
103 myTimer
= [[NSTimer scheduledTimerWithTimeInterval
:duration target
:self selector
:@selector(doTimer
:) userInfo
:nil repeats
:NO
] retain
];
107 - (void)doTimer
:(NSTimer
*)timer
113 // set the default status
114 if ( myDefaultStatus
) {
115 [self setStringValue
:myDefaultStatus
];
117 if ( myDefaultColor
) {
118 [self setTextColor
:myDefaultColor
];