mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-11-07 23:06:28 +01:00
* Added a 'master' toggle to the Speedhacks panel.
* ... more WIP stuff on the Video options panel. * Spent 12 hrs working on crap text wrapping and window sizing issues. * Moved several UI classes to utilities (lots of project changes, breaks linux) * Fixed stilly bug in SPU2-X that prevented it from working (at all). * Lots of code cleanups, and 1 or 2 bugfixes. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2212 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
1 parent
0cac04b028
commit
4f9cd96e50
45 files changed
+1173
-605
No files matched your search
@@ -0,0 +1,130 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "pxStaticText.h"
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// pxStaticText Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Implementation Notes:
|
||||
// * No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems.
|
||||
|
||||
pxStaticText::pxStaticText( wxWindow* parent, const wxString& label, int style )
|
||||
: wxStaticText( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style )
|
||||
, m_message( label )
|
||||
{
|
||||
m_alignflags = style & wxALIGN_MASK;
|
||||
m_wrapwidth = wxDefaultCoord;
|
||||
m_centerPadding = 0.08;
|
||||
}
|
||||
|
||||
pxStaticText::pxStaticText( wxWindow* parent, int style )
|
||||
: wxStaticText( parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style )
|
||||
{
|
||||
m_alignflags = style & wxALIGN_MASK;
|
||||
m_wrapwidth = wxDefaultCoord;
|
||||
m_centerPadding = 0.08;
|
||||
}
|
||||
|
||||
pxStaticText& pxStaticText::SetWrapWidth( int newwidth )
|
||||
{
|
||||
m_wrapwidth = newwidth;
|
||||
SetLabel( m_message );
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pxStaticText::SetLabel( const wxString& label )
|
||||
{
|
||||
m_message = label;
|
||||
_setLabel();
|
||||
}
|
||||
|
||||
void pxStaticText::_setLabel()
|
||||
{
|
||||
_parent::SetLabel( pxTextWrapper().Wrap( *this, m_message, GetIdealWidth() ).GetResult() );
|
||||
}
|
||||
|
||||
pxStaticText& pxStaticText::SetToolTip( const wxString& tip )
|
||||
{
|
||||
pxSetToolTip( this, tip );
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pxStaticText::AddTo( wxSizer& sizer )
|
||||
{
|
||||
sizer.Add( this, pxSizerFlags::StdSpace().Align( m_alignflags ) );
|
||||
_setLabel();
|
||||
}
|
||||
|
||||
void pxStaticText::InsertAt( wxSizer& sizer, int position )
|
||||
{
|
||||
sizer.Insert( position, this, pxSizerFlags::StdSpace().Align( m_alignflags ) );
|
||||
_setLabel();
|
||||
}
|
||||
|
||||
int pxStaticText::GetIdealWidth() const
|
||||
{
|
||||
if( m_wrapwidth != wxDefaultCoord ) return m_wrapwidth;
|
||||
|
||||
//pxAssertDev( GetContainingSizer() != NULL, "The Static Text must first belong to a Sizer!!" );
|
||||
int idealWidth = wxDefaultCoord;
|
||||
|
||||
// Find the first parent with a fixed width:
|
||||
wxWindow* millrun = this->GetParent();
|
||||
while( (idealWidth == wxDefaultCoord) && millrun != NULL )
|
||||
{
|
||||
if( wxIsKindOf( millrun, wxPanelWithHelpers ) )
|
||||
idealWidth = ((wxPanelWithHelpers*)millrun)->GetIdealWidth();
|
||||
|
||||
else if( wxIsKindOf( millrun, wxDialogWithHelpers ) )
|
||||
idealWidth = ((wxDialogWithHelpers*)millrun)->GetIdealWidth();
|
||||
|
||||
millrun = millrun->GetParent();
|
||||
}
|
||||
|
||||
if( idealWidth != wxDefaultCoord )
|
||||
{
|
||||
idealWidth -= 6;
|
||||
|
||||
if( GetWindowStyle() & wxALIGN_CENTRE )
|
||||
idealWidth *= (1.0 - m_centerPadding);
|
||||
}
|
||||
|
||||
return idealWidth;
|
||||
}
|
||||
|
||||
wxSize pxStaticText::GetMinSize() const
|
||||
{
|
||||
int ideal = GetIdealWidth();
|
||||
wxSize minSize( _parent::GetMinSize() );
|
||||
if( ideal == wxDefaultCoord ) return minSize;
|
||||
return wxSize( std::min( ideal, minSize.x ), minSize.y );
|
||||
}
|
||||
|
||||
/*pxStaticText::operator wxSizerFlags() const
|
||||
{
|
||||
return pxSizerFlags::StdSpace().Align( m_alignflags );
|
||||
}*/
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// pxStaticHeading Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
pxStaticHeading::pxStaticHeading( wxWindow* parent, const wxString& label, int style )
|
||||
: pxStaticText( parent, label, style )
|
||||
{
|
||||
m_centerPadding = 0.18;
|
||||
}
|
||||
Reference in new issue
Block a user