2 // **********************************************************************
3 // The Cheat - A universal game cheater for Mac OS X
4 // (C) 2003-2005 Chaz McGarvey (BrokenZipper)
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 1, or (at your option)
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #import "StatusTextField.h"
24 @interface StatusTextField ( Private
)
26 - (void)doTimer
:(NSTimer
*)timer
;
31 @implementation StatusTextField
36 if ( self = [super init
] ) {
44 [myDefaultStatus release
];
52 - (void)setDefaultStatus
:(NSString
*)message
54 [self setDefaultStatus
:message color
:[NSColor blackColor
]];
57 - (void)setDefaultStatus
:(NSString
*)message color
:(NSColor
*)color
60 message
= [NSString stringWithString
:@
""];
63 color
= [NSColor blackColor
];
65 // save the new values
67 [myDefaultStatus release
];
68 myDefaultStatus
= message
;
69 // save the new values
71 [myDefaultColor release
];
72 myDefaultColor
= color
;
73 // set the new default if there isn't already a temp showing
75 [self setStringValue
:myDefaultStatus
];
76 [self setTextColor
:myDefaultColor
];
81 - (void)setTemporaryStatus
:(NSString
*)message
83 [self setTemporaryStatus
:message color
:[NSColor blackColor
]];
86 - (void)setTemporaryStatus
:(NSString
*)message color
:(NSColor
*)color
88 [self setTemporaryStatus
:message color
:color duration
:4.0];
91 - (void)setTemporaryStatus
:(NSString
*)message duration
:(NSTimeInterval
)duration
93 [self setTemporaryStatus
:message color
:[NSColor blackColor
] duration
:duration
];
96 - (void)setTemporaryStatus
:(NSString
*)message color
:(NSColor
*)color duration
:(NSTimeInterval
)duration
98 // stop any current temporary status
103 message
= [NSString stringWithString
:@
""];
106 color
= [NSColor blackColor
];
108 // set the new temporary status
109 [self setStringValue
:message
];
110 [self setTextColor
:color
];
112 myTimer
= [[NSTimer scheduledTimerWithTimeInterval
:duration target
:self selector
:@selector(doTimer
:) userInfo
:nil repeats
:NO
] retain
];
116 - (void)doTimer
:(NSTimer
*)timer
122 // set the default status
123 if ( myDefaultStatus
) {
124 [self setStringValue
:myDefaultStatus
];
126 if ( myDefaultColor
) {
127 [self setTextColor
:myDefaultColor
];