1/*
2  Copyright (C) 2000-2005 SKYRIX Software AG
3
4  This file is part of SOPE.
5
6  SOPE is free software; you can redistribute it and/or modify it under
7  the terms of the GNU Lesser General Public License as published by the
8  Free Software Foundation; either version 2, or (at your option) any
9  later version.
10
11  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12  WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14  License for more details.
15
16  You should have received a copy of the GNU Lesser General Public
17  License along with SOPE; see the file COPYING.  If not, write to the
18  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19  02111-1307, USA.
20*/
21
22#include "WETableViewColorConfig.h"
23#include "WETableViewDefines.h"
24#include "common.h"
25
26@implementation WETableViewColorConfig
27
28- (id)initWithAssociations:(NSDictionary *)_config {
29  if ((self = [super initWithAssociations:_config])) {
30    self->titleColor  = WOExtGetProperty(_config, @"titleColor");
31    self->headerColor = WOExtGetProperty(_config, @"headerColor");
32    self->footerColor = WOExtGetProperty(_config, @"footerColor");
33    self->evenColor   = WOExtGetProperty(_config, @"evenColor");
34    self->oddColor    = WOExtGetProperty(_config, @"oddColor");
35  }
36  return self;
37}
38
39- (void)dealloc {
40  [self->titleColor  release];
41  [self->headerColor release];
42  [self->footerColor release];
43  [self->evenColor   release];
44  [self->oddColor    release];
45  [super dealloc];
46}
47
48- (void)updateConfigInContext:(WOContext *)_ctx {
49  WOComponent *cmp;
50  NSString    *tmp;
51
52  cmp = [_ctx component];
53
54#define SetConfigInContext(_a_, _key_)           \
55  if (_a_ && (tmp = [_a_ valueInComponent:cmp])) \
56    [_ctx setObject:tmp forKey:_key_];
57
58  SetConfigInContext(self->titleColor,      WETableView_titleColor);
59  SetConfigInContext(self->headerColor,     WETableView_headerColor);
60  SetConfigInContext(self->footerColor,     WETableView_footerColor);
61  SetConfigInContext(self->evenColor,       WETableView_evenColor);
62  SetConfigInContext(self->oddColor,        WETableView_oddColor);
63#undef SetConfigInContext
64}
65
66@end /* WETableViewColorConfig */
67