themed disclosure button
This commit is contained in:
parent
468bcdbd0b
commit
3100b1dbb8
9 changed files with 141 additions and 23 deletions
|
@ -416,7 +416,6 @@ private:
|
|||
SAL_DLLPRIVATE void ImplInitCheckBoxData();
|
||||
SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
|
||||
SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
|
||||
SAL_DLLPRIVATE void ImplDrawCheckBoxState();
|
||||
SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState();
|
||||
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
|
||||
const Point& rPos, const Size& rSize,
|
||||
|
@ -436,10 +435,11 @@ protected:
|
|||
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
|
||||
SAL_DLLPRIVATE virtual void FillLayoutData() const;
|
||||
|
||||
SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
|
||||
SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
|
||||
public:
|
||||
SAL_DLLPRIVATE void ImplCheck();
|
||||
SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
|
||||
|
||||
public:
|
||||
CheckBox( Window* pParent, WinBits nStyle = 0 );
|
||||
CheckBox( Window* pParent, const ResId& rResId );
|
||||
|
@ -538,4 +538,13 @@ public:
|
|||
~TriStateBox();
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC DisclosureButton : public CheckBox
|
||||
{
|
||||
protected:
|
||||
SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
|
||||
public:
|
||||
DisclosureButton( Window* pParent, WinBits nStyle = 0 );
|
||||
DisclosureButton( Window* pParent, const ResId& rResId );
|
||||
};
|
||||
|
||||
#endif // _SV_BUTTON_HXX
|
||||
|
|
|
@ -146,8 +146,7 @@ namespace vcl
|
|||
public:
|
||||
FixedLine maPrinterFL;
|
||||
ListBox maPrinters;
|
||||
PushButton maDetailsBtn;
|
||||
FixedText maDetailsTxt;
|
||||
DisclosureButton maDetailsBtn;
|
||||
FixedText maStatusLabel;
|
||||
FixedText maStatusTxt;
|
||||
FixedText maLocationLabel;
|
||||
|
|
|
@ -86,6 +86,7 @@ class Timer;
|
|||
class AutoTimer;
|
||||
class Help;
|
||||
class ImageList;
|
||||
class Image;
|
||||
class PopupMenu;
|
||||
class Application;
|
||||
class OutputDevice;
|
||||
|
@ -247,6 +248,10 @@ struct ImplSVCtrlData
|
|||
ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's)
|
||||
ImageList* mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows)
|
||||
ImageList* mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows)
|
||||
Image* mpDisclosurePlus;
|
||||
Image* mpDisclosurePlusHC;
|
||||
Image* mpDisclosureMinus;
|
||||
Image* mpDisclosureMinusHC;
|
||||
ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox
|
||||
USHORT mnCheckStyle; // CheckBox-Style for ImageList-Update
|
||||
USHORT mnRadioStyle; // Radio-Style for ImageList-Update
|
||||
|
|
|
@ -60,6 +60,11 @@
|
|||
#define SV_RESID_BITMAP_CLOSEDOC 1052
|
||||
#define SV_RESID_BITMAP_CLOSEDOCHC 1053
|
||||
|
||||
#define SV_DISCLOSURE_PLUS 1060
|
||||
#define SV_DISCLOSURE_MINUS 1061
|
||||
#define SV_DISCLOSURE_PLUS_HC 1062
|
||||
#define SV_DISCLOSURE_MINUS_HC 1063
|
||||
|
||||
#define SV_RESID_MENU_EDIT 2000
|
||||
#define SV_MENU_EDIT_UNDO 1
|
||||
#define SV_MENU_EDIT_CUT 2
|
||||
|
@ -146,7 +151,6 @@
|
|||
#define SV_PRINT_LOCATION_TXT 21
|
||||
#define SV_PRINT_COMMENT_TXT 22
|
||||
#define SV_PRINT_DETAILS_BTN 23
|
||||
#define SV_PRINT_DETAILS_TXT 24
|
||||
|
||||
#define SV_PRINT_TAB_OPT 3
|
||||
#define SV_PRINT_OPT_PRINT_FL 1
|
||||
|
|
|
@ -444,6 +444,26 @@ void DeInitVCL()
|
|||
delete pSVData->maCtrlData.mpSplitVArwImgList;
|
||||
pSVData->maCtrlData.mpSplitVArwImgList = NULL;
|
||||
}
|
||||
if ( pSVData->maCtrlData.mpDisclosurePlus )
|
||||
{
|
||||
delete pSVData->maCtrlData.mpDisclosurePlus;
|
||||
pSVData->maCtrlData.mpDisclosurePlus = NULL;
|
||||
}
|
||||
if ( pSVData->maCtrlData.mpDisclosurePlusHC )
|
||||
{
|
||||
delete pSVData->maCtrlData.mpDisclosurePlusHC;
|
||||
pSVData->maCtrlData.mpDisclosurePlusHC = NULL;
|
||||
}
|
||||
if ( pSVData->maCtrlData.mpDisclosureMinus )
|
||||
{
|
||||
delete pSVData->maCtrlData.mpDisclosureMinus;
|
||||
pSVData->maCtrlData.mpDisclosureMinus = NULL;
|
||||
}
|
||||
if ( pSVData->maCtrlData.mpDisclosureMinusHC )
|
||||
{
|
||||
delete pSVData->maCtrlData.mpDisclosureMinusHC;
|
||||
pSVData->maCtrlData.mpDisclosureMinusHC = NULL;
|
||||
}
|
||||
if ( pSVData->mpDefaultWin )
|
||||
{
|
||||
delete pSVData->mpDefaultWin;
|
||||
|
|
|
@ -4389,3 +4389,76 @@ TriStateBox::TriStateBox( Window* pParent, const ResId& rResId ) :
|
|||
TriStateBox::~TriStateBox()
|
||||
{
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
||||
DisclosureButton::DisclosureButton( Window* pParent, WinBits nStyle ) :
|
||||
CheckBox( pParent, WB_NOBORDER )
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
DisclosureButton::DisclosureButton( Window* pParent, const ResId& rResId ) :
|
||||
CheckBox( pParent, rResId.SetRT( RSC_CHECKBOX ) )
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void DisclosureButton::ImplDrawCheckBoxState()
|
||||
{
|
||||
/* HACK: DisclosureButton is currently assuming, that the disclosure sign
|
||||
will fit into the rectangle occupied by a normal checkbox on all themes.
|
||||
If this does not hold true for some theme, ImplGetCheckImageSize
|
||||
would have to be overloaded for DisclosureButton; also GetNativeControlRegion
|
||||
for CTRL_LISTNODE would have to be implemented and taken into account
|
||||
*/
|
||||
|
||||
Rectangle aStateRect( GetStateRect() );
|
||||
|
||||
ImplControlValue aControlValue( GetState() == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF, rtl::OUString(), 0 );
|
||||
Region aCtrlRegion( aStateRect );
|
||||
ControlState nState = 0;
|
||||
|
||||
if ( HasFocus() ) nState |= CTRL_STATE_FOCUSED;
|
||||
if ( ImplGetButtonState() & BUTTON_DRAW_DEFAULT ) nState |= CTRL_STATE_DEFAULT;
|
||||
if ( Window::IsEnabled() ) nState |= CTRL_STATE_ENABLED;
|
||||
if ( IsMouseOver() && aStateRect.IsInside( GetPointerPosPixel() ) )
|
||||
nState |= CTRL_STATE_ROLLOVER;
|
||||
|
||||
if( ! DrawNativeControl( CTRL_LISTNODE, PART_ENTIRE_CONTROL, aCtrlRegion, nState,
|
||||
aControlValue, rtl::OUString() ) )
|
||||
{
|
||||
ImplSVCtrlData& rCtrlData( ImplGetSVData()->maCtrlData );
|
||||
if( ! rCtrlData.mpDisclosurePlus )
|
||||
rCtrlData.mpDisclosurePlus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS ) ) );
|
||||
if( ! rCtrlData.mpDisclosurePlusHC )
|
||||
rCtrlData.mpDisclosurePlusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS_HC ) ) );
|
||||
if( ! rCtrlData.mpDisclosureMinus )
|
||||
rCtrlData.mpDisclosureMinus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS ) ) );
|
||||
if( ! rCtrlData.mpDisclosureMinusHC )
|
||||
rCtrlData.mpDisclosureMinusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS_HC ) ) );
|
||||
|
||||
Image* pImg = NULL;
|
||||
if( GetSettings().GetStyleSettings().GetHighContrastMode() )
|
||||
pImg = IsChecked() ? rCtrlData.mpDisclosureMinusHC : rCtrlData.mpDisclosurePlusHC;
|
||||
else
|
||||
pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus;
|
||||
|
||||
DBG_ASSERT( pImg, "no disclosure image" );
|
||||
if( ! pImg )
|
||||
return;
|
||||
|
||||
USHORT nStyle = 0;
|
||||
if( ! IsEnabled() )
|
||||
nStyle |= IMAGE_DRAW_DISABLE;
|
||||
|
||||
Size aSize( aStateRect.GetSize() );
|
||||
Size aImgSize( pImg->GetSizePixel() );
|
||||
Point aOff( (aSize.Width() - aImgSize.Width())/2,
|
||||
(aSize.Height() - aImgSize.Height())/2 );
|
||||
aOff += aStateRect.TopLeft();
|
||||
DrawImage( aOff, *pImg, nStyle );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -833,3 +833,23 @@ Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRINTERADMIN)
|
|||
File = "printeradmin_16_h.png" ;
|
||||
};
|
||||
|
||||
Bitmap SV_DISCLOSURE_PLUS
|
||||
{
|
||||
File = "plus.png";
|
||||
};
|
||||
|
||||
Bitmap SV_DISCLOSURE_PLUS_HC
|
||||
{
|
||||
File = "plus_sch.png";
|
||||
};
|
||||
|
||||
Bitmap SV_DISCLOSURE_MINUS
|
||||
{
|
||||
File = "minus.png";
|
||||
};
|
||||
|
||||
Bitmap SV_DISCLOSURE_MINUS_HC
|
||||
{
|
||||
File = "minus_sch.png";
|
||||
};
|
||||
|
||||
|
|
|
@ -316,17 +316,12 @@ ModalDialog SV_DLG_PRINT
|
|||
Border = TRUE;
|
||||
HelpText [en-US] = "Select the printer to print on.";
|
||||
};
|
||||
PushButton SV_PRINT_DETAILS_BTN
|
||||
CheckBox SV_PRINT_DETAILS_BTN
|
||||
{
|
||||
Pos = MAP_APPFONT( 5, 5 );
|
||||
Size = MAP_APPFONT( 5, 5 );
|
||||
HelpText [en-US] = "Show/Hide detailed information of the selected printer.";
|
||||
};
|
||||
FixedText SV_PRINT_DETAILS_TXT
|
||||
{
|
||||
Pos = MAP_APPFONT( 5, 5 );
|
||||
Size = MAP_APPFONT( 10, 10 );
|
||||
Text [en-US] = "Details";
|
||||
HelpText [en-US] = "Show/Hide detailed information of the selected printer.";
|
||||
};
|
||||
FixedText SV_PRINT_STATUS_TXT
|
||||
{
|
||||
|
|
|
@ -454,7 +454,6 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId )
|
|||
, maPrinterFL( this, VclResId( SV_PRINT_PRINTERS_FL ) )
|
||||
, maPrinters( this, VclResId( SV_PRINT_PRINTERS ) )
|
||||
, maDetailsBtn( this, VclResId( SV_PRINT_DETAILS_BTN ) )
|
||||
, maDetailsTxt( this, VclResId( SV_PRINT_DETAILS_TXT ) )
|
||||
, maStatusLabel( this, VclResId( SV_PRINT_STATUS_TXT ) )
|
||||
, maStatusTxt( this, 0 )
|
||||
, maLocationLabel( this, VclResId( SV_PRINT_LOCATION_TXT ) )
|
||||
|
@ -526,10 +525,7 @@ void PrintDialog::JobTabPage::setupLayout()
|
|||
// create a row for details button/text and properties button
|
||||
boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) );
|
||||
maLayout.addChild( xDetRow );
|
||||
boost::shared_ptr< vcl::LabeledElement > xDetLbl( new vcl::LabeledElement( xDetRow.get() ) );
|
||||
xDetRow->addChild( xDetLbl );
|
||||
xDetLbl->setLabel( &maDetailsBtn );
|
||||
xDetLbl->setElement( &maDetailsTxt );
|
||||
xDetRow->addWindow( &maDetailsBtn );
|
||||
xDetRow->addChild( new vcl::Spacer( xDetRow.get(), 2 ) );
|
||||
xDetRow->addWindow( &maSetupButton );
|
||||
|
||||
|
@ -568,9 +564,7 @@ void PrintDialog::JobTabPage::setupLayout()
|
|||
xCollateRow->setLabel( &maCollateBox );
|
||||
xCollateRow->setElement( &maCollateImage );
|
||||
|
||||
maDetailsBtn.SetSymbol( SYMBOL_SPIN_DOWN );
|
||||
maDetailsBtn.SetSmallSymbol();
|
||||
maDetailsBtn.SetStyle( maDetailsBtn.GetStyle() | (WB_SMALLSTYLE | WB_BEVELBUTTON) );
|
||||
// maDetailsBtn.SetStyle( maDetailsBtn.GetStyle() | (WB_SMALLSTYLE | WB_BEVELBUTTON) );
|
||||
mxDetails->show( false, false );
|
||||
}
|
||||
|
||||
|
@ -796,7 +790,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
|
|||
maBackwardBtn.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maJobPage.maCollateBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maJobPage.maSetupButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maJobPage.maDetailsBtn.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maJobPage.maDetailsBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
|
||||
|
@ -1950,8 +1944,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
|
|||
}
|
||||
else if( pButton == &maJobPage.maDetailsBtn )
|
||||
{
|
||||
bool bShow = ! maJobPage.maStatusTxt.IsVisible();
|
||||
maJobPage.maDetailsBtn.SetSymbol( bShow ? SYMBOL_SPIN_UP : SYMBOL_SPIN_DOWN );
|
||||
bool bShow = maJobPage.maDetailsBtn.IsChecked();
|
||||
maJobPage.mxDetails->show( bShow );
|
||||
if( bShow )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue