//************************************************** bool wxSFComponent::CreateFromXPM(const char* const* bits) { bool fSuccess = false; // create bitmap from XPM m_Image = wxImage(bits); fSuccess = m_Image.IsOk(); if(!fSuccess) { m_Image = wxImage(NoSource_xpm); } m_OriginalImage = m_Image; m_nRectSize.x = m_Image.GetWidth(); m_nRectSize.y = m_Image.GetHeight(); if(m_fCanScale) { AddStyle(sfsSIZE_CHANGE); } else RemoveStyle(sfsSIZE_CHANGE); return fSuccess; }
//************************************************** // public functions //************************************************** bool wxSFIfShape::CreateFromXPM(const char* const* bits) { bool fSuccess = false; // create bitmap from XPM m_Image = wxImage(bits); fSuccess = m_Image.IsOk(); if(!fSuccess) { m_Image = wxImage(NoSource_xpm); } m_OriginalImage = m_Image; m_nRectSize.x = m_Image.GetWidth(); m_nRectSize.y = m_Image.GetHeight(); wxRealPoint diamond[4]={wxRealPoint(0, m_Image.GetHeight()/2), wxRealPoint(m_Image.GetWidth()/2, 0), wxRealPoint(m_Image.GetWidth(), m_Image.GetHeight()/2), wxRealPoint(m_Image.GetWidth()/2, m_Image.GetHeight())}; SetVertices(4, diamond); if(m_fCanScale) { AddStyle(sfsSIZE_CHANGE); } else RemoveStyle(sfsSIZE_CHANGE); return fSuccess; }
//************************************************** bool wxSFTrigger::CreateFromImage(wxImage *image) { bool fSuccess = true; if(image) { m_Image = *image; fSuccess = true; } else fSuccess = false; if(!fSuccess) { m_Image = wxImage(NoSource_xpm); } m_OriginalImage = m_Image; m_nRectSize.x = m_Image.GetWidth(); m_nRectSize.y = m_Image.GetHeight(); if(m_fCanScale) { AddStyle(sfsSIZE_CHANGE); } else RemoveStyle(sfsSIZE_CHANGE); return fSuccess; }
void uddPageElement::Initialize() { // nastavení neprůhlednosti (bílé barvy) okrajům m_pMarginLeft->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginTop->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginRight->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginBottom->SetFill( *wxTRANSPARENT_BRUSH ); m_pMarginLeft->SetBorder( *wxTRANSPARENT_PEN ); m_pMarginTop->SetBorder( *wxTRANSPARENT_PEN ); m_pMarginRight->SetBorder( *wxTRANSPARENT_PEN ); m_pMarginBottom->SetBorder( *wxTRANSPARENT_PEN ); SetFill( *wxWHITE_BRUSH ); SetBorder( *wxBLACK_PEN ); AddStyle( sfsSHOW_SHADOW ); // přidání stylu stínu RemoveStyle(sfsSIZE_CHANGE); // znemožnění změny velikosti m_pShapeInside->AcceptChild( wxT("uddImageItemElement") ); m_pShapeInside->AcceptChild( wxT("uddTableItemElement") ); m_pShapeInside->SetBorder( *wxLIGHT_GREY_PEN ); m_pageSize = MilimetersToPixels( 210.0, 297.0 ); // nastavení velikosti papíru this->SetMargins( 0, 0, 0, 0 ); // nastavení okrajů (pro inicilizaci velikosti) }
//************************************************** void wxSFIfShape::OnHandle(wxSFShapeHandle& handle) { if(m_fCanScale) { wxSFDiamondShape::OnHandle(handle); } else RemoveStyle(sfsSIZE_CHANGE); }
wxSFGridShape::wxSFGridShape() : wxSFRectShape() { m_nRows = sfdvGRIDSHAPE_ROWS; m_nCols = sfdvGRIDSHAPE_COLS; m_nCellSpace = sfdvGRIDSHAPE_CELLSPACE; RemoveStyle(sfsSIZE_CHANGE); MarkSerializableDataMembers(); }
wxSFGridShape::wxSFGridShape(const wxSFGridShape& obj) : wxSFRectShape(obj) { m_nRows = obj.m_nRows; m_nCols = obj.m_nCols; m_nCellSpace = obj.m_nCellSpace; RemoveStyle(sfsSIZE_CHANGE); m_arrCells.Clear(); WX_APPEND_ARRAY(m_arrCells, obj.m_arrCells); MarkSerializableDataMembers(); }
wxSFGridShape::wxSFGridShape(const wxRealPoint& pos, const wxRealPoint& size, int rows, int cols, int cellspace, wxSFDiagramManager* manager) : wxSFRectShape(pos, size, manager) { m_nRows = rows; m_nCols = cols; m_nCellSpace = cellspace; RemoveStyle(sfsSIZE_CHANGE); m_arrCells.Alloc( rows * cols ); MarkSerializableDataMembers(); }
void CIconButtonCtrl::SetIcon(HICON hIcon, BOOL bMirrored) { if ( hIcon ) { if ( bMirrored ) { hIcon = CreateMirroredIcon( hIcon ); ASSERT( hIcon != NULL ); } if ( hIcon ) { if ( m_pImageList.GetImageCount() ) { ASSERT( m_pImageList.GetImageCount() == 1 ); VERIFY( m_pImageList.Remove( 0 ) ); } VERIFY( m_pImageList.Add( hIcon ) != -1 ); VERIFY( DestroyIcon( hIcon ) ); RemoveStyle(); } } }
//************************************************** bool wxSFIfShape::CreateFromImage(wxImage *image) { bool fSuccess = true; if(image) { m_Image = *image; fSuccess = true; } else fSuccess = false; if(!fSuccess) { m_Image = wxImage(NoSource_xpm); } m_OriginalImage = m_Image; m_nRectSize.x = m_Image.GetWidth(); m_nRectSize.y = m_Image.GetHeight(); wxRealPoint diamond[4]={wxRealPoint(0, m_Image.GetHeight()/2), wxRealPoint(m_Image.GetWidth()/2, 0), wxRealPoint(m_Image.GetWidth(), m_Image.GetHeight()/2), wxRealPoint(m_Image.GetWidth()/2, m_Image.GetHeight())}; SetVertices(4, diamond); if(m_fCanScale) { AddStyle(sfsSIZE_CHANGE); } else RemoveStyle(sfsSIZE_CHANGE); return fSuccess; }
void wxSFEditTextShape::EditLabel() { if( GetParentCanvas() ) { int dx, dy; wxRealPoint shpPos = GetAbsolutePosition(); double scale = GetParentCanvas()->GetScale(); GetParentCanvas()->CalcUnscrolledPosition(0, 0, &dx, &dy); switch( m_nEditType ) { case editINPLACE: { wxRect shpBB = GetBoundingBox(); int style = 0; if( m_fForceMultiline || m_sText.Contains(wxT("\n")) ) { style = wxTE_MULTILINE; // set minimal control size } if( (m_sText == wxEmptyString) || ((style == wxTE_MULTILINE) && (shpBB.GetWidth() < 50)) )shpBB.SetWidth(50); m_nCurrentState = GetStyle(); RemoveStyle(sfsSIZE_CHANGE); m_pTextCtrl = new wxSFContentCtrl(GetParentCanvas(), textCtrlId, this, m_sText, wxPoint(int((shpPos.x * scale) - dx), int((shpPos.y * scale) - dy)), wxSize(int(shpBB.GetWidth() * scale), int(shpBB.GetHeight() * scale)), style); } break; case editDIALOG: { wxString sPrevText = GetText(); wxSFDetachedContentCtrl m_pTextDlg( GetParentCanvas() ); //m_pTextDlg.Move( wxPoint(int((shpPos.x * scale) - dx), int((shpPos.y * scale) - dy)) ); m_pTextDlg.SetContent( sPrevText ); if( m_pTextDlg.ShowModal() == wxID_OK ) { if( m_pTextDlg.GetContent() != sPrevText ) { SetText( m_pTextDlg.GetContent() ); GetParentCanvas()->OnTextChange( this ); GetParentCanvas()->SaveCanvasState(); Update(); GetParentCanvas()->Refresh( false ); } } } break; default: break; } } }
uddImageItemElement::uddImageItemElement() { RemoveStyle( sfsPARENT_CHANGE ); m_previousAbsolutePosition = wxRealPoint( -1, - 1); }