package Win32::GUI::Constants::Tags;
# $Id: Tags.pm,v 1.5 2006/08/03 22:20:38 robertemay Exp $

use strict;
use warnings;

# On one line so MakeMaker will see it.
require Win32::GUI::Constants;  our $VERSION = $Win32::GUI::Constants::VERSION;

use AutoLoader 'AUTOLOAD';

=head1 NAME

Win32::GUI::Constants::Tags - export :tag definitions for Win32::GUI::Constants

=head1 SYNOPSIS

  use Win32::GUI::Constants qw ( :tag ... );

Win32::GUI::Constants::Tags provide export :tag definitions for use with
Win32::GUI::Constants.  It is implemented as a seperate module to improve
the speed and memory usage of Win32::GUI::Constants if no :tag symbols
are used on the import line.

=head1 EXPORT TAGS

The following tags are defined for use with Win32::GUI::Constants:

=head2 General Export Tags

=over

=item B<:common>

A somewhat subjective list of commonly used constants.

=item B<:customdraw>

Constants related to custom draw handling.

=item B<:stockobjects>

Constants defining the system objects that can be created with GetStockObject().

=item B<:compatibility_win32_gui>

All constants exported by default by Win32::GUI up to v1.03.  Note that this is a large list.

=item B<:all>

All defined constants.  Note that this is a very large list.

=back

=head2 Package Specific Export Tags

The following list of export tags is defined, each exporting constant that may be
useful with the related Win32::GUI package(s).  Note that some currently export nothing.

:accelerator, :animation, :bitmap, :brush, :button, :class, :combobox, :cursor,
:datetime, :dc, :font, :header, :icon, :imagelist, :label, :listbox, :listview, :mdi,
:menu, :monthcal, :notifyicon, :pen, :progressbar, :rebar, :region, :richedit,
:scrollbar, :slider, :splitter, :statusbar, :tabstrip, :textfield, :timer, :toolbar,
:tooltip, :treeview, :updown, :window

=cut

# tag spec's
# keys are tags, values are array ref containg regex patterns of
# constants to match.  If value is undef, then the definition will
# be the return value of a subroutine named tag_spec().  These
# subroutines are defined after the __END__ token in this file, and processed
# by AutoSplit and AutoLoader.
our %TAG_SPECS = (
    common      => [ qw( ^CW_USEDEFAULT$ ) ],
    customdraw  => [ qw( ^CDDS_ ^CDRF_ ) ],
    stockobjects=> undef,
    all         => [ qw( .* ) ],

    compatibility_win32_gui => undef,

    accelerator => [ qw( ^VK_ ) ],
    animation   => [ qw( ^ACS_ ) ],
    bitmap      => [ qw( ^OBM_ ) ],
    brush       => [ qw() ],
    button      => undef,
    class       => [ qw( ^COLOR_ ^CS_ ) ],
    combobox    => [ qw( ^CBS_ ^CBES_ ) ],
    cursor      => [ qw( ^IDC_ ^OCR_ ) ],
    datetime    => [ qw( ^DTS_ ) ],
    dc          => undef,
    font        => [ qw() ],
    header      => [ qw( ^HDS_ ) ],
    icon        => [ qw( ^IDI_ ^OIC_ ) ],
    imagelist   => [ qw( ^ILC_ ^ILD_ ^ILS_ ^CLR_NONE$ ^CLR_DEFAULT$ ^IMAGE_ ) ],
    label       => [ qw( ^IMAGE_ ) ],
    listbox     => [ qw( ^LBS_ ) ],
    listview    => [ qw( ^LVS_ ^LVIS_ ^LVIR_ ^LVSIL_ ^CLR_NONE$ ) ],
    mdi         => [ qw() ],
    menu        => [ qw( ^MF_ ^SC_ ^TPM_ ) ],
    monthcal    => [ qw( ^MCS_ ^MCSC_ ) ],
    notifyicon  => [ qw() ],
    pen         => [ qw( ^PS_ ) ],
    progressbar => [ qw( ^CLR_DEFAULT$ ) ],
    rebar       => [ qw( ^CLR_DEFAULT$ ^RBBS_ ) ],
    region      => [ qw( ^RGN_ ) ],
    richedit    => [ qw( ^CP_ ^EM_ ^ENM_ ^ES_ ^GT_ ^SF_ ^SFF_ ) ],
    scrollbar   => [ qw( ^SB_ ) ],
    slider      => [ qw( ^TBTS_ ) ],
    splitter    => [ qw() ],
    statusbar   => [ qw( ^CLR_DEFAULT$ ^SBT_ ) ],
    tabstrip    => [ qw() ],
    textfield   => [ qw( ^EM_ ^ES_ ) ],
    timer       => [ qw() ],
    toolbar     => [ qw( ^BTNS_ ^TBSTATE_ ^TBSTYLE_ ^I_ ^CLR_DEFAULT$ ^TRANSPARENT$
                         ^OPAQUE$ ^HINST_COMMCTRL$ ^IBD_ ) ],
    tooltip     => [ qw( ^TTDT_ ^TTF_ ^TTM_ ^TTN_ ) ],
    treeview    => [ qw( ^CLR_DEFAULT$ ^TVGN_ ^TVHT_ ) ],
    updown      => [ qw() ],
    window      => [ qw( ^DS_ ^ID.[^_]+ ^MA_ ^MK_ ^NM_ ^RDW_ ^SIZE_ ^SW_ ^WA_ ^WM_
                             ^WS_ ) ],
);

# tag() returns a reference to a list of constant names,
# or undef if the tag passed has no definition
sub tag {
    my $spec = shift;

    if(exists $TAG_SPECS{$spec}) {
        my $patterns;
        if(defined($TAG_SPECS{$spec})) {
            $patterns = $TAG_SPECS{$spec};
        }
        else {
            no strict 'refs';
            $patterns = &{"tag_$spec"};
        }
        my @names = ();
        my @syms = @{Win32::GUI::Constants::_export_ok()};
        foreach my $patn (@$patterns) {
            push @names, grep(/$patn/, @syms);
        }
        return \@names;
    }
       
    return undef;
}

1; #End of Tags.pm

=head1 SUPPORT

Homepage: L<http://perl-win32-gui.sourceforge.net/>.

For further support join the users mailing list
(C<perl-win32-gui-users@lists.sourceforge.net>) from the website
at L<http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users>.
There is a searchable list archive at
L<http://sourceforge.net/mail/?group_id=16572>

=head1 BUGS

No all constants are covered.  If you find missing constants
please raise a feature request at
L<http://sourceforge.net/tracker/?group_id=16572&atid=366572>

=head1 AUTHORS

Robert May, E<lt>robertemay@users.sourceforge.netE<gt>

=head1 ACKNOWLEDGEMENTS

Many thanks to the Win32::GUI developers at
L<http://perl-win32-gui.sourceforge.net/> for suggestions
and assistance.

=head1 COPYRIGHT & LICENSE

Copyright 2005..2006 Robert May, All Rights Reserved.

=cut

#AutoLoaded subs go after the __END__ token
# each sub here is the name of a tag, and returns an array ref
# to a list of patterns to match
__END__
sub tag_stockobjects() { [
qw( ^WHITE_BRUSH$ ^LTGRAY_BRUSH$ ^GRAY_BRUSH$ ^DKGRAY_BRUSH$ ^BLACK_BRUSH$ ^NULL_BRUSH$
    ^HOLLOW_BRUSH$ ^WHITE_PEN$ ^BLACK_PEN$ ^NULL_PEN$ ^OEM_FIXED_FONT$ ^ANSI_F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IBPATTERNPT$
    ^BS_PATTERN8X8$ ^BS_DIBPATTERN8X8$ ^BS_MONOPATTERN$ ^HS_ ^PS_ ^BLACKONWHITE$
    ^WHITEONBLACK$ ^COLORONCOLOR$ ^HALFTONE$ ^STRETCH_ )
] }
sub tag_compatibility_win32_gui() { [
qw( ^BS_3STATE$ ^BS_AUTO3STATE$ ^BS_AUTOCHECKBOX$ ^BS_AUTORADIOBUTTON$ ^BS_CHECKBOX$
    ^BS_DEFPUSHBUTTON$ ^BS_GROUPBOX$ ^BS_LEFTTEXT$ ^BS_NOTIFY$ ^BS_OWNERDRAW$
    ^BS_PUSHBUTTON$ ^BS_RADIOBUTTON$ ^BS_USERBUTTON$ ^BS_BITMAP$ ^BS_BOTTOM$ ^BS_CENTER$
    ^BS_ICON$ ^BS_LEFT$ ^BS_MULTILINE$ ^BS_RIGHT$ ^BS_RIGHTBUTTON$ ^BS_TEXT$ ^BS_TOP$
    ^BS_VCENTER$ ^COLOR_3DFACE$ ^COLOR_ACTIVEBORDER$ ^COLOR_ACTIVECAPTION$
    ^COLOR_APPWORKSPACE$ ^COLOR_BACKGROUND$ ^COLOR_BTNFACE$ ^COLOR_BTNSHADOW$
    ^COLOR_BTNTEXT$ ^COLOR_CAPTIONTEXT$ ^COLOR_GRAYTEXT$ ^COLOR_HIGHLIGHT$
    ^COLOR_HIGHLIGHTTEXT$ ^COLOR_INACTIVEBORDER$ ^COLOR_INACTIVECAPTION$ ^COLOR_MENU$
    ^COLOR_MENUTEXT$ ^COLOR_SCROLLBAR$ ^COLOR_WINDOW$ ^COLOR_WINDOWFRAME$
    ^COLOR_WINDOWTEXT$ ^DS_3DLOOK$ ^DS_ABSALIGN$ ^DS_CENTER$ ^DS_CENTERMOUSE$
    ^DS_CONTEXTHELP$ ^DS_CONTROL$ ^DS_FIXEDSYS$ ^DS_LOCALEDIT$ ^DS_MODALFRAME$
    ^DS_NOFAILCREATE$ ^DS_NOIDLEMSG$ ^DS_SETFONT$ ^DS_SETFOREG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