示例#1
0
LRESULT CModuleSettings::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
  std::wstring strWName;
  WinUTF8::UTF8string_to_wstring(m_strModuleName, strWName);
  SetWindowText(strWName.c_str());

  int iDlgWidth = 7 + CModuleControl::CAPTION_WIDTH + CModuleControl::CHILD_WIDTH + 7;
  int iTop = 7;

  for (int i(0); i < m_iCount; ++i) {
    RECT controlRect = { 7, iTop, iDlgWidth - 7, iTop + m_pControls[i]->GetHeight() };
    MapDialogRect(&controlRect);

    m_pControls[i]->Create(m_hWnd, controlRect);
    m_pControls[i]->Initialise(m_pAppSets);
    iTop += m_pControls[i]->GetHeight() + 2;
  }
  iTop += -2 + 7;

  MoveButton(IDCANCEL, iDlgWidth - 57, iTop);
  MoveButton(IDOK, iDlgWidth - 2 * (57), iTop);

  RECT size = { 0, 0, iDlgWidth, iTop + 14 + 7 };
  MapDialogRect(&size);
  ResizeClient(size.right, size.bottom);

  SendMessageToDescendants(WM_SETFONT, (WPARAM)GetFont(), true);
  return 1;
}
示例#2
0
static void
create_joystick_type_selector( struct joystick_info *info, HWND hwndDlg )
{
  size_t i;
  HFONT font;
  RECT rect;

  font = ( HFONT ) SendMessage( hwndDlg, WM_GETFONT, 0, 0 );

  for( i = 0; i < JOYSTICK_TYPE_COUNT; i++ ) {

    rect.left = 5; rect.top = i * 10 + 10 ;
    rect.right = 5 + 45; rect.bottom = ( i * 10 ) + 10 + 10;
    MapDialogRect( hwndDlg, &rect );
    info->radio[ i ] = CreateWindowEx( 0, WC_BUTTON, joystick_name[ i ],
                                       WS_VISIBLE | WS_CHILD |
                                       WS_TABSTOP | BS_AUTORADIOBUTTON,
                                       rect.left, rect.top,
                                       rect.right - rect.left,
                                       rect.bottom - rect.top,
                                       hwndDlg, 0, fuse_hInstance, 0 );
    SendMessage( info->radio[ i ], WM_SETFONT, ( WPARAM ) font, FALSE );

    if( i == *( info->type ) ) 
      SendMessage( info->radio[ i ], BM_SETCHECK, BST_CHECKED, 0 );
  }
  
  rect.left = 0; rect.top = 0;
  rect.right = 60; rect.bottom = ( i * 10 ) + 10 + 10 + 5;
  MapDialogRect( hwndDlg, &rect );
  MoveWindow( GetDlgItem( hwndDlg, IDR_JOYSTICKS_POPUP ),
              rect.left, rect.top,
              rect.right - rect.left, rect.bottom - rect.top,
              FALSE );
}
BOOL CALLBACK W32StandaloneDialogPanel::StaticCallback(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam) {
	if (message == WM_INITDIALOG) {
		((W32DialogPanel*)lParam)->init(hDialog);
		return true;
	} else if (message == WM_COMMAND) {
		W32DialogPanel *panel = ourPanels[hDialog];
		if (panel != 0) {
			return panel->commandCallback(wParam);
		}
	} else if (message == WM_NOTIFY) {
		W32DialogPanel *panel = ourPanels[hDialog];
		if (panel != 0) {
			return panel->notificationCallback(wParam, lParam);
		}
	} else if (message == WM_GETMINMAXINFO) {
		W32DialogPanel *panel = ourPanels[hDialog];
		if (panel != 0) {
			POINT &minTrackSize = ((MINMAXINFO*)lParam)->ptMinTrackSize;
			W32Widget::Size minSize = panel->minimumSize();
			RECT r;
			r.left = 0;
			r.top = 0;
			r.right = minSize.Width;
			r.bottom = minSize.Height;
			MapDialogRect(hDialog, &r);
			minTrackSize.x = std::max(minTrackSize.x, r.right);
			minTrackSize.y += r.bottom;
			return true;
		}
	} else if (message == WM_SIZE) {
		W32DialogPanel *panel = ourPanels[hDialog];
		if (panel != 0) {
			RECT r;
			r.left = 0;
			r.top = 0;
			r.right = 100;
			r.bottom = 100;
			MapDialogRect(hDialog, &r);
			panel->setSize(W32Widget::Size(
				(int)LOWORD(lParam) * 100 / r.right,
				(int)HIWORD(lParam) * 100 / r.bottom));
			panel->updateElementSize();
		}
		return false;
	} else if (message == WM_DRAWITEM) {
		W32DialogPanel *panel = ourPanels[hDialog];
		if (panel != 0) {
			return panel->drawItemCallback(wParam, *(DRAWITEMSTRUCT*)lParam);
		}
	} else if (message == LAYOUT_MESSAGE) {
		W32DialogPanel *panel = ourPanels[hDialog];
		if (panel != 0) {
			panel->layout();
			return true;
		}
	}
	return false;
}
示例#4
0
void CModuleControl::Create(HWND hParent, RECT& rect)
{
  CWindowImpl<CModuleControl>::Create(hParent, rect);

  RECT captionRect = { 0, 0, CAPTION_WIDTH, GetCaptionHeight() };
  MapDialogRect(hParent, &captionRect);
  m_hCaption.Create(TEXT("STATIC"), *this, captionRect, m_strCaption.c_str(), WS_CHILD | WS_VISIBLE);

  RECT childRect = { CAPTION_WIDTH, 0, CAPTION_WIDTH + CHILD_WIDTH, GetChildHeight() };
  MapDialogRect(hParent, &childRect);
  CreateChild(*this, childRect);
};
示例#5
0
文件: roms.c 项目: CiaranG/ZXdroid
static void
add_rom( HWND hwndDlg, size_t start, size_t row )
{
  RECT rect;
  HFONT font;
  HWND hgroup, hedit, hbutton;
  TCHAR buffer[ 80 ], **setting;

  _sntprintf( buffer, 80, "ROM %d", row );
  
  font = ( HFONT ) SendMessage( hwndDlg, WM_GETFONT, 0, 0 );
  
  /* create a groupbox */
  rect.left = 0; rect.top = ( row * 30 );
  rect.right = 160; rect.bottom = ( row * 30 ) + 30;
  MapDialogRect( hwndDlg, &rect );
  hgroup = CreateWindowEx( 0, WC_BUTTON, buffer,
                           WS_VISIBLE | WS_CHILD | BS_GROUPBOX,
                           rect.left, rect.top,
                           rect.right - rect.left, rect.bottom - rect.top,
                           hwndDlg, 0, fuse_hInstance, 0 );
  SendMessage( hgroup, WM_SETFONT, ( WPARAM ) font, FALSE );

  /* create an edit */
  setting = settings_get_rom_setting( &settings_current, start + row );

  rect.left = 5; rect.top = ( row * 30 ) + 10;
  rect.right = 5 + 110; rect.bottom = ( row * 30 ) + 10 + 14;
  MapDialogRect( hwndDlg, &rect );
  hedit = CreateWindowEx( 0, WC_EDIT, *setting,
                          WS_VISIBLE | WS_CHILD | WS_TABSTOP
                          | WS_BORDER | ES_AUTOHSCROLL,
                          rect.left, rect.top,
                          rect.right - rect.left, rect.bottom - rect.top,
                          hwndDlg, 0, fuse_hInstance, 0 );
  SendMessage( hedit, WM_SETFONT, ( WPARAM ) font, FALSE );
  
  rom[ row ] = hedit;

  /* create a select... button */
  rect.left = 120; rect.top = ( row * 30 ) + 10;
  rect.right = 120 + 35; rect.bottom = ( row * 30 ) + 10 + 14;
  MapDialogRect( hwndDlg, &rect );
  hbutton = CreateWindowEx( 0, WC_BUTTON, TEXT( "Select..." ),
                            WS_VISIBLE | WS_CHILD | WS_TABSTOP,
                            rect.left, rect.top,
                            rect.right - rect.left, rect.bottom - rect.top,
                            hwndDlg, 0, fuse_hInstance, 0 );
  SendMessage( hbutton, WM_SETFONT, ( WPARAM ) font, FALSE );
  
  /* associate handle to the edit box with each Select button as user data */
  SetWindowLong( hbutton, GWL_USERDATA, ( LONG ) hedit );
}
示例#6
0
文件: roms.c 项目: CiaranG/ZXdroid
static void
roms_init( HWND hwndDlg, LPARAM lParam )
{
  size_t i;
  struct callback_info *info;

  info = ( struct callback_info * ) lParam;
  
  for( i = 0; i < info->n; i++ ) add_rom( hwndDlg, info->start, i );

  /* Move the OK and Cancel buttons */
  RECT rect;

  rect.left = 25; rect.top = ( info->n * 30 ) + 5;
  rect.right = 25 + 50; rect.bottom = ( info->n * 30 ) + 5 + 14;
  MapDialogRect( hwndDlg, &rect );
  MoveWindow( GetDlgItem( hwndDlg, IDOK ),
              rect.left, rect.top,
              rect.right - rect.left, rect.bottom - rect.top,
              FALSE );

  rect.left = 85; rect.top = ( info->n * 30 ) + 5;
  rect.right = 85 + 50; rect.bottom = ( info->n * 30 ) + 5 + 14;
  MapDialogRect( hwndDlg, &rect );
  MoveWindow( GetDlgItem( hwndDlg, IDCANCEL ),
              rect.left, rect.top,
              rect.right - rect.left, rect.bottom - rect.top,
              FALSE );
              
  /* resize the dialog as needed */
  RECT window_rect, client_rect;
  
  GetWindowRect( hwndDlg, &window_rect );
  GetClientRect( hwndDlg, &client_rect );

  rect.left = 0; rect.top = 0;
  rect.right = 163; rect.bottom = ( info->n * 30 ) + 24;
  MapDialogRect( hwndDlg, &rect );
  
  /* rect now contains the size of the client area in pixels,
     now add window's absolute position on the screen */
  rect.left += window_rect.left;
  rect.top += window_rect.top;
  
  /* now just add the difference between client area and window area */
  rect.right += ( window_rect.right - window_rect.left )
              - ( client_rect.right - client_rect.left );
  rect.bottom += ( window_rect.bottom - window_rect.top )
               - ( client_rect.bottom - client_rect.top );
  
  /* MoveWindow doesn't really take rect, instead it's X, Y, sizeX and sizeY */
  MoveWindow( hwndDlg, rect.left, rect.top, rect.right, rect.bottom, FALSE );
}
示例#7
0
CELFProgramView::CELFProgramView(HWND hParent, CELF* pELF)
: CDialog(MAKEINTRESOURCE(IDD_ELFVIEW_PROGRAMVIEW), hParent)
, m_nProgram(-1)
, m_pELF(pELF)
{
	SetClassPtr();

	m_pType		= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_TYPE_EDIT));
	m_pOffset	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_OFFSET_EDIT));
	m_pVAddr	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_VADDR_EDIT));
	m_pPAddr	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_PADDR_EDIT));
	m_pFileSize	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FILESIZE_EDIT));
	m_pMemSize	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_MEMSIZE_EDIT));
	m_pFlags	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FLAGS_EDIT));
	m_pAlign	= new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_ALIGN_EDIT));

	RECT columnEditBoxSize;
	SetRect(&columnEditBoxSize, 0, 0, 70, 12);
	MapDialogRect(m_hWnd, &columnEditBoxSize);
	unsigned int columnEditBoxWidth = columnEditBoxSize.right - columnEditBoxSize.left;
	unsigned int columnEditBoxHeight = columnEditBoxSize.bottom - columnEditBoxSize.top;

	RECT columnLabelSize;
	SetRect(&columnLabelSize, 0, 0, 70, 8);
	MapDialogRect(m_hWnd, &columnLabelSize);
	unsigned int columnLabelWidth = columnLabelSize.right - columnLabelSize.left;
	unsigned int columnLabelHeight = columnLabelSize.bottom - columnLabelSize.top;

	m_pLayout = Framework::CGridLayout::Create(2, 9);

	m_pLayout->SetObject(0, 0, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_TYPE_LABEL))));
	m_pLayout->SetObject(0, 1, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_OFFSET_LABEL))));
	m_pLayout->SetObject(0, 2, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_VADDR_LABEL))));
	m_pLayout->SetObject(0, 3, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_PADDR_LABEL))));
	m_pLayout->SetObject(0, 4, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FILESIZE_LABEL))));
	m_pLayout->SetObject(0, 5, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_MEMSIZE_LABEL))));
	m_pLayout->SetObject(0, 6, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FLAGS_LABEL))));
	m_pLayout->SetObject(0, 7, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_ALIGN_LABEL))));

	m_pLayout->SetObject(1, 0, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pType));
	m_pLayout->SetObject(1, 1, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pOffset));
	m_pLayout->SetObject(1, 2, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pVAddr));
	m_pLayout->SetObject(1, 3, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pPAddr));
	m_pLayout->SetObject(1, 4, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pFileSize));
	m_pLayout->SetObject(1, 5, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pMemSize));
	m_pLayout->SetObject(1, 6, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pFlags));
	m_pLayout->SetObject(1, 7, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pAlign));
	m_pLayout->SetObject(1, 8, Framework::CLayoutStretch::Create());

	RefreshLayout();
}
void CGameParamsSheet::InitButtons()
{
  // Calculate the height of 7 dialog units
  CRect rectUnits(0, 0, 0, 7);

  //mmf vc8 does not like two arguments, below was commented out, I uncommented it - Imago made them co-exist
#if _MSC_VER >= 1400
  MapDialogRect(rectUnits);
#else
  MapDialogRect(GetSafeHwnd(), rectUnits); 
#endif


  // Get the OK and cancel buttons
  CWnd* pwndOK     = GetDlgItem(IDOK);
  CWnd* pwndCancel = GetDlgItem(IDCANCEL);
  CWnd* pwndHelp   = GetDlgItem(IDHELP);

  // Get the window rectangles of the buttons
  CRect rectOK, rectCancel, rectHelp;
  pwndOK->GetWindowRect(rectOK);
  pwndCancel->GetWindowRect(rectCancel);
  pwndHelp->GetWindowRect(rectHelp);
  ScreenToClient(rectOK);
  ScreenToClient(rectCancel);
  ScreenToClient(rectHelp);

  // Compute the offset to position these buttons flush-right
  int cxOffset = rectHelp.right - rectCancel.right;

  // Move the buttons into place
  rectOK.OffsetRect(cxOffset, 0);
  rectCancel.OffsetRect(cxOffset, 0);
  pwndOK->MoveWindow(rectOK);
  pwndCancel->MoveWindow(rectCancel);

  // Hide the Apply and Help buttons
  GetDlgItem(ID_APPLY_NOW)->ShowWindow(SW_HIDE);
  GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);

  // Show the OK and Cancel buttons
  GetDlgItem(IDOK)->ShowWindow(SW_SHOW);
  GetDlgItem(IDCANCEL)->ShowWindow(SW_SHOW);

  // Enable the OK and Cancel buttons
  GetDlgItem(IDOK)->EnableWindow(true);
  GetDlgItem(IDCANCEL)->EnableWindow(true);
}
BOOL dialog_resize_helper::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult) {
	switch(uMsg) {
	case WM_SIZE:
		on_wm_size();
		return FALSE;
	case WM_GETMINMAXINFO:
		{
			RECT r;
			LPMINMAXINFO info = (LPMINMAXINFO) lParam;
			DWORD dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
			DWORD dwExStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
			if (max_x && max_y)
			{
				r.left = 0; r.right = max_x;
				r.top = 0; r.bottom = max_y;
				MapDialogRect(hWnd,&r);
				AdjustWindowRectEx(&r, dwStyle, FALSE, dwExStyle);
				info->ptMaxTrackSize.x = r.right - r.left;
				info->ptMaxTrackSize.y = r.bottom - r.top;
			}
			if (min_x && min_y)
			{
				r.left = 0; r.right = min_x;
				r.top = 0; r.bottom = min_y;
				MapDialogRect(hWnd,&r);
				AdjustWindowRectEx(&r, dwStyle, FALSE, dwExStyle);
				info->ptMinTrackSize.x = r.right - r.left;
				info->ptMinTrackSize.y = r.bottom - r.top;
			}
		}
		lResult = 0;
		return TRUE;
	case WM_INITDIALOG:
		set_parent(hWnd);
		{
			t_size n;
			for(n=0;n<m_table.get_size();n++) {
				GetChildWindowRect(parent,m_table[n].id,&rects[n]);
			}
		}
		return FALSE;
	case WM_DESTROY:
		reset();
		return FALSE;
	default:
		return FALSE;
	}
}
示例#10
0
int convert_coords_list(HWND hwnd,short *list,int count)
{
	int i;
	for(i=0;i<count;i+=2){
		int token=list[i];
		if(token==RESIZE_FINISH)
			break;
		switch(token){
		case CONTROL_ID:
		case CONTROL_FINISH:
			break;
		case XPOS:
		case WIDTH:
		case HUG_L:
		case HUG_R:
		case HUG_CTRL_X:
		case HUG_WIDTH:
		case HUG_CTRL_TXT_X:
		case HUG_CTRL_TXT_X_:
		case SIZE_WIDTH_OFF:
			{
				RECT rect={0};
				rect.right=list[i+1];
				if(MapDialogRect(hwnd,&rect))
					list[i+1]=(short)rect.right;
			}
			break;
		case YPOS:
		case HEIGHT:
		case HUG_T:
		case HUG_B:
		case HUG_CTRL_Y:
		case HUG_HEIGHT:
		case HUG_CTRL_TXT_Y:
		case HUG_CTRL_TXT_Y_:
		case SIZE_HEIGHT_OFF:
			{
				RECT rect={0};
				rect.bottom=list[i+1];
				if(MapDialogRect(hwnd,&rect))
					list[i+1]=(short)rect.bottom;
			}
		break;
		}

	}
	return 0;
}
示例#11
0
CThreadCallStackViewWnd::CThreadCallStackViewWnd(HWND parentWindow) 
: CDialog(MAKEINTRESOURCE(IDD_DEBUG_THREADCALLSTACK), parentWindow)
, m_hasSelection(false)
, m_selectedAddress(0)
{
	SetClassPtr();

	m_okButton			= new Framework::Win32::CButton(GetItem(IDOK));
	m_cancelButton		= new Framework::Win32::CButton(GetItem(IDCANCEL));
	m_callStackItemList = new Framework::Win32::CListBox(GetItem(IDC_CALLSTACKITEM_LIST));

	RECT buttonSize;
	SetRect(&buttonSize, 0, 0, 75, 16);
	MapDialogRect(m_hWnd, &buttonSize);
	unsigned int buttonWidth = buttonSize.right - buttonSize.left;
	unsigned int buttonHeight = buttonSize.bottom - buttonSize.top;

	m_layout = 
		Framework::VerticalLayoutContainer
		(
			Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateCustomBehavior(100, 20, 1, 1, m_callStackItemList)) +
			Framework::HorizontalLayoutContainer
			(
				Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(buttonWidth, buttonHeight, m_okButton)) +
				Framework::LayoutExpression(Framework::CLayoutStretch::Create()) +
				Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(buttonWidth, buttonHeight, m_cancelButton))
			)
		);

	{
		RECT rc = GetClientRect();
		m_layout->SetRect(rc.left + 10, rc.top + 10, rc.right - 10, rc.bottom - 10);
		m_layout->RefreshGeometry();
	}
}
示例#12
0
BOOL CGeneralMsgBox::OnInitDialog()
{
  if (!CDialog::OnInitDialog())
    return FALSE;

  SetWindowText(m_strTitle);

  // Getting the base dialog unit used in pixel <-> d.u. conversion
  CRect rc(0, 0, CX_DLGUNIT_BASE, CY_DLGUNIT_BASE);
  MapDialogRect(rc);

  m_dimDlgUnit = rc.Size();

  // Creating the nested controls
  CreateRtfCtrl();
  CreateIcon();
  CreateBtns();

  // Updating the layout - preparing to show
  UpdateLayout();

  // Disabling the ESC key
  if (m_uiEscCmdId == (UINT)IDC_STATIC)
    ModifyStyle(WS_SYSMENU, NULL);

  // Focusing and setting the defaul button
  if (m_uiDefCmdId != (UINT)IDC_STATIC) {
    GetDlgItem(m_uiDefCmdId)->SetFocus();
    SetDefID(m_uiDefCmdId);

    return FALSE;
  }

  return TRUE;
}
示例#13
0
static void drawUnselected( HDC hdc, int x, int y )
{
    RECT        rect;
    HBRUSH      hColourBrush;
    COLORREF    nearest;

    rect.left = 0;
    rect.top = 0;
    rect.right = WIDTH * NUM_ACROSS;
    rect.bottom = HEIGHT * NUM_DOWN;
    MapDialogRect( hColorbar, &rect );

    Width = (rect.right - rect.left) / NUM_ACROSS;
    Height = (rect.bottom - rect.top) / NUM_DOWN;


    rect.left = x * Width + SPC;
    rect.top = y * Height + SPC;
    rect.right = (x + 1) * Width - SPC;
    rect.bottom = (y + 1) * Height - SPC;
    // MapDialogRect( hColorbar, &rect );

    nearest = GetNearestColor( hdc, RGBValues[y * NUM_ACROSS + x] );
    hColourBrush = CreateSolidBrush( nearest );
    FillRect( hdc, &rect, hColourBrush );
    drawFocus( hdc, &rect, false );

    DeleteObject( hColourBrush );
}
示例#14
0
文件: tudlg.c 项目: mingpen/OpenNT
void far pascal zMapDialogRect( HWND pp1, LPRECT pp2 )
{

    SaveRegs();
    /*
    ** Log IN Parameters (No Create/Destroy Checking Yet!)
    */
    LogIn( (LPSTR)"APICALL:MapDialogRect HWND+LPRECT+",
        pp1, pp2 );

    /*
    ** Call the API!
    */
    RestoreRegs();
    GrovelDS();
    MapDialogRect(pp1,pp2);
    UnGrovelDS();
    SaveRegs();
    /*
    ** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!)
    */
    LogOut( (LPSTR)"APIRET:MapDialogRect +LPRECT+",
        (short)0, pp2 );

    RestoreRegs();
    return;
}
示例#15
0
vduirect VDUIBaseWindowW32::MapUnitsToPixels(vduirect r) {
	RECT rwin = {r.left, r.top, r.right, r.bottom};

	MapDialogRect(mhwnd, &rwin);

	return vduirect(rwin.left, rwin.top, rwin.right, rwin.bottom);
}
示例#16
0
void CXUIDatePicker::Init()
{
	DWORD wStyle = WS_CHILD | WS_TABSTOP;

	if(m_showNone)	wStyle |= DTS_SHOWNONE;
	if(m_useSpin)	wStyle |= DTS_UPDOWN;
	switch(m_format)
	{
	case XUI_DATE_FORMAT_LONG:
		wStyle |= DTS_LONGDATEFORMAT;
		break;
	case XUI_DATE_FORMAT_TIME:
		wStyle |= DTS_TIMEFORMAT;
		break;
	default:
		wStyle |= DTS_SHORTDATEFORMAT;
		break;
	}

	if(get_disabled())	wStyle |= WS_DISABLED;
	if(!get_hidden())	wStyle |= WS_VISIBLE;

	m_hWnd = CreateWindowEx(0, DATETIMEPICK_CLASS, L"", wStyle, m_left, m_top, m_width, m_height, m_parent->get_parentWnd(), (HMENU) m_id, m_engine->get_hInstance(), NULL);

	RECT rcDlg = {0, 0, 100, 14};
	if(m_width) rcDlg.right = m_width;
	if(m_height) rcDlg.bottom = m_height;
	MapDialogRect(m_parent->get_parentWnd(), &rcDlg);
	m_minWidth	= rcDlg.right;
	m_minHeight = rcDlg.bottom;

	CXUIElement::Init();
}
示例#17
0
//
//  hwnd       - window to calc
//  szDlgUnits - (input)  size in dialog units
//  szClient   - (output) size of client area in pixels
//  szWindow   - (output) total size of based on current settings
//
void CalcDlgWindowSize(HWND hwnd, SIZE *szDlgUnits, SIZE *szClient, SIZE *szWindow)
{
	RECT rect;
	DWORD dwStyle;
	DWORD dwStyleEx;

	// work out the size in pixels of our main window, by converting
	// from dialog units
	SetRect(&rect, 0, 0, szDlgUnits->cx, szDlgUnits->cy);
	MapDialogRect(hwnd, &rect);

	if (szClient)
	{
		szClient->cx = GetRectWidth(&rect);
		szClient->cy = GetRectHeight(&rect);
	}

	dwStyle = GetWindowLong(hwnd, GWL_STYLE);
	dwStyleEx = GetWindowLong(hwnd, GWL_EXSTYLE);

	AdjustWindowRectEx(&rect, dwStyle, FALSE, dwStyleEx);

	if (szWindow)
	{
		szWindow->cx = GetRectWidth(&rect);
		szWindow->cy = GetRectHeight(&rect);
	}
}
示例#18
0
vduisize VDUIBaseWindowW32::MapUnitsToPixels(vduisize s) {
	RECT rwin = {0,0,s.w,s.h};

	MapDialogRect(mhwnd, &rwin);

	return vduisize(rwin.right, rwin.bottom);
}
示例#19
0
int LayoutNetStartPane (HWND pane, int w)
{
	HWND ctl;
	RECT margin, rectc;
	int staticheight, barheight;

	// Determine margin sizes.
	SetRect (&margin, 7, 7, 0, 0);
	MapDialogRect (pane, &margin);

	// Stick the message text in the upper left corner.
	ctl = GetDlgItem (pane, IDC_NETSTARTMESSAGE);
	GetClientRect (ctl, &rectc);
	MoveWindow (ctl, margin.left, margin.top, rectc.right, rectc.bottom, TRUE);

	// Stick the count text in the upper right corner.
	ctl = GetDlgItem (pane, IDC_NETSTARTCOUNT);
	GetClientRect (ctl, &rectc);
	MoveWindow (ctl, w - rectc.right - margin.left, margin.top, rectc.right, rectc.bottom, TRUE);
	staticheight = rectc.bottom;

	// Stretch the progress bar to fill the entire width.
	ctl = GetDlgItem (pane, IDC_NETSTARTPROGRESS);
	barheight = GetSystemMetrics (SM_CYVSCROLL);
	MoveWindow (ctl, margin.left, margin.top*2 + staticheight, w - margin.left*2, barheight, TRUE);

	// Center the abort button underneath the progress bar.
	ctl = GetDlgItem (pane, IDCANCEL);
	GetClientRect (ctl, &rectc);
	MoveWindow (ctl, (w - rectc.right) / 2, margin.top*3 + staticheight + barheight, rectc.right, rectc.bottom, TRUE);

	return margin.top*4 + staticheight + barheight + rectc.bottom;
}
示例#20
0
void CCreateEventDlg::OnInitDialog()
{
    RECT r = { 43, 24, 43+211, 24+12 };
    MapDialogRect(m_hwnd, &r);
    m_pTaskCombo->Create(m_hwnd, r, WS_VISIBLE | WS_CHILD, WS_EX_CLIENTEDGE);

    StringBuffer sbFormat(2048);
    LoadString(resInstance, IDS_EVENT_TIME_FORMAT, sbFormat, 2047);
    HWND hwnd = GetDlgItem(m_hwnd, IDC_CREATE_EVENT_TIME);
    SendMessage(hwnd, DTM_SETFORMAT, 0, reinterpret_cast<LPARAM>(sbFormat.operator TCHAR *()));
    m_picker = TimePicker::CreateTimePicker(hwnd);

    SYSTEMTIME st;
    GetLocalTime(&st);
    if(st.wMinute % 15)
    {
        st.wMinute = ((st.wMinute / 15) + 1) * 15;
        if(st.wMinute > 45)
        {
            st.wMinute = 0;
            st.wHour += 1;
        }
    }
    SendMessage(hwnd, DTM_SETSYSTEMTIME, GDT_VALID, reinterpret_cast<LPARAM>(&st));

    hwnd = GetDlgItem(m_hwnd, IDC_CREATE_EVENT_EDIT_DURATION_DAYS);
    m_pEstDuration = new EstDurationEdit(hwnd, false, true);

//	hwnd = GetDlgItem(m_hwnd, IDC_CREATE_EVENT_EDIT_DURATION_HOURS);
//	SetWindowText(hwnd, _T("1"));
}
HWND container_window::create_in_dialog_units(HWND wnd_dialog, const ui_helpers::window_position_t & p_window_position, LPVOID create_param)
{
	RECT rc;
	p_window_position.convert_to_rect(rc);
	MapDialogRect(wnd_dialog, &rc);
	return create(wnd_dialog, create_param, ui_helpers::window_position_t(rc));
}
示例#22
0
文件: main.c 项目: PatroxGaurab/wine
static void draw_joystick_axes(HWND hwnd, struct JoystickData* data)
{
    int i;
    HINSTANCE hinst = (HINSTANCE) GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
    static const WCHAR button_class[] = {'B','u','t','t','o','n','\0'};
    static const WCHAR axes_names[TEST_MAX_AXES][7] = { {'X',',','Y','\0'}, {'R','x',',','R','y','\0'},
                                                        {'Z',',','R','z','\0'}, {'P','O','V','\0'} };
    static const DWORD axes_idc[TEST_MAX_AXES] = { IDC_TESTGROUPXY, IDC_TESTGROUPRXRY,
                                                   IDC_TESTGROUPZRZ, IDC_TESTGROUPPOV };

    for (i = 0; i < TEST_MAX_AXES; i++)
    {
        RECT r;
        /* Set axis box name */
        SetWindowTextW(GetDlgItem(hwnd, axes_idc[i]), axes_names[i]);

        r.left = (TEST_AXIS_X + TEST_NEXT_AXIS_X*i);
        r.top = TEST_AXIS_Y;
        r.right = r.left + TEST_AXIS_SIZE_X;
        r.bottom = r.top + TEST_AXIS_SIZE_Y;
        MapDialogRect(hwnd, &r);

        data->graphics.axes[i] = CreateWindowW( button_class, NULL, WS_CHILD | WS_VISIBLE,
            r.left, r.top, r.right - r.left, r.bottom - r.top,
            hwnd, NULL, NULL, hinst);
    }
}
示例#23
0
文件: main.c 项目: PatroxGaurab/wine
static void draw_joystick_buttons(HWND hwnd, struct JoystickData* data)
{
    int i;
    int row = 0, col = 0;
    WCHAR button_label[3];
    HINSTANCE hinst = (HINSTANCE) GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
    static WCHAR button_class[] = {'B','u','t','t','o','n','\0'};

    for (i = 0; i < TEST_MAX_BUTTONS; i++)
    {
        RECT r;

        if ((i % TEST_BUTTON_COL_MAX) == 0 && i != 0)
        {
            row += 1;
            col = 0;
        }

        r.left = (TEST_BUTTON_X + TEST_NEXT_BUTTON_X*col);
        r.top = (TEST_BUTTON_Y + TEST_NEXT_BUTTON_Y*row);
        r.right = r.left + TEST_BUTTON_SIZE_X;
        r.bottom = r.top + TEST_BUTTON_SIZE_Y;
        MapDialogRect(hwnd, &r);

        button_number_to_wchar(i + 1, button_label);

        data->graphics.buttons[i] = CreateWindowW(button_class, button_label, WS_CHILD,
            r.left, r.top, r.right - r.left, r.bottom - r.top,
            hwnd, NULL, NULL, hinst);

        col += 1;
    }
}
示例#24
0
static void ResizeVert(HWND hDlg, int yy)
{
	RECT r = { 0, 0, 244, yy };
	MapDialogRect(hDlg, &r);
	r.bottom += GetSystemMetrics(SM_CYSMCAPTION);
	SetWindowPos(hDlg, 0, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER);
}
示例#25
0
LRESULT CFunctionPage::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if (wParam == SIZE_RESTORED)
	{
		CRect rc, rc2;
		CWindow wnd = GetDlgItem(IDC_COMBO_CLASSES);
		wnd.GetWindowRect(rc);
		ScreenToClient(rc);
		CSize NewSize(LOWORD(lParam), HIWORD(lParam));
		
		CRect CheckRc(0, 0, 1,12);
		MapDialogRect(CheckRc);
		rc2.left = 0;
		rc2.right = NewSize.cx;
		rc2.top = rc.bottom + CheckRc.Height();
		rc2.bottom = NewSize.cy;
		m_SplitMessages.MoveWindow(rc2);

		if (!m_bShowWindow && lParam)
		{
			m_bShowWindow = true;
			m_SplitMessages.SetSplitterPos(m_WindowSettings.m_MesSpitPos);
			m_SplitFunctions.SetSplitterPos(m_WindowSettings.m_FuncSplitPos);
		}
	}
	return 0;
}
示例#26
0
文件: virtmem.c 项目: GYGit/reactos
static VOID
SetListBoxColumns(HWND hwndListBox)
{
    RECT rect = {0, 0, 103, 0};
    MapDialogRect(hwndListBox, &rect);

    SendMessage(hwndListBox, LB_SETTABSTOPS, (WPARAM)1, (LPARAM)&rect.right);
}
示例#27
0
DLGBOOL CALLBACK defDemoDlg ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    switch ( message )
		{
		case WM_INITDIALOG:
			{
#ifdef DEBUGBASEUNIT
			char s[256];
			RECT rc, rcb;
			TEXTMETRIC tm;
			HFONT hfnt = (HFONT) SendMessage ( hWnd, WM_GETFONT, 0, 0 );
			HDC hdc = GetDC ( hWnd );
			rcb.left = rcb.top = 0;
			rcb.right = 4, rcb.bottom = 8;
			SelectObject ( hdc, hfnt );
			GetTextMetrics ( hdc, &tm );
			GetClientRect(hWnd, &rc);
			MapDialogRect ( hWnd, &rcb );
			sprintf ( s, "AW=%d (%d), Ht=%d (%d), %d x %d", 
					  tm.tmAveCharWidth, rcb.right, tm.tmHeight, rcb.bottom,
					  rc.right, rc.bottom );
			SetWindowText ( hWnd, s );
			ReleaseDC ( hWnd, hdc );
#endif
			}
			break;

		case WM_CTLCOLORSTATIC:
			{
			if( GetDlgCtrlID((HWND)lParam) == IDC_CTLCOLOR )
				{
				HBRUSH hbr = (HBRUSH)(LRESULT)DefWindowProc ( hWnd, message, wParam, lParam );
				SetTextColor ( (HDC)wParam, RGB(255,0,0) );
				SetBkColor ( (HDC)wParam, GetSysColor(COLOR_3DFACE) );
				return (DLGBOOL)hbr;
				}
			}
			return DefWindowProc ( hWnd, message, wParam, lParam );

		case WM_COMMAND:
			switch ( LOWORD(wParam) )
				{
				case IDOK:
					EndDialog ( hWnd, TRUE );
					break;

				case IDCANCEL:
					EndDialog ( hWnd, FALSE );
					break;
				}
			break;

		default:
			return FALSE;
		}

	return TRUE;
}
示例#28
0
void ResizeHorizontal(HWND hwnd, bool wide) {
	RECT r = { 0, 0, wide ? 422 : 271, 116 };
	MapDialogRect(hwnd, &r);
	r.bottom += GetSystemMetrics(SM_CYSMCAPTION);
	SetWindowPos(hwnd, 0, 0, 0, r.right, r.bottom, SWP_NOMOVE | SWP_NOZORDER);
	SetDlgItemText(hwnd, IDC_EXPAND, (wide ? TranslateT("<< Contacts") : TranslateT("Contacts >>")));
	ShowWindow(GetDlgItem(hwnd, IDC_CCLIST), wide);
	ShowWindow(GetDlgItem(hwnd, IDC_CCLIST_LABEL), wide);
}
示例#29
0
// Converts pixels to this dialog's units
void CDialogTemplate::DlgUnitsToPixels(short& x, short& y) {
	HWND hDlg = CreateDummyDialog();
	RECT r = {0, 0, 10000, 10000};
	MapDialogRect(hDlg, &r);
	DestroyWindow(hDlg);

	x = short(float(x) * (float(r.right)/10000));
	y = short(float(y) * (float(r.bottom)/10000));
}
示例#30
0
void CAboutDlg::OnPaint()
{
	CDialog::OnPaint();

	CClientDC dc(this);

	CRect rcAppIcon(7, 10, 27, 30);
	MapDialogRect(&rcAppIcon);
	dc.DrawIcon(rcAppIcon.left, rcAppIcon.top, m_hAppIcon);
}