1 |
wakaba |
1.1 |
package Message::DOM::CSSStyleSheet; |
2 |
|
|
use strict; |
3 |
|
|
our $VERSION=do{my @r=(q$Revision: 1.12 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
4 |
|
|
push our @ISA, 'Message::IF::CSSStyleSheet'; |
5 |
|
|
|
6 |
|
|
sub new ($) { |
7 |
|
|
return bless \{css_rules => []}, shift; |
8 |
|
|
} # new |
9 |
|
|
|
10 |
|
|
sub AUTOLOAD { |
11 |
|
|
my $method_name = our $AUTOLOAD; |
12 |
|
|
$method_name =~ s/.*:://; |
13 |
|
|
return if $method_name eq 'DESTROY'; |
14 |
|
|
|
15 |
|
|
if ({ |
16 |
|
|
## Read-only attributes (trivial accessors) |
17 |
|
|
href => 1, |
18 |
|
|
owner_node => 1, |
19 |
|
|
owner_rule => 1, |
20 |
|
|
parent_style_sheet => 1, |
21 |
|
|
type => 1, |
22 |
|
|
}->{$method_name}) { |
23 |
|
|
no strict 'refs'; |
24 |
|
|
eval qq{ |
25 |
|
|
sub $method_name (\$) { |
26 |
|
|
return \${\$_[0]}->{$method_name}; |
27 |
|
|
} |
28 |
|
|
}; |
29 |
|
|
goto &{ $AUTOLOAD }; |
30 |
|
|
} else { |
31 |
|
|
require Carp; |
32 |
|
|
Carp::croak (qq<Can't locate method "$AUTOLOAD">); |
33 |
|
|
} |
34 |
|
|
} # AUTOLOAD |
35 |
|
|
|
36 |
|
|
## |StyleSheet| attributes |
37 |
|
|
|
38 |
|
|
sub disabled ($;$) { |
39 |
|
|
if (@_ > 1) { |
40 |
|
|
if ($_[1]) { |
41 |
|
|
${$_[0]}->{disabled} = 1; |
42 |
|
|
} else { |
43 |
|
|
delete ${$_[0]}->{disabled}; |
44 |
|
|
} |
45 |
|
|
} |
46 |
|
|
return ${$_[0]}->{disabled}; |
47 |
|
|
} # disabled |
48 |
|
|
|
49 |
|
|
sub href ($); |
50 |
|
|
|
51 |
|
|
## TODO: media |
52 |
|
|
|
53 |
|
|
sub owner_node ($); |
54 |
|
|
|
55 |
|
|
sub parent_style_sheet ($); |
56 |
|
|
|
57 |
|
|
sub title ($;$) { |
58 |
|
|
if (@_ > 1) { |
59 |
|
|
if (defined $_[1]) { |
60 |
|
|
${$_[0]}->{title} = ''.$_[1]; |
61 |
|
|
} else { |
62 |
|
|
delete ${$_[0]}->{title}; |
63 |
|
|
} |
64 |
|
|
} |
65 |
|
|
return ${$_[0]}->{title}; |
66 |
|
|
} # title |
67 |
|
|
|
68 |
|
|
sub type ($); |
69 |
|
|
|
70 |
|
|
## |CSSStyleSheet| attributes |
71 |
|
|
|
72 |
|
|
sub css_rules ($) { |
73 |
|
|
require Message::DOM::CSSRuleList; |
74 |
|
|
return bless \\($_[0]), 'Message::DOM::CSSRuleList'; |
75 |
|
|
} # css_rules |
76 |
|
|
|
77 |
|
|
sub owner_rule ($); |
78 |
|
|
|
79 |
|
|
## |CSSStyleSheet| methods |
80 |
|
|
|
81 |
|
|
## TODO: delete_rule |
82 |
|
|
|
83 |
|
|
## TODO: insert_rule |
84 |
|
|
|
85 |
|
|
package Message::IF::StyleSheet; |
86 |
|
|
package Message::IF::CSSStyleSheet; |
87 |
|
|
|
88 |
|
|
1; |
89 |
|
|
## $Date:$ |