summaryrefslogtreecommitdiff
path: root/padmin/source/titlectrl.cxx
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2001-06-19 12:47:44 +0000
committerPhilipp Lohmann <pl@openoffice.org>2001-06-19 12:47:44 +0000
commit577273b73fe789196a6de6c6f126a5a169fde011 (patch)
tree9e38845ce92c543e478b87a96a5e3d910f96e695 /padmin/source/titlectrl.cxx
parentf83eddd8b4c8c7e0bfcb85b7b5b80699f4920d8d (diff)
#85520# dialogue redesign
Diffstat (limited to 'padmin/source/titlectrl.cxx')
-rw-r--r--padmin/source/titlectrl.cxx136
1 files changed, 136 insertions, 0 deletions
diff --git a/padmin/source/titlectrl.cxx b/padmin/source/titlectrl.cxx
new file mode 100644
index 000000000000..70e422900b30
--- /dev/null
+++ b/padmin/source/titlectrl.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * $RCSfile: titlectrl.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: pl $ $Date: 2001-06-19 13:47:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _PAD_NEWPPDLG_HXX_
+#include <titlectrl.hxx>
+#endif
+
+using namespace padmin;
+
+TitleImage::TitleImage( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ m_bArranged( false )
+{
+ Font aFont = GetFont();
+ aFont.SetHeight( aFont.GetHeight()*3/2 );
+ SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+TitleImage::~TitleImage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::arrange()
+{
+ m_bArranged = true;
+ Size aCtrlSize( GetSizePixel() );
+ Size aImageSize( m_aImage.GetSizePixel() );
+ Size aTextSize( GetTextWidth( m_aText ), GetTextHeight() );
+
+ m_aImagePos.Y() = ( aCtrlSize.Height() - aImageSize.Height() ) / 2;
+ m_aImagePos.X() = m_aImagePos.Y() < 0 ? -m_aImagePos.Y() : m_aImagePos.Y();
+ m_aTextPos.X() = m_aImagePos.X() + aImageSize.Width() + aTextSize.Height()/2;
+ m_aTextPos.Y() = ( aCtrlSize.Height() - aTextSize.Height() ) / 2;
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::Paint( const Rectangle& rRect )
+{
+ if( ! m_bArranged )
+ arrange();
+
+ SetLineColor( m_aBGColor );
+ SetFillColor( m_aBGColor );
+ DrawRect( Rectangle( Point( 0, 0 ), Size( GetSizePixel() ) ) );
+ DrawImage( m_aImagePos, m_aImage );
+ DrawText( m_aTextPos, m_aText );
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::SetText( const String& rText )
+{
+ m_aText = rText;
+ m_bArranged = false;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::SetImage( const Image& rImage )
+{
+ m_aImage = rImage;
+ m_bArranged = false;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TitleImage::SetBackgroundColor( const Color& rColor )
+{
+ m_aBGColor = rColor;
+ Invalidate();
+}