예제 #1
0
void CLinkBar::GetButtonTip( UINT nID, CString& strTip)
{
    GetButtonText( nID, strTip);

	/*
	CMainFrame * pMainfrm=(CMainFrame *)AfxGetApp()->m_pMainWnd;
    if( nID>0xe00&& nID<0xfff)
	{
		if((nID-0xe00)<(UINT)pMainfrm->m_astrFavoriteURLs.GetSize())	
		{
			strTip=pMainfrm->m_astrFavoriteURLs[nID-0xe00];
		}
	}
	*/
}
예제 #2
0
파일: gui.c 프로젝트: pcercuei/ReGBA
static void DisplayButtonMappingValue(struct MenuEntry* DrawnMenuEntry, struct MenuEntry* ActiveMenuEntry)
{
	bool Valid;
	char* Value = GetButtonText(*(uint32_t*) DrawnMenuEntry->Target, &Valid);

	uint32_t TextWidth = GetRenderedWidth(Value);
	if (TextWidth <= GCW0_SCREEN_WIDTH - 2)
	{
		bool IsActive = (DrawnMenuEntry == ActiveMenuEntry);
		uint16_t TextColor = Valid ? (IsActive ? COLOR_ACTIVE_TEXT : COLOR_INACTIVE_TEXT) : COLOR_ERROR_TEXT;
		uint16_t OutlineColor = Valid ? (IsActive ? COLOR_ACTIVE_OUTLINE : COLOR_INACTIVE_OUTLINE) : COLOR_ERROR_OUTLINE;
		print_string_outline(Value, TextColor, OutlineColor, GCW0_SCREEN_WIDTH - TextWidth - 1, GetRenderedHeight(" ") * (DrawnMenuEntry->Position + 2) + 1);
	}
	else
		ReGBA_Trace("W: Hid value '%s' from the menu due to it being too long", Value);
}
예제 #3
0
파일: gui.c 프로젝트: pcercuei/ReGBA
static void ActionSetMapping(struct Menu** ActiveMenu, uint32_t* ActiveMenuEntryIndex)
{
	char Text[256];
	char* Lines[] = { &Text[0], &Text[64], &Text[128], &Text[192] };
	bool Valid;
	sprintf(Lines[0], "Setting mapping for %s", (*ActiveMenu)->Entries[*ActiveMenuEntryIndex]->Name);
	sprintf(Lines[1], "Currently %s", GetButtonText(*(uint32_t*) (*ActiveMenu)->Entries[*ActiveMenuEntryIndex]->Target, &Valid));
	strcpy(Lines[2], "Press the new button or");
	strcpy(Lines[3], "two at once to leave alone");

	enum OpenDingux_Buttons ButtonTotal = GrabButton(*ActiveMenu, Lines);
	// If there's more than one button, change nothing.
	uint_fast8_t BitCount = 0, i;
	for (i = 0; i < OPENDINGUX_BUTTON_COUNT; i++)
		if ((ButtonTotal & (1 << i)) != 0)
			BitCount++;
	if (BitCount == 1)
		*(uint32_t*) (*ActiveMenu)->Entries[*ActiveMenuEntryIndex]->Target = ButtonTotal;
}
예제 #4
0
void CToolBarEx::OnGetButtonInfo( NMHDR* pNMHDR, LRESULT* pResult )
{
    NMTOOLBAR* lpnmtb = ( NMTOOLBAR* )pNMHDR;

    int nItem = lpnmtb->iItem;
    if ( ( 0 <= nItem ) && ( nItem <= m_aButtons.GetUpperBound() ) )
    {
        // Copy button info from internal cache
        lpnmtb->tbButton = m_aButtons[ nItem ].tbinfo;
        if ( !( lpnmtb->tbButton.fsStyle & TBSTYLE_SEP ) )
        {
            CString strText;
            GetButtonText( lpnmtb->tbButton.idCommand, strText );
            _tcsncpy( lpnmtb->pszText, strText, lpnmtb->cchText );
        }

        *pResult = TRUE;
    }
    else
    {
        *pResult = FALSE;
    }
}
예제 #5
0
void CToolBarEx::SetTextOptions( ETextOptions eTextOptions, bool bUpdate /*=true*/ )
{
    ASSERT( ::IsWindow( m_hWnd ) );
    ASSERT( GetStyle() & TBSTYLE_TOOLTIPS );
    ASSERT( !( GetBarStyle() & CBRS_TOOLTIPS ) );
    ASSERT( IsTextOptionAvailable( eTextOptions ) );

    m_eTextOptions = eTextOptions;

    // Modify toolbar style according to new text options
    ModifyStyle(
        ( eTextOptions == toTextOnRight ) ? 0 : TBSTYLE_LIST,
        ( eTextOptions == toTextOnRight ) ? TBSTYLE_LIST : 0 );

    CToolBarCtrl& tbCtrl = GetToolBarCtrl();
    DWORD dwStyleEx = tbCtrl.GetExtendedStyle();
    tbCtrl.SetExtendedStyle(
        ( eTextOptions == toTextOnRight ) ?
            ( dwStyleEx |  TBSTYLE_EX_MIXEDBUTTONS ) :
            ( dwStyleEx & ~TBSTYLE_EX_MIXEDBUTTONS ) );
    VERIFY( tbCtrl.SetMaxTextRows(
        ( eTextOptions == toNoTextLabels ) ? 0 : 1 ) );

    if ( eTextOptions == toTextLabels )
    {
        VERIFY( tbCtrl.SetButtonWidth( 0, 76 ) );
    }

    // Modify all (even currently hidden ones) buttons in internal cache
    int nIndex;
    for ( nIndex = 0; nIndex <= m_aButtons.GetUpperBound(); nIndex++ )
    {
        TBBUTTON& tbinfo = m_aButtons[ nIndex ].tbinfo;
        if ( !( tbinfo.fsStyle & TBSTYLE_SEP ) )
        {
            CString strButtonText;
            GetButtonText( tbinfo.idCommand, strButtonText );
            CString strToAdd( strButtonText, strButtonText.GetLength() + 1 );
            tbinfo.iString = tbCtrl.AddStrings( strToAdd );

            switch ( eTextOptions )
            {
                case toTextLabels:
                    tbinfo.fsStyle &= ~( TBSTYLE_AUTOSIZE | BTNS_SHOWTEXT );
                    break;

                case toTextOnRight:
                    tbinfo.fsStyle |= ( TBSTYLE_AUTOSIZE |
                        ( HasButtonText( tbinfo.idCommand ) ? BTNS_SHOWTEXT : 0 ) );
                    break;

                case toNoTextLabels:
                    tbinfo.fsStyle &= ~BTNS_SHOWTEXT;
                    tbinfo.fsStyle |= TBSTYLE_AUTOSIZE;
                    break;
            }
        }
    }

    // If requested, reflect changes immediately
    if ( bUpdate )
    {
        ReloadButtons();
        UpdateParentBandInfo();
    }
}
예제 #6
0
void CToolBarEx::GetButtonTip( UINT nID, CString& strTip )
{
    GetButtonText( nID, strTip );
}
예제 #7
0
//--------------
//
void DisplayConfigLine(char lineNumber)
{
    char	str[80], str2[80];
	char	*text;
	int     optionNumber, page;


	if (( lineNumber < 1 ) || ( lineNumber > CONFIG_LINES )) return;		// bound check

    optionNumber = lineNumber;
    page = ((optionNumber-1)/LINES_PER_PAGE)+1;
    lineNumber = lineNumber % LINES_PER_PAGE;
    if (lineNumber == 0) lineNumber = 10;  // Put the Save/Cancel options always on line 10.	

	if (( chosenConfigLine == optionNumber ) && ( optionNumber != 10 ))		// highlight the current cursor line
    {																	// save, cancel, delete looks after itself
		TAP_Osd_PutGd( rgn, 53, lineNumber*CONFIG_Y_STEP+CONFIG_Y_OFFSET-8, &_highlightGd, FALSE );
	}
	else
	{
		TAP_Osd_PutGd( rgn, 53, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET - 8, &_rowaGd, FALSE );
	}
	TAP_SPrint(str,"%d.",optionNumber);
	TAP_Osd_PutStringAf1622(rgn, 75, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), 700, str, MAIN_TEXT_COLOUR, 0 );
	

	switch ( optionNumber )
	{
		case 1 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Model Type", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );


				if ( currentModelType == TF5800 ) TAP_SPrint(str,"TF5800  (UK)");
				else TAP_SPrint(str,"TF5000  (International)");
				
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;


		case 2 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Language", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				TAP_SPrint(str, "English");
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, COLOR_DarkGray, 0 );
			    break;

				
		case 3 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1,  "Activation Key", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( keyStage )
				{
				    case 0 : 	text = GetButtonText( &localKeyCodes, CurrentActivationKey );
								strcpy( str, text );
								break;
								
					case 1 : 	TAP_SPrint( str, "Press new key now" );
								break;

					case 2 : 	TAP_SPrint( str, "Invalid choice" );
						    	break;

					default : 	TAP_SPrint( str, "eh?" );
								break;
				}
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
			    break;


		case 4 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Highlight", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );


				TAP_SPrint(str,"%d", currentHighlight );
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
		case 5 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Selection Style", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( displayOption )
				{
				    case 0 : 	TAP_SPrint( str, "Carousel" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Linear" );
								break;

					default : 	TAP_SPrint( str, "BAD" );
								break;
				}
				
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

		case 6 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Now/Next Tag", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentNowNextTag )
				{
				    case 0 : 	TAP_SPrint( str, "Off" );
								break;
								
					case 1 : 	TAP_SPrint( str, "On" );
								break;

					default : 	TAP_SPrint( str, "BAD" );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
				
		case 7 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Progress Info", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentProgressInfo )
				{
				    case 0 : 	TAP_SPrint( str, "Off" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Text" );
								break;

					default : 	TAP_SPrint( str, "BAD" );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
				
		case 8 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Recall/PiP-Swap Key", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentRecallKey )
				{
				    case 0 : 	TAP_SPrint( str, "First Channel" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Swap Channels" );
								break;

					default : 	TAP_SPrint( str, "BAD" );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
				
		case 9 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Screen Fading", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentScreenFade)
				{
				    case 0 : 	TAP_SPrint( str, "Off - no screen fading" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Manual - use Blue key" );
								break;

					default : 	TAP_SPrint( str, "Automatic after %d seconds", currentScreenFade  );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
		case 11 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Start Channel", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentStartChannel)
				{
				    case 0 : 	TAP_SPrint( str, "Channel Last Highlighted" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Current Channel" );
								break;

					default : 	TAP_SPrint( str, "BAD"  );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

		case 12 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Timer Start Offset", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentStartOffset)
				{
				    default : 	TAP_SPrint( str, "%d minutes",currentStartOffset );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

		case 13 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Timer End Offset", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentEndOffset)
				{
				    default : 	TAP_SPrint( str, "%d minutes",currentEndOffset );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;


		case 14 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Guide At Startup", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentGuideStart )
				{
				    case 0 : 	TAP_SPrint( str, "Start hidden" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Start displayed" );
								break;

					case 2 : 	TAP_SPrint( str, "Start as it was when last exited" );
								break;

					default : 	TAP_SPrint( str, "BAD"  );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
				
		case 15 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "TV Screen Ratio", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentTvRatio)
				{
				    case 0 : 	TAP_SPrint( str, "4:3 Standard" );
								break;
								
					case 1 : 	TAP_SPrint( str, "16:9 Widescreen" );
								break;

					default : 	TAP_SPrint( str, "BAD"  );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
				
		case 16 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1, "Main/Guide window", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				switch ( currentGuideWindowOption)
				{
				    case 0 : 	TAP_SPrint( str, "Normal size" );
								break;
								
					case 1 : 	TAP_SPrint( str, "Shrink to fit" );
								break;

					default : 	TAP_SPrint( str, "BAD"  );
								break;
				}

				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
				break;

				
		case 17 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1,  "Progress Bars", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );
				switch ( currentProgressBarOption )
				{
				    case 0 : 	TAP_SPrint( str, "Multi Coloured" );
								break;
								
					case 1 : 	sprintf( str, "Single colour, %% filled" );
						    	break;

					case 2 : 	TAP_SPrint( str, "Single colour, all filled" );
								break;

					case 3 : 	sprintf( str, "White colour, %% filled" );
								break;

					default : 	TAP_SPrint( str, "[Invalid value]" );
								break;
				}
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
			    break;
				
		case 18 :
				PrintCenter(rgn, CONFIG_E0, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E1,  "Channel Numbers", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );
				switch ( currentChannelNumberOption )
				{
				    case 0 : 	TAP_SPrint( str, "LCN" );
								break;
								
					case 1 : 	sprintf( str, "Topfield" );
						    	break;

					default : 	TAP_SPrint( str, "[Invalid value]" );
								break;
				}
				TAP_Osd_PutStringAf1622(rgn, CONFIG_X2, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), CONFIG_E2, str, MAIN_TEXT_COLOUR, 0 );
			    break;	

		case 10 :		
		case 20 :
				TAP_Osd_PutGd( rgn, 53, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET - 8, &_rowaGd, FALSE );		// No highlight for us
	            TAP_SPrint(str,"%d.",optionNumber);
                TAP_Osd_PutStringAf1622(rgn, 75, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), 700, str, MAIN_TEXT_COLOUR, 0 );

				if (( configOption == 0 ) && ( chosenConfigLine%10 == 0 ))
				{
					TAP_Osd_PutGd( rgn, 116, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET - 8, &_smallgreenbarGd, FALSE );
				    PrintCenter(rgn, 144, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET, 244, "Save", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );
				}
				else PrintCenter(rgn, 144, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET, 244, "Save", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

				if (( configOption == 1 ) && ( chosenConfigLine%10 == 0 ))
				{
					TAP_Osd_PutGd( rgn, 278, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET - 8, &_smallgreenbarGd, FALSE );
					PrintCenter(rgn, 306, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET, 406, "Cancel", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );
				}
				else PrintCenter(rgn, 306, lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET, 406, "Cancel", MAIN_TEXT_COLOUR, 0, FNT_Size_1622 );

			    TAP_Osd_FillBox( rgn, 437, lineNumber*CONFIG_Y_STEP+CONFIG_Y_OFFSET-8, 3, CONFIG_Y_STEP, FILL_COLOUR );		// one extra column seperator for us
			    
	            TAP_SPrint(str,"Page %d of %d",page,TOTAL_PAGES);
	            TAP_Osd_PutStringAf1622(rgn, 470, (lineNumber * CONFIG_Y_STEP + CONFIG_Y_OFFSET), 700, str, MAIN_TEXT_COLOUR, 0 );
			    
				break;


		default :
			break;
	}


    TAP_Osd_FillBox( rgn, CONFIG_E0, lineNumber*CONFIG_Y_STEP+CONFIG_Y_OFFSET-8, 3, CONFIG_Y_STEP, FILL_COLOUR );		// draw the column seperators
    TAP_Osd_FillBox( rgn, CONFIG_E1, lineNumber*CONFIG_Y_STEP+CONFIG_Y_OFFSET-8, 3, CONFIG_Y_STEP, FILL_COLOUR );

}
예제 #8
0
void BookmarkToolBar::GetButtonTextByCommand(xpr_uint_t aId, CString &aText)
{
    GetButtonText(CommandToIndex(aId), aText);
}
// subclass for dialog item
LRESULT CALLBACK InternalEmulatorInputDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
	auto d = (DialogData *)dwRefData;
	switch (uMsg) {
	case WM_PAINT: {
		HDC				hdc;
		PAINTSTRUCT		ps;
		HANDLE			hOldFont;
		TCHAR			szText[200];
		RECT			rect;
		SIZE			sz;
		int				x, y;

		// Get a device context for this window
		hdc = BeginPaint(hWnd, &ps);

		auto hFont = CreateFont(14, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
			CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, VARIABLE_PITCH, TEXT("Arial"));
		SelectObject(hdc, hFont);

		// Set the text colours
		SetTextColor(hdc, d->fgColor);
		SetBkColor(hdc, d->bgColor);

		// Find the text to draw
		GetWindowText(hWnd, szText, sizeof(szText));

		// Work out where to draw
		GetClientRect(hWnd, &rect);

		// Find out how big the text will be
		GetTextExtentPoint32(hdc, szText, lstrlen(szText), &sz);

		// Center the text
		x = (rect.right - sz.cx) / 2;
		y = (rect.bottom - sz.cy) / 2;

		// Draw the text
		ExtTextOut(hdc, x, y, ETO_OPAQUE, &rect, szText, lstrlen(szText), 0);

		DeleteObject(hFont);

		EndPaint(hWnd, &ps);

		break;
	}
	case WM_KEYDOWN: {
		if (LOWORD(wParam) == VK_DELETE) {
			d->setting.type = InternalEmulatorInputType::KEY;
			d->setting.value = 0;

			d->fgColor = RGB(255, 0, 0);
			d->bgColor = RGB(0, 255, 0);

			auto s = GetButtonText(d);
			SetWindowText(hWnd, s.c_str());
		}
		else if (IsValidKey(LOWORD(wParam))) {
			//d->fgColor = GetSysColor(COLOR_WINDOWTEXT);
			//d->bgColor = GetSysColor(COLOR_WINDOW);

			d->setting.type = InternalEmulatorInputType::KEY;
			d->setting.value = lParam;

			d->fgColor = RGB(255, 0, 0);
			d->bgColor = RGB(0, 255, 0);

			auto s = GetButtonText(d);
			SetWindowText(hWnd, s.c_str());
		}
		else {
			d->fgColor = RGB(0, 255, 0);
			d->bgColor = RGB(255, 0, 0);
		}
		InvalidateRect(GetParent(hWnd), NULL, false);

		break;
	}
	case WM_TIMER: {
		if (hWnd == GetFocus()) {
			if (JoystickPoll(GetParent(hWnd), d)) {
				//d->fgColor = GetSysColor(COLOR_WINDOWTEXT);
				//d->bgColor = GetSysColor(COLOR_WINDOW);

				auto s = GetButtonText(d);
				SetWindowText(hWnd, s.c_str());
				InvalidateRect(GetParent(hWnd), NULL, false);
			}
		}
		SetTimer(hWnd, 747, 125, NULL);
		break;
	}
	case WM_CHAR: {
		break;
	}
	case WM_SETFOCUS: {
		if (!d->timerActive) {
			SetTimer(hWnd, 777, 125, NULL);
			d->timerActive = true;
		}
		d->fgColor = RGB(255, 0, 0);
		d->bgColor = RGB(0, 255, 0);
		InvalidateRect(GetParent(hWnd), NULL, false);
		break;
	}
	case WM_KILLFOCUS: {
		d->fgColor = GetSysColor(COLOR_WINDOWTEXT);
		d->bgColor = GetSysColor(COLOR_WINDOW);
		InvalidateRect(GetParent(hWnd), NULL, false);
		break;
	}
	default:
		return DefSubclassProc(hWnd, uMsg, wParam, lParam);
	}
	return 0;
}
BOOL CALLBACK InternalEmulatorSettingsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_INITDIALOG: {
		DialogData *d;
		std::string s;

		for (unsigned i = 0; i < 16; i++) {
			std::stringstream ss;
			ss << "JOY" << i;
			SendMessage(GetDlgItem(hWnd, IDC_IEJOYNUM), CB_ADDSTRING, 0, (LPARAM)ss.str().c_str());
		}
		s = "DISABLE";
		SendMessage(GetDlgItem(hWnd, IDC_IEJOYNUM), CB_ADDSTRING, 0, (LPARAM)s.c_str());
		SendMessage(GetDlgItem(hWnd, IDC_IEJOYNUM), CB_SETCURSEL, set.joyNum, 0);

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::UP)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYUP), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYUP), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::DOWN)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYDOWN), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYDOWN), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::LEFT)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYLEFT), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYLEFT), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::RIGHT)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYRIGHT), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYRIGHT), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::A)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYA), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYA), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::B)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYB), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYB), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::X)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYX), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYX), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::Y)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYY), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYY), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::L)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYL), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYL), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::R)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYR), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYR), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::SELECT)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYSELECT), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYSELECT), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::START)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYSTART), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYSTART), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::NEXTSTATE)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYNEXTSTATE), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYNEXTSTATE), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::PREVSTATE)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYPREVSTATE), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYPREVSTATE), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::SAVESTATE)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYSAVESTATE), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYSAVESTATE), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::LOADSTATE)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYLOADSTATE), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYLOADSTATE), s.c_str());

		d = new DialogData;
		d->setting = set.emulatorButtons[unsigned(InternalEmulatorButtonType::FASTFORWARD)];
		SetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYFASTFORWARD), InternalEmulatorInputDialogProc, 0, DWORD_PTR(d));
		s = GetButtonText(d);
		SetWindowText(GetDlgItem(hWnd, IDC_IEKEYFASTFORWARD), s.c_str());

		SendMessage(GetDlgItem(hWnd, IDC_IEVOLUME), TBM_SETRANGEMIN, 0, DSBVOLUME_MIN + 10000);
		SendMessage(GetDlgItem(hWnd, IDC_IEVOLUME), TBM_SETRANGEMAX, 0, DSBVOLUME_MAX + 10000);
		SendMessage(GetDlgItem(hWnd, IDC_IEVOLUME), TBM_SETPOS, 1, set.volume + 10000);

		break;
	}
	case WM_COMMAND: {
		switch (LOWORD(wParam))
		{
		case IDC_IESAVE: {
			DialogData *d;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYUP), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::UP)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYDOWN), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::DOWN)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYLEFT), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::LEFT)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYRIGHT), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::RIGHT)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYA), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::A)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYB), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::B)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYX), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::X)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYY), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::Y)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYL), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::L)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYR), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::R)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYSELECT), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::SELECT)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYSTART), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::START)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYNEXTSTATE), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::NEXTSTATE)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYPREVSTATE), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::PREVSTATE)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYSAVESTATE), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::SAVESTATE)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYLOADSTATE), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::LOADSTATE)] = d->setting;
			GetWindowSubclass(GetDlgItem(hWnd, IDC_IEKEYFASTFORWARD), InternalEmulatorInputDialogProc, NULL, (DWORD_PTR *)(&d));
			set.emulatorButtons[unsigned(InternalEmulatorButtonType::FASTFORWARD)] = d->setting;

			set.volume = SendMessage(GetDlgItem(hWnd, IDC_IEVOLUME), TBM_GETPOS, NULL, NULL) - 10000;
			set.joyNum = SendMessage(GetDlgItem(hWnd, IDC_IEJOYNUM), CB_GETCURSEL, 0, 0);

			DeleteState(hWnd);
			EndDialog(hWnd, 0);

			break;
		}
		case IDC_IECANCEL: {
			DeleteState(hWnd);
			EndDialog(hWnd, 0);
			break;
		}
		}
		break;
	}
	case WM_HSCROLL: {
		unsigned v = SendMessage(GetDlgItem(hWnd, IDC_IEVOLUME), TBM_GETPOS, NULL, NULL) - 10000;
		SetVolume(v);
		break;
	}
	case WM_CLOSE: {
		DeleteState(hWnd);
		EndDialog(hWnd, 0);
		break;
	}
	default:
		return FALSE;
	}
	return TRUE;
}
예제 #11
0
void CGuiToolBarWnd::OnPaint()
{

	CPaintDC dc(this);  	
	CRect rcBtn;
	
	int nBtn=GetToolBarCtrl().GetButtonCount();
	int iBitmap;
	UINT nID;
	UINT nStyle;
	WORD wStyle, wState;
	DWORD dwBarStyle = GetToolBarCtrl().GetStyle();
	BOOL mbIsPress;
	BOOL mbIsEnabled;
	CBrush cb;
	CImageList m_imgList;
	CRect rcUpdate;
	int iUltbot;
	CRect rcClient;
	GetClientRect(&rcClient);
	cb.CreateSolidBrush(GuiDrawLayer::GetRGBColorXP());
	
    // draw borders in non-client area
    CRect rcDraw = rcClient;
 
	dc.FillRect(rcDraw, &cb);
	
	
	HIMAGELIST hiImg = 0;
	iBitmap=0;
	hiImg = HIMAGELIST(SendMessage(TB_GETIMAGELIST));
	m_imgList.Attach(hiImg);
	int j=0;
	for(int i=0; i < nBtn; i++)
	{
		
		bOver=FALSE;
		GetItemRect(i,&rcBtn);
		GetButtonInfo(i,nID,nStyle,iBitmap);
		wStyle= LOWORD(nStyle);
		wState= HIWORD(nStyle);
		if (wState & TBSTATE_HIDDEN) continue;
		if (wStyle == TBSTYLE_SEP)
		{
			if (!(wState & TBSTATE_WRAP) || ! IsFloating() )
			{
				CRect m_Separ;
				m_Separ=rcBtn;
				
				//si existe un separador vertical
				if (m_dwStyle & CBRS_ORIENT_HORZ)
				{
					dc.FillRect(&rcBtn,&cb);
					int nhalf=(m_Separ.Width()/2)-1;
					m_Separ.top-=1;
					m_Separ.left+=nhalf;
					m_Separ.right=m_Separ.left+1;
					m_Separ.bottom+=1;
					
				}
				else
				{
					int nhalf=(m_Separ.Width()/2)-1;
					int iHeigh=m_Separ.Height();
					
					m_Separ.left=0;
					m_Separ.right=m_Separ.left+m_Separ.Height()+1;
					m_Separ.top=iUltbot;
					m_Separ.bottom=m_Separ.top+m_Separ.Width();			
					dc.FillRect(&m_Separ,&cb);
					
					m_Separ.left=0;
					m_Separ.right=m_Separ.left+iHeigh+1;
					m_Separ.top=iUltbot+nhalf;
					m_Separ.bottom=m_Separ.top+1;
					
					
				}
				CBrush cbt;
				cbt.CreateSolidBrush(RGB(167, 167, 167));
				dc.FillRect(m_Separ,&cbt);
				continue;
				
			}
			
				 
		}
		else {
			
			mbIsPress=(wState & TBSTATE_CHECKED) || (wState & TBSTATE_PRESSED);
			mbIsEnabled= GetToolBarCtrl().IsButtonEnabled((int)nID);
			CPoint pt;
			GetCursorPos(&pt);
			ScreenToClient(&pt);
			CBrush cblu;
			if(!rcBtn.PtInRect(pt))
			{
				if (wState & TBSTATE_CHECKED)
				{
					cblu.CreateSolidBrush(GuiDrawLayer::GetRGBPressBXP());
					dc.FillRect(rcBtn,&cblu);					
				}
				else
				{
					dc.FillRect(rcBtn,&cb);
				}
			}
			else
			{
				
				if (bPressDown)
					dc.Draw3dRect(rcBtn,GuiDrawLayer::GetRGBColorShadow(),GuiDrawLayer::GetRGBColorShadow());
				else
					dc.Draw3dRect(rcBtn,GuiDrawLayer::GetRGBCaptionXP(),GuiDrawLayer::GetRGBCaptionXP());
				rcBtn.DeflateRect(1,1);
				if (wState & TBSTATE_CHECKED)
				{
					cblu.CreateSolidBrush(GuiDrawLayer::GetRGBFondoXP());
					dc.FillRect(rcBtn,&cblu);					
				}
				else
				{
					
					if (bPressDown)
					{
						cblu.CreateSolidBrush(GuiDrawLayer::GetRGBColorXP());
						dc.FillRect(rcBtn,&cblu);
					}
					else
					{
						cblu.CreateSolidBrush(mbIsPress?GuiDrawLayer::GetRGBPressBXP():GuiDrawLayer::GetRGBFondoXP());
						dc.FillRect(rcBtn,&cblu);					
					}
					if (wStyle == 8) 
					{
						
						CRect rcCli=rcBtn;
						int dif=rcBtn.right-_afxDropDownWidth;
						rcCli.left=dif+1;
						
						if (!bPressDown)
						{
							CPen Cp( PS_SOLID, 1, GuiDrawLayer::GetRGBCaptionXP());
							CPen* oldPen= dc.SelectObject(&Cp);
							dc.MoveTo(dif,rcBtn.top);
							dc.LineTo(dif,rcBtn.bottom);
							dc.SelectObject(oldPen);
						}
						
					}
					if (!mbIsPress && !bPressDown)
						bOver=TRUE;
					else
						bOver=FALSE;
					if (!bPressDown) 
						SetTimer(1,10,NULL);
					else
						KillTimer(1);		

				}
				rcBtn.InflateRect(1,1);
				
			}

		}

		if (wStyle != TBSTYLE_SEP)
	{
			
			int OldMode=dc.SetBkMode(TRANSPARENT);
			IMAGEINFO pImageInfo;
			m_imgList.GetImageInfo(iBitmap,&pImageInfo);
			CRect rcima =pImageInfo.rcImage;
			CSize siImg=CSize(rcima.Width(),rcima.Height());
			/* Modified By SunZhenyu 2003/6/27, Replace by the next 5 lines, CPoint pti(rcBtn.left+2,rcBtn.top+4); */
			CPoint pti(rcBtn.left+(rcBtn.Width()-siImg.cx)/2,rcBtn.top+4);
			if( dwBarStyle & TBSTYLE_LIST ) // ÎÄ×ÖÔÚÓÒ±ß
				pti = CPoint(rcBtn.left+4,rcBtn.top+(rcBtn.Height()-siImg.cy)/2);
			else if( wStyle & TBSTYLE_DROPDOWN )
				pti.x -= _AfxGetDropDownWidth()/2;
			CString mszText=GetButtonText(i);
			CFont* m_fontOld=dc.SelectObject(&m_cfont);
			if (!(wState & TBSTATE_ENABLED))
			{
				if (bOver==TRUE)
				{
					pti.x+=1;
					pti.y+=1;
					dc.DrawState(pti,siImg,m_imgList.ExtractIcon(iBitmap),DSS_MONO,CBrush (GuiDrawLayer::GetRGBColorShadow()));
							pti.x-=2;					pti.y-=2;
				
				}
				m_imgList.Draw(&dc, iBitmap, pti, ILD_TRANSPARENT);
				if (mszText.GetLength() > 0 && !bVertDocked)
				{
					CRect m_rctext=rcBtn;
					/* Modified By SunZhenyu 2003/6/27, Replace by the next 6 line, m_rctext.left+=siImg.cx+4; */
					if( dwBarStyle & TBSTYLE_LIST )
						m_rctext.left += siImg.cx+4;
					else
						m_rctext.top += siImg.cy+4;
					if( wStyle & TBSTYLE_DROPDOWN )
						m_rctext.right -= _AfxGetDropDownWidth();
					m_rctext.bottom-=1;
					/* Modified By SunZhenyu 2003/6/27, Replace by the next 5 line
					dc.DrawText(mszText,&m_rctext,DT_SINGLELINE|DT_BOTTOM|DT_CENTER);
					*/
					m_rctext.right-=1;
					if( dwBarStyle & TBSTYLE_LIST )
						dc.DrawText(mszText,&m_rctext,DT_SINGLELINE|DT_VCENTER|DT_RIGHT);
					else
						dc.DrawText(mszText,&m_rctext,DT_SINGLELINE|DT_BOTTOM|DT_CENTER);
				}
			}
			else
			{
				dc.DrawState(pti,siImg,m_imgList.ExtractIcon(iBitmap),DSS_DISABLED,(CBrush*)NULL);
				CRect m_rctext=rcBtn;
				/* Modified By SunZhenyu 2003/6/27, Replace by the next 5 line, m_rctext.left+=siImg.cx+4; */
				if( dwBarStyle & TBSTYLE_LIST )
					m_rctext.left += siImg.cx+4;
				else
					m_rctext.top += siImg.cy+4;
				m_rctext.bottom-=1;
				CSize szText=dc.GetTextExtent(mszText);
				/* Modified By SunZhenyu 2003/6/27, Replace by the next 4 lines,
				pti.x= m_rctext.left+2;
				pti.y= (m_rctext.Height()/2)-1;
				*/
				pti.x = m_rctext.left+(m_rctext.Width()-szText.cx)/2;
				if( wStyle & TBSTYLE_DROPDOWN )
					pti.x = m_rctext.left+(m_rctext.Width()-szText.cx-_AfxGetDropDownWidth())/2;
				pti.y= m_rctext.top+(m_rctext.Height()-szText.cy)/2;
				//DrawState(pt, m_Csize, m_szCaption, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL);
				dc.DrawState(pti,szText,mszText,DSS_DISABLED,TRUE,0,(HBRUSH)NULL);
			}
			
			if (wStyle == TBSTYLE_DROPDOWN) 
				DrawArrow(&dc,rcBtn);
			dc.SetBkMode(OldMode);
			// Modified By SunZhenyu
			dc.SelectObject(m_fontOld);
			iBitmap++;
			iUltbot=rcBtn.bottom;
			j++;
		}
	}
	m_imgList.Detach();
	
	
    ReleaseDC(&dc);

  
}