BEGIN_GUI TAbstractWindow::TAbstractWindow(const TAbstractWindowSource& source) : parent_type(source), allowMoving(source.allowMoving), headerHeight(source.headerHeight), headerColor(source.headerColor), color(source.color), colorModifier(), image(source.image), innerElementsPadding(source.innerElementsPadding), minSize(source.minSize), maxSize(source.maxSize), clickPosition(), clicked(false) { if (source.enabled == true) { state = State::Normal; } else { state = State::Disabled; } if (HasHeader() == true) { headerText.reset(new TTextArea(source.headerText, this)); } }
const FString* FWordCountReportData::GetColumnHeader(int32 ColumnIndex) const { if( ColumnIndex >= 0 && HasHeader() && ColumnIndex < GetColumnCount() ) { return &Data[0][ColumnIndex]; } return NULL; }
bool TAbstractWindow::_isMouseOverHeader() const { if (HasHeader() == false) { return false; } const TCoordinate position = GetScreenPosition(); return IO::IsCursorInRect(position.x, position.y, position.x + size.x, position.y + headerHeight); }
int32 FWordCountReportData::GetColumnIndex( const FString& ColumnHeading ) const { if(HasHeader()) { const TArray< FString >& Row = Data[0]; return Row.Find(ColumnHeading); } return INDEX_NONE; }
void TAbstractWindow::_draw(TRenderTarget& target) { if (needsRedraw == true) { TRenderTarget& localTarget = renderImage.getRenderTarget(); localTarget.clear(_currentColor()); if (image.drawingObject != nullptr) { if (image.image != nullptr) { sf::Sprite* sprite = image.drawingObject.get(); if (sprite != nullptr) { sprite->setColor(_currentColor()); } } localTarget.draw(*image.drawingObject); } if (HasHeader() == true) { sf::RectangleShape headerRect( sf::Vector2f(size.x, headerHeight) ); headerRect.setFillColor(_currentHeaderColor()); localTarget.draw(headerRect); } if (headerText->GetText().empty() == false) { headerText->Draw(localTarget); } renderImage.createDrawingObject(); needsRedraw = false; } const TCoordinate position = GetScreenPosition(); renderImage.getDrawingObject().setPosition(position.x, position.y); target.draw(renderImage.getDrawingObject()); #if defined(_DEBUG) if (Debug::show_frames() == true) { sf::RectangleShape boundingRect( sf::Vector2f(size.x, size.y) ); boundingRect.setFillColor(sf::Color(0, 0, 0, 0)); boundingRect.setOutlineColor(sf::Color(0, 255 - 55 * mouseOver, 0, 128)); boundingRect.setOutlineThickness(2.f); boundingRect.setPosition(position.x, position.y); target.draw(boundingRect); sf::Text rectText = TFont().CreateText(String::toWide(name)); rectText.setPosition(position.x, position.y); target.draw(rectText); } #endif // _DEBUG }
long wxGxContentView::HitTest( const wxPoint& point, int& flags, long *pSubItem) const { wxPoint TestPt = point; #ifdef __WXGTK__ if(HasHeader()) { //TODO: find out header height int nHHeight = 20; //wxListHeaderWindow* pWnd = wxListCtrl::m_headerWin; //if(pWnd != NULL) //{ // wxSize size = pWnd->GetSize(); TestPt.y -= nHHeight; //} } #endif // __WXGTK__ long ret = wxListCtrl::HitTest(TestPt, flags, pSubItem); if(ret < wxNOT_FOUND) ret = wxNOT_FOUND; return ret; }
int32 FWordCountReportData::AddColumn(const FString* ColumnHeading ) { int32 RowIndex = 0; if( ColumnHeading != NULL && HasHeader() ) { // Check to see if a column with the provided header already exists int32 ExistingColumnIndex = GetColumnIndex(*ColumnHeading); if(ExistingColumnIndex != INDEX_NONE) { return ExistingColumnIndex; } Data[0].Add(*ColumnHeading); RowIndex++; } for(;RowIndex < Data.Num(); RowIndex++) { Data[RowIndex].Add(FString(TEXT(""))); } return GetColumnCount() - 1; }
//******************************************************************************************************************** //******************************************************************************************************************** // //in the GCC/UNIX version of this function file access is done with low-level POSIX functions and not std::fstream because //mmap needs the raw file handle which is not available when using std::fstream. // ierr TimeBuf::OpenFile(CString FileName) { ierr Ret; ULONGLONG FileSizeBytes; //CFileException e; int FileType; uintd BytesRead; struct stat statbuf; //open file fd=0; fd = open( FileName, O_RDONLY); if ( fd == 0 ) { // opens file fname_buf. Amb("Error opening file; Is the file/path name correct? Win Err:"); return(0); } FileOpen = TRUE; ThisFileName = FileName; //get file size fstat (fd,&statbuf); FileSizeBytes = statbuf.st_size; //File.GetLength(); // size of file in bytes //must check to see if we have a .t file, b/c otherwise, nlxFileType will think its a .nts file and thats bad char buf[100]; CString str; int ret = -1; int position = 0; ULONGLONG newPosition = 0; read(fd,buf,100); str = buf; if( str.Find("%%BEGINHEADER") != -1 ) { //now close it, so we can reopen in Objfer ret = str.Find("%%ENDHEADER"); while( ret == -1 ) { memcpy( buf, &buf[80], sizeof(char)*20 ); read(fd,&buf[20], 80 ); str = buf; position += 80; ret = str.Find("%%ENDHEADER"); } position += ret; position += 12; newPosition=lseek(fd,position,SEEK_SET); FileSizeBytes -= newPosition; } else { lseek(fd,0,SEEK_SET); Ret = NlxFileType(FileType,FileName); if (Ret == NLX_OK) { if (FileType != DATAFILETYPE) { FileOpen = FALSE; close(fd); Amb("Invalid FileType found, cannot proceed"); return(NLX_WRONGFILETYPE); } } else { Amb("Unable to calculate file type: Error Code - ", Ret); } lseek(fd,0,SEEK_SET); FileHeader = HasHeader(fd); if (FileHeader) { //do the actual read lseek(fd,0,SEEK_SET); BytesRead = read(fd,HeaderBuf,NlxHeaderLength); //err check if (BytesRead != NlxHeaderLength ) { Amb("Insufficient read length. Likely corrupt header or invalid file. Bytes read:", BytesRead); //LeaveCriticalSection(&ThreadSafe); return(NLX_RANGE); } FileSizeBytes -= NlxHeaderLength; } } NumRecsInFile = (unsigned int)(FileSizeBytes / ((ULONGLONG)RecSizeBytes)); // count of total records in file if (FileSizeBytes % RecSizeBytes) { Amb("FileSizeBytes=", FileSizeBytes); Amb("Corrupt file - incomplete record encountered: Record size in bytes :", RecSizeBytes); } /*DataFileMap = CreateFileMapping(File.m_hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL); if (DataFileMap == NULL) { Ret = GetLastError(); Amb("Error Creating File Mapping, GetLastError = ", Ret); FileOpen = FALSE; File.Close(); //LeaveCriticalSection(&ThreadSafe); return(Ret); } Buf = (char*)( MapViewOfFileEx(DataFileMap, FILE_MAP_READ, 0, 0, 0, NULL) ); BufValueForUnmappingFile = Buf; if (Buf == NULL) { Ret = GetLastError(); Amb("Error Mapping View Of File, GetLastError = ", Ret); FileOpen = FALSE; CloseHandle(DataFileMap); File.close(); //LeaveCriticalSection(&ThreadSafe); return(Ret); } */ mmapSize=statbuf.st_size; Buf = (char*) mmap (0, mmapSize, PROT_READ, MAP_SHARED, fd, 0); BufValueForUnmappingFile = Buf; if( position != 0 ) { Buf += position; } //adjust for header if (FileHeader) { Buf += NlxHeaderLength; } return(0); }