2002-03-06 23:13:23 +00:00
|
|
|
/** GSWCollapsibleComponentContent.m - <title>GSWeb: Class GSWCollapsibleComponentContent</title>
|
|
|
|
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-03-06 23:13:23 +00:00
|
|
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
2000-01-22 12:49:49 +00:00
|
|
|
Date: Apr 1999
|
|
|
|
|
2002-03-06 23:13:23 +00:00
|
|
|
$Revision$
|
|
|
|
$Date$
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-03-06 23:13:23 +00:00
|
|
|
<abstract></abstract>
|
|
|
|
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
|
|
|
|
<license>
|
2000-01-22 12:49:49 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2002-03-06 23:13:23 +00:00
|
|
|
</license>
|
|
|
|
**/
|
|
|
|
|
|
|
|
static char rcsId[] = "$Id$";
|
|
|
|
|
2000-10-30 15:36:50 +00:00
|
|
|
#include <GSWeb/GSWeb.h>
|
2000-01-22 12:49:49 +00:00
|
|
|
#include "GSWCollapsibleComponentContent.h"
|
|
|
|
|
|
|
|
//===================================================================================
|
|
|
|
@implementation GSWCollapsibleComponentContent
|
|
|
|
|
|
|
|
-(void)awake
|
|
|
|
{
|
|
|
|
[super awake];
|
|
|
|
};
|
|
|
|
|
|
|
|
-(void)sleep
|
|
|
|
{
|
|
|
|
[super sleep];
|
|
|
|
};
|
|
|
|
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
|
|
|
GSWLogC("Dealloc GSWCollopsibleComponent");
|
|
|
|
GSWLogC("Dealloc GSWCollopsibleComponent Super");
|
2002-03-06 23:13:23 +00:00
|
|
|
DESTROY(_openedImageFileName);
|
|
|
|
DESTROY(_closedImageFileName);
|
|
|
|
DESTROY(_openedHelpString);
|
|
|
|
DESTROY(_closedHelpString);
|
2000-01-22 12:49:49 +00:00
|
|
|
[super dealloc];
|
|
|
|
GSWLogC("End Dealloc GSWCollopsibleComponent");
|
|
|
|
};
|
|
|
|
|
|
|
|
-(BOOL)synchronizesVariablesWithBindings
|
|
|
|
{
|
|
|
|
return NO;
|
|
|
|
};
|
|
|
|
|
|
|
|
-(BOOL)isVisible
|
|
|
|
{
|
|
|
|
LOGObjectFnStart();
|
2002-03-06 23:13:23 +00:00
|
|
|
NSDebugMLog(@"_isVisibleConditionPassed=%s",(_isVisibleConditionPassed ? "YES" : "NO"));
|
|
|
|
if (!_isVisibleConditionPassed)
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-03-06 23:13:23 +00:00
|
|
|
_isVisible=boolValueFor([self valueForBinding:@"condition"]);
|
|
|
|
_isVisibleConditionPassed=YES;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
2002-03-06 23:13:23 +00:00
|
|
|
NSDebugMLog(@"_isVisible=%s",(_isVisible ? "YES" : "NO"));
|
2000-01-22 12:49:49 +00:00
|
|
|
LOGObjectFnStop();
|
2002-03-06 23:13:23 +00:00
|
|
|
return _isVisible;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
-(GSWComponent*)toggleVisibilityAction
|
|
|
|
{
|
|
|
|
LOGObjectFnStart();
|
2002-03-06 23:13:23 +00:00
|
|
|
NSDebugMLog(@"_isVisible=%s",(_isVisible ? "YES" : "NO"));
|
|
|
|
_isVisible = ![self isVisible];
|
|
|
|
NSDebugMLog(@"_isVisible=%s",(_isVisible ? "YES" : "NO"));
|
2000-01-22 12:49:49 +00:00
|
|
|
if ([self hasBinding:@"visibility"])
|
|
|
|
{
|
2002-03-06 23:13:23 +00:00
|
|
|
[self setValue:[NSNumber numberWithBool:_isVisible]
|
2000-01-22 12:49:49 +00:00
|
|
|
forBinding:@"visibility"];
|
|
|
|
};
|
|
|
|
LOGObjectFnStop();
|
|
|
|
return nil;
|
|
|
|
};
|
|
|
|
|
|
|
|
-(NSString*)imageFileName
|
|
|
|
{
|
|
|
|
NSString* _image=nil;
|
|
|
|
LOGObjectFnStart();
|
|
|
|
if ([self isVisible])
|
|
|
|
{
|
2002-03-06 23:13:23 +00:00
|
|
|
if (!_openedImageFileName)
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
if ([self hasBinding:@"openedImageFileName"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_openedImageFileName,[self valueForBinding:@"openedImageFileName"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else if ([self hasBinding:@"helpString"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_openedImageFileName,[self valueForBinding:@"helpString"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_openedImageFileName,@"DownTriangle.png");
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
2002-03-06 23:13:23 +00:00
|
|
|
_image=_openedImageFileName;
|
2000-01-22 12:49:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-06 23:13:23 +00:00
|
|
|
NSDebugMLog(@"_closedImageFileName=%@",_closedImageFileName);
|
|
|
|
if (!_closedImageFileName)
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
if ([self hasBinding:@"closedImageFileName"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_closedImageFileName,[self valueForBinding:@"closedImageFileName"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else if ([self hasBinding:@"helpString"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_closedImageFileName,[self valueForBinding:@"helpString"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_closedImageFileName,@"RightTriangle.png");
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
2002-03-06 23:13:23 +00:00
|
|
|
_image=_closedImageFileName;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
NSDebugMLog(@"_image=%@",_image);
|
|
|
|
LOGObjectFnStop();
|
|
|
|
return _image;
|
|
|
|
};
|
|
|
|
|
|
|
|
-(NSString*)label
|
|
|
|
{
|
|
|
|
NSString* _label=nil;
|
|
|
|
LOGObjectFnStart();
|
|
|
|
if ([self isVisible])
|
|
|
|
{
|
|
|
|
if ([self hasBinding:@"openedLabel"])
|
|
|
|
_label=[self valueForBinding:@"openedLabel"];
|
|
|
|
else if ([self hasBinding:@"label"])
|
|
|
|
_label=[self valueForBinding:@"label"];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ([self hasBinding:@"closedLabel"])
|
|
|
|
_label=[self valueForBinding:@"closedLabel"];
|
|
|
|
else if ([self hasBinding:@"label"])
|
|
|
|
_label=[self valueForBinding:@"label"];
|
|
|
|
};
|
|
|
|
NSDebugMLog(@"_label=%@",_label);
|
|
|
|
LOGObjectFnStop();
|
|
|
|
return _label;
|
|
|
|
};
|
|
|
|
|
|
|
|
-(NSString*)helpString
|
|
|
|
{
|
|
|
|
NSString* _helpString=nil;
|
|
|
|
LOGObjectFnStart();
|
|
|
|
if ([self isVisible])
|
|
|
|
{
|
2002-03-06 23:13:23 +00:00
|
|
|
if (!_openedHelpString)
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
if ([self hasBinding:@"openedHelpString"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_openedHelpString,[self valueForBinding:@"openedHelpString"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else if ([self hasBinding:@"helpString"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_openedHelpString,[self valueForBinding:@"helpString"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_openedHelpString,@"Click to collapse");
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
2002-03-06 23:13:23 +00:00
|
|
|
_helpString=_openedHelpString;
|
2000-01-22 12:49:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-06 23:13:23 +00:00
|
|
|
if (!_closedHelpString)
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
if ([self hasBinding:@"closedHelpString"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_closedHelpString,[self valueForBinding:@"closedHelpString"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else if ([self hasBinding:@"helpString"])
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_closedHelpString,[self valueForBinding:@"helpString"]);
|
2000-01-22 12:49:49 +00:00
|
|
|
else
|
2002-03-06 23:13:23 +00:00
|
|
|
ASSIGN(_closedHelpString,@"Click to expand");
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
2002-03-06 23:13:23 +00:00
|
|
|
_helpString=_closedHelpString;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
NSDebugMLog(@"_helpString=%@",_helpString);
|
|
|
|
LOGObjectFnStop();
|
|
|
|
return _helpString;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@end
|