コード例 #1
0
	ScrollBar::ScrollBar( int nId, Win* parent, bool _vertical, bool _autoHide, crect* rect )
		:  Win( Win::WT_CHILD, 0, parent, rect, nId ),
		   vertical( _vertical ),
		   si( 100, 10, 0 ),
		   len( 0 ),
		   bsize( 0 ),
		   bpos( 0 ),
		   trace( false ),
		   traceBPoint( 0 ),
		   autoHide( _autoHide ),
		   b1Pressed( false ),
		   b2Pressed( false ),
		   managedWin( 0 )
	{
		LSize ls;
		int l = SB_WIDTH * 2;// + 2;// + 5;
		int h = SB_WIDTH;// + 2;

		if ( vertical )
		{
			ls.Set( cpoint( h, l ) );
			ls.y.maximal = 16000;
		}
		else
		{
			ls.Set( cpoint( l, h ) );
			ls.x.maximal = 16000;
		}

		SetLSize( ls );
		SetScrollInfo( 0 );
//	crect r = ClientRect();
//	EventSize(&cevent_size(cpoint(r.Width(),r.Height())));
	}
コード例 #2
0
	void Button::OnChangeStyles()
	{
		GC gc( this );
		gc.Set( GetFont() );
		cpoint p = text.GetTextExtents(gc);

		if ( icon.ptr() )
		{
			if ( p.y < 12 )
			{
				p.y = 12;
			}

			p.x += ICONX_RIGHTSPACE + icon->Width();

			if ( icon->Width() > p.y + 4 )
			{
				p.y = icon->Width() - 4;
			}
		}

		p.x += LEFTSPACE + RIGHTSPACE;
		p.x += 8;
		p.y += 8;
		SetLSize( LSize( p ) );
	}
コード例 #3
0
ファイル: path-list.cpp プロジェクト: 0-wiz-0/WCMCommander
PathListWin::PathListWin(Win* parent, PathList& dataList)
    : VListWin(Win::WT_CHILD, WH_TABFOCUS | WH_CLICKFOCUS, 0, parent, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0),
    m_dataList(dataList)
{
    wal::GC gc(this);
    gc.Set(GetFont());

    cpoint ts = gc.GetTextExtents(ABCString);
    const int fontH = ts.y + 2;
    this->SetItemSize((fontH > 16 ? fontH : 16) + 1, 100);

    LSize ls;
    ls.x.maximal = 10000;
    ls.x.ideal = 1000;
    ls.x.minimal = 600;

    ls.y.maximal = 10000;
    ls.y.ideal = 600;
    ls.y.minimal = 400;

    SetLSize(ls);

    if (m_dataList.GetCount() > 0)
    {
        SetCount(m_dataList.GetCount());
        SetCurrent(0);
    }
}
コード例 #4
0
ファイル: fileopers.cpp プロジェクト: FaionWeb/WCMCommander
	NCNumberWin( Win* parent, int width = 10 )
		:  Win( Win::WT_CHILD, 0, parent, 0 ), _num( 0 )
	{
		wal::GC gc( this );
		cpoint size = GetStaticTextExtent( gc, ABCString, GetFont() );
		size.x = size.x / ABCStringLen * width;
		SetLSize( LSize( size ) );
	}
コード例 #5
0
	void TextList::SetWidthRange( LSRange range )
	{
		LSize s = GetLSize();
		range.minimal *= fontW;
		range.maximal *= fontW;
		range.ideal *= fontW;
		s.x = range;
		SetLSize( s );
	}
コード例 #6
0
	void TextList::SetHeightRange( LSRange range )
	{
		LSize s = GetLSize();
		range.minimal *= fontH;
		range.maximal *= fontH;
		range.ideal *= fontH;
		s.y = range;
		SetLSize( s );
	}
コード例 #7
0
ファイル: swl_winbase.cpp プロジェクト: Karamax/WalCommander
StaticLine::StaticLine(int nId, Win *parent, const unicode_t *txt, crect *rect)
: Win(Win::WT_CHILD, 0, parent, rect, nId), text(new_unicode_str(txt))
{
	if (!rect) 
	{
		GC gc(this);
		SetLSize(LSize(GetStaticTextExtent(gc,txt,GetFont())));
	}
}
コード例 #8
0
	StaticLabel::StaticLabel(int nId, Win* parent, const unicode_t* txt, Win* _master, crect* rect)
		: Win(Win::WT_CHILD, 0, parent, rect, nId), text(txt), master(_master)
	{
		if (!rect)
		{
			GC gc(this);
			SetLSize(LSize(text.GetTextExtents(gc, GetFont())));
		}
	}
