コード例 #1
0
Notebook::Notebook(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
		: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL)
		, m_style(style)
		, m_aui(NULL)
		, m_popupWin(NULL)
{
	Initialize();
	SetBitmapSize(16);
}
コード例 #2
0
ファイル: MainToolBarCtrl.cpp プロジェクト: killbug2004/cosps
/////////////////////////////////////////////////////////////////////////////
// CMainToolBarCtrl message handlers
void CMainToolBarCtrl::Init()
{
	COLORREF crMask = RGB(255, 255, 255);
	
	CSize bitmapSize(32, 32);
	SetBitmapSize(bitmapSize);
	
	CSize buttonSize(40, 40);
	SetButtonSize(buttonSize);

	
	m_normalIL.Create(32, 32, ILC_COLOR24|ILC_MASK, 6, 1);
	UINT nBtnID[] = {IDB_TB_ADD, IDB_TB_START, IDB_TB_CLEAR, IDB_TB_EXPORT, IDB_TB_OPTION, IDB_TB_EXIT};
	COLORREF nCrMask[] = {RGB(255, 255, 255), RGB(255, 0, 255), RGB(255, 0, 255), RGB(255, 255, 255), 
		RGB(255, 255, 255), RGB(255, 255, 255)};
	int i;
	for(i = 0; i < (sizeof(nBtnID)/sizeof(nBtnID[0])); i++)
	{
		CBitmap bm;
		bm.LoadBitmap(nBtnID[i]);
		m_normalIL.Add(&bm, nCrMask[i]);
	}
	SetImageList(&m_normalIL);
	
	int nFirstButtonID = IDC_MAIN_TOOLBAR_BUTTON_FIRST;
	int m_nButtonCount = IDC_MAIN_TOOLBAR_BUTTON_LAST - nFirstButtonID + 1;
	
	int nBitmapIndex[] = {0, 1, 2, 3, 4, 5};
	TBBUTTON tb;
	for (int nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + nFirstButtonID);
		
		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR * pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;
		
		VERIFY((tb.iString = AddStrings(pString)) != -1);
		
		string.ReleaseBuffer();
		
		tb.fsState = TBSTATE_ENABLED;
		tb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE;
		tb.dwData = 0;
		tb.iBitmap = nBitmapIndex[nIndex];
		tb.idCommand = nIndex + nFirstButtonID;
		
		AddButtons(1, &tb);
	}
}
コード例 #3
0
ファイル: Globals.cpp プロジェクト: aidush/openmpt
BOOL CModControlBar::Init(UINT nId)
//---------------------------------
{
    HINSTANCE hInstance = AfxGetInstanceHandle();
    TBADDBITMAP tbab;

    SetButtonStructSize(sizeof(TBBUTTON));
    SetBitmapSize(CSize(16, 15));
    SetButtonSize(CSize(27, 24));
    // Add bitmaps
    m_hBarBmp = AfxLoadSysColorBitmap(
                    hInstance,
                    ::FindResource(hInstance, MAKEINTRESOURCE(nId), RT_BITMAP));
    tbab.hInst = NULL;
    tbab.nID = (UINT)m_hBarBmp;
    ::SendMessage(m_hWnd, TB_ADDBITMAP, 16, (LPARAM)&tbab);
    UpdateStyle();
    return TRUE;
}
コード例 #4
0
ファイル: fileview.cpp プロジェクト: mygaldre/mmsstv
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::LoadImage(void)
{
	if( !m_Max ) return;
	if( pCurPage->pList == NULL ) LoadFileList();
	m_CurFile = -1;
	UpdateStat();

	CWaitCursor wait;
	MultProc();
	SetCurrentDirectory(pCurPage->m_Folder.c_str());
	Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
	pBitmap->PixelFormat = pf24bit;
	pBitmap->Width = 16;
	pBitmap->Height = 16;

	MultProc();
	int i;
	int n = pCurPage->m_CurPage * m_Max;
	SetBitmapSize();
	for( i = 0; i < m_Max; i++, n++ ){
		TRect rc;
		GetRect(rc, i);
		if( n < pCurPage->pList->Count ){
			USHORT crc;
			LPCSTR pn = pCurPage->pList->Get(crc, n);
			if( !pCurPage->m_Thumb.LoadThumb(n, pCurPage->pBitmapS, rc, crc, pCurPage->m_Size[i]) ){
				LoadFile(pBitmap, pn);
				pCurPage->m_Size[i] = (pBitmap->Height << 16) + pBitmap->Width;
				Graphics::TBitmap *pBitmapT = CreateBitmap(m_RectS.Right, m_RectS.Bottom, -1);
				::SetStretchBltMode(pBitmapT->Canvas->Handle, HALFTONE);
				MultProcA();
				if( sys.m_FileViewKeep ){
					FillBitmap(pBitmapT, clGray);
					if( ((pBitmap->Width <= pBitmapT->Width) && (pBitmap->Height <= pBitmapT->Height)) ){
						pBitmapT->Canvas->Draw(0, 0, pBitmap);
					}
					else {
						KeepAspectDraw(pBitmapT->Canvas, pBitmapT->Width, pBitmapT->Height, pBitmap);
					}
				}
				else {
					pBitmapT->Canvas->StretchDraw(m_RectS, pBitmap);
				}
				pCurPage->m_Thumb.SaveThumb(n, pBitmapT, m_RectS, crc, pCurPage->m_Size[i]);
				pCurPage->pBitmapS->Canvas->CopyRect(rc, pBitmapT->Canvas, m_RectS);
				if( pBox[i] != NULL ){
					pBox[i]->Canvas->Draw(0, 0, pBitmapT);
				}
				delete pBitmapT;
			}
		}
		else {
			pCurPage->pBitmapS->Canvas->Brush->Style = bsSolid;
			pCurPage->pBitmapS->Canvas->Brush->Color = clWhite;
			pCurPage->pBitmapS->Canvas->FillRect(rc);
		}
		MultProc();
	}
	delete pBitmap;
	UpdateBitmap();
}
コード例 #5
0
ファイル: fileview.cpp プロジェクト: mygaldre/mmsstv
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::FormResize(TObject *Sender)
{
	if( m_DisEvent ) return;

	int WW = m_RectS.Right + 6;
	int HH = m_RectS.Bottom + 6;
	if( BorderStyle == bsNone ){
		int ch = m_Line * HH;
		int cw = m_Col * WW;
		m_DisEvent++;
		ClientHeight = GetCH(ch);
		ClientWidth = cw;
		m_DisEvent--;
		return;
	}
	int OldMax = m_Max;
	int h = (pTabS != NULL) ? ClientHeight - pTabS->TabHeight - 6 : ClientHeight;
	h = int((double(h - Panel->Height)/ HH) + 0.5);
	if( !h ) h = 1;
	int w = int((double(ClientWidth)/ WW) + 0.5);
	if( !w ) w = 1;
	while( (h * w) > AHDMAX ){
		if( w > 1 ){
			w--;
		}
		else if( h > 1 ){
			h--;
		}
	}
	int ch = h * HH;
	int cw = w * WW;
	if( cw < (UD->Left + UD->Width) ){
		w++;
		cw += WW;
	}
	m_Col = w;
	m_Line = h;
	m_Max = h * w;
	SetBitmapSize();
	TWinControl *pCtr = this;
	if( (m_MaxPage > 1) && (pTabS == NULL) ){
		Panel->Align = alNone;
		RemoveControl(Panel);
		pTabS = new TTabControl(this);
		pTabS->Width = ClientWidth;
		pTabS->Height = ClientHeight;
		pTabS->TabPosition = KBP->Checked ? tpBottom : tpTop;
		InsertControl(pTabS);
		pTabS->Parent = this;
		pTabS->Align = alClient;
		for( int j = 0; j < m_MaxPage; j++ ){
			AnsiString as;
			GetPageName(as, j);
			pTabS->Tabs->Add(as);
		}
		pTabS->Font->Height = -16;
		pTabS->TabHeight = 20;
		pTabS->InsertControl(Panel);
		Panel->Parent = pTabS;
		if( KBP->Checked ){
			Panel->Top = 0;
		}
		else {
			Panel->Top = pTabS->TabHeight + 3;
		}
		pTabS->TabIndex = m_CurPage;
		pTabS->OnChange = TabSChange;
		pCtr = pTabS;
	}
	pCurPage = pFileV[m_CurPage];
	if( UD->Max < pCurPage->m_CurPage ) UD->Max = SHORT(pCurPage->m_CurPage + 1);
	UD->Position = SHORT(pCurPage->m_CurPage);
	int i;
	for( i = 0; i < m_Max; i++ ){
		if( pPanel[i] == NULL ){
			pPanel[i] = new TPanel(this);
			TPanel *pn = pPanel[i];
			pn->BorderStyle = bsSingle;
			pn->Width = WW;
			pn->Height = HH;
			pCtr->InsertControl(pn);
			pn->Parent = pCtr;
			pBox[i] = new TPaintBox(this);
			TPaintBox *pb = pBox[i];
			pn->InsertControl(pb);
			pb->Parent = pn;
			pb->Align = alClient;
			pb->OnPaint = PBPaint;
			pb->OnMouseDown = PBMouseDown;
			pb->OnMouseMove = PBMouseMove;
			pb->OnDblClick = PBDblClick;
			pb->OnDragOver = PanelDragOver;
			pb->OnDragDrop = PanelDragDrop;
			pb->PopupMenu = pPopup;
		}
		else {
			pPanel[i]->Visible = FALSE;
			pPanel[i]->Width = WW;
			pPanel[i]->Height = HH;
		}
		MultProc();
	}
	for( ; i < AHDMAX; i++ ){
		if( pPanel[i] != NULL ){
			pPanel[i]->Visible = FALSE;
		}
		MultProc();
	}
	m_DisEvent++;
	ClientHeight = GetCH(ch);
	ClientWidth = cw;
	for( i = 0; i < m_Max; i++ ){
		pPanel[i]->Left = (i % m_Col) * WW;
		pPanel[i]->Top = Panel->Top + Panel->Height + (i / m_Col) * HH;
		pPanel[i]->Visible = TRUE;
	}
	if( pTabS != NULL ) Panel->Width = pTabS->ClientWidth;
	m_DisEvent--;
	if( m_Max != OldMax ){
		for( i = 0; i < m_MaxPage; i++ ){
			if( i != m_CurPage ){
				delete pFileV[i]->pList;
				pFileV[i]->pList = NULL;
			}
		}
		LoadImage();
	}
	SetPopup(Popup);
}
コード例 #6
0
ファイル: MyToolBarCtrl.cpp プロジェクト: killbug2004/cosps
/////////////////////////////////////////////////////////////////////////////
// CMyToolBarCtrl message handlers
void CMyToolBarCtrl::Init()
{
	COLORREF crMask = RGB(255, 0, 255);
	CBitmap tbBitmap;
	tbBitmap.LoadBitmap(IDB_TB_HOT);
	
	BITMAP bmpInfo;
	tbBitmap.GetBitmap(&bmpInfo);
	
	CSize bitmapSize(bmpInfo.bmHeight - 2, bmpInfo.bmHeight);
	SetBitmapSize(bitmapSize);
	
	CSize buttonSize(bmpInfo.bmHeight + 7, bmpInfo.bmHeight + 7);
	SetButtonSize(buttonSize);
	
	m_normalIL.Create(bmpInfo.bmHeight - 2, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1);
	m_normalIL.Add(&tbBitmap, crMask);
	SetImageList(&m_normalIL);
	tbBitmap.DeleteObject();

	tbBitmap.LoadBitmap(IDB_TB_HOT);
	m_hotIL.Create(bmpInfo.bmHeight - 2, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1);
	m_hotIL.Add(&tbBitmap, crMask);
	SetHotImageList(&m_hotIL);
	tbBitmap.DeleteObject();

	tbBitmap.LoadBitmap(IDB_TB_HOT);
	m_disableIL.Create(bmpInfo.bmHeight - 2, bmpInfo.bmHeight, ILC_COLOR24|ILC_MASK, 1, 1);
	m_disableIL.Add(&tbBitmap, crMask);
	SetDisabledImageList(&m_disableIL);
	tbBitmap.DeleteObject();

	int nFirstButtonID = FISRT_TOOLBAR_BUTTON_ID;
	int m_nButtonCount = LAST_TOOLBAR_BUTTON_ID - nFirstButtonID + 1;
	
	TBBUTTON tb;
	for (int nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + nFirstButtonID);
		
		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR * pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;
		
		VERIFY((tb.iString = AddStrings(pString)) != -1);
		
		string.ReleaseBuffer();
		
		tb.fsState = TBSTATE_ENABLED;
		tb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE;
		tb.dwData = 0;
		tb.iBitmap = nIndex;
		tb.idCommand = nIndex + nFirstButtonID;
		if(tb.idCommand >= TBBTN_DUMMY2)
		{
			tb.fsState = 0;
		}
		
		AddButtons(1, &tb);
	}
}
コード例 #7
0
ファイル: TransparentBar.cpp プロジェクト: mikekov/ExifPro
bool CTransparentBar::Create(CWnd* parent, UINT id)
{
	int height= GetApp()->IsWhistlerLookAvailable() ? 25 : 23;

	if (!CToolBarCtrl::Create(WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT | //TBSTYLE_TRANSPARENT |
		CCS_NOMOVEY | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER, CRect(0,0,80,height), parent, id))
	{
		ASSERT(false);
		return false;
	}

	SendMessage(WM_SETFONT, WPARAM(::GetStockObject(DEFAULT_GUI_FONT)));

	// Add toolbar buttons
	//
	SetButtonStructSize(sizeof(TBBUTTON));
	static const int anCommands[]=
	{
		ID_PHOTO_PREV, ID_PHOTO_NEXT, SC_CLOSE
	};
	const int COUNT= array_count(anCommands);		// no of buttons
	CSize btn_size;
	{
		CBitmap Bmp;
		Bmp.LoadBitmap(IDB_TRANSPARENT_BAR);
		BITMAP bmp;
		Bmp.GetBitmap(&bmp);
		btn_size = CSize(bmp.bmWidth / COUNT, bmp.bmHeight);	// determine single button bitmap size
	}
	SetBitmapSize(btn_size);
	SetButtonSize(btn_size + CSize(8, 7));
	AddBitmap(COUNT, IDB_TRANSPARENT_BAR);
//	RString tb(IDS_MAIN_TOOLBAR);
//	tb += "\n";
//	tb.Replace('\n', '\0');
//	int string= AddStrings(tb);
	CSize padding_size= GetApp()->IsWhistlerLookAvailable() ? CSize(5, 9) : CSize(3, 7);
	SendMessage(TB_SETPADDING, 0, MAKELONG(padding_size.cx, padding_size.cy));
	for (int i= 0; i < COUNT; i++)
	{
		TBBUTTON btn;
		if (anCommands[i] == 0)
		{
			btn.iBitmap = 8;
			btn.idCommand = -1;
			btn.fsState = TBSTATE_ENABLED;
			btn.fsStyle = TBSTYLE_SEP;
			btn.data  = 0;
			btn.iString = 0;
			AddButtons(1, &btn);
		}
		btn.iBitmap = i;
		btn.idCommand = anCommands[i];
		btn.fsState = TBSTATE_ENABLED;
		btn.fsStyle = TBSTYLE_BUTTON; // | TBSTYLE_AUTOSIZE;
//		if (anCommands[i] == ID_RECURSIVE || anCommands[i] == ID_EXIF_ONLY)
//			btn.fsStyle |= TBSTYLE_CHECK;
//		else if (anCommands[i] == ID_VIEW_DETAILS || anCommands[i] == ID_VIEW_THUMBNAILS)
//			btn.fsStyle |= TBSTYLE_CHECKGROUP;
//		if (anCommands[i] == ID_FOLDER_LIST)
//			btn.fsStyle |= BTNS_WHOLEDROPDOWN;
//		if (anCommands[i] == ID_BROWSER || anCommands[i] == ID_COMPOSER || anCommands[i] == ID_READ_CAMERA)
//			btn.fsStyle |= BTNS_DROPDOWN;

		btn.data = 0;

//		if (anCommands[i] == ID_BROWSER || anCommands[i] == ID_COMPOSER ||
//			anCommands[i] == ID_READ_CAMERA || anCommands[i] == ID_FOLDER_LIST)
//			btn.iString = string++;
//		else
			btn.iString = -1;

		AddButtons(1, &btn);
	}
//	SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);

	return true;
}
コード例 #8
0
ファイル: RRECToolbar.cpp プロジェクト: CyberShadow/Ditto
BOOL CRRECToolbar::Create( CWnd* parent, CRect& rc )
/* ============================================================
	Function :		CRRECToolbar::Create
	Description :	Creates the toolbar control
	Access :		Public
					
	Return :		BOOL			-	"TRUE" if success
	Parameters :	CWnd* parent	-	Parent editor
					CRect& rc		-	Rectangle to place 
										toolbar in.

	Usage :			Called from the parent editor

   ============================================================*/
{

	BOOL result = FALSE;

	HINSTANCE hInstance = AfxFindResourceHandle( MAKEINTRESOURCE( TOOLBAR_CONTROL ), RT_TOOLBAR );
	if(!hInstance)
		return FALSE;

	HRSRC hRsrc = ::FindResource( hInstance, MAKEINTRESOURCE( TOOLBAR_CONTROL ), RT_TOOLBAR );
	if( !hRsrc )
		return FALSE;

	HGLOBAL hGlobal = LoadResource( hInstance, hRsrc );
	if (hGlobal == NULL)
		return FALSE;

	CToolBarData* pData = ( CToolBarData* ) LockResource( hGlobal );
	if (pData == NULL)
		return FALSE;

	ASSERT( pData->wVersion == 1 );

	TBBUTTON tb, tbSep;
	memset ( &tb, 0, sizeof( tb ) );
	memset ( &tbSep, 0, sizeof( tbSep ) );

	result = CToolBarCtrl::Create(WS_VISIBLE|WS_CHILD, rc, parent, TOOLBAR_CONTROL);

	if( result )
	{
		SetButtonStructSize( sizeof ( tb ) );

		CSize sz ( pData->wWidth, pData->wHeight );
		SetBitmapSize( sz );
		sz.cx += 4;
		sz.cy += 4;
		SetButtonSize( sz );

		// Loop through adding buttons.
		tb.fsState = TBSTATE_ENABLED;
		tb.fsStyle = TBSTYLE_BUTTON;
		tb.iString = -1;
		tb.iBitmap = 0;

		tbSep.iString = -1;
		tbSep.fsStyle = TBSTYLE_SEP;

		for( WORD w = 0; w < pData->wItemCount; w++ )
		{
			if ( pData->items()[ w ] == 0 )
				AddButtons( 1, &tbSep );
			else
			{
				tb.idCommand = pData->items()[ w ];
				AddButtons( 1, &tb );
				tb.iBitmap++;
			}
		}

		HBITMAP	hBitmap = (HBITMAP) ::LoadImage( hInstance, MAKEINTRESOURCE( TOOLBAR_CONTROL ), IMAGE_BITMAP, 0,0, LR_LOADMAP3DCOLORS );
		if( !hBitmap )
			return FALSE;

		BITMAP bm;
		memset( &bm, 0, sizeof ( bm ) );
		::GetObject( hBitmap, sizeof ( bm ), &bm );
		AddBitmap( bm.bmWidth / pData->wWidth, CBitmap::FromHandle ( hBitmap ) );

		UnlockResource( hGlobal );
		FreeResource( hGlobal );

		/////////////////////////////////////
		// Map in combo boxes
		//

		CRect rect;

		TBBUTTONINFO tbi;
		tbi.cbSize = sizeof( TBBUTTONINFO );
		tbi.cx = FONT_COMBO_WIDTH;
		tbi.dwMask = TBIF_SIZE | 0x80000000;  // By index

		SetButtonInfo( FONT_NAME_POS, &tbi );
		GetItemRect( FONT_NAME_POS, &rect );
		rect.bottom += COMBO_HEIGHT;

		// The font name combo
		if( m_font.Create( WS_CHILD | 
							WS_VSCROLL |
							WS_VISIBLE |
							CBS_AUTOHSCROLL | 
							CBS_DROPDOWN | 
							CBS_SORT | 
							CBS_HASSTRINGS, 
							rect, this, DROPDOWN_FONT ) )
		{

			m_font.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( ANSI_VAR_FONT ) ) );
			m_font.FillCombo();

			tbi.cx = COMBO_WIDTH;
			SetButtonInfo( FONT_SIZE_POS, &tbi );
			GetItemRect( FONT_SIZE_POS, &rect );
			rect.bottom += COMBO_HEIGHT;

			// The font size combo
			if( m_size.Create( WS_CHILD | 
								WS_VISIBLE | 
								CBS_AUTOHSCROLL | 
								CBS_DROPDOWNLIST | 
								CBS_HASSTRINGS, 
								rect, this, DROPDOWN_SIZE ) )
			{

				m_size.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( ANSI_VAR_FONT ) ) );
				m_size.FillCombo();
				CString color;
				CString defaultText;
				CString customText;
				color.LoadString( STRING_COLOR );
				defaultText.LoadString( STRING_DEFAULT );
				customText.LoadString( STRING_CUSTOM );

				tbi.cx = COLOR_WIDTH;
				SetButtonInfo( FONT_COLOR_POS, &tbi );
				GetItemRect( FONT_COLOR_POS, &rect );

				// The color picker
				if( m_color.Create( color,
									WS_VISIBLE|
									WS_CHILD,
									rect, this, BUTTON_COLOR ) )
				{

					m_color.SetDefaultText( defaultText );
					m_color.SetCustomText( customText );
					m_color.SetSelectionMode( CP_MODE_TEXT );
					m_color.SetBkColour( RGB( 255, 255, 255 ) );

					m_color.SetFont( CFont::FromHandle( ( HFONT ) ::GetStockObject( ANSI_VAR_FONT ) ) );
					result = TRUE;

				}

			}

		}

	}

	return result;

}
コード例 #9
0
ファイル: NativeToolbar.cpp プロジェクト: Aerodynamic/rhodes
void CNativeToolbar::createToolbar(rho_param *p)
{
    if (!rho_rhodesapp_check_mode() || !rho_wmsys_has_touchscreen() )
        return;

    int bar_type = TOOLBAR_TYPE;
    m_rgbBackColor = RGB(220,220,220);
    m_rgbMaskColor = RGB(255,255,255);
    m_nHeight = MIN_TOOLBAR_HEIGHT;

	rho_param *params = NULL;
    switch (p->type) 
    {
        case RHO_PARAM_ARRAY:
            params = p;
            break;
        case RHO_PARAM_HASH: 
            {
                for (int i = 0, lim = p->v.hash->size; i < lim; ++i) 
                {
                    const char *name = p->v.hash->name[i];
                    rho_param *value = p->v.hash->value[i];
                    
                    if (strcasecmp(name, "background_color") == 0) 
					    m_rgbBackColor = getColorFromString(value->v.string);
                    else if (strcasecmp(name, "mask_color") == 0) 
					    m_rgbMaskColor = getColorFromString(value->v.string);
                    else if (strcasecmp(name, "view_height") == 0) 
					    m_nHeight = atoi(value->v.string);
                    else if (strcasecmp(name, "buttons") == 0 || strcasecmp(name, "tabs") == 0) 
                        params = value;
                }
            }
            break;
        default: {
            LOG(ERROR) + "Unexpected parameter type for create_nativebar, should be Array or Hash";
            return;
        }
    }
    
    if (!params) {
        LOG(ERROR) + "Wrong parameters for create_nativebar";
        return;
    }

    int size = params->v.array->size;
    if ( size == 0 )
    {
        removeToolbar();
        return;
    }

    if ( m_hWnd )
    {
        removeAllButtons();
    }else
    {
        RECT rcToolbar;
        rcToolbar.left = 0;
        rcToolbar.right = 0;
        rcToolbar.top = 0;
        rcToolbar.bottom = m_nHeight;
        Create(getAppWindow().m_hWnd, rcToolbar, NULL, WS_CHILD|CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NOMOVEY|CCS_BOTTOM|CCS_NODIVIDER |
            TBSTYLE_FLAT |TBSTYLE_LIST|TBSTYLE_TRANSPARENT ); //TBSTYLE_AUTOSIZE

        SetButtonStructSize();
    }

    for (int i = 0; i < size; ++i) 
    {
        rho_param *hash = params->v.array->value[i];
        if (hash->type != RHO_PARAM_HASH) {
            LOG(ERROR) + "Unexpected type of array item for create_nativebar, should be Hash";
            return;
        }
        
        const char *label = NULL;
        const char *action = NULL;
        const char *icon = NULL;
        const char *colored_icon = NULL;
		int  nItemWidth = 0;

        for (int j = 0, lim = hash->v.hash->size; j < lim; ++j) 
        {
            const char *name = hash->v.hash->name[j];
            rho_param *value = hash->v.hash->value[j];
            if (value->type != RHO_PARAM_STRING) {
                LOG(ERROR) + "Unexpected '" + name + "' type, should be String";
                return;
            }
            
            if (strcasecmp(name, "label") == 0)
                label = value->v.string;
            else if (strcasecmp(name, "action") == 0)
                action = value->v.string;
            else if (strcasecmp(name, "icon") == 0)
                icon = value->v.string;
            else if (strcasecmp(name, "colored_icon") == 0)
                colored_icon = value->v.string;
            else if (strcasecmp(name, "width") == 0)
                nItemWidth = atoi(value->v.string);
        }
        
        if (label == NULL && bar_type == TOOLBAR_TYPE)
            label = "";
        
        if ( label == NULL || action == NULL) {
            LOG(ERROR) + "Illegal argument for create_nativebar";
            return;
        }
        if ( strcasecmp(action, "forward") == 0 && rho_conf_getBool("jqtouch_mode") )
            continue;

        m_arButtons.addElement( new CToolbarBtn(label, action, icon, nItemWidth) );
	}

    CSize sizeMax = getMaxImageSize();
    m_nHeight = max(m_nHeight, sizeMax.cy+MIN_TOOLBAR_IDENT);
    int nBtnSize = m_nHeight-MIN_TOOLBAR_IDENT;
    SetButtonSize(max(nBtnSize,sizeMax.cx), max(nBtnSize,sizeMax.cy));
    SetBitmapSize(sizeMax.cx, sizeMax.cy);
    m_listImages.Create(sizeMax.cx, sizeMax.cy, ILC_MASK|ILC_COLOR32, m_arButtons.size(), 0);
    SetImageList(m_listImages);

    for ( int i = 0; i < (int)m_arButtons.size(); i++ )
        addToolbarButton( *m_arButtons.elementAt(i), i );

    AutoSize();

    alignSeparatorWidth();

    ShowWindow(SW_SHOW);

#if defined (OS_WINDOWS)
    RECT rcWnd;
    getAppWindow().GetWindowRect(&rcWnd);
    getAppWindow().SetWindowPos( 0, 0,0,rcWnd.right-rcWnd.left-1,rcWnd.bottom-rcWnd.top, SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);
    getAppWindow().SetWindowPos( 0, 0,0,rcWnd.right-rcWnd.left,rcWnd.bottom-rcWnd.top, SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);
#else
    getAppWindow().SetWindowPos( 0, 0,0,0,0, SWP_NOMOVE|SWP_NOZORDER|SWP_NOSIZE|SWP_FRAMECHANGED);
#endif
}