void WinEDA_SetOptionsFrame::CreateControls() { SetFont(*g_DialogFont); ////@begin WinEDA_SetOptionsFrame content construction // Generated by DialogBlocks, 21/02/2006 11:38:20 (unregistered) WinEDA_SetOptionsFrame* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); itemDialog1->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_ShowGridOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Show grid"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGridOpt->SetValue(false); itemBoxSizer3->Add(m_ShowGridOpt, 0, wxALIGN_LEFT|wxALL, 5); wxString m_SelGridSizeStrings[] = { _("Normal (50 mils)"), _("Small (25 mils)"), _("Very small (10 mils)"), _("Special (5 mils)"), _("Special (2 mils)"), _("Special (1 mil)") }; m_SelGridSize = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Grid Size"), wxDefaultPosition, wxDefaultSize, 6, m_SelGridSizeStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer3->Add(m_SelGridSize, 0, wxGROW|wxALL, 5); wxString m_SelShowPinsStrings[] = { _("Normal"), _("Show alls") }; m_SelShowPins = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Show pins"), wxDefaultPosition, wxDefaultSize, 2, m_SelShowPinsStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer3->Add(m_SelShowPins, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_AutoPANOpt->SetValue(false); m_AutoPANOpt->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer7->Add(m_AutoPANOpt, 0, wxGROW|wxALL, 5); wxString m_SelunitsStrings[] = { _("millimeter"), _("inches") }; m_Selunits = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Units"), wxDefaultPosition, wxDefaultSize, 2, m_SelunitsStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer7->Add(m_Selunits, 0, wxGROW|wxALL, 5); wxString m_SelDirWiresStrings[] = { _("Horiz/Vertical"), _("Any") }; m_SelDirWires = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _("Wires - Bus orient"), wxDefaultPosition, wxDefaultSize, 2, m_SelDirWiresStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer7->Add(m_SelDirWires, 0, wxGROW|wxALL, 5); wxString m_Show_Page_LimitsStrings[] = { _("Yes"), _("No") }; m_Show_Page_Limits = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 2, m_Show_Page_LimitsStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer7->Add(m_Show_Page_Limits, 0, wxGROW|wxALL, 5); wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* itemButton13 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton13->SetForegroundColour(wxColour(202, 0, 0)); itemBoxSizer12->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxButton* itemButton14 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton14->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer12->Add(itemButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Auto increment params")); wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer(itemStaticBoxSizer15Static, wxVERTICAL); itemBoxSizer12->Add(itemStaticBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticText* itemStaticText16 = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step X"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer15->Add(itemStaticText16, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_DeltaStepCtrl_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer15->Add(m_DeltaStepCtrl_X, 0, wxGROW|wxALL, 5); wxStaticText* itemStaticText18 = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Step Y"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer15->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_DeltaStepCtrl_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer15->Add(m_DeltaStepCtrl_Y, 0, wxGROW|wxALL, 5); wxStaticText* itemStaticText20 = new wxStaticText( itemDialog1, wxID_STATIC, _("Delta Label:"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer15->Add(itemStaticText20, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_DeltaLabelCtrl = new wxSpinCtrl( itemDialog1, ID_SPINCTRL, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -16, 16, 0 ); itemStaticBoxSizer15->Add(m_DeltaLabelCtrl, 0, wxGROW|wxALL, 5); ////@end WinEDA_SetOptionsFrame content construction }
int SurfaceImpl::AverageCharWidth(Font &font) { SetFont(font); return hdc->GetCharWidth(); }
int SurfaceImpl::Height(Font &font) { SetFont(font); return hdc->GetCharHeight() + 1; }
int SurfaceImpl::ExternalLeading(Font &font) { SetFont(font); int w, h, d, e; hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e); return e; }
static void DrawConnectionScreen() { unsigned char const* pSwash; /* this is part of the idle update * timing is controlled by the idle update timer * buffer was already cleared when drawing the time */ etConnectionState cs = QueryConnectionState(); switch (cs) { case RadioOn: if (QueryValidPairingInfo()) { pSwash = pBootPageConnectionSwash; } else { pSwash = pBootPagePairingSwash; } break; case Paired: pSwash = pBootPageConnectionSwash; break; case Connected: //pSwash = pBootPageConnectionSwash; //break; // Think we should do something here? pSwash = pBootPageUnknownSwash; break; case Initializing: case ServerFailure: case RadioOff: case RadioOffLowBattery: case ShippingMode: default: pSwash = pBootPageBluetoothOffSwash; break; } CopyRowsIntoMyBuffer(pSwash,WATCH_DRAWN_IDLE_BUFFER_ROWS+1,32); #ifdef XXFONT_TESTING gRow = 65; gColumn = 0; gBitColumnMask = BIT0; SetFont(MetaWatch5); WriteFontString("Peanut Butter"); gRow = 72; gColumn = 0; gBitColumnMask = BIT0; SetFont(MetaWatch7); //WriteFontString("ABCDEFGHIJKLMNOP"); WriteFontString("Peanut Butter W"); gRow = 80; gColumn = 0; gBitColumnMask = BIT0; SetFont(MetaWatch16); WriteFontString("ABC pqr StuVw"); #else unsigned char row; unsigned char col; /* characters are 10h then add space of 2 lines */ row = 65; col = 0; col = WriteString(GetLocalBluetoothAddressString(),row,col,DONT_ADD_SPACE_AT_END); /* add the firmware version */ row = 75; col = 0; col = WriteString("App",row,col,ADD_SPACE_AT_END); col = WriteString(VERSION_STRING,row,col,ADD_SPACE_AT_END); /* and the stack version */ row = 85; col = 0; col = WriteString("Stack",row,col,ADD_SPACE_AT_END); col = WriteString(GetStackVersion(),row,col,ADD_SPACE_AT_END); #endif }
//////////////////////////////////////////////////////////////////////////////// // SetupDebugger() // // This function creates the debugger views... // void frmDebugger::SetupDebugger() { SetFont(settings->GetSystemFont()); // Initializing Stack Frame Window if (m_stackWindow == NULL) { m_stackWindow = new ctlStackWindow(this, WINDOW_ID_STACK, wxDefaultPosition, wxDefaultSize, 0); m_manager.AddPane(m_stackWindow, wxAuiPaneInfo().Name(wxT("stackPane")).Caption(_("Stack pane")).Right() .MinSize(wxSize(100, 100)).BestSize(wxSize(250, 200))); } // Initializing Tab Window if (m_tabWindow == NULL) { m_tabWindow = new ctlTabWindow(this, WINDOW_ID_TABS, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON); m_manager.AddPane(m_tabWindow, wxAuiPaneInfo().Name(wxT("outputPane")).Caption(_("Output pane")).Bottom() .MinSize(wxSize(200, 100)).BestSize(wxSize(550, 300))); } // Initialing Code viewer Window if (m_codeViewer == NULL) { m_codeViewer = new ctlSQLBox(this, -1); // Set up the markers that we use to indicate the current line and // the break-point m_codeViewer->MarkerDefine(MARKER_CURRENT, wxSTC_MARK_ARROW, *wxGREEN, *wxGREEN); m_codeViewer->MarkerDefine(MARKER_CURRENT_BG, wxSTC_MARK_BACKGROUND, *wxGREEN, *wxGREEN); m_codeViewer->MarkerDefine(MARKER_BREAKPOINT, wxSTC_MARK_CIRCLEPLUS, *wxRED, *wxRED); m_codeViewer->SetMarginWidth(1, 16); m_codeViewer->SetMarginType(1, wxSTC_MARGIN_SYMBOL); // Make sure that the text control tells us when the user clicks in the // left margin m_codeViewer->SetMarginSensitive(0, true); m_codeViewer->SetMarginSensitive(1, true); m_codeViewer->SetMarginSensitive(2, true); m_manager.AddPane(m_codeViewer, wxAuiPaneInfo().Name(wxT("sourcePane")).Caption(_("Source pane")).Center() .CaptionVisible(false).CloseButton(false).MinSize(wxSize(200, 100)) .BestSize(wxSize(350, 200))); } // Make sure the user can't edit the source code for this function m_codeViewer->SetReadOnly(true); // Now (re)load the layout wxString perspective; settings->Read( wxT("Debugger/frmDebugger/Perspective-") + wxString(FRMDEBUGGER_PERSPECTIVE_VER), &perspective, FRMDEBUGGER_DEFAULT_PERSPECTIVE); m_manager.LoadPerspective(perspective, true); // And reset the captions m_manager.GetPane(wxT("sourcePane")).Caption(_("Source pane")); m_manager.GetPane(wxT("stackPane")).Caption(_("Stack pane")); m_manager.GetPane(wxT("outputPane")).Caption(_("Output pane")); // Sync the View menu options m_viewMenu->Check(MENU_ID_VIEW_STACKPANE, m_manager.GetPane(wxT("stackPane")).IsShown()); m_viewMenu->Check(MENU_ID_VIEW_OUTPUTPANE, m_manager.GetPane(wxT("outputPane")).IsShown()); // Enable the options for these controls m_viewMenu->Enable(MENU_ID_VIEW_OUTPUTPANE, true); m_viewMenu->Enable(MENU_ID_VIEW_STACKPANE, true); m_manager.Update(); // force EnableToolsAndMenus(false); PushEventHandler(m_controller); }
void MatrixControl::Draw (BRect restrictiveRect) { if (IsFocus() == false) showcursor=false; Window()->Lock(); float orx = GetScrollX(); float ory = GetScrollY(); SetHighColor(0,0,0,255); StrokeRect(BRect(orx,ory,Frame().Width()+orx,Frame().Height()+ory),B_SOLID_HIGH); int i,k; int32 a,b; BString out; escapement_delta delta; delta.space = 0; delta.nonspace = 0; SetDrawingMode( B_OP_OVER ); SetFont( be_bold_font ); if ((CursorOnKoeff == true) && (cursoron == true)) { SetHighColor(255,255,255,255); } if (CursorOnKoeff) DrawString( edit->String() , BPoint(10,20), &delta); else if (!DrawfromPulse) DrawString( extra::fStringOutOf( Koeffizient,GLOBAL_ACCURACY ).String() , BPoint(10,20), &delta); if /* A */ (DrawfromPulse == false) { for /* B */ (i=0;i<matrix_dimension;++i) { if (!DataEnterMode) { SetHighColor(255,40,40,255); FillRect(BRect( (i+1)*square_size-10, 20 ,(i+1)*square_size-5 , square_size * matrix_dimension), B_SOLID_HIGH ); SetHighColor(40,40,255,255); FillRect(BRect( 20, (i+1)*square_size+5, square_size * (matrix_dimension+1) ,(i+1)*square_size+10 ), B_SOLID_HIGH ); SetHighColor(0,0,0,255); StrokeRect(BRect( (i+1)*square_size-10, 20 ,(i+1)*square_size -5 , square_size * matrix_dimension), B_SOLID_HIGH ); StrokeRect(BRect( 20, (i+1)*square_size+5, square_size * (matrix_dimension+1) ,(i+1)*square_size +10 ), B_SOLID_HIGH ); } for /* C */(k=0;k<matrix_dimension;++k) { out.SetTo(extra::fStringOutOf(float_matrix[i*matrix_dimension +k],GLOBAL_ACCURACY).String()); SetHighColor(255,50,127,255); if /* D */ ((showcursor == true) && (posx == k) && (posy == i) && (cursoron == true) && (CursorOnKoeff == false)) SetHighColor(255,255,255,255); // D a = (k+1)*square_size; b = (i+1)*square_size; DrawString(out.String(),BPoint(a,b), &delta); } // C } // B } // A else // A { //out.SetTo(extra::fStringOutOf(float_matrix[posy*matrix_dimension +posx],3).String()); if (CursorOnKoeff == false) { bool optimizer; optimizer = ((showcursor == true) && (cursoron == true)); SetHighColor(200,200,200,255); FillRect(BRect((posx+1)*square_size-10, posy*square_size+10, (posx+2)*square_size-10, (posy+1)*square_size+10)); SetHighColor(255,50,127,255); DrawString(edit->String(),BPoint((posx+1)*square_size,(posy+1)*square_size), &delta); if /* B */(optimizer == true) { SetHighColor(255,255,255,255); DrawString("|", &delta); }// B } } // A Window()->Sync(); Window()->Unlock(); }
/*=============================================================================================*\ | Draw | +-----------------------------------------------------------------------------------------------+ | Effet: Redessiner une partie de la view. | | Entre: | | BRect frame: Rectagle qui a besoin d'etre redessine. | \*=============================================================================================*/ void ShrinkView::Draw(BRect updateRect) { BPoint pPointList[8]; //Utilise pour dessiner les polygone. rgb_color color = {0,0,0,0}; rgb_color colorHigh = {0,0,0,0}; SetDrawingMode(B_OP_COPY); if(m_pBmp) { uint32 * uiBits = (uint32*)m_pBmp->Bits(); uint32 uiColor = uiBits[141]; uint32 uiColorHigh = uiBits[289]; color.red = ( uiColor & 0xFF0000) / 0x10000; color.green = (uiColor & 0xFF00) / 0x100; color.blue = (uiColor & 0xFF) ; colorHigh.red = ( uiColorHigh & 0xFF0000) / 0x10000; colorHigh.green = (uiColorHigh & 0xFF00) / 0x100; colorHigh.blue = (uiColorHigh & 0xFF) ; } //if(updateRect.left < 10) { if(m_pBmp) { DrawBitmap(m_pBmp, BRect(140,15,147,15), BRect(Bounds().Width() - 7, 16, Bounds().Width(), Bounds().Height() - 7)); } } //if(updateRect.right > Bounds().Width()-10) { if(m_pBmp) { DrawBitmap(m_pBmp, BRect(140,14,147,14), BRect(0, 16, 7, Bounds().Height() - 7)); } } //Dessiner l'etiquette si necessaire. if(updateRect.top < 16 && updateRect.right >= 16) { if(m_pBmp) { if(m_bShrink && m_bMouseOver) { DrawBitmap(m_pBmp, BRect(80,0,95,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15)); DrawBitmap(m_pBmp, BRect(137,0,137,15), BRect(16, 0, Bounds().Width() - 15, 15)); } else if(m_bShrink) { DrawBitmap(m_pBmp, BRect(64,0,79,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15)); DrawBitmap(m_pBmp, BRect(136,0,136,15), BRect(16, 0, Bounds().Width() - 15, 15)); } else if(m_bMouseOver) { DrawBitmap(m_pBmp, BRect(112,0,127,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15)); DrawBitmap(m_pBmp, BRect(139,0,139,15), BRect(16, 0, Bounds().Width() - 15, 15)); } else { DrawBitmap(m_pBmp, BRect(96,0,111,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15)); DrawBitmap(m_pBmp, BRect(138,0,138,15), BRect(16, 0, Bounds().Width() - 15 , 15)); } SetFont(be_bold_font); if(m_bMouseOver) { SetHighColor(colorHigh); } else { SetHighColor(color); } SetDrawingMode(B_OP_OVER); DrawString(m_pzLabel, BPoint(18,12), NULL); SetDrawingMode(B_OP_COPY); } else { if(m_bShrink) { DrawDegrader(BRect(16,0,Bounds().Width(),4), 255, 192); DrawDegrader(BRect(16,11,Bounds().Width(),15), 192, 128); //Remplir le milieu de l'etiquette en gris SetHighColor(192, 192, 192, 0); FillRect(BRect(16, 5, Bounds().Width(), 10)); } else //Degrader du blanc au gris { DrawDegrader(BRect(16,0,Bounds().Width(),15), 255, 192); } SetFont(be_bold_font); SetHighColor(0, 0, 0, 0); SetDrawingMode(B_OP_OVER); DrawString(m_pzLabel, BPoint(18,12), NULL); } } //Redessiner le boutton si nessesaire. if(updateRect.left < 16 && updateRect.top < 16) { if(m_pBmp) { if(m_bShrink && m_bMouseOver) { DrawBitmap(m_pBmp, BRect(16,0,31,15), BRect(0,0,15,15)); } else if(m_bShrink) { DrawBitmap(m_pBmp, BRect(0,0,15,15), BRect(0,0,15,15)); } else if(m_bMouseOver) { DrawBitmap(m_pBmp, BRect(48,0,63,15), BRect(0,0,15,15)); } else { DrawBitmap(m_pBmp, BRect(32,0,47,15), BRect(0,0,15,15)); } } else { //Redessiner le degrader if(m_bShrink) { DrawDegrader(BRect(0, 0, 16, 4), 255, 192); DrawDegrader(BRect(0, 11, 16, 15), 192, 128); //Remplir le milieu de l'etiquette en gris SetHighColor(192, 192, 192, 0); FillRect(BRect(0, 5, 15, 10)); } else //Degrader du blanc au gris { DrawDegrader(BRect(0,0,15,15), 255, 192); } //Dessiner le Boutton si le curseur est au dessus du triangle. if( m_bMouseOver) { SetHighColor(64, 64, 64, 0); pPointList[0] = BPoint(1,3); pPointList[1] = BPoint(3,1); pPointList[2] = BPoint(12,1); pPointList[3] = BPoint(14,3); pPointList[4] = BPoint(14,12); pPointList[5] = BPoint(12,14); pPointList[6] = BPoint(3,14); pPointList[7] = BPoint(1,12); StrokePolygon(pPointList, 8, true, B_SOLID_HIGH); SetHighColor(255, 255, 255, 0); pPointList[0] = BPoint(2,12); pPointList[1] = BPoint(2,3); pPointList[2] = BPoint(3,2); pPointList[3] = BPoint(12,2); StrokePolygon(pPointList, 4, false, B_SOLID_HIGH); SetHighColor(192, 192, 192, 0); pPointList[0] = BPoint(3,3); pPointList[1] = BPoint(12,3); pPointList[2] = BPoint(12,12); pPointList[3] = BPoint(3,12); FillPolygon(pPointList, 4, B_SOLID_HIGH); SetHighColor(128, 128, 128, 0); pPointList[0] = BPoint(13,3); pPointList[1] = BPoint(13,12); pPointList[2] = BPoint(12,13); pPointList[3] = BPoint(3,13); StrokePolygon(pPointList, 4, false, B_SOLID_HIGH); } //Dessiner le triangle vers la droite. // La View est reduite. if(m_bShrink) { SetHighColor(0, 0, 0, 256); pPointList[0] = BPoint(9,7); pPointList[1] = BPoint(6,4); pPointList[2] = BPoint(6,11); pPointList[3] = BPoint(9,8); FillPolygon(pPointList, 4, B_SOLID_HIGH); } //Dessiner le triangle vers le bas. // La View est agrandi. else { SetHighColor(0, 0, 0, 256); pPointList[0] = BPoint(7,9); pPointList[1] = BPoint(4,6); pPointList[2] = BPoint(11,6); pPointList[3] = BPoint(8,9); FillPolygon(pPointList, 4, B_SOLID_HIGH); } } } //Redessiner le degrader du bas si necessaire if(!m_bShrink && updateRect.bottom > Bounds().Height() - 8) { if(m_pBmp) { DrawBitmap(m_pBmp, BRect(128,0,135,7), BRect(0,Bounds().Height()-7,7,Bounds().Height())); DrawBitmap(m_pBmp, BRect(128,8,135,15), BRect(Bounds().Width() - 7,Bounds().Height()-7,Bounds().Width(),Bounds().Height())); DrawBitmap(m_pBmp, BRect(140,0,140,7), BRect(8, Bounds().Height()-7, Bounds().Width() - 7, Bounds().Height())); } else { DrawDegrader(BRect(0,Bounds().bottom - 8,Bounds().Width(),Bounds().bottom), 192, 128); } } }//End of Draw.
bool wxSpinButton::Create( wxWindow* pParent , wxWindowID vId , const wxPoint& rPos , const wxSize& rSize , long lStyle , const wxString& rsName ) { int nX = rPos.x; int nY = rPos.y; int nWidth = rSize.x; int nHeight = rSize.y; SWP vSwp; m_min = 0; m_max = 100; if (vId == -1) m_windowId = NewControlId(); else m_windowId = vId; if (pParent) { m_backgroundColour = pParent->GetBackgroundColour(); m_foregroundColour = pParent->GetForegroundColour(); } SetName(rsName); SetParent(pParent); m_windowStyle = lStyle; // // Get the right size for the control // if (nWidth <= 0 || nHeight <= 0 ) { wxSize vSize = DoGetBestSize(); if (nWidth <= 0 ) nWidth = vSize.x; if (nHeight <= 0 ) nHeight = vSize.y; } if (nX < 0 ) nX = 0; if (nY < 0 ) nY = 0; long lSstyle = 0L; lSstyle = WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | // We use only single field spin buttons SPBS_NUMERICONLY; // We default to numeric data if (m_windowStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) ,WC_SPINBUTTON ,(PSZ)NULL ,lSstyle ,0L, 0L, 0L, 0L ,GetWinHwnd(pParent) ,HWND_TOP ,(HMENU)vId ,NULL ,NULL ); if (m_hWnd == 0) { return FALSE; } SetRange(m_min, m_max); if(pParent) pParent->AddChild((wxSpinButton *)this); ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y-5); // compensate for the associated TextControl border SetFont(*wxSMALL_FONT); // // For OS/2 we want to hide the text portion so we can substitute an // independent text ctrl in its place. // Therefore we must override any user given width with our best guess. // SetSize( nX - GetXComp() ,nY - GetYComp() ,nWidth ,nHeight ); wxAssociateWinWithHandle( m_hWnd ,(wxWindowOS2*)this ); #if 0 // FIXME: // Apparently, this does not work, as it crashes in setvalue/setrange calls // What's it supposed to do anyway? ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc); #endif return TRUE; } // end of wxSpinButton::Create
void CLabelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { if( _tcscmp(pstrName, _T("align")) == 0 ) { if( _tcsstr(pstrValue, _T("left")) != NULL ) { m_uTextStyle &= ~(DT_CENTER | DT_RIGHT | DT_SINGLELINE); m_uTextStyle |= DT_LEFT; } if( _tcsstr(pstrValue, _T("center")) != NULL ) { m_uTextStyle &= ~(DT_LEFT | DT_RIGHT ); m_uTextStyle |= DT_CENTER; } if( _tcsstr(pstrValue, _T("right")) != NULL ) { m_uTextStyle &= ~(DT_LEFT | DT_CENTER | DT_SINGLELINE); m_uTextStyle |= DT_RIGHT; } } else if (_tcscmp(pstrName, _T("valign")) == 0) { if (_tcsstr(pstrValue, _T("top")) != NULL) { m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER); m_uTextStyle |= (DT_TOP | DT_SINGLELINE); } if (_tcsstr(pstrValue, _T("vcenter")) != NULL) { m_uTextStyle &= ~(DT_TOP | DT_BOTTOM); m_uTextStyle |= (DT_VCENTER | DT_SINGLELINE); } if (_tcsstr(pstrValue, _T("bottom")) != NULL) { m_uTextStyle &= ~(DT_TOP | DT_VCENTER); m_uTextStyle |= (DT_BOTTOM | DT_SINGLELINE); } } else if( _tcscmp(pstrName, _T("endellipsis")) == 0 ) { if( _tcscmp(pstrValue, _T("true")) == 0 ) m_uTextStyle |= DT_END_ELLIPSIS; else m_uTextStyle &= ~DT_END_ELLIPSIS; } else if( _tcscmp(pstrName, _T("font")) == 0 ) SetFont(_ttoi(pstrValue)); else if( _tcscmp(pstrName, _T("textcolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetTextColor(clrColor); } else if( _tcscmp(pstrName, _T("disabledtextcolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetDisabledTextColor(clrColor); } else if( _tcscmp(pstrName, _T("textpadding")) == 0 ) { RECT rcTextPadding = { 0 }; LPTSTR pstr = NULL; rcTextPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetTextPadding(rcTextPadding); } else if( _tcscmp(pstrName, _T("showhtml")) == 0 ) SetShowHtml(_tcscmp(pstrValue, _T("true")) == 0); else if( _tcscmp(pstrName, _T("enabledeffect")) == 0 ) SetEnabledEffect(_tcscmp(pstrValue, _T("true")) == 0); else if( _tcscmp(pstrName, _T("enabledluminous")) == 0 ) SetEnabledLuminous(_tcscmp(pstrValue, _T("true")) == 0); else if( _tcscmp(pstrName, _T("luminousfuzzy")) == 0 ) SetLuminousFuzzy((float)_tstof(pstrValue)); else if( _tcscmp(pstrName, _T("gradientangle")) == 0 ) SetGradientAngle(_ttoi(pstrValue)); else if( _tcscmp(pstrName, _T("enabledstroke")) == 0 ) SetEnabledStroke(_tcscmp(pstrValue, _T("true")) == 0); else if( _tcscmp(pstrName, _T("enabledshadow")) == 0 ) SetEnabledShadow(_tcscmp(pstrValue, _T("true")) == 0); else if( _tcscmp(pstrName, _T("gradientlength")) == 0 ) SetGradientLength(_ttoi(pstrValue)); else if( _tcscmp(pstrName, _T("shadowoffset")) == 0 ){ LPTSTR pstr = NULL; int offsetx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); int offsety = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetShadowOffset(offsetx,offsety); } else if( _tcscmp(pstrName, _T("textcolor1")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetTextColor1(clrColor); } else if( _tcscmp(pstrName, _T("textshadowcolora")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetTextShadowColorA(clrColor); } else if( _tcscmp(pstrName, _T("textshadowcolorb")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetTextShadowColorB(clrColor); } else if( _tcscmp(pstrName, _T("strokecolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetStrokeColor(clrColor); } else CControlUI::SetAttribute(pstrName, pstrValue); }
bool wxTextCtrl::Create( wxWindow* pParent , wxWindowID vId , const wxString& rsValue , const wxPoint& rPos , const wxSize& rSize , long lStyle , const wxValidator& rValidator , const wxString& rsName ) { // // Base initialization // if ( !CreateBase( pParent ,vId ,rPos ,rSize ,lStyle ,rValidator ,rsName )) return false; wxPoint vPos = rPos; // The OS/2 position SWP vSwp; if (pParent ) { pParent->AddChild(this); } m_windowStyle = lStyle; m_bIsMLE = false; m_bSkipUpdate = false; long lSstyle = WS_VISIBLE | WS_TABSTOP; // // Single and multiline edit fields are two different controls in PM // if ( m_windowStyle & wxTE_MULTILINE ) { lSstyle |= MLS_BORDER | MLS_WORDWRAP; m_bIsMLE = true; if ((m_windowStyle & wxTE_NO_VSCROLL) == 0) lSstyle |= MLS_VSCROLL; if (m_windowStyle & wxHSCROLL) lSstyle |= MLS_HSCROLL; if (m_windowStyle & wxTE_READONLY) lSstyle |= MLS_READONLY; } else { lSstyle |= ES_LEFT | ES_AUTOSCROLL | ES_MARGIN; if (m_windowStyle & wxHSCROLL) lSstyle |= ES_AUTOSCROLL; if (m_windowStyle & wxTE_READONLY) lSstyle |= ES_READONLY; if (m_windowStyle & wxTE_PASSWORD) // hidden input lSstyle |= ES_UNREADABLE; } if (m_bIsMLE) { m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_MLE // Window class ,(PSZ)rsValue.c_str() // Initial Text ,(ULONG)lSstyle // Style flags ,(LONG)0 // X pos of origin ,(LONG)0 // Y pos of origin ,(LONG)0 // field width ,(LONG)0 // field height ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent ,HWND_TOP // initial z position ,(ULONG)vId // Window identifier ,NULL // no control data ,NULL // no Presentation parameters ); } else { m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_ENTRYFIELD // Window class ,(PSZ)rsValue.c_str() // Initial Text ,(ULONG)lSstyle // Style flags ,(LONG)0 // X pos of origin ,(LONG)0 // Y pos of origin ,(LONG)0 // field width ,(LONG)0 // field height ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent ,HWND_TOP // initial z position ,(ULONG)vId // Window identifier ,NULL // no control data ,NULL // no Presentation parameters ); } if (m_hWnd == 0) { return false; } SubclassWin(GetHWND()); // // Set font, position, size and initial value // wxFont* pTextFont = new wxFont( 8 ,wxMODERN ,wxNORMAL ,wxNORMAL ); SetFont(*pTextFont); if (!rsValue.empty()) { SetValue(rsValue); } SetupColours(); // // If X and/or Y are not zero the difference is the compensation value // for margins for OS/2 controls. // ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y); SetSize( vPos.x - GetXComp() ,vPos.y - GetYComp() ,rSize.x ,rSize.y ); delete pTextFont; return true; } // end of wxTextCtrl::Create
static MRESULT EXPENTRY AttachStatProc(HWND hwnd, ULONG message, MPARAM mp1, MPARAM mp2) { extern WINDOWPOSITIONS windowpositions; extern WINDOWCOLORS windowcolors; extern WINDOWFONTS windowfonts; extern HWND frame; extern HWND hwndhelp; PCHECKATPAR pCheckPar=NULL; PFIELDINFO pFieldInfo, pFirstFieldInfo; FIELDINFOINSERT FieldInfoInsert; CNRINFO CnrInfo; PATTACHRECORD pRecord, pFirstRecord; RECORDINSERT RecordInsert; HWND hwndCnr; PFILELIST pTemp; static char pchTitleFile[50]; static char pchTitleSize[50]; static char pchTitleStatus[50]; static char pchOK[50]; static char pchNotFound[50]; switch(message) { case WM_INITDLG: pCheckPar=(PCHECKATPAR) mp2; LoadString(IDST_ATT_TITLEFILE, 50, pchTitleFile); LoadString(IDST_ATT_TITLESIZE, 50, pchTitleSize); LoadString(IDST_ATT_TITLESTATUS, 50, pchTitleStatus); LoadString(IDST_ATT_OK, 50, pchOK); LoadString(IDST_ATT_NOTF, 50, pchNotFound); WinAssociateHelpInstance(hwndhelp, hwnd); hwndCnr=WinWindowFromID(hwnd, IDD_ATTACHSTAT+2); OldAttachContainerProc=WinSubclassWindow(hwndCnr, NewAttachContainerProc); SetFont(hwndCnr, windowfonts.attachfont); SetForeground(hwndCnr, &windowcolors.attachfore); SetBackground(hwndCnr, &windowcolors.attachback); /* Felder des Containers vorbereiten */ pFirstFieldInfo=(PFIELDINFO)SendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(3), NULL); pFieldInfo=pFirstFieldInfo; pFieldInfo->cb=sizeof(FIELDINFO); pFieldInfo->flData=CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR; pFieldInfo->flTitle=0; pFieldInfo->pTitleData= pchTitleFile; pFieldInfo->offStruct= FIELDOFFSET(ATTACHRECORD, pchFileName); pFieldInfo=pFieldInfo->pNextFieldInfo; pFieldInfo->cb=sizeof(FIELDINFO); pFieldInfo->flData=CFA_ULONG | CFA_HORZSEPARATOR | CFA_SEPARATOR | CFA_RIGHT; pFieldInfo->flTitle=0; pFieldInfo->pTitleData= pchTitleSize; pFieldInfo->offStruct= FIELDOFFSET(ATTACHRECORD, ulSize); pFieldInfo=pFieldInfo->pNextFieldInfo; pFieldInfo->cb=sizeof(FIELDINFO); pFieldInfo->flData=CFA_STRING | CFA_HORZSEPARATOR | CFA_SEPARATOR | CFA_CENTER; pFieldInfo->flTitle=0; pFieldInfo->pTitleData= pchTitleStatus; pFieldInfo->offStruct= FIELDOFFSET(ATTACHRECORD, pchStatus); /* Felder des Containers einfuegen */ FieldInfoInsert.cb=sizeof(FIELDINFOINSERT); FieldInfoInsert.pFieldInfoOrder=(PFIELDINFO) CMA_FIRST; FieldInfoInsert.fInvalidateFieldInfo=TRUE; FieldInfoInsert.cFieldInfoInsert=3; SendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, pFirstFieldInfo, &FieldInfoInsert); /* Container-Attribute setzen */ CnrInfo.cb=sizeof(CNRINFO); CnrInfo.pFieldInfoLast=NULL; CnrInfo.flWindowAttr=CV_DETAIL | CA_DETAILSVIEWTITLES; CnrInfo.xVertSplitbar=0; SendMsg(hwndCnr, CM_SETCNRINFO, &CnrInfo, MPFROMLONG(CMA_FLWINDOWATTR)); /* Elemente einfuegen */ pFirstRecord=(PATTACHRECORD)SendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(sizeof(ATTACHRECORD)-sizeof(MINIRECORDCORE)), MPFROMLONG(pCheckPar->ulCountRecords)); pRecord=pFirstRecord; pTemp=pCheckPar->pFileList; while(pTemp) { pRecord->pchFileName=pTemp->pchFileName; pRecord->ulSize=pTemp->ulSize; if (pTemp->bFound) pRecord->pchStatus = pchOK; else pRecord->pchStatus = pchNotFound; pRecord=(PATTACHRECORD)pRecord->RecordCore.preccNextRecord; pTemp=pTemp->next; } RecordInsert.cb=sizeof(RECORDINSERT); RecordInsert.pRecordOrder=(PRECORDCORE) CMA_FIRST; RecordInsert.pRecordParent=NULL; RecordInsert.fInvalidateRecord=TRUE; RecordInsert.zOrder=CMA_TOP; RecordInsert.cRecordsInsert=pCheckPar->ulCountRecords; SendMsg(hwndCnr, CM_INSERTRECORD, pFirstRecord, &RecordInsert); RestoreWinPos(hwnd, &windowpositions.attachpos, FALSE, TRUE); break; case WM_DESTROY: QueryWinPos(hwnd, &windowpositions.attachpos); QueryFont(WinWindowFromID(hwnd, IDD_ATTACHSTAT+2), windowfonts.attachfont); QueryForeground(WinWindowFromID(hwnd, IDD_ATTACHSTAT+2), &windowcolors.attachfore); QueryBackground(WinWindowFromID(hwnd, IDD_ATTACHSTAT+2), &windowcolors.attachback); WinAssociateHelpInstance(hwndhelp, frame); break; default: break; } return WinDefDlgProc(hwnd, message, mp1, mp2); }
bool wxChoice::CreateAndInit(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name) { if ( !(style & wxSP_VERTICAL) ) style |= wxSP_HORIZONTAL; if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) style |= wxBORDER_SIMPLE; style |= wxSP_ARROW_KEYS; SetWindowStyle(style); WXDWORD exStyle = 0; WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; wxSize sizeText(size), sizeBtn(size); sizeBtn.x = GetBestSpinnerSize(IsVertical(style)).x; if ( sizeText.x == wxDefaultCoord ) { // DEFAULT_ITEM_WIDTH is the default width for the text control sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; if ( sizeText.x <= 0 ) { wxLogDebug(wxT("not enough space for wxSpinCtrl!")); } wxPoint posBtn(pos); posBtn.x += sizeText.x + MARGIN_BETWEEN; // we must create the list control before the spin button for the purpose // of the dialog navigation: if there is a static text just before the spin // control, activating it by Alt-letter should give focus to the text // control, not the spin and the dialog navigation code will give focus to // the next control (at Windows level), not the one after it // create the text window m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border wxT("LISTBOX"), // window class NULL, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) GetHwndOf(parent), // parent (HMENU)-1, // control id wxGetInstance(), // app instance NULL // unused client data ); if ( !m_hwndBuddy ) { wxLogLastError(wxT("CreateWindow(buddy text window)")); return false; } // initialize wxControl if ( !CreateControl(parent, id, posBtn, sizeBtn, style, validator, name) ) return false; // now create the real HWND WXDWORD spiner_style = WS_VISIBLE | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_EXPANDABLE; if ( !IsVertical(style) ) spiner_style |= UDS_HORZ; if ( style & wxSP_WRAP ) spiner_style |= UDS_WRAP; if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxEmptyString, 0) ) return false; // subclass the text ctrl to be able to intercept some events wxSetWindowUserData(GetBuddyHwnd(), this); m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyChoiceWndProc); // set up fonts and colours (This is nomally done in MSWCreateControl) InheritAttributes(); if (!m_hasFont) SetFont(GetDefaultAttributes().font); // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } SetInitialSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); // associate the list window with the spin button (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0); // do it after finishing with m_hwndBuddy creation to avoid generating // initial wxEVT_TEXT message ms_allChoiceSpins.Add(this); // initialize the controls contents for ( int i = 0; i < n; i++ ) { Append(choices[i]); } return true; }
/***************************************************************************** * void CreateSecurityScreen(void) *****************************************************************************/ void CreateSecurityScreen(void) { GOL_SCHEME *currentScheme; currentScheme = GFX_SchemeGetCurrentScheme(); CreatePanelScreen(); // This adds the widgets seen on the left of the screen SetState(GOLFindObject(PANEL_SCREEN_ID_SECURITY_BUT), BTN_DISABLED); if(GetState(GOLFindObject(PANEL_SCREEN_ID_COMFORT_BUT),BTN_DISABLED)) { ClrState(GOLFindObject(PANEL_SCREEN_ID_COMFORT_BUT), BTN_DISABLED); SetState(GOLFindObject(PANEL_SCREEN_ID_COMFORT_BUT),BTN_DRAW); } if(GetState(GOLFindObject(PANEL_SCREEN_ID_LIGHTING_BUT),BTN_DISABLED)) { ClrState(GOLFindObject(PANEL_SCREEN_ID_LIGHTING_BUT), BTN_DISABLED); SetState(GOLFindObject(PANEL_SCREEN_ID_LIGHTING_BUT),BTN_DRAW); } if(GetState(GOLFindObject(PANEL_SCREEN_ID_ENERGY_USAGE_BUT),BTN_DISABLED)) { ClrState(GOLFindObject(PANEL_SCREEN_ID_ENERGY_USAGE_BUT), BTN_DISABLED); SetState(GOLFindObject(PANEL_SCREEN_ID_ENERGY_USAGE_BUT),BTN_DRAW); } SetFont((void *) &FONTDEFAULT); SetColor(WHITE); OutTextXY(SECURITY_EB_ORIGIN_X + 70,SECURITY_EB_ORIGIN_Y -25, (XCHAR *)EnterPINStr); OutTextXY(SECURITY_BUTTON_ORIGIN,SECURITY_EB_ORIGIN_Y -25, (XCHAR *)SecurityOptionsStr); BtnCreate //Disarmed ( SERCURITY_SCREEN_ID_DISARMED_BUT, // button ID SECURITY_BUTTON_ORIGIN, SECURITY_EB_ORIGIN_Y, SECURITY_BUTTON_ORIGIN + (SECURITY_KEYSIZEX << 1), SECURITY_EB_ORIGIN_Y + 1 * SECURITY_KEYSIZEY, // dimension 5, // set radius BTN_DRAW, // draw a beveled button NULL, // no bitmap (XCHAR *)DisarmedStr, // "Button", // text currentScheme ); BtnCreate //Armed ( SERCURITY_SCREEN_ID_ARMED_BUT, // button ID SECURITY_BUTTON_ORIGIN, SECURITY_EB_ORIGIN_Y + 1 * SECURITY_KEYSIZEY + 3, SECURITY_BUTTON_ORIGIN + (SECURITY_KEYSIZEX << 1), SECURITY_EB_ORIGIN_Y + 2 * SECURITY_KEYSIZEY, // dimension 5, // set radius BTN_DRAW, // draw a beveled button NULL, // no bitmap (XCHAR *)ArmedStr, // "Button", // text currentScheme ); BtnCreate //Sleeping ( SERCURITY_SCREEN_ID_SLEEPING_BUT, // button ID SECURITY_BUTTON_ORIGIN, SECURITY_EB_ORIGIN_Y + 2 * SECURITY_KEYSIZEY +3, SECURITY_BUTTON_ORIGIN + (SECURITY_KEYSIZEX << 1), SECURITY_EB_ORIGIN_Y + 3 * SECURITY_KEYSIZEY, // dimension 5, // set radius BTN_DRAW, // draw a beveled button NULL, // no bitmap (XCHAR *)SleepingStr, // "Button", // text currentScheme ); BtnCreate //Vacation ( SERCURITY_SCREEN_ID_VACATION_BUT, // button ID SECURITY_BUTTON_ORIGIN, SECURITY_EB_ORIGIN_Y + 3 * SECURITY_KEYSIZEY +3, SECURITY_BUTTON_ORIGIN + (SECURITY_KEYSIZEX << 1), SECURITY_EB_ORIGIN_Y + 4 * SECURITY_KEYSIZEY, // dimension 5, // set radius BTN_DRAW, // draw a beveled button NULL, // no bitmap (XCHAR *)VacationStr, // "Button", // text currentScheme ); BtnCreate //Entertaining ( SERCURITY_SCREEN_ID_ENTERTAINING_BUT, // button ID SECURITY_BUTTON_ORIGIN, SECURITY_EB_ORIGIN_Y + 4 * SECURITY_KEYSIZEY +3, SECURITY_BUTTON_ORIGIN + (SECURITY_KEYSIZEX << 1), SECURITY_EB_ORIGIN_Y + 5 * SECURITY_KEYSIZEY, // dimension 5, // set radius BTN_DRAW, // draw a beveled button NULL, // no bitmap (XCHAR *)EntertainingStr, // "Button", // text currentScheme ); EbCreate ( SERCURITY_SCREEN_ID_CODE_EDIT_BOX, // ID SECURITY_KEYSTARTX+5, SECURITY_KEYSTARTY + 1, SECURITY_KEYSTARTX + (3 * SECURITY_KEYSIZEX)-5, SECURITY_KEYSTARTY + 1 * SECURITY_KEYSIZEY - GOL_EMBOSS_SIZE, // dimension EB_DRAW | EB_CARET | EB_FOCUSED, // will be dislayed after creation NULL, 17, currentScheme ); // default GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_0_BUT, // ID SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 4 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 5 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[0], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_1_BUT, // ID SECURITY_KEYSTARTX + 0 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 1 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 2 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[1], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_2_BUT, // ID SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 1 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 2 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[2], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_3_BUT, // ID SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 1 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 3 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 2 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[3], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_4_BUT, // ID SECURITY_KEYSTARTX + 0 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 2 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 3 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[4], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_5_BUT, // ID SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 2 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 3 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[5], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_6_BUT, // ID SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 2 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 3 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 3 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[6], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_7_BUT, // ID SECURITY_KEYSTARTX + 0 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 3 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 4 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[7], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_8_BUT, // ID SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 3 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 4 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[8], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_KEYPAD_9_BUT, // ID SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 3 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 3 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 4 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap padNumbers[9], // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_CLEAR_BUT, // ID SECURITY_KEYSTARTX + 0 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 4 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 1 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 5 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap (XCHAR *)ClearStr, // text currentScheme ); // alternative GOL scheme BtnCreate ( SERCURITY_SCREEN_ID_ENTER_BUT, // ID SECURITY_KEYSTARTX + 2 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 4 * SECURITY_KEYSIZEY, SECURITY_KEYSTARTX + 3 * SECURITY_KEYSIZEX, SECURITY_KEYSTARTY + 5 * SECURITY_KEYSIZEY, // dimension 5, BTN_DRAW, // will be dislayed after creation NULL, // no bitmap (XCHAR *)EnterStr, // text currentScheme ); // alternative GOL scheme }
void WinEDA_PlotPSFrame::CreateControls() { SetFont(*g_DialogFont); ////@begin WinEDA_PlotPSFrame content construction // Generated by DialogBlocks, 04/02/2006 17:30:50 (unregistered) WinEDA_PlotPSFrame* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxString m_SizeOptionStrings[] = { _("Auto"), _("Page Size A4"), _("Page Size A") }; m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, 3, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer3->Add(m_SizeOption, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxString m_PlotPSColorOptionStrings[] = { _("B/W"), _("Color") }; m_PlotPSColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot Color:"), wxDefaultPosition, wxDefaultSize, 2, m_PlotPSColorOptionStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer3->Add(m_PlotPSColorOption, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL); itemBoxSizer3->Add(itemBoxSizer8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); wxButton* itemButton9 = new wxButton( itemDialog1, ID_PLOT_PS_CURRENT_EXECUTE, _("&Plot CURRENT"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton9->SetForegroundColour(wxColour(0, 128, 0)); itemBoxSizer8->Add(itemButton9, 0, wxGROW|wxALL, 5); wxButton* itemButton10 = new wxButton( itemDialog1, ID_PLOT_PS_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton10->SetForegroundColour(wxColour(179, 0, 0)); itemBoxSizer8->Add(itemButton10, 0, wxGROW|wxALL, 5); wxButton* itemButton11 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton11->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer8->Add(itemButton11, 0, wxGROW|wxALL, 5); m_Plot_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Plot_Sheet_Ref->SetValue(false); itemBoxSizer2->Add(m_Plot_Sheet_Ref, 0, wxALIGN_LEFT|wxALL, 5); wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE ); itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5); // Set validators m_SizeOption->SetValidator( wxGenericValidator(& PS_SizeSelect) ); m_PlotPSColorOption->SetValidator( wxGenericValidator(& g_PlotPSColorOpt) ); m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) ); ////@end WinEDA_PlotPSFrame content construction }
void HostInfoView::Draw(BRect rect) { BRect r = Bounds(); BRect iconRect(13.0, 5.0, 45.0, 37.0); rgb_color black = { 0, 0, 0, 255 }; rgb_color green = { 0, 255, 0, 255 }; rgb_color red = { 255, 0, 0, 255 }; rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color shadow = { 190, 190, 190, 255 }; char buf[50]; SetViewColor(gray); SetLowColor(shadow); r.right = 35; FillRect(r, B_SOLID_LOW); r = Bounds(); r.left = 35; SetLowColor(gray); FillRect(r, B_SOLID_LOW); if (ent) { SetHighColor(black); SetFont(be_bold_font); SetFontSize(14); MovePenTo(50, 25); DrawString(ent->h_name); } SetFont(be_plain_font); SetFontSize(10); MovePenTo(40, 50); DrawString("Aliases:"); MovePenTo(40, 140); DrawString("Known Addresses:"); SetFont(be_plain_font); SetFontSize(10); MovePenTo(40, 230); DrawString("System:"); MovePenTo(100, 230); if (hostInfo.cpus > 0) DrawString(hostInfo.system); MovePenTo(40,243); DrawString("Network:"); MovePenTo(100, 243); if (hostInfo.cpus > 0) DrawString(hostInfo.beServed); MovePenTo(40, 256); DrawString("Platform:"); MovePenTo(100, 256); if (hostInfo.cpus > 0) DrawString(hostInfo.platform); MovePenTo(40, 269); DrawString("Processors:"); MovePenTo(100, 269); if (hostInfo.cpus > 0) { sprintf(buf, "%ld", hostInfo.cpus); DrawString(buf); } if (hostInfo.cpus > 0) { double pct = hostInfo.connections * 100.0 / hostInfo.maxConnections; sprintf(buf, "%ld of %ld total", hostInfo.connections, hostInfo.maxConnections); status->SetMaxValue(hostInfo.maxConnections); status->Reset(); status->Update(hostInfo.connections, "Connections", buf); status->SetBarColor(pct < 90.0 ? green : red); } SetDrawingMode(B_OP_ALPHA); SetHighColor(0, 0, 0, 180); SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE); DrawBitmap(icon, iconRect); }
bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style, int min, int max, int initial, const wxString& name) { // before using DoGetBestSize(), have to set style to let the base class // know whether this is a horizontal or vertical control (we're always // vertical) style |= wxSP_VERTICAL; if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) #ifdef __WXWINCE__ style |= wxBORDER_SIMPLE; #else style |= wxBORDER_SUNKEN; #endif SetWindowStyle(style); WXDWORD exStyle = 0; WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; // Scroll text automatically if there is not enough space to show all of // it, this is better than not allowing to enter more digits at all. msStyle |= ES_AUTOHSCROLL; // propagate text alignment style to text ctrl if ( style & wxALIGN_RIGHT ) msStyle |= ES_RIGHT; else if ( style & wxALIGN_CENTER ) msStyle |= ES_CENTER; // calculate the sizes: the size given is the total size for both controls // and we need to fit them both in the given width (height is the same) wxSize sizeText(size), sizeBtn(size); sizeBtn.x = wxSpinButton::DoGetBestSize().x; if ( sizeText.x <= 0 ) { // DEFAULT_ITEM_WIDTH is the default width for the text control sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; if ( sizeText.x <= 0 ) { wxLogDebug(wxS("wxSpinCtrl \"%s\": initial width %d is too small, ") wxS("at least %d pixels needed."), name, size.x, sizeBtn.x + MARGIN_BETWEEN + 1); } wxPoint posBtn(pos); posBtn.x += sizeText.x + MARGIN_BETWEEN; // we must create the text control before the spin button for the purpose // of the dialog navigation: if there is a static text just before the spin // control, activating it by Alt-letter should give focus to the text // control, not the spin and the dialog navigation code will give focus to // the next control (at Windows level), not the one after it // create the text window m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border wxT("EDIT"), // window class NULL, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) GetHwndOf(parent), // parent (HMENU)-1, // control id wxGetInstance(), // app instance NULL // unused client data ); if ( !m_hwndBuddy ) { wxLogLastError(wxT("CreateWindow(buddy text window)")); return false; } // create the spin button if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) ) { return false; } wxSpinButtonBase::SetRange(min, max); // subclass the text ctrl to be able to intercept some events gs_spinForTextCtrl[GetBuddyHwnd()] = this; m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextWndProc); // set up fonts and colours (This is nomally done in MSWCreateControl) InheritAttributes(); if (!m_hasFont) SetFont(GetDefaultAttributes().font); // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } SetInitialSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); // associate the text window with the spin button (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0); // If the initial text value is actually a number, it overrides the // "initial" argument specified later. long initialFromText; if ( value.ToLong(&initialFromText) ) initial = initialFromText; // Set the range in the native control: notice that we must do it before // calling SetValue() to use the correct validity checks for the initial // value. SetRange(min, max); SetValue(initial); // Also set the text part of the control if it was specified independently // but don't generate an event for this, it would be unexpected. m_blockEvent = true; if ( !value.empty() ) SetValue(value); m_blockEvent = false; return true; }
/* This expects a cstring. Draws to the current port*/ void _draw_screen_text( char *text, screen_rectangle *destination, short flags, short font_id, short text_color) { TextSpec old_font; short x, y; RGBColor old_color, new_color; char text_to_draw[256]; assert(font_id>=0 && font_id<NUMBER_OF_INTERFACE_FONTS); GetFont(&old_font); SetFont(&interface_fonts.fonts[font_id]); GetForeColor(&old_color); _get_interface_color(text_color, &new_color); RGBForeColor(&new_color); /* Copy the text to draw.. */ strcpy(text_to_draw, text); /* Check for wrapping, and if it occurs, be recursive... */ if(flags & _wrap_text) { /*еее WHAT IS THE INTERNATIONALIZED WAY OF DETERMINING NON-PRINTING CHARACTERS? IE SPACES? */ short last_non_printing_character; short text_width; short count= 0; text_width= 0; last_non_printing_character= 0; count= 0; while(count<strlen(text_to_draw) && text_width<RECTANGLE_WIDTH(destination)) { text_width+= CharWidth(text_to_draw[count]); if(text_to_draw[count]==' ') last_non_printing_character= count; count++; } if(count!=strlen(text_to_draw)) { char remaining_text_to_draw[256]; screen_rectangle new_destination; /* If we ever have to wrap text, we can't also center vertically. Sorry */ flags &= ~_center_vertical; flags |= _top_justified; /* Pass the rest of it back in, recursively, on the next line.. */ BlockMove(&text_to_draw[last_non_printing_character+1], remaining_text_to_draw, strlen(&text_to_draw[last_non_printing_character+1])+1); new_destination= *destination; new_destination.top+= interface_fonts.line_spacing[font_id]; _draw_screen_text(remaining_text_to_draw, &new_destination, flags, font_id, text_color); /* now truncate our text to draw...*/ text_to_draw[last_non_printing_character]= 0; } } /* Handle the horizontal stuff. */ if(flags & _center_horizontal || flags & _right_justified) { short text_width; text_width= TextWidth(text_to_draw, 0, strlen(text_to_draw)); if(text_width>RECTANGLE_WIDTH(destination)) { short length; short trunc_code; /* Truncate the puppy.. */ x= destination->left; length= strlen(text); trunc_code= TruncText(RECTANGLE_WIDTH(destination), text_to_draw, &length, truncEnd); text_to_draw[length]= 0; /* Now recenter it.. */ text_width= TextWidth(text_to_draw, 0, strlen(text_to_draw)); if (flags & _center_horizontal) x= destination->left+(((destination->right-destination->left)-text_width)>>1); else
BOOL CFavUrlMenuDlg::OnInitDialog() { CDialog::OnInitDialog(); SetFont(&m_font); if (m_bAddFav) { ITEM item; item.type = ITEM_TYPE_BTN_ADD; item.strName = "添加到收藏夹"; item.strPath = m_strParentPath; m_arrItems.Add(item); item.type = ITEM_TYPE_SEPARATOR; m_arrItems.Add(item); GetUrls(m_strParentPath, m_arrItems); }else { ITEM item; item.type = ITEM_TYPE_BTN_OPEN; item.strName = "打开"; item.strPath = m_strParentPath; m_arrItems.Add(item); item.type = ITEM_TYPE_BTN_REMOE; item.strName = "删除"; item.strPath = m_strParentPath; m_arrItems.Add(item); } // 获取最长字符串所占宽度 CClientDC dc(this); int nTextWidthMax = 0; CSize size; dc.SelectObject(&m_font); for (INT_PTR i=0; i<m_arrItems.GetSize(); i++) { CString strText = m_arrItems.GetAt(i).strName; size = dc.GetTextExtent(strText); if (size.cx > nTextWidthMax) nTextWidthMax = size.cx; } nTextWidthMax = nTextWidthMax < 90 ? nTextWidthMax+100: nTextWidthMax+30; size.cx = nTextWidthMax; m_rctFirsItem = CRect(CPoint(m_nBorderWidth, m_nBorderWidth), CSize(size.cx+m_nSpacingHeigth*2, size.cy+m_nSpacingHeigth)); m_rctFirsItem.top += 6; m_rctFirsItem.bottom +=10; CRect rctWnd(0, 0, 0, 0); rctWnd.right = m_nBorderWidth*2 + m_rctFirsItem.Width(); rctWnd.bottom= m_nBorderWidth*2 + m_rctFirsItem.Height()*m_arrItems.GetSize() ; if (m_nBorderWidth % 2) { rctWnd.right += 2; rctWnd.bottom += 2; } dc.BeginPath(); dc.RoundRect(rctWnd, CPoint(m_nBorderWidth, m_nBorderWidth)); dc.EndPath(); HRGN hRgn = PathToRegion(dc.m_hDC); SetWindowRgn(hRgn, FALSE); GetRgnBox(hRgn, &rctWnd); SetWindowPos(NULL, 0, 0, rctWnd.Width(), rctWnd.Height(), SWP_NOMOVE); return TRUE; // 除非设置了控件的焦点,否则返回 TRUE }
void CSysButtonUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { if(_tcscmp(pstrName, _T("font")) == 0) SetFont(_ttoi(pstrValue)); else __super::SetAttribute(pstrName, pstrValue); }
bool wxControl::MSWCreateControl(const wxChar *classname, WXDWORD style, const wxPoint& pos, const wxSize& size, const wxString& label, WXDWORD exstyle) { // if no extended style given, determine it ourselves if ( exstyle == (WXDWORD)-1 ) { exstyle = 0; (void) MSWGetStyle(GetWindowStyle(), &exstyle); } // all controls should have this style style |= WS_CHILD; // create the control visible if it's currently shown for wxWidgets if ( m_isShown ) { style |= WS_VISIBLE; } // choose the position for the control: we have a problem with default size // here as we can't calculate the best size before the control exists // (DoGetBestSize() may need to use m_hWnd), so just choose the minimal // possible but non 0 size because 0 window width/height result in problems // elsewhere int x = pos.x == wxDefaultCoord ? 0 : pos.x, y = pos.y == wxDefaultCoord ? 0 : pos.y, w = size.x == wxDefaultCoord ? 1 : size.x, h = size.y == wxDefaultCoord ? 1 : size.y; // ... and adjust it to account for a possible parent frames toolbar AdjustForParentClientOrigin(x, y); m_hWnd = (WXHWND)::CreateWindowEx ( exstyle, // extended style classname, // the kind of control to create label.t_str(), // the window name style, // the window style x, y, w, h, // the window position and size GetHwndOf(GetParent()), // parent (HMENU)wxUIntToPtr(GetId()), // child id wxGetInstance(), // app instance NULL // creation parameters ); if ( !m_hWnd ) { wxLogLastError(wxString::Format ( wxT("CreateWindowEx(\"%s\", flags=%08lx, ex=%08lx)"), classname, style, exstyle )); return false; } #if !wxUSE_UNICODE // Text labels starting with the character 0xff (which is a valid character // in many code pages) don't appear correctly as CreateWindowEx() has some // special treatment for this case, apparently the strings starting with -1 // are not really strings but something called "ordinals". There is no // documentation about it but the fact is that the label gets mangled or // not displayed at all if we don't do this, see #9572. // // Notice that 0xffff is not a valid Unicode character so the problem // doesn't arise in Unicode build. if ( !label.empty() && label[0] == -1 ) ::SetWindowText(GetHwnd(), label.t_str()); #endif // !wxUSE_UNICODE // saving the label in m_labelOrig to return it verbatim // later in GetLabel() m_labelOrig = label; // install wxWidgets window proc for this window SubclassWin(m_hWnd); // set up fonts and colours InheritAttributes(); if ( !m_hasFont ) { bool setFont = true; wxFont font = GetDefaultAttributes().font; // if we set a font for {list,tree}ctrls and the font size is changed in // the display properties then the font size for these controls doesn't // automatically adjust when they receive WM_SETTINGCHANGE // FIXME: replace the dynamic casts with virtual function calls!! #if wxUSE_LISTCTRL || wxUSE_TREECTRL bool testFont = false; #if wxUSE_LISTCTRL if ( wxDynamicCastThis(wxListCtrl) ) testFont = true; #endif // wxUSE_LISTCTRL #if wxUSE_TREECTRL if ( wxDynamicCastThis(wxTreeCtrl) ) testFont = true; #endif // wxUSE_TREECTRL if ( testFont ) { // not sure if we need to explicitly set the font here for Win95/NT4 // but we definitely can't do it for any newer version // see wxGetCCDefaultFont() in src/msw/settings.cpp for explanation // of why this test works // TODO: test Win95/NT4 to see if this is needed or breaks the // font resizing as it does on newer versions if ( font != wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) ) { setFont = false; } } #endif // wxUSE_LISTCTRL || wxUSE_TREECTRL if ( setFont ) { SetFont(GetDefaultAttributes().font); } } // set the size now if no initial size specified SetInitialSize(size); return true; }
int SurfaceImpl::Descent(Font &font) { SetFont(font); int w, h, d, e; hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e); return d; }
bool wxComboBox::Create( wxWindow* pParent , wxWindowID vId , const wxString& rsValue , const wxPoint& rPos , const wxSize& rSize , int n , const wxString asChoices[] , long lStyle , const wxValidator& rValidator , const wxString& rsName ) { m_isShown = false; if (!CreateControl( pParent ,vId ,rPos ,rSize ,lStyle ,rValidator ,rsName )) return false; // // Get the right style // long lSstyle = 0L; lSstyle = WS_TABSTOP | WS_VISIBLE; if (lStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; if (lStyle & wxCB_READONLY) lSstyle |= CBS_DROPDOWNLIST; else if (lStyle & wxCB_SIMPLE) lSstyle |= CBS_SIMPLE; // A list (shown always) and edit control else lSstyle |= CBS_DROPDOWN; if (!OS2CreateControl( _T("COMBOBOX") ,lSstyle )) return false; // // A choice/combobox normally has a white background (or other, depending // on global settings) rather than inheriting the parent's background colour. // SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetFont(*wxSMALL_FONT); int i; for (i = 0; i < n; i++) { Append(asChoices[i]); } SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); if (!rsValue.empty()) { SetValue(rsValue); } gfnWndprocEdit = (WXFARPROC)::WinSubclassWindow( (HWND)GetHwnd() ,(PFNWP)wxComboEditWndProc ); ::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this); Show(true); return true; } // end of wxComboBox::Create
bool wxToolBar::Create( wxWindow* pParent, wxWindowID vId, const wxPoint& rPos, const wxSize& rSize, long lStyle, const wxString& rsName ) { if ( !wxWindow::Create( pParent ,vId ,rPos ,rSize ,lStyle ,rsName )) return false; // Set it to grey (or other 3D face colour) SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); SetFont(*wxSMALL_FONT); if (GetWindowStyleFlag() & (wxTB_LEFT | wxTB_RIGHT)) { m_vLastX = 7; m_vLastY = 3; m_maxRows = 32000; // a lot m_maxCols = 1; } else { m_vLastX = 3; m_vLastY = 7; m_maxRows = 1; m_maxCols = 32000; // a lot } SetCursor(*wxSTANDARD_CURSOR); // // The toolbar's tools, if they have labels and the winTB_TEXT // style is set, then we need to take into account the size of // the text when drawing tool bitmaps and the text // if (HasFlag(wxTB_TEXT)) { wxClientDC vDC(this); vDC.SetFont(GetFont()); vDC.GetTextExtent( wxT("XXXX") ,&m_vTextX ,&m_vTextY ); } // // Position it // int nX = rPos.x; int nY = rPos.y; int nWidth = rSize.x; int nHeight = rSize.y; if (lStyle & (wxTB_TOP | wxTB_BOTTOM)) { if (nWidth <= 0) { nWidth = pParent->GetClientSize().x; } if (nHeight <= 0) { if (lStyle & wxTB_TEXT) nHeight = m_defaultHeight + m_vTextY; else nHeight = m_defaultHeight; } } else { if (nHeight <= 0) { nHeight = pParent->GetClientSize().y; } if (nWidth <= 0) { if (lStyle & wxTB_TEXT) nWidth = m_vTextX + (int)(m_vTextX/2); // a little margin else nWidth = m_defaultWidth + (int)(m_defaultWidth/2); // a little margin } } if (nX < 0) nX = 0; if (nY < 0) nY = 0; SetSize( nX ,nY ,nWidth ,nHeight ); return true; } // end of wxToolBar::Create
void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLocators, UINT8 ubLevel, BOOLEAN fForce ) { UINT32 maincnt,markercnt,marker,tilesLeftToSee,cnt,prevmarker; INT32 Inc[6],Dir[6]; INT8 itemVisible = FALSE; INT8 Blocking,twoMoreTiles,markerDir; INT8 nextDir=0,AlreadySawItem=FALSE; UINT8 who; //,itemIndex; // for each square checked UINT8 dir,range,Path2; UINT8 ubRoomNo; BOOLEAN fCheckForRooms = FALSE; ITEM_POOL *pItemPool; BOOLEAN fHiddenStructVisible; UINT8 ubMovementCost; BOOLEAN fTravelCostObs; BOOLEAN fGoneThroughDoor = FALSE; BOOLEAN fThroughWindow = FALSE; BOOLEAN fItemsQuoteSaid = FALSE; UINT16 usIndex; BOOLEAN fRevealItems = TRUE; BOOLEAN fStopRevealingItemsAfterThisTile = FALSE; INT8 bTallestStructureHeight; INT32 iDoorGridNo; STRUCTURE * pStructure, *pDummy; INT8 bStructHeight; INT8 bThroughWindowDirection; if ( pSoldier->uiStatusFlags & SOLDIER_ENEMY ) { //pSoldier->needToLookForItems = FALSE; return; } if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) { return; } // Return if this guy has no gridno, has bad life, etc if( pSoldier->sGridNo == NOWHERE || !pSoldier->bInSector || pSoldier->bLife < OKLIFE ) { return; } if (pSoldier->bBlindedCounter > 0) { return; } gubGridNoValue++; if ( gubGridNoValue == 255 ) { // Reset! memset( gubGridNoMarkers, 0, sizeof( gubGridNoMarkers ) ); gubGridNoValue = 1; } // OK, look for doors MercLooksForDoors( pSoldier, TRUE ); who = pSoldier->ubID; dir = pSoldier->bDirection; //NumMessage("good old reveal",dir); // a gassed merc can only see 1 tile away due to blurred vision if ( pSoldier->uiStatusFlags & SOLDIER_GASSED ) { range = 1; } else { range = pSoldier->bViewRange; // balance item viewing range between normal and the limit set by opplist-type functions -- CJC range = (AdjustMaxSightRangeForEnvEffects( pSoldier, LightTrueLevel( pSoldier->sGridNo, pSoldier->bLevel), range ) + range) / 2; } BuildSightDir(dir,&Dir[0],&Dir[1],&Dir[2],&Dir[3],&Dir[4]); for (cnt = 0; cnt < 5; cnt++) Inc[cnt] = DirectionInc( (INT16)Dir[cnt]); // create gridno increment for NOVIEW - in other words, no increment! Inc[5] = 0; Dir[5] = pSoldier->bDirection; if (dir % 2 == 1) /* even numbers use ViewPath2 */ Path2 = TRUE; else Path2 = FALSE; // ATE: if in this special cercumstance... our guys are moving on their own... // Stop sighting items // IN the future, we may want to do something else here... if ( gTacticalStatus.uiFlags & OUR_MERCS_AUTO_MOVE ) { itemsToo = FALSE; } for (maincnt = 0; maincnt < MAXVIEWPATHS; maincnt++) { marker = pSoldier->sGridNo; Blocking = FALSE; twoMoreTiles = FALSE; tilesLeftToSee = 99; fRevealItems = TRUE; fStopRevealingItemsAfterThisTile = FALSE; #ifdef _DEBUG if ( _KeyDown( NUM_LOCK ) ) { memset( gubFOVDebugInfoInfo, 0, sizeof( gubFOVDebugInfoInfo ) ); SetRenderFlags( RENDER_FLAG_FULL ); RenderWorld( ); } #endif for (markercnt = 0; markercnt < range; markercnt++) { //fGoneThroughDoor = FALSE; //fThroughWindow = FALSE; prevmarker = marker; nextDir = 99; fCheckForRooms = FALSE; fTravelCostObs = FALSE; if ( fStopRevealingItemsAfterThisTile ) { fRevealItems = FALSE; fStopRevealingItemsAfterThisTile = FALSE; } if (Path2) { markerDir = ViewPath2[maincnt][markercnt]; if (markercnt < 12) nextDir = ViewPath2[maincnt][markercnt+1]; } else { markerDir = ViewPath[maincnt][markercnt]; if (markercnt < 12) nextDir = ViewPath[maincnt][markercnt+1]; } // OK, check flags for going through door/window last tile if ( fThroughWindow == 1 ) { // ATE: Make sure we are going through the same direction! // THis is to solve the drassen SAM problem with seeing through walls if ( Dir[markerDir] == bThroughWindowDirection) { fThroughWindow = 2; } else { fThroughWindow = 0; } } else if ( fThroughWindow == 2 ) { // We've overstayed our welcome - remove! fThroughWindow = 0; } if ( fGoneThroughDoor == 1 ) { fGoneThroughDoor = 2; } else if ( fGoneThroughDoor == 2 ) { // We've overstayed our welcome - remove! fGoneThroughDoor = 0; } //ATE CHECK FOR NOVIEW! if ( nextDir == NOVIEW ) { nextDir = 99; } marker = NewGridNo((INT16)marker,(INT16)Inc[markerDir]); if ( marker == 12426 ) { int i = 0; } // End if this is a no view... if ( markerDir == NOVIEW && markercnt != 0 ) { break; } #ifdef _DEBUG if ( _KeyDown( NUM_LOCK ) ) { int cnt = GetJA2Clock( ); gubFOVDebugInfoInfo[ marker ] = (UINT8)markercnt; StartFrameBufferRender(); RenderFOVDebug( ); SetFont( LARGEFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); mprintf( 10, 10 , L"%d", maincnt ); //mprintf( 10, 20 , L"%d", marker ); //mprintf( 50, 20 , L"%d", pSoldier->sGridNo ); InvalidateScreen( ); EndFrameBufferRender(); RefreshScreen( NULL ); do { } while( ( GetJA2Clock( ) - cnt ) < 250 ); } #endif // Check if we can get to this gridno from our direction in ubMovementCost = gubWorldMovementCosts[ marker ][ Dir[ markerDir ] ][ ubLevel ]; // ATE: Added: If our current sector is below ground, ignore any blocks! if ( gfCaves && ubMovementCost != TRAVELCOST_CAVEWALL ) { ubMovementCost = TRAVELCOST_FLAT; } if ( IS_TRAVELCOST_DOOR( ubMovementCost ) ) { ubMovementCost = DoorTravelCost( pSoldier, marker, ubMovementCost, (BOOLEAN) (pSoldier->bTeam == gbPlayerNum), &iDoorGridNo ); pStructure = FindStructure( (INT16) iDoorGridNo, STRUCTURE_ANYDOOR ); if ( pStructure != NULL && pStructure->fFlags & STRUCTURE_TRANSPARENT) { // cell door or somehow otherwise transparent; allow merc to see through ubMovementCost = TRAVELCOST_FLAT; } } // If we have hit an obstacle, STOP HERE if ( ubMovementCost >= TRAVELCOST_BLOCKED ) { // We have an obstacle here... // If it is bigger than a breadbox... err... taller than a man... // Then stop path altogether // otherwise just stop revealing items // CJC: only do this when the direction is horizontal; easier and faster to check // and the effect should still be good enough if ( ubMovementCost == TRAVELCOST_WALL || ubMovementCost == TRAVELCOST_DOOR || ubMovementCost == TRAVELCOST_EXITGRID ) { fTravelCostObs = TRUE; fRevealItems = FALSE; } else { // walls are handled above, so the blocking object is guaranteed not to be a wall bTallestStructureHeight = GetTallestStructureHeight( (INT16) marker, FALSE ); if (bTallestStructureHeight >= 3) { fTravelCostObs = TRUE; fStopRevealingItemsAfterThisTile = TRUE; } else if ( bTallestStructureHeight != 0 ) { // stop revealing items after this tile but keep going fStopRevealingItemsAfterThisTile = TRUE; } } if ( (Dir[markerDir] % 2) == 1 ) { // diagonal fTravelCostObs = TRUE; // cheap hack... don't reveal items fRevealItems = FALSE; } else { bTallestStructureHeight = GetTallestStructureHeight( (INT16) marker, FALSE ); if (bTallestStructureHeight >= 3) { fTravelCostObs = TRUE; fStopRevealingItemsAfterThisTile = TRUE; } else if ( bTallestStructureHeight != 0 ) { // stop revealing items after this tile but keep going fStopRevealingItemsAfterThisTile = TRUE; } } } // Check if it's been done already! if ( gubGridNoMarkers[ marker ] != gubGridNoValue ) { // Mark gridno gubGridNoMarkers[ marker ] = gubGridNoValue; // check and see if the gridno changed // if the gridno is the same, avoid redundancy and break if (marker==prevmarker && markercnt != 0 ) { } else // it changed { // Skip others if we have gone through a door but are too far away.... if ( fGoneThroughDoor ) { if (markercnt > 5 ) // Are we near the door? { break; } } // DO MINE FINDING STUFF // GET INDEX FOR ITEM HERE // if there IS a direction after this one, nextdir WILL NOT be 99 if (nextDir != 99) { Blocking = GetBlockingStructureInfo( (INT16)marker, (INT8)Dir[ markerDir ], (INT8)Dir[ nextDir ], ubLevel, &bStructHeight, &pDummy, FALSE ); } else // no "next" direction, so pass in a NOWHERE so that // "SpecialViewObstruction" will know not to take it UINT32o consideration { Blocking = GetBlockingStructureInfo( (INT16)marker, (INT8)Dir[markerDir], (INT8)30, ubLevel, &bStructHeight, &pDummy, FALSE ); } if ( gfCaves ) { Blocking = NOTHING_BLOCKING; } // CHECK FOR ROOMS if ( Blocking == BLOCKING_TOPLEFT_WINDOW || Blocking == BLOCKING_TOPLEFT_OPEN_WINDOW ) { // CHECK FACING DIRECTION! if ( Dir[markerDir] == NORTH || Dir[markerDir] == SOUTH ) { if (markercnt <= 1 ) // Are we right beside it? { fThroughWindow = TRUE; bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; } } } if ( Blocking == BLOCKING_TOPRIGHT_WINDOW || Blocking == BLOCKING_TOPRIGHT_OPEN_WINDOW ) { // CHECK FACING DIRECTION! if ( Dir[markerDir] == EAST || Dir[markerDir] == WEST ) { if (markercnt <= 1 ) // Are we right beside it? { fThroughWindow = TRUE; bThroughWindowDirection = ( INT8 ) Dir[ markerDir ]; } } } if ( Blocking == BLOCKING_TOPLEFT_DOOR ) { fGoneThroughDoor = TRUE; } if ( Blocking == BLOCKING_TOPRIGHT_DOOR ) { fGoneThroughDoor = TRUE; } // ATE: If we hit this tile, find item always! //if (Blocking < FULL_BLOCKING ) { // Handle special things for our mercs, like uncovering roofs // and revealing objects... //gpSoldier->shad |= SEENBIT; //itemVisible = ObjList[itemIndex].visible; // NOTE: don't allow object viewing if gassed XXX if (itemsToo && fRevealItems ) // && itemIndex < MAXOBJECTLIST) { // OK, look for corpses... LookForAndMayCommentOnSeeingCorpse( pSoldier, (INT16)marker, ubLevel ); if ( GetItemPool( (INT16)marker, &pItemPool, ubLevel ) ) { itemVisible = pItemPool->bVisible; if ( SetItemPoolVisibilityOn( pItemPool, INVISIBLE, fShowLocators ) ) { SetRenderFlags(RENDER_FLAG_FULL); if ( fShowLocators ) { // Set makred render flags //gpWorldLevelData[marker].uiFlags|=MAPELEMENT_REDRAW; //gpWorldLevelData[gusCurMousePos].pTopmostHead->uiFlags |= LEVELNODE_DYNAMIC; //SetRenderFlags(RENDER_FLAG_MARKED); SetRenderFlags(RENDER_FLAG_FULL); // Hault soldier // ATE: Only if in combat... if ( gTacticalStatus.uiFlags & INCOMBAT ) { HaultSoldierFromSighting( pSoldier, FALSE ); } else { // ATE: Make sure we show locators... gTacticalStatus.fLockItemLocators = FALSE; } if ( !fItemsQuoteSaid && gTacticalStatus.fLockItemLocators == FALSE ) { gTacticalStatus.fLockItemLocators = TRUE; if ( gTacticalStatus.ubAttackBusyCount > 0 && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { gTacticalStatus.fItemsSeenOnAttack = TRUE; gTacticalStatus.ubItemsSeenOnAttackSoldier = pSoldier->ubID; gTacticalStatus.usItemsSeenOnAttackGridNo = (INT16)(marker); } else { // Display quote! if ( !AM_AN_EPC( pSoldier ) ) { TacticalCharacterDialogueWithSpecialEvent( pSoldier, (UINT16)( QUOTE_SPOTTED_SOMETHING_ONE + Random( 2 ) ), DIALOGUE_SPECIAL_EVENT_SIGNAL_ITEM_LOCATOR_START, (INT16)(marker), 0 ); } else { // Turn off item lock for locators... gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! SlideToLocation( 0, (INT16)(marker) ); } } fItemsQuoteSaid = TRUE; } } } } } // if blood here, let the user see it now... //if (ExtGrid[marker].patrolInfo < MAXBLOOD) // gpSoldier->blood = ExtGrid[marker].patrolInfo; //DoRoofs(marker,gpSoldier); tilesLeftToSee--; } // CHECK FOR HIDDEN STRUCTS // IF we had a hidden struct here that is not visible ( which will still be true because // we set it revealed below... if ( DoesGridnoContainHiddenStruct( (UINT16)marker, &fHiddenStructVisible ) ) { if ( !fHiddenStructVisible ) { gpWorldLevelData[marker].uiFlags|=MAPELEMENT_REDRAW; SetRenderFlags(RENDER_FLAG_MARKED); RecompileLocalMovementCosts( (UINT16)marker ); } } if (tilesLeftToSee <= 0) break; if ( Blocking == FULL_BLOCKING || ( fTravelCostObs && !fThroughWindow ) ) { break; } //if ( Blocking == NOTHING_BLOCKING || Blocking == BLOCKING_NEXT_TILE ) if ( Blocking == NOTHING_BLOCKING ) { fCheckForRooms = TRUE; } if ( ubLevel != 0 ) { fCheckForRooms = FALSE; } // CHECK FOR SLANT ROOF! { STRUCTURE *pStructure, *pBase; pStructure = FindStructure( (INT16)marker, STRUCTURE_SLANTED_ROOF ); if ( pStructure != NULL ) { pBase = FindBaseStructure( pStructure ); // ADD TO SLANTED ROOF LIST! AddSlantRoofFOVSlot( (INT16)marker ); } } // Set gridno as revealed if ( ubLevel == FIRST_LEVEL ) { if ( gfBasement || gfCaves ) { // OK, if we are underground, we don't want to reveal stuff if // 1 ) there is a roof over us and // 2 ) we are not in a room if ( gubWorldRoomInfo[ marker ] == NO_ROOM && TypeRangeExistsInRoofLayer( marker, FIRSTROOF, FOURTHROOF, &usIndex ) ) { int i = 0; } else { gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED; if( gfCaves ) { RemoveFogFromGridNo( marker ); } } } else { gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED; } // CHECK FOR ROOMS //if ( fCheckForRooms ) { if ( InAHiddenRoom( (INT16)marker, &ubRoomNo ) ) { RemoveRoomRoof( (INT16)marker, ubRoomNo, pSoldier ); if ( ubRoomNo == ROOM_SURROUNDING_BOXING_RING && gWorldSectorX == BOXING_SECTOR_X && gWorldSectorY == BOXING_SECTOR_Y && gbWorldSectorZ == BOXING_SECTOR_Z ) { // reveal boxing ring at same time RemoveRoomRoof( (INT16)marker, BOXING_RING, pSoldier ); } } } } else { gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_REVEALED_ROOF; } // Check for blood.... UpdateBloodGraphics( (INT16)marker, ubLevel ); if ( Blocking != NOTHING_BLOCKING && Blocking != BLOCKING_TOPLEFT_DOOR && Blocking != BLOCKING_TOPRIGHT_DOOR && Blocking != BLOCKING_TOPLEFT_WINDOW && Blocking != BLOCKING_TOPRIGHT_WINDOW && Blocking != BLOCKING_TOPRIGHT_OPEN_WINDOW && Blocking != BLOCKING_TOPLEFT_OPEN_WINDOW) { break; } //gpWorldLevelData[ marker ].uiFlags |= MAPELEMENT_SHADELAND; } } // End of duplicate check else { if ( fTravelCostObs ) { break; } } } // end of one path } // end of path loop // Loop through all availible slant roofs we collected and perform cool stuff on them ExamineSlantRoofFOVSlots( ); //pSoldier->needToLookForItems = FALSE; //LookForDoors(pSoldier,UNAWARE); }
void TWindowMenu::AttachedToWindow() { SetFont(be_plain_font); RemoveItems(0, CountItems(), true); int32 miniCount = 0; bool dragging = false; TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView(); if (barview && barview->LockLooper()) { // 'dragging' mode set in BarView::CacheDragData // invoke in MouseEnter in ExpandoMenuBar dragging = barview->Dragging(); if (dragging) { // We don't want to show the menu when dragging, but it's not // possible to remove a submenu once it exists, so we simply hide it // Don't call BMenu::Hide(), it causes the menu to pop up every now // and then. Window()->Hide(); // if in expando (horizontal or vertical) if (barview->Expando()) { SetTrackingHook(barview->MenuTrackingHook, barview->GetTrackingHookData()); } barview->DragStart(); } barview->UnlockLooper(); } int32 parentMenuItems = 0; int32 numTeams = fTeam->CountItems(); for (int32 i = 0; i < numTeams; i++) { team_id theTeam = (team_id)fTeam->ItemAt(i); int32 count = 0; int32* tokens = get_token_list(theTeam, &count); for (int32 j = 0; j < count; j++) { client_window_info* wInfo = get_window_info(tokens[j]); if (wInfo == NULL) continue; if (WindowShouldBeListed(wInfo->feel) && (wInfo->show_hide_level <= 0 || wInfo->is_mini)) { // Don't add new items if we're expanded. We've already done // this, they've just been moved. int32 numItems = CountItems(); int32 addIndex = 0; for (; addIndex < numItems; addIndex++) if (strcasecmp(ItemAt(addIndex)->Label(), wInfo->name) > 0) break; if (!fExpanded) { TWindowMenuItem* item = new TWindowMenuItem(wInfo->name, wInfo->server_token, wInfo->is_mini, ((1 << current_workspace()) & wInfo->workspaces) != 0, dragging); // disable app's window dropping for now if (dragging) item->SetEnabled(false); AddItem(item, TWindowMenuItem::InsertIndexFor(this, 0, item)); } else { TTeamMenuItem* parentItem = static_cast<TTeamMenuItem*>(Superitem()); if (parentItem->ExpandedWindowItem(wInfo->server_token)) { TWindowMenuItem* item = parentItem->ExpandedWindowItem( wInfo->server_token); if (item == NULL) continue; item->SetTo(wInfo->name, wInfo->server_token, wInfo->is_mini, ((1 << current_workspace()) & wInfo->workspaces) != 0, dragging); parentMenuItems++; } } if (wInfo->is_mini) miniCount++; } free(wInfo); } free(tokens); } int32 itemCount = CountItems() + parentMenuItems; if (itemCount < 1) { TWindowMenuItem* noWindowsItem = new TWindowMenuItem(B_TRANSLATE("No windows"), -1, false, false); noWindowsItem->SetEnabled(false); AddItem(noWindowsItem); // if an application has no windows, this feature makes it easy to quit // it. (but we only add this option if the application is not Tracker.) if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { AddSeparatorItem(); AddItem(new TShowHideMenuItem(B_TRANSLATE("Quit application"), fTeam, B_QUIT_REQUESTED)); } } else { // if we are in drag mode, then don't add the window controls // to the menu if (!dragging) { TShowHideMenuItem* hide = new TShowHideMenuItem(B_TRANSLATE("Hide all"), fTeam, B_MINIMIZE_WINDOW); TShowHideMenuItem* show = new TShowHideMenuItem(B_TRANSLATE("Show all"), fTeam, B_BRING_TO_FRONT); TShowHideMenuItem* close = new TShowHideMenuItem(B_TRANSLATE("Close all"), fTeam, B_QUIT_REQUESTED); if (miniCount == itemCount) hide->SetEnabled(false); else if (miniCount == 0) show->SetEnabled(false); if (!parentMenuItems) AddSeparatorItem(); AddItem(hide); AddItem(show); AddItem(close); } } BMenu::AttachedToWindow(); }
void RenderPopupMenu() { UINT16 usX, usY; UINT8 ubColumn, ubEntry, ubCounter; UINT8 *pDestBuf; UINT32 uiDestPitchBYTES; UINT16 usLineColor; UINT16 usStringWidth; UINT16 usStart; //Draw the menu ColorFillVideoSurfaceArea(FRAME_BUFFER, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, Get16BPPColor(FROMRGB(128, 128, 128) ) ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) ); RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, usLineColor, pDestBuf ); if( gPopup.ubColumns > 1 ) { //draw a vertical line between each column usStart = gPopup.usLeft + gPopup.ubColumnWidth[ 0 ]; for( ubColumn = 1; ubColumn < gPopup.ubColumns; ubColumn++ ) { LineDraw( TRUE, usStart, gPopup.usTop, usStart, gPopup.usBottom, usLineColor, pDestBuf ); } usStart += (UINT16)gPopup.ubColumnWidth[ ubColumn ]; } UnLockVideoSurface( FRAME_BUFFER ); //Set up the text attributes. SetFont( gPopup.usFont); SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); usX = gPopup.usLeft + 1; ubCounter = 0; usStart = gPopup.usLeft; for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) { for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) { if( ubCounter >= gPopup.ubNumEntries ) return; //done //Calc current string's width in pixels. Adding 14 pixels which is the width of //two padded gPopup.usFont spaces not stored in the string. usStringWidth = 14 + StringPixLength( GetPopupMenuString( ubCounter ), gPopup.usFont ); //Horizontally center the string inside the popup menu usX = usStart + ( gPopup.ubColumnWidth[ ubColumn ] - usStringWidth ) / 2; usY = gPopup.usTop + 1 + ubEntry * gusEntryHeight; if( ubCounter == gPopup.ubSelectedIndex - 1 ) { //This is the highlighted menu entry. SetFontForeground( FONT_MCOLOR_LTBLUE ); mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) ); SetFontForeground( FONT_MCOLOR_WHITE ); } else { mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) ); } ubCounter++; } usStart += gPopup.ubColumnWidth[ ubColumn ]; } }
CInPlaceList::CInPlaceList(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID, int nRow, int nColumn, COLORREF crFore, COLORREF crBack, CStringArray& Items, CString sInitText, UINT nFirstChar) { m_crForeClr = crFore; m_crBackClr = crBack; m_nNumLines = 4; m_sInitText = sInitText; m_nRow = nRow; m_nCol = nColumn; m_nLastChar = 0; m_bExitOnArrows = FALSE; //(nFirstChar != VK_LBUTTON); // If mouse click brought us here, // Create the combobox DWORD dwComboStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL| CBS_AUTOHSCROLL | dwStyle; int nHeight = rect.Height(); rect.bottom = rect.bottom + m_nNumLines*nHeight + ::GetSystemMetrics(SM_CYHSCROLL); if (!Create(dwComboStyle, rect, pParent, nID)) return; // Add the strings for (int i = 0; i < Items.GetSize(); i++) AddString(Items[i]); SetFont(pParent->GetFont()); SetItemHeight(-1, nHeight); int nMaxLength = GetCorrectDropWidth(); /* if (nMaxLength > rect.Width()) rect.right = rect.left + nMaxLength; // Resize the edit window and the drop down window MoveWindow(rect); */ SetDroppedWidth(nMaxLength); SetHorizontalExtent(0); // no horz scrolling // Set the initial text to m_sInitText if (::IsWindow(m_hWnd) && SelectString(-1, m_sInitText) == CB_ERR) SetWindowText(m_sInitText); // No text selected, so restore what was there before ShowDropDown(); // Subclass the combobox edit control if style includes CBS_DROPDOWN if ((dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST) { m_edit.SubclassDlgItem(IDC_COMBOEDIT, this); SetFocus(); switch (nFirstChar) { case VK_LBUTTON: case VK_RETURN: m_edit.SetSel((int)_tcslen(m_sInitText), -1); return; case VK_BACK: m_edit.SetSel((int)_tcslen(m_sInitText), -1); break; case VK_DOWN: case VK_UP: case VK_RIGHT: case VK_LEFT: case VK_NEXT: case VK_PRIOR: case VK_HOME: case VK_END: m_edit.SetSel(0,-1); return; default: m_edit.SetSel(0,-1); } SendMessage(WM_CHAR, nFirstChar); } else SetFocus(); }
void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positions) { wxString str = sci2wx(s, len); SetFont(font); #if !wxCHECK_VERSION(2, 5, 0) #ifndef __WXMAC__ // Calculate the position of each character based on the widths of // the previous characters int* tpos = new int[len+1]; int totalWidth = 0; size_t i; for (i=0; i<str.Length(); i++) { int w, h; hdc->GetTextExtent(str[i], &w, &h); totalWidth += w; tpos[i] = totalWidth; } #else // Instead of a running total, remeasure from the begining of the // text for each character's position. This is because with AA fonts // on OS X widths can be fractions of pixels wide when more than one // are drawn together, so the sum of all character widths is not necessarily // (and probably not) the same as the whole string width. int* tpos = new int[len+1]; size_t i; for (i=0; i<str.Length(); i++) { int w, h; hdc->GetTextExtent(str.Left(i+1), &w, &h); tpos[i] = w; } #endif #else wxArrayInt tpos; hdc->GetPartialTextExtents(str, tpos); #endif #if wxUSE_UNICODE // Map the widths for UCS-2 characters back to the UTF-8 input string // NOTE: I don't think this is right for when sizeof(wxChar) > 2, ie wxGTK2 // so figure it out and fix it! int j = 0; size_t ui = 0; while ((int)j < len) { unsigned char uch = (unsigned char)s[j]; positions[j++] = tpos[ui]; if (uch >= 0x80) { if (uch < (0x80 + 0x40 + 0x20)) { positions[j++] = tpos[ui]; } else { positions[j++] = tpos[ui]; positions[j++] = tpos[ui]; } } ui++; } #else // If not unicode then just use the widths we have #if !wxCHECK_VERSION(2, 5, 0) memcpy(positions, tpos, len * sizeof(*tpos)); #else #if wxUSE_STL std::copy(tpos.begin(), tpos.end(), positions); #else memcpy(positions, tpos.begin(), len * sizeof(int)); #endif #endif #endif #if !wxCHECK_VERSION(2, 5, 0) delete [] tpos; #endif }
static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, subpicture_region_t *p_region_in ) { filter_sys_t *p_sys = p_filter->p_sys; int i_font_color, i_font_alpha, i_font_size; uint8_t *p_bitmap; TCHAR *psz_string; int i, i_width, i_height; HBITMAP bitmap, bitmap_bak; BITMAPINFO *p_bmi; RECT rect = { 0, 0, 0, 0 }; /* Sanity check */ if( !p_region_in || !p_region_out ) return VLC_EGENERIC; if( !p_region_in->psz_text || !*p_region_in->psz_text ) return VLC_EGENERIC; psz_string = malloc( (strlen( p_region_in->psz_text )+1) * sizeof(TCHAR) ); if( !psz_string ) return VLC_ENOMEM; #ifdef UNICODE if( mbstowcs( psz_string, p_region_in->psz_text, strlen( p_region_in->psz_text ) * sizeof(TCHAR) ) < 0 ) { free( psz_string ); return VLC_EGENERIC; } #else strcpy( psz_string, p_region_in->psz_text ); #endif if( !*psz_string ) { free( psz_string ); return VLC_EGENERIC; } if( p_region_in->p_style ) { i_font_color = __MAX( __MIN( p_region_in->p_style->i_font_color, 0xFFFFFF ), 0 ); i_font_alpha = __MAX( __MIN( p_region_in->p_style->i_font_alpha, 255 ), 0 ); i_font_size = __MAX( __MIN( p_region_in->p_style->i_font_size, 255 ), 0 ); } else { i_font_color = p_sys->i_font_color; i_font_alpha = 255 - p_sys->i_font_opacity; i_font_size = p_sys->i_default_font_size; } SetFont( p_filter, i_font_size ); SetTextColor( p_sys->hcdc, RGB( (i_font_color >> 16) & 0xff, (i_font_color >> 8) & 0xff, i_font_color & 0xff) ); DrawText( p_sys->hcdc, psz_string, -1, &rect, DT_CALCRECT | DT_CENTER | DT_NOPREFIX ); i_width = rect.right; i_height = rect.bottom; p_bmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*16); memset( p_bmi, 0, sizeof(BITMAPINFOHEADER) ); p_bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); p_bmi->bmiHeader.biWidth = (i_width+3) & ~3; p_bmi->bmiHeader.biHeight = - i_height; p_bmi->bmiHeader.biPlanes = 1; p_bmi->bmiHeader.biBitCount = 8; p_bmi->bmiHeader.biCompression = BI_RGB; p_bmi->bmiHeader.biClrUsed = 16; for( i = 0; i < 16; i++ ) { p_bmi->bmiColors[i].rgbBlue = p_bmi->bmiColors[i].rgbGreen = p_bmi->bmiColors[i].rgbRed = pi_gamma[i]; } bitmap = CreateDIBSection( p_sys->hcdc, p_bmi, DIB_RGB_COLORS, (void **)&p_bitmap, NULL, 0 ); if( !bitmap ) { msg_Err( p_filter, "could not create bitmap" ); free( psz_string ); return VLC_EGENERIC; } bitmap_bak = SelectObject( p_sys->hcdc, bitmap ); FillRect( p_sys->hcdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) ); if( !DrawText( p_sys->hcdc, psz_string, -1, &rect, DT_CENTER | DT_NOPREFIX ) ) { msg_Err( p_filter, "could not draw text" ); } p_region_out->i_x = p_region_in->i_x; p_region_out->i_y = p_region_in->i_y; Render( p_filter, p_region_out, p_bitmap, i_width, i_height ); SelectObject( p_sys->hcdc, bitmap_bak ); DeleteObject( bitmap ); free( psz_string ); return VLC_SUCCESS; }