void CReportEntityBox::Copy( CDiagramEntity * obj ) /* ============================================================ Function : CReportEntityBox::Copy Description : Copies the data from "obj" to this object. Access : Public Return : void Parameters : CDiagramEntity * obj - Object to copy from Usage : Call to copy data from "obj" ============================================================*/ { CDiagramEntity::Copy( obj ); CReportEntityBox* copy = static_cast< CReportEntityBox* >( obj ); SetBorderThickness( copy->GetBorderThickness() ); SetBorderStyle( copy->GetBorderStyle() ); SetBorderColor( copy->GetBorderColor() ); SetFill( copy->GetFill() ); SetFillColor( copy->GetFillColor() ); }
BOOL CReportEntityPicture::FromString( const CString& str ) /* ============================================================ Function : CReportEntityPicture::FromString Description : Sets the data of the object from "str". Access : Public Return : BOOL - "TRUE" if the string represents an object of this type. Parameters : const CString& str - String to parse Usage : Call to load objects from a file. ============================================================*/ { BOOL result = FALSE; CString data( str ); if( LoadFromString( data ) ) { CTokenizer tok( data ); double borderthickness; unsigned int borderstyle; unsigned int bordercolor; CString filename; int count = 0; tok.GetAt( count++, borderthickness ); int aaa; tok.GetAt( count++, aaa ); borderstyle=aaa; tok.GetAt( count++, aaa ); bordercolor=aaa; tok.GetAt( count++, filename ); int bt = CUnitConversion::InchesToPixels( borderthickness ); SetBorderThickness( bt ); SetBorderStyle( borderstyle ); SetBorderColor( bordercolor ); UnmakeSaveString( filename ); SetFilename( filename ); int left = CUnitConversion::InchesToPixels( GetLeft() ); int right = CUnitConversion::InchesToPixels( GetRight() ); int top = CUnitConversion::InchesToPixels( GetTop() ); int bottom = CUnitConversion::InchesToPixels( GetBottom() ); CRect rect( left, top, right, bottom ); SetRect( rect ); result = TRUE; } return result; }
CGLPlanarWorkspace::CGLPlanarWorkspace(CGLObject *parent, const QPointF &position, const QPointF &size): CGLObject(parent, position, size) { PlanWorkLog.write("Begin: CGLPlanarWorkspace::CGLPlanarWorkspace"); //iLayout = NULL; iLastInnerHeight = 0; iLastInnerWidth = 0; iWorkspaceChanged = true; iName = new QString(); iSaveSnapshot = false; iSaveSnapshotFileName = NULL; QString name; name.clear(); name.append("MPS"); //name.append(QString::number(CWorkspaceManager::GetInstance()->GetWorkspaces().count())); SetName(name); iImage = NULL; //SetLayout(layoutType); iWorkspaceSnapshot =new CGLWorkspaceSnapshot(parent,(CGLWorkspace*)this,QPointF(10,10), QPointF(100,100)); SetBorders(Settings::GetBordersConstant(EWorkspaceBorders)); SetBorderColor(Settings::GetColorConstant(EWorkspaceBorderColor)); SetInnerColor(Settings::GetColorConstant(EWorkspaceInnerColor)); iPlanarCrossPosition.x=0.5; iPlanarCrossPosition.y=0.5; iPlanarCrossPosition.z=0.5; setMouseTracking(true); iEventHistory = new QPoint(); iCursorHistory = new QPoint(); iSensitivity = 1000; }
CGLWorkspace::CGLWorkspace(CGLObject *parent, const QPointF &position, const QPointF &size, TLayoutType layoutType): CGLObject(parent, position, size) { WorkLog.write("Begin: CGLWorkspace::CGLWorkspace"); iLayout = NULL; iLastInnerHeight = 0; iLastInnerWidth = 0; iWorkspaceChanged = true; iName = new QString(); iSaveSnapshot = false; iSaveSnapshotFileName = NULL; QString name; name.clear(); name.append("WS:"); name.append(QString::number(CWorkspaceManager::GetInstance()->GetWorkspaces().count())); SetName(name); iActiveImage = NULL; SetLayout(layoutType); if(!InitTexture()) { int err=1; throw TextureNotCreatedException(); } iWorkspaceSnapshot =new CGLWorkspaceSnapshot(parent,this,QPointF(10,10), QPointF(100,100)); SetBorders(Settings::GetBordersConstant(EWorkspaceBorders)); SetBorderColor(Settings::GetColorConstant(EWorkspaceBorderColor)); SetInnerColor(Settings::GetColorConstant(EWorkspaceInnerColor)); WorkLog.write("End: CGLWorkspace::CGLWorkspace"); }
void TextBox::OnFocusAcquired() { assert(SDL_IsTextInputActive() == SDL_FALSE); m_caret.StartAnimation(); SetBorderColor(SDLColor(64, 64, 128, 0)); auto loc = GetLocation(); SDL_SetTextInputRect(&loc); SDL_StartTextInput(); }
TablePrinter::TablePrinter(std::ostream * output, const std::string & separator){ out_stream_ = output; i_ = 0; j_ = 0; separator_ = separator; table_width_ = 0; SetTableColor(zkr::cc::fore::lightyellow); SetBorderColor(zkr::cc::fore::lightblue); no_color = zkr::cc::console; content_color.clear(); }
void CReportEntityBox::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; } BOX_RESERVE_FIELDS; BOX_RESERVE_FIELDS box_reserve; memset(&box_reserve,0,sizeof(BOX_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int bst = GetBorderStyle( ); ar.Write(&bst,sizeof(unsigned int)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int)); BOOL gf = GetFill(); ar.Write(&gf, sizeof(BOOL)); brC = GetFillColor(); ar.Write(&brC,sizeof(unsigned int)); ar.Write(&box_reserve,sizeof(BOX_RESERVE_FIELDS)); } else { // „итаем double bordhickness; ar.Read(&bordhickness,sizeof(double)); unsigned int bordst; ar.Read(&bordst,sizeof(unsigned int)); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int)); BOOL fil; ar.Read(&fil,sizeof(BOOL)); unsigned int filcolor; ar.Read(&filcolor,sizeof(unsigned int)); ar.Read(&box_reserve,sizeof(BOX_RESERVE_FIELDS)); int bt = CUnitConversion::InchesToPixels( bordhickness ); SetBorderThickness( bt ); SetBorderStyle( bordst ); SetBorderColor( linecolor ); SetFill( fil ); SetFillColor( filcolor ); } }
void Widget::LoadStyle(const std::string& style) { ResourceManager* rm = ResourceManager::Get(); StyleProperties& properties = rm->GetStyle(style); if (properties["from"] != "") LoadStyle(properties["from"]); SetX(rm->GetValue(properties["x"], GetPosition().x)); SetY(rm->GetValue(properties["y"], GetPosition().y)); mAlignOffset.x = rm->GetValue(properties["x"], mAlignOffset.x); mAlignOffset.y = rm->GetValue(properties["y"], mAlignOffset.y); SetWidth(rm->GetValue(properties["width"], GetWidth())); SetHeight(rm->GetValue(properties["height"], GetHeight())); // Detect alignement if (properties["align"] != "") { std::string strA = properties["align"]; if (strA == "top_left") mAlign = Align::TOP_LEFT; else if (strA == "top_center") mAlign = Align::TOP_CENTER; else if (strA == "top_right") mAlign = Align::TOP_RIGHT; else if (strA == "left") mAlign = Align::LEFT; else if (strA == "center") mAlign = Align::CENTER; else if (strA == "right") mAlign = Align::RIGHT; else if (strA == "bottom_left") mAlign = Align::BOTTOM_LEFT; else if (strA == "bottom_center") mAlign = Align::BOTTOM_CENTER; else if (strA == "bottom_right") mAlign = Align::BOTTOM_RIGHT; else mAlign = Align::NONE; } SetColor(rm->GetColorValue(properties["color"], GetColor())); SetBorderColor(rm->GetColorValue(properties["borderColor"], GetBorderColor())); SetEnabled(rm->GetValue(properties["enabled"], IsEnabled())); SetVisible(rm->GetValue(properties["visible"], IsVisible())); SetFocusable(rm->GetValue(properties["focusable"], IsFocusable())); UpdatePosition(); }
void CReportEntityPicture::Copy( CDiagramEntity * obj ) /* ============================================================ Function : CReportEntityPicture::Copy Description : Copies data from "obj" to this object. Access : Public Return : void Parameters : CDiagramEntity * obj - Object to copy from Usage : Call to copy data from "obj" to this object. ============================================================*/ { CDiagramEntity::Copy( obj ); CReportEntityPicture* copy = static_cast< CReportEntityPicture* >( obj ); SetBorderThickness( copy->GetBorderThickness() ); SetBorderStyle( copy->GetBorderStyle() ); SetBorderColor( copy->GetBorderColor() ); SetFilename( copy->GetFilename() ); if( m_bitmap ) delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; if (m_image_bits) delete[] m_image_bits; m_image_bits = NULL; if (copy->m_image_size>0 && copy->m_image_bits) { m_image_type = copy->m_image_type; m_image_size = copy->m_image_size; m_image_bits = new BYTE[m_image_size]; memcpy(m_image_bits,copy->m_image_bits,m_image_size); m_bitmap = new CxImage(m_image_bits,m_image_size,m_image_type); if (!m_bitmap->IsValid()) { AfxMessageBox(m_bitmap->GetLastError()); delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; delete[] m_image_bits; m_image_bits = NULL; ASSERT(0); return; } } }
TextBox::TextBox(Window* pWindow, const SDL_Rect& location) : Control(pWindow, location), m_caret(pWindow, SDLRect(location.x + TextOffsetX, location.y + 8, CaretWidth, location.h - 16)), m_pPrevCursor(nullptr), m_position(0), m_clipOffset(0) { SetBorderColor(SDLColor(128, 128, 128, 0)); SetBorderSize(1); // place the caret above the text box m_caret.SetZOrder(GetZOrder() + 1); }
CImageExplorer::CImageExplorer(CWidget *parentWindow, QPointF& position, QPointF &size ):CObject (parentWindow, position, size) { iActiveImage = NULL; iScrollBar = new QScrollBar(Qt::Vertical,parentWindow); iScrollBar->setMinimum(0); iScrollBar->setMaximum(0); iScrollBar->setValue(0); QObject::connect(iScrollBar , SIGNAL(valueChanged(int)), this, SLOT(Scrolled(int))); SetBorders(Settings::GetBordersConstant(EImageExplorerBorders)); SetBorderColor(Settings::GetColorConstant(EImageExplorerBorderColor)); SetInnerColor(Settings::GetColorConstant(EImageExplorerInnerColor)); }
CUISimpleBG::CUISimpleBG( unsigned int _uId, float _fPosX, float _fPosY, float _fWidth, float _fHeight ) : IUInterface( _uId, _fPosX, _fPosY, _fWidth, _fHeight ), m_bMoving( false ) { // Text Color SetForegroundColor( 1.0f, 1.0f, 1.0f, 1.0f ); // Background SetBackgroundColor( 0.2f, 0.7f, 0.2f, 0.4f ); // Border SetBorderColor( 1.0f, 1.0f, 1.0f, 1.0f ); }
CPlanarWorkspace::CPlanarWorkspace(CObject *parent, const QPointF &position, const QPointF &size): CObject(parent, position, size){ //iLayout = NULL; iLastInnerHeight = 0; iLastInnerWidth = 0; iWorkspaceChanged = true; iName = new QString(); iSaveSnapshot = false; iSaveSnapshotFileName = NULL; QString name; name.clear(); name.append("MPR"); //name.append(QString::number(CWorkspaceManager::GetInstance()->GetWorkspaces().count())); SetName(name); iImage = NULL; //SetLayout(layoutType); iWorkspaceSnapshot =new CWorkspaceSnapshot(parent,(CWorkspace*)this,QPointF(400,400), QPointF(100,100)); SetBorders(Settings::GetBordersConstant(EWorkspaceBorders)); SetBorderColor(Settings::GetColorConstant(EWorkspaceBorderColor)); SetInnerColor(Settings::GetColorConstant(EWorkspaceInnerColor)); iPlanarCrossPosition.x=0.5; iPlanarCrossPosition.y=0.5; iPlanarCrossPosition.z=0.5; setMouseTracking(true); iEventHistory = new QPoint(); iCursorHistory = new QPoint(); iSensitivity = 1000; CImage* image = CImageExplorer::GetInstance()->iActiveImage; iImage1 = image->CreateDerivedImage(EImageOrientationAxial); iImage2 = image->CreateDerivedImage(EImageOrientationAxial); iImage3 = image->CreateDerivedImage(EImageOrientationAxial); iImage1->SetOrientation(EImageOrientationAxial); iImage2->SetOrientation(EImageOrientationSagittal); iImage3->SetOrientation(EImageOrientationCoronal); iImage1->SetGeometry(0, 0, iSize.x()/2, iSize.y()/2); iImage2->SetGeometry(iSize.x()/2, 0, iSize.x()/2, iSize.y()/2); iImage3->SetGeometry(0, iSize.y()/2, iSize.x()/2, iSize.y()/2); float textureWidth = (float)iImage1->GetTexture()->GetWidth(); int textureHeight = iImage1->GetTexture()->GetHeight(); int textureDepth = iImage1->GetTexture()->GetDepth(); float zoom = iImage1->GetSize().x()/textureWidth; iImage1->SetZoom(zoom); iImage2->SetZoom(zoom); iImage3->SetZoom(zoom); iImage1->MoveToDepth(0.5); iImage2->MoveToDepth(0.5); iImage3->MoveToDepth(0.5); CWidget::GetInstance()->paint(); }
int main(){ unsigned int i; unsigned int j; ClearVram(); SetBorderColor(0xBFU); /* Fill VRAM */ for (i = 0U; i < VRAM_SIZE; i++){ aram[i * 2U ] = (i ) & 0xFFU; aram[i * 2U + 1U] = (i * 3U) & 0xFFU; } for (i = 0U; i < VRAM_SIZE; i++){ vram[i] = (i * 5U) & 0xFFU; } /* Bitmap modes */ palette[0] = 0x00U; palette[1] = 0xC0U; palette[2] = 0x38U; palette[3] = 0xF8U; palette[4] = 0x07U; palette[5] = 0xC7U; palette[6] = 0x3FU; palette[7] = 0xFFU; SetTileTableRow(M40_TILEROW_3BPP, 8U); SetTileTableRow(M40_TILEROW_3BPP, 9U); SetTileTableRow(M40_TILEROW_3BPP, 10U); SetTileTableRow(M40_TILEROW_3BPP, 11U); SetTileTableRow(M40_TILEROW_1BPP, 12U); SetTileTableRow(M40_TILEROW_1BPP, 13U); SetTileTableRow(M40_TILEROW_1BPP, 14U); SetTileTableRow(M40_TILEROW_1BPP, 15U); for (j = 0U; j < 16U; j ++){ for (i = 0U; i < 32U; i ++){ PutPixel(i + (j << 1) + 0U, i + 32U, j); PutPixel(i + (j << 1) + 1U, i + 32U, j); } } while(1); }
bool CMeterIcon::Init(HICON hFrame, int nMaxVal, int nNumBars, int nSpacingWidth, int nWidth, int nHeight, COLORREF crColor) // nWidth & nHeight are the dimensions of the icon that you want created // nSpacingWidth is the space between the bars // hFrame is the overlay for the bars // crColor is the outline color for the bars {// begin Init SetFrame(hFrame); SetWidth(nSpacingWidth); SetMaxValue(nMaxVal); SetDimensions(nWidth,nHeight); SetNumBars(nNumBars); SetBorderColor(crColor); m_bInit = true; return m_bInit; }// end Init
void Texture::SetParameters(const XMLElement& element) { XMLElement paramElem = element.GetChild(); while (paramElem) { String name = paramElem.GetName(); if (name == "address") { String coord = paramElem.GetAttributeLower("coord"); if (coord.Length() >= 1) { TextureCoordinate coordIndex = (TextureCoordinate)(coord[0] - 'u'); String mode = paramElem.GetAttributeLower("mode"); SetAddressMode(coordIndex, (TextureAddressMode)GetStringListIndex(mode.CString(), addressModeNames, ADDRESS_WRAP)); } } if (name == "border") SetBorderColor(paramElem.GetColor("color")); if (name == "filter") { String mode = paramElem.GetAttributeLower("mode"); SetFilterMode((TextureFilterMode)GetStringListIndex(mode.CString(), filterModeNames, FILTER_DEFAULT)); } if (name == "mipmap") SetNumLevels(paramElem.GetBool("enable") ? 0 : 1); if (name == "quality") { if (paramElem.HasAttribute("low")) SetMipsToSkip(QUALITY_LOW, paramElem.GetInt("low")); if (paramElem.HasAttribute("med")) SetMipsToSkip(QUALITY_MEDIUM, paramElem.GetInt("med")); if (paramElem.HasAttribute("medium")) SetMipsToSkip(QUALITY_MEDIUM, paramElem.GetInt("medium")); if (paramElem.HasAttribute("high")) SetMipsToSkip(QUALITY_HIGH, paramElem.GetInt("high")); } if (name == "srgb") SetSRGB(paramElem.GetBool("enable")); paramElem = paramElem.GetNext(); } }
bool Texture::Load(const void* wrapper) { std::string str; if (!IsObject(wrapper)) return false; if (!LoadMemberValue(wrapper, "format", str)) { FURYE << "Texture param 'format' not found!"; return false; } auto format = EnumUtil::TextureFormatFromString(str); if (!LoadMemberValue(wrapper, "type", str)) str = EnumUtil::TextureTypeToString(TextureType::TEXTURE_2D); auto type = EnumUtil::TextureTypeFromString(str); int width, height; if (!LoadMemberValue(wrapper, "width", width) || !LoadMemberValue(wrapper, "height", height)) { FURYE << "Texture param 'width/height' not found!"; return false; } auto filterMode = FilterMode::LINEAR; if (LoadMemberValue(wrapper, "filter", str)) filterMode = EnumUtil::FilterModeFromString(str); auto wrapMode = WrapMode::REPEAT; if (LoadMemberValue(wrapper, "wrap", str)) wrapMode = EnumUtil::WrapModeFromString(str); auto color = Color::Black; LoadMemberValue(wrapper, "borderColor", color); SetBorderColor(color); bool mipmap = false; LoadMemberValue(wrapper, "mipmap", mipmap); SetFilterMode(filterMode); SetWrapMode(wrapMode); CreateEmpty(width, height, format, type, mipmap); return true; }
// CFepLayoutChoiceList::Draw // Draw a choice list. // (other items were commented in a header). // --------------------------------------------------------------------------- // EXPORT_C void CFepLayoutChoiceList::Draw() { if(!AbleToDraw()) return; SetBorderColor( PenColor() ); DrawChoiceListBackground(Rect()); //draw with border if(iWndControl) { iWndControl->DrawNow(); return; } //draw background for(int ii = 0; ii < iItemList.Count(); ++ii) { DrawItem(ii, EFalse); } }
void Initialize() override { __super::Initialize(); SetTitle(L"Test clear edge"); const int count = 3; float x = 0; float width = 100.0f / count; for (int index = 0; index < count; ++index) { auto control = zaf::Create<zaf::Control>(); control->SetBackgroundColor(zaf::Color::White); control->SetBorderColor(zaf::Color::Black); control->SetBorderThickness(1); control->SetRect(zaf::Rect(x, 0, width, 20)); GetRootControl()->AddChild(control); x += width; } }
void ApplyColorsToWindow(FXWindow* win) { if (win) { for (FXWindow*w=win; w; w=w->getNext()) { SetBackColor(w); SetBaseColor(w); SetTextColor(w); SetSelBackColor(w); SetSelTextColor(w); SetHiliteColor(w); SetShadowColor(w); SetBorderColor(w); SetBoxColor(w); SetArrowColor(w); SetCheckColor(w); SetDiskColor(w); SetCursorColor(w); w->update(); ApplyColorsToWindow(w->getFirst()); } } }
void StyledFrame::Init() { m_frameSizer = new wxFlexGridSizer(3, 0, 0); m_frameInnerSizer = new wxBoxSizer(wxVERTICAL); m_framePanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE); m_framePanel->SetSizer(m_frameSizer); m_frameInnerPanel = new wxPanel(m_framePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE); m_frameInnerPanel->SetSizer(m_frameInnerSizer); m_frameInnerPanel->SetMinSize(wxSize(0, 0)); m_frameInnerPanel->SetBackgroundColour("#3e3e42"); m_headerPanel = new FrameHeader(m_frameInnerPanel, this); m_headerPanel->SetTitle(GetTitle()); m_headerPanel->SetMinSize(wxSize(0, 26)); m_headerPanel->SetBackgroundColour("#3e3e42"); m_contentPanel = new wxPanel(m_frameInnerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE); m_contentPanel->SetBackgroundColour("#3e3e42"); /* Initialize the inner panel */ m_frameInnerSizer->Add(m_headerPanel, 0, wxEXPAND); m_frameInnerSizer->Add(m_contentPanel, 1, wxEXPAND); m_resizeHandler = new ResizeHandler(this); /* Initialize the borders */ InitBorders(); SetBorderSize(5); /* Set the default colors */ SetBackgroundColour("#3e3e42"); SetBorderColor("#2d2d30"); /* Fit everything on the frame */ Fit(); }
void CReportEntityLine::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; } LINE_RESERVE_FIELDS; LINE_RESERVE_FIELDS line_reserve; memset(&line_reserve,0,sizeof(LINE_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int)); ar.Write(&line_reserve,sizeof(LINE_RESERVE_FIELDS)); } else { // „итаем double linethickness; ar.Read(&linethickness,sizeof(double)); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int)); ar.Read(&line_reserve,sizeof(LINE_RESERVE_FIELDS)); unsigned int lt = CUnitConversion::InchesToPixels( linethickness ); SetBorderThickness( lt ); SetBorderColor( linecolor ); } }
// CFepLayoutChoiceList::DrawItem // Draw a choice list item. // (other items were commented in a header). // --------------------------------------------------------------------------- // void CFepLayoutChoiceList::DrawItem(const TRect& aRect, const CFepLayoutChoiceList::SItem& aItem, TBool aErase, TBool aFocus) { if(iWndControl) return; CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); if( aErase ) { SetBorderColor( BkColor() ); //DrawChoiceListBackground( aRect );//, EFalse); } if( aFocus ) { //draw focus bitmap TRect rtFocusRect(iItemFocusRect); TRect rtFocusInBmp(TPoint(0,0), iItemFocusRect.Size()); rtFocusRect.Move(aRect.iTl); TRect rtInnerRect( rtFocusRect ); rtInnerRect.Shrink( 5, 5 ); if( iSubItemSkinID.iMajor != EAknsMajorNone && iSubItemSkinID.iMinor != EAknsMinorNone) { gc->Activate( BitmapDevice() ); AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), *gc, rtFocusRect, rtInnerRect, iSubItemSkinID, KAknsIIDDefault ); } else { //mask bitmaps------- gc->Activate( MaskBitmapDevice() ); if( iItemFocusBmpMask ) { DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmpMask, iItemFocusBmpMask->SizeInPixels() == rtFocusInBmp.Size()); } //front bitmaps------- gc->Activate( BitmapDevice() ); if( iItemFocusBmp ) { DrawBitmap(rtFocusRect, rtFocusInBmp, iItemFocusBmp, iItemFocusBmp->SizeInPixels() == rtFocusInBmp.Size()); } } } //draw text if (iFont) { gc->UseFont(iFont); gc->SetBrushStyle( CGraphicsContext::ENullBrush ); gc->SetPenColor(iFontColor); gc->SetPenStyle(CGraphicsContext::ESolidPen); gc->DrawText(aItem.iText, aRect, iBaseline, CGraphicsContext::ELeft, iMargin); gc->DiscardFont(); } }
void QGraph::LoadSettings(QSettings *pSettings) { int k; QString FontName; QFont lgft; bool bs, ba; int s,w; int r,g,b; double f; pSettings->beginGroup(m_GraphName); { //read variables r = pSettings->value("AxisColorRed",255).toInt(); g = pSettings->value("AxisColorGreen",255).toInt(); b = pSettings->value("AxisColorBlue",255).toInt(); SetAxisColor(QColor(r,g,b)); k = pSettings->value("AxisStyle",0).toInt(); SetAxisStyle(k); k = pSettings->value("AxisWidth",1).toInt(); SetAxisWidth(k); r = pSettings->value("TitleColorRed",255).toInt(); g = pSettings->value("TitleColorGreen",255).toInt(); b = pSettings->value("TitleColorBlue",255).toInt(); SetTitleColor(QColor(r,g,b)); r = pSettings->value("LabelColorRed",255).toInt(); g = pSettings->value("LabelColorGreen",255).toInt(); b = pSettings->value("LabelColorBlue",255).toInt(); SetLabelColor(QColor(r,g,b)); FontName = pSettings->value("TitleFontName","Comic Sans MS").toString(); lgft.setFamily(FontName); lgft.setPointSize(pSettings->value("TitleFontSize",8).toInt()); SetTitleLogFont(&lgft); FontName = pSettings->value("LabelFontName","Comic Sans MS").toString(); lgft.setFamily(FontName); lgft.setPointSize(pSettings->value("LabelFontSize",8).toInt()); SetLabelLogFont(&lgft); r = pSettings->value("XMajGridColorRed",90).toInt(); g = pSettings->value("XMajGridColorGreen",90).toInt(); b = pSettings->value("XMajGridColorBlue",90).toInt(); bs = pSettings->value("XMajGridShow",true).toBool(); s = pSettings->value("XMajGridStyle",1).toInt(); w = pSettings->value("XMajGridWidth",1).toInt(); SetXMajGrid(bs,QColor(r,g,b),s,w); r = pSettings->value("YMajGridColorRed",90).toInt(); g = pSettings->value("YMajGridColorGreen",90).toInt(); b = pSettings->value("YMajGridColorBlue",90).toInt(); bs = pSettings->value("YMajGridShow",true).toBool(); s = pSettings->value("YMajGridStyle",1).toInt(); w = pSettings->value("YMajGridWidth",1).toInt(); SetYMajGrid(bs,QColor(r,g,b),s,w); r = pSettings->value("XMinGridColorRed",50).toInt(); g = pSettings->value("XMinGridColorGreen",50).toInt(); b = pSettings->value("XMinGridColorBlue",50).toInt(); ba = pSettings->value("XMinGridAuto",true).toBool(); bs = pSettings->value("XMinGridShow",false).toBool(); s = pSettings->value("XMinGridStyle",2).toInt(); w = pSettings->value("XMinGridWidth",1).toInt(); f = pSettings->value("XMinGridUnit", 0.01).toDouble(); SetXMinGrid(bs,ba,QColor(r,g,b),s,w,f); r = pSettings->value("YMinGridColorRed",50).toInt(); g = pSettings->value("YMinGridColorGreen",50).toInt(); b = pSettings->value("YMinGridColorBlue",50).toInt(); ba = pSettings->value("YMinGridAuto",true).toBool(); bs = pSettings->value("YMinGridShow",false).toBool(); s = pSettings->value("YMinGridStyle",2).toInt(); w = pSettings->value("YMinGridWidth",1).toInt(); f = pSettings->value("YMinGridUnit",0.01).toDouble(); SetYMinGrid(bs,ba,QColor(r,g,b),s,w,f); r = pSettings->value("BorderColorRed",200).toInt(); g = pSettings->value("BorderColorGreen",200).toInt(); b = pSettings->value("BorderColorBlue",200).toInt(); s = pSettings->value("BorderStyle",0).toInt(); w = pSettings->value("BorderWidth",2).toInt(); m_bBorder = pSettings->value("BorderShow", true).toBool(); SetBorderColor(QColor(r,g,b)); SetBorderStyle(s); SetBorderWidth(w); r = pSettings->value("BackColorRed",0).toInt(); g = pSettings->value("BackColorGreen",20).toInt(); b = pSettings->value("BackColorBlue",20).toInt(); SetBkColor(QColor(r,g,b)); m_bYInverted = pSettings->value("Inverted", false).toBool(); m_X = pSettings->value("XVariable",1).toInt(); m_Y = pSettings->value("YVariable",0).toInt(); } pSettings->endGroup(); }
void TextBox::OnFocusLost() { m_caret.StopAnimation(); SetBorderColor(SDLColor(128, 128, 128, 0)); SDL_StopTextInput(); }
void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { // ÊÇ·ñÑùʽ±í if(m_pManager != NULL) { LPCTSTR pStyle = m_pManager->GetStyle(pstrValue); if( pStyle != NULL) { ApplyAttributeList(pStyle); return; } } if( _tcsicmp(pstrName, _T("pos")) == 0 ) { RECT rcPos = { 0 }; LPTSTR pstr = NULL; rcPos.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcPos.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPos.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom}; SetFixedXY(szXY); SetFixedWidth(rcPos.right - rcPos.left); SetFixedHeight(rcPos.bottom - rcPos.top); } else if( _tcsicmp(pstrName, _T("float")) == 0 ) { CDuiString nValue = pstrValue; // ¶¯Ì¬¼ÆËãÏà¶Ô±ÈÀý if(nValue.Find(',') < 0) { SetFloat(_tcsicmp(pstrValue, _T("true")) == 0); } else { TPercentInfo piFloatPercent = { 0 }; LPTSTR pstr = NULL; piFloatPercent.left = _tcstod(pstrValue, &pstr); ASSERT(pstr); piFloatPercent.top = _tcstod(pstr + 1, &pstr); ASSERT(pstr); piFloatPercent.right = _tcstod(pstr + 1, &pstr); ASSERT(pstr); piFloatPercent.bottom = _tcstod(pstr + 1, &pstr); ASSERT(pstr); SetFloatPercent(piFloatPercent); SetFloat(true); } } else if( _tcsicmp(pstrName, _T("padding")) == 0 ) { RECT rcPadding = { 0 }; LPTSTR pstr = NULL; rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetPadding(rcPadding); } else if( _tcsicmp(pstrName, _T("bkcolor")) == 0 || _tcsicmp(pstrName, _T("bkcolor1")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBkColor(clrColor); } else if( _tcsicmp(pstrName, _T("bkcolor2")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBkColor2(clrColor); } else if( _tcsicmp(pstrName, _T("bkcolor3")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBkColor3(clrColor); } else if( _tcsicmp(pstrName, _T("forecolor")) == 0 ) { while( *pstrValue > _T('\0') && *pstrValue <= _T(' ') ) pstrValue = ::CharNext(pstrValue); if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetForeColor(clrColor); } else if( _tcsicmp(pstrName, _T("bordercolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetBorderColor(clrColor); } else if( _tcsicmp(pstrName, _T("focusbordercolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); LPTSTR pstr = NULL; DWORD clrColor = _tcstoul(pstrValue, &pstr, 16); SetFocusBorderColor(clrColor); } else if( _tcsicmp(pstrName, _T("colorhsl")) == 0 ) SetColorHSL(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("bordersize")) == 0 ) { CDuiString nValue = pstrValue; if(nValue.Find(',') < 0) { SetBorderSize(_ttoi(pstrValue)); RECT rcPadding = {0}; SetBorderSize(rcPadding); } else { RECT rcPadding = { 0 }; LPTSTR pstr = NULL; rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rcPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetBorderSize(rcPadding); } } else if( _tcsicmp(pstrName, _T("leftbordersize")) == 0 ) SetLeftBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("topbordersize")) == 0 ) SetTopBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("rightbordersize")) == 0 ) SetRightBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("bottombordersize")) == 0 ) SetBottomBorderSize(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("borderstyle")) == 0 ) SetBorderStyle(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("borderround")) == 0 ) { SIZE cxyRound = { 0 }; LPTSTR pstr = NULL; cxyRound.cx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); cxyRound.cy = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); SetBorderRound(cxyRound); } else if( _tcsicmp(pstrName, _T("bkimage")) == 0 ) SetBkImage(pstrValue); else if( _tcsicmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue); else if( _tcsicmp(pstrName, _T("width")) == 0 ) SetFixedWidth(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("height")) == 0 ) SetFixedHeight(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("minwidth")) == 0 ) SetMinWidth(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("minheight")) == 0 ) SetMinHeight(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("maxwidth")) == 0 ) SetMaxWidth(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("maxheight")) == 0 ) SetMaxHeight(_ttoi(pstrValue)); else if( _tcsicmp(pstrName, _T("name")) == 0 ) SetName(pstrValue); else if( _tcsicmp(pstrName, _T("drag")) == 0 ) SetDragEnable(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("drop")) == 0 ) SetDropEnable(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("resourcetext")) == 0 ) SetResourceText(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("text")) == 0 ) SetText(pstrValue); else if( _tcsicmp(pstrName, _T("tooltip")) == 0 ) SetToolTip(pstrValue); else if( _tcsicmp(pstrName, _T("userdata")) == 0 ) SetUserData(pstrValue); else if( _tcsicmp(pstrName, _T("enabled")) == 0 ) SetEnabled(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("mouse")) == 0 ) SetMouseEnabled(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("keyboard")) == 0 ) SetKeyboardEnabled(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("visible")) == 0 ) SetVisible(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("float")) == 0 ) SetFloat(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("shortcut")) == 0 ) SetShortcut(pstrValue[0]); else if( _tcsicmp(pstrName, _T("menu")) == 0 ) SetContextMenuUsed(_tcsicmp(pstrValue, _T("true")) == 0); else if( _tcsicmp(pstrName, _T("cursor")) == 0 && pstrValue) { if( _tcsicmp(pstrValue, _T("arrow")) == 0 ) SetCursor(DUI_ARROW); else if( _tcsicmp(pstrValue, _T("ibeam")) == 0 ) SetCursor(DUI_IBEAM); else if( _tcsicmp(pstrValue, _T("wait")) == 0 ) SetCursor(DUI_WAIT); else if( _tcsicmp(pstrValue, _T("cross")) == 0 ) SetCursor(DUI_CROSS); else if( _tcsicmp(pstrValue, _T("uparrow")) == 0 ) SetCursor(DUI_UPARROW); else if( _tcsicmp(pstrValue, _T("size")) == 0 ) SetCursor(DUI_SIZE); else if( _tcsicmp(pstrValue, _T("icon")) == 0 ) SetCursor(DUI_ICON); else if( _tcsicmp(pstrValue, _T("sizenwse")) == 0 ) SetCursor(DUI_SIZENWSE); else if( _tcsicmp(pstrValue, _T("sizenesw")) == 0 ) SetCursor(DUI_SIZENESW); else if( _tcsicmp(pstrValue, _T("sizewe")) == 0 ) SetCursor(DUI_SIZEWE); else if( _tcsicmp(pstrValue, _T("sizens")) == 0 ) SetCursor(DUI_SIZENS); else if( _tcsicmp(pstrValue, _T("sizeall")) == 0 ) SetCursor(DUI_SIZEALL); else if( _tcsicmp(pstrValue, _T("no")) == 0 ) SetCursor(DUI_NO); else if( _tcsicmp(pstrValue, _T("hand")) == 0 ) SetCursor(DUI_HAND); } else if( _tcsicmp(pstrName, _T("virtualwnd")) == 0 ) SetVirtualWnd(pstrValue); else if( _tcsicmp(pstrName, _T("innerstyle")) == 0 ) { CDuiString sXmlData = pstrValue; sXmlData.Replace(_T("""), _T("\"")); LPCTSTR pstrList = sXmlData.GetData(); CDuiString sItem; CDuiString sValue; while( *pstrList != _T('\0') ) { sItem.Empty(); sValue.Empty(); while( *pstrList != _T('\0') && *pstrList != _T('=') ) { LPTSTR pstrTemp = ::CharNext(pstrList); while( pstrList < pstrTemp) { sItem += *pstrList++; } } ASSERT( *pstrList == _T('=') ); if( *pstrList++ != _T('=') ) return; ASSERT( *pstrList == _T('\"') ); if( *pstrList++ != _T('\"') ) return; while( *pstrList != _T('\0') && *pstrList != _T('\"') ) { LPTSTR pstrTemp = ::CharNext(pstrList); while( pstrList < pstrTemp) { sValue += *pstrList++; } } ASSERT( *pstrList == _T('\"') ); if( *pstrList++ != _T('\"') ) return; SetAttribute(sItem, sValue); if( *pstrList++ != _T(' ') && *pstrList++ != _T(',') ) return; } } }
void CReportEntityPicture::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; int c_f; int d_f; } PIC_RESERVE_FIELDS; PIC_RESERVE_FIELDS pic_reserve; memset(&pic_reserve,0,sizeof(PIC_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int bst = GetBorderStyle( ); ar.Write(&bst,sizeof(unsigned int)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int )); ar.Write(&pic_reserve,sizeof(PIC_RESERVE_FIELDS)); if (m_image_size>0 && m_image_bits) { ar.Write(&m_image_type,sizeof(int)); ar.Write(&m_image_size,sizeof(unsigned int)); ar.Write(m_image_bits,sizeof(BYTE)*m_image_size); } } else { // „итаем double bordhickness; ar.Read(&bordhickness,sizeof(double)); unsigned int bordst; ar.Read(&bordst,sizeof(unsigned int )); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int )); ar.Read(&pic_reserve,sizeof(PIC_RESERVE_FIELDS)); int bt = CUnitConversion::InchesToPixels( bordhickness ); SetBorderThickness( bt ); SetBorderStyle( bordst ); SetBorderColor( linecolor ); if( m_bitmap ) delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; if (m_image_bits) delete[] m_image_bits; m_image_bits = NULL; ar.Read(&m_image_type,sizeof(int)); ar.Read(&m_image_size,sizeof(unsigned int)); if (m_image_size==0) return; try { m_image_bits = new BYTE[m_image_size]; } catch (std::bad_alloc) { AfxMessageBox("bad_alloc exception in Serialize function"); ASSERT(0); return; } if (ar.Read(m_image_bits,m_image_size*sizeof(BYTE))!=m_image_size*sizeof(BYTE)) { delete[] m_image_bits; m_image_bits=NULL; m_image_type = -1; m_image_size = 0; ASSERT(0); return; } m_bitmap = new CxImage(m_image_bits, m_image_size, m_image_type); if (!m_bitmap->IsValid()) { AfxMessageBox(m_bitmap->GetLastError()); delete m_bitmap; m_bitmap = NULL; delete[] m_image_bits; m_image_bits=NULL; m_image_type = -1; m_image_size = 0; ASSERT(0); return; } } }