Hi,
I would be grateful if someone could commit this change to the InsertBand
method of a rebar control. I've added the option "-style".
Cheers,
jez.
###########################################################################
# (@)METHOD:InsertBand(%OPTIONS)
#
# Insert a new band into the rebar control.
#
# Allowed %OPTIONS are:
#
# -image => Zero based index of the imagelist.
# -index => Zero based index where the band is inserted.
# -bitmap => The background bitmap for the band.
# -child => Child control. See Below.
# -foreground => Band foreground colors.
# -background => Band background colors.
# -width => The width of the band.
# -minwidth => The minimum width of the band.
# -minheight => The minimum height of the band.
# -text => The text for the band.
# -style => The style of the band. See Below
#
# Each band can only contain one child control. However, you can add a
child window that contains many controls:
#
# $mainwindow = <main window code>
#
# my $band = new Win32::GUI::Window (
# -parent => $mainwindow,
# -name => "RebarBand1",
# -popstyle => WS_CAPTION | WS_SIZEBOX,
# -pushstyle => WS_CHILD,
# );
#
# # create Date time control for band 1
# my $DateTime = $band->AddDateTime (
# -name => "DateTime",
# -pos => [0, 0],
# -size => [130, 20],
# -tip => 'A date and time',
# );
# #set the format for the datetime control
# $DateTime->Format('dd-MMM-yyyy HH:mm:ss');
#
# #Add a button to band 1
# $band->AddButton (
# -name => 'Button',
# -pos => [135, 0],
# -size => [50, 20],
# -text => 'Button',
# -tip => 'A Button',
# -onClick => sub {print 'button clicked' },
# );
#
# my $rebar = $mainwindow->AddRebar(
# -name => "Rebar",
# -bandborders => 1,
# );
#
# #Insert band
# $rebar->InsertBand (
# -child => $band,
# -width => 210,
# -minwidth => 210,
# -minheight => 20,
# );
#
# Styles
#
# Each band can have it's own style. As a default, each band has
RBBS_CHILDEDGE | RBBS_FIXEDBMP
# RBBS_BREAK 1 The band is on a new line.
# RBBS_FIXEDSIZE 2 The band can't be sized. With this style, the sizing
grip is not displayed on the band.
# RBBS_CHILDEDGE 4 The band has an edge at the top and bottom of the child
window.
# RBBS_HIDDEN 8 The band will not be visible.
# RBBS_FIXEDBMP 32 The background bitmap does not move when the band is
resized.
# RBBS_VARIABLEHEIGHT 64 The band can be resized by the rebar control.
# RBBS_GRIPPERALWAYS 128 The band will always have a sizing grip, even if
it is the only band in the rebar.
# RBBS_NOGRIPPER 256 The band will never have a sizing grip, even if there
is more than one band in the rebar.
#
LRESULT
InsertBand(handle,...)
HWND handle
PREINIT:
REBARBANDINFO rbbi;
int i, next_i;
UINT index;
CODE:
ZeroMemory(&rbbi, sizeof(REBARBANDINFO));
rbbi.cbSize = sizeof(REBARBANDINFO);
rbbi.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDBMP;
SwitchBit(rbbi.fMask, RBBIM_STYLE, 1);
index = (UINT) -1;
next_i = -1;
for(i = 1; i < items; i++) {
if(next_i == -1) {
if(strcmp(SvPV_nolen(ST(i)), "-image") == 0) {
next_i = i + 1;
rbbi.iImage = SvIV(ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_IMAGE, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-index") == 0) {
next_i = i + 1;
index = (UINT) SvIV(ST(next_i));
} else if(strcmp(SvPV_nolen(ST(i)), "-bitmap") == 0) {
next_i = i + 1;
rbbi.hbmBack = (HBITMAP) handle_From(NOTXSCALL ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_BACKGROUND, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-child") == 0) {
next_i = i + 1;
rbbi.hwndChild = (HWND) handle_From(NOTXSCALL ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_CHILD, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-foreground") == 0) {
next_i = i + 1;
rbbi.clrFore = SvCOLORREF(NOTXSCALL ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_COLORS, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-background") == 0) {
next_i = i + 1;
rbbi.clrBack = SvCOLORREF(NOTXSCALL ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_COLORS, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-width") == 0) {
next_i = i + 1;
rbbi.cx = SvIV(ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_SIZE, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-minwidth") == 0) {
next_i = i + 1;
rbbi.cxMinChild = SvIV(ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_CHILDSIZE, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-minheight") == 0) {
next_i = i + 1;
rbbi.cyMinChild = SvIV(ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_CHILDSIZE, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-text") == 0) {
next_i = i + 1;
rbbi.lpText = SvPV_nolen(ST(next_i));
SwitchBit(rbbi.fMask, RBBIM_TEXT, 1);
} else if(strcmp(SvPV_nolen(ST(i)), "-style") == 0) {
next_i = i + 1;
rbbi.fStyle = SvIV(ST(next_i));
}
} else {
next_i = -1;
}
}
RETVAL = SendMessage(handle, RB_INSERTBAND, (WPARAM) index, (LPARAM) &rbbi);
OUTPUT:
RETVAL