コード例 #9
0
ファイル: fileopers.cpp プロジェクト: FaionWeb/WCMCommander
	NCProgressWin( Win* parent )
		:  Win( Win::WT_CHILD, 0, parent, 0 ), _from( 0 ), _to( 0 ), _num( 0 ), _lastWidth( 0 ), _lastPos( 0 )

	{
		cpoint size;
		size.x = 10;
		size.y = 16;
		LSize ls( size );
		ls.x.maximal = 1000;
		SetLSize( ls );
	}
コード例 #10
0
ファイル: fileopers.cpp プロジェクト: FaionWeb/WCMCommander
OperFileNameWin::OperFileNameWin( Win* parent, int ccount )
	: Win( Win::WT_CHILD, 0, parent, 0 )
	, _ccount( ccount )
{
	wal::GC gc( this );
	cpoint size = GetStaticTextExtent( gc, ABCString, GetFont() );
	size.x = size.x / ABCStringLen * ccount;

	if ( size.x > 500 ) { size.x = 550; }

	SetLSize( LSize( size ) );
}
コード例 #11
0
ファイル: toolbar.cpp プロジェクト: 0-wiz-0/WCMCommander
void ToolBar::OnChangeStyles()
{
	int h = _iconSize;
	h += 2 + 4 +  YSPACE * 2;

	LSize ls;
	ls.x.minimal = ls.x.ideal = 0;
	ls.x.maximal = 16000;
	ls.y.minimal = ls.y.maximal = ls.y.ideal = h;
	SetLSize( ls );
	RecalcItems();
}
コード例 #12
0
ファイル: ncdialogs.cpp プロジェクト: FaionWeb/WCMCommander
void NCDialog::SetPosition()
{

	if ( Type() == WT_CHILD )
	{
		LSize ls = _lo.GetLSize();
//		ls.x.maximal = ls.x.minimal;
//		ls.y.maximal = ls.y.minimal;
		SetLSize( ls );

		if ( Parent() )
		{
			Parent()->RecalcLayouts();
		}

		return;
	}


	LSize ls = _lo.GetLSize();

	crect r = Rect();

	int w =  ls.x.ideal > 0 ? ls.x.ideal : 20;
	int h =  ls.y.ideal > 0 ? ls.y.ideal : 20;

	r.right  = r.left + w;
	r.bottom = r.top + h;

	Win* parent = Parent();

	if ( parent )
	{
		crect pr = parent->Rect();

		int w = r.Width();
		int h = r.Height();

		int dx = ( pr.Width() - w ) / 2;
		int dy = ( pr.Height() - h ) / 2;


		r.left = pr.left + dx;
		r.right = r.left + w;
		r.top  = pr.top  + dy;
		r.bottom = r.top + h;

	}

	Move( r );
}
コード例 #13
0
	SButton::SButton( int nId, Win* parent, unicode_t* txt, int _group, bool _isSet, crect* rect )
		:  Win( Win::WT_CHILD, Win::WH_TABFOCUS | WH_CLICKFOCUS, parent, rect, nId ),
		   isSet( _isSet ),
		   text( txt ),
		   group( _group )
	{
		if ( !rect )
		{
			GC gc( this );
			gc.Set( GetFont() );
			cpoint p = gc.GetTextExtents( txt );

			if ( p.y < 16 ) { p.y = 16; }

			p.x += 17 + 4;
			p.y += 2;
			SetLSize( LSize( p ) );
		}

		Change( isSet );
	}
コード例 #14
0
ファイル: charsetdlg.cpp プロジェクト: Karamax/WalCommander
	CharsetListWin(Win *parent, int H)
	:	VListWin(Win::WT_CHILD, WH_TABFOCUS | WH_CLICKFOCUS, 0, parent, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0),
		cList(0),
		cCount(0)
	{
		wal::GC gc(this);
		gc.Set(GetFont());
		cpoint ts = gc.GetTextExtents(ABCString);
		fontW = (ts.x /ABCStringLen);
		fontH = ts.y + 4;

		this->SetItemSize( (fontH > 16 ? fontH: 16)+1, 100);

		LSize ls;
		ls.x.maximal = 10000;
		ls.x.ideal = ls.x.minimal = fontW*57;
		if (ls.x.minimal<100) ls.x.minimal = 100;

		ls.y.maximal = 10000;
		ls.y.ideal = ls.y.minimal = fontH*H;
		if (ls.y.minimal<100) ls.y.minimal = 100;

		SetLSize(ls);
	}
コード例 #15
0
ファイル: ncdialogs.cpp プロジェクト: FaionWeb/WCMCommander
clSelectDriveDlgMenu::clSelectDriveDlgMenu( Win* parent, clMenuData* data )
	: Win( Win::WT_CHILD, Win::WH_TABFOCUS | Win::WH_CLICKFOCUS, parent )
	, _data( data )
	, _current( 0 )
	, _itemH( 16 )
	, _width( 50 )
	, _nameW( 10 )
	, _comment1W( 0 )
	, _comment2W( 0 )
	, _splitterH( 5 )
	, _splitterW( 1 )
{
	wal::GC gc( this );
	gc.Set( GetFont() );

	int w = 0;
	int height = 0;

	static unicode_t A[] = {'A', 'B', 'C'};
	cpoint p = gc.GetTextExtents( A, 3 );
	_itemH = p.y;

	if ( _itemH < 16 ) { _itemH = 16; }

	_splitterH = _itemH / 4;

	if ( _splitterH < 3 ) { _splitterH = 3; }

	for ( int i = 0 ; i < _data->Count(); i++ )
	{
		unicode_t* name = _data->list[i].name.data();

		if ( _data->list[i].cmd != 0 )
		{
			if ( name )
			{
				cpoint p = gc.GetTextExtents( name );

				if ( _nameW < p.x ) { _nameW = p.x; }
			}

			unicode_t* comment1 = _data->list[i].comment1.data();
			unicode_t* comment2 = _data->list[i].comment2.data();

			if ( comment1 )
			{
				cpoint p = gc.GetTextExtents( comment1 );

				if ( _comment1W < p.x ) { _comment1W = p.x; }
			}

			if ( comment2 )
			{
				cpoint p = gc.GetTextExtents( comment2 );

				if ( _comment2W < p.x ) { _comment2W = p.x; }
			}

			height += _itemH;
		}
		else
		{
			height += _splitterH;
		}
	}

	w =  16 + 5 + _nameW + 5 + _comment1W + 30 + _comment2W;

	if ( _width < w ) { _width = w; }

	SetLSize( LSize( cpoint( _width, height ) ) );
}
コード例 #16
0
Win::Win( WTYPE t, unsigned hints, Win *_parent, const crect *rect, int uiNId )
:	
	type(t),
	whint(hints),
	parent(_parent),
	captured(false),
	state(0),
	lastFocusChild(0),
	blockedBy(0),
	modal(0),

	upLayout(0), 
	layout(0)
{

	DWORD st = WS_CLIPSIBLINGS | WS_CLIPCHILDREN  ;
	switch (type) {
	case WT_CHILD: st |= WS_CHILD; break;
	case WT_POPUP: st |= WS_POPUP; break;
	case WT_MAIN:
	default:
		if ((hints & WH_MINBOX) !=0 ) st |= WS_MINIMIZEBOX;
		if ((hints & WH_MAXBOX) !=0 ) st |= WS_MAXIMIZEBOX;
		if ((hints & WH_SYSMENU) !=0 ) st |= WS_SYSMENU;
		if ((hints & WH_RESIZE) !=0 ) st |= WS_SIZEBOX ;
//		if ((hints & WH_OVERLAPPED) !=0 ) st |= WS_OVERLAPPED;
	}

	crect r;
	if (rect) r = *rect;
	else 
	{
		r.left = CW_USEDEFAULT;
		r.top = CW_USEDEFAULT;
		r.right = CW_USEDEFAULT;
		r.bottom = CW_USEDEFAULT;
	}

	{
		int X, Y, W, H;

		if (!rect || type==WT_MAIN && (hints & WH_USEDEFPOS) != 0)
		{
			X = CW_USEDEFAULT;
			Y = 0;
			W = CW_USEDEFAULT;
			H = 0;
		} else {
			X = rect->left;
			Y = rect->top;
			W = rect->Width();
			H = rect->Height();
		}
	
		handle = CreateWindow(wClass, "Hi", st,
			X, Y, W, H, 
			(parent && parent->handle)? parent->handle :0, NULL, appInstance, NULL);
		DWORD e= GetLastError();
	}

	if (!handle) {
		throw_syserr();
	}

	AddWinToHash(handle, this);

	if (parent)
	{
		parent->childList.append(this);
	}

	if (rect && !rect->IsEmpty()) 
	{
		LSize ls;
		ls.Set(*rect);
		SetLSize(ls);
	}
}