THXVarTable::THXVarTable ( THXVarList* varList, JXTextMenu* fontMenu, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1,1, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h) { const JSize rowHeight = 2*kVMarginWidth + (GetFontManager())->GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()); SetDefaultRowHeight(rowHeight); itsVarList = varList; itsTextInput = NULL; itsFontMenu = fontMenu; AppendCols(2); // name, function const JSize count = itsVarList->GetElementCount() - THXVarList::kUserFnOffset; AppendRows(count); FitToEnclosure(); // make sure SetColWidth() won't fail ListenTo(this); // adjust fn col width SetColWidth(kNameColumn, GetApertureWidth()/3); // kFnColumn width set automatically }
//--------------------------------------------------------- bool CVIEW_Table_Control::Update_Table(void) { if( GetBatchCount() > 0 ) { return( false ); } BeginBatch(); //----------------------------------------------------- int Difference = (m_pTable->Get_Field_Count() - m_Field_Offset) - GetNumberCols(); if( Difference > 0 ) { AppendCols(Difference); } else if( (Difference = -Difference < GetNumberCols() ? -Difference : GetNumberCols()) > 0 ) { // here is (or was!?) a memory leak - solution: use own wxGridTableBase derived grid table class DeleteCols(0, Difference); } //----------------------------------------------------- for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++) { SetColLabelValue(iCol, m_pTable->Get_Field_Name(iField)); switch( m_pTable->Get_Field_Type(iField) ) { default: case SG_DATATYPE_Byte: case SG_DATATYPE_Char: case SG_DATATYPE_String: case SG_DATATYPE_Date: case SG_DATATYPE_Binary: SetColFormatCustom(iCol, wxGRID_VALUE_STRING); break; case SG_DATATYPE_Bit: case SG_DATATYPE_Word: case SG_DATATYPE_Short: case SG_DATATYPE_DWord: case SG_DATATYPE_Int: case SG_DATATYPE_ULong: case SG_DATATYPE_Long: case SG_DATATYPE_Color: SetColFormatNumber(iCol); break; case SG_DATATYPE_Float: case SG_DATATYPE_Double: SetColFormatFloat(iCol); break; } } //----------------------------------------------------- EndBatch(); return( _Set_Records() ); }
DataTable::DataTable ( JArray<JIndex>* data, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(kDefRowHeight, kDefColWidth, scrollbarSet, enclosure, hSizing, vSizing, x, y, w, h) { // This will be our data, but we don't own it so we can't delete it. itsData = data; // This data needs only one column AppendCols(1, kDefColWidth); // We need to add a row for each element in the data array AppendRows(itsData->GetElementCount(), kDefRowHeight); // The table is now in sync with the data array, but in // order to hear about changes in the data, we have to listen // for messages from the data. ListenTo(itsData); }
ctlVarWindow::ctlVarWindow( wxWindow *parent, wxWindowID id ) : wxGrid( parent, id ), m_cells( NULL ), m_nameFont( GetDefaultCellFont()) { wxWindowBase::SetFont(settings->GetSystemFont()); // Create the grid control CreateGrid( 0, 0 ); SetRowLabelSize( 0 ); // Turn off the row labels // Set up three columns: name, value, and data type AppendCols( 3 ); SetColLabelValue( COL_NAME, _( "Name" )); SetColLabelValue( COL_TYPE, _( "Type" )); SetColLabelValue( COL_VALUE, _( "Value" )); EnableDragGridSize( true ); // EDB wants to hide certain PL variables. To do that, we // keep a hash of hidden names and a hash of hidden types... m_hiddenNames.insert( wxT( "found" )); m_hiddenNames.insert( wxT( "rowcount" )); m_hiddenNames.insert( wxT( "sqlcode" )); m_hiddenNames.insert( wxT( "sqlerrm" )); m_hiddenNames.insert( wxT( "_found" )); m_hiddenNames.insert( wxT( "_rowcount" )); m_hiddenNames.insert( wxT( "sqlstate" )); m_hiddenTypes.insert( wxT( "refcursor" )); }
void GMAccountList::GMAccountListX() { AppendCols(1, kDefColWidth); const JSize count = itsAccountInfo->GetElementCount(); AppendRows(count, itsLineHeight); GetTableSelection().SelectRow(1); WantInput(kJFalse); }
void ctlResultGrid::fillGrid( PGresult * result ) { int rowCount = PQntuples( result ); int colCount = PQnfields( result ); // If this PGresult represents a non-query command // (like an INSERT), there won't be any columns in // the result set - just return if( colCount == 0 ) return; // Disable repaints to we don't flicker too much BeginBatch(); // Clear out the old results (if any) and resize // grid to match the result set if( GetNumberRows()) DeleteRows( 0, GetNumberRows()); if( GetNumberCols()) DeleteCols( 0, GetNumberCols()); AppendRows( rowCount ); AppendCols( colCount ); EnableEditing( false ); // Copy the column names from the result set into the column headers for( int col = 0; col < colCount; ++col ) SetColLabelValue( col, wxString( PQfname( result, col ), wxConvUTF8 )); // Now copy each value from the result set into the grid for( int row = 0; row < rowCount; ++row ) { for( int col = 0; col < colCount; ++col ) { if( PQgetisnull( result, row, col )) SetCellValue( row, col, wxT( "" )); else SetCellValue( row, col, wxString( PQgetvalue( result, row, col ), wxConvUTF8 )); } } // Resize each column to fit its content AutoSizeColumns( false ); // Enable repaints EndBatch(); }
JX2DCurveNameList::JX2DCurveNameList ( const JArray<J2DCurveInfo>& curveInfo, const JIndex startIndex, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h), itsInput(NULL) { itsMinColWidth = 1; const JFontManager* fontMgr = GetFontManager(); const JSize rowHeight = 2*kVMarginWidth + fontMgr->GetDefaultFont().GetLineHeight(); SetDefaultRowHeight(rowHeight); const JSize count = curveInfo.GetElementCount(); itsNameList = jnew JPtrArray<JString>(JPtrArrayT::kForgetAll, count); assert(itsNameList != NULL); AppendRows(count); for (JIndex i=1; i<=count; i++) { const J2DCurveInfo info = curveInfo.GetElement(i); itsNameList->Append(info.name); const JCoordinate width = 2*kHMarginWidth + fontMgr->GetDefaultFont().GetStringWidth(*(info.name)); if (width > itsMinColWidth) { itsMinColWidth = width; } } AppendCols(1); AdjustColWidth(); JXColormap* colormap = GetColormap(); SetRowBorderInfo(0, colormap->GetBlackColor()); SetColBorderInfo(0, colormap->GetBlackColor()); BeginEditing(JPoint(1, startIndex)); }
JXTreeListWidget::JXTreeListWidget ( JTreeList* treeList, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXStyleTable(scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h), itsToggleOpenColIndex(0), itsNodeColIndex(0), itsElasticColIndex(0) { itsTreeList = treeList; ListenTo(itsTreeList); itsMinColWidths = new JArray<JSize>; assert( itsMinColWidths != NULL ); itsReselectNodeList = new JPtrArray<JTreeNode>(JPtrArrayT::kForgetAll); assert( itsReselectNodeList != NULL ); ListenTo(itsTreeList->GetTree()); itsIndentWidth = kDefaultIndent; itsDrawSelectionFlag = kJTrue; itsAdjustToTreeTask = NULL; itsToggleDragIndex = 0; itsDNDTargetIndex = 0; itsMaxOpenDepth = kDefaultMaxOpenDepth; itsSavedScrollSetup = NULL; SetRowBorderInfo(0, GetBackColor()); SetColBorderInfo(0, GetBackColor()); ShouldActLike1DList(); NeedsAdjustToTree(); AppendRows(itsTreeList->GetElementCount()); AppendCols(2, kToggleColWidth); // second width adjusts automatically itsToggleOpenColIndex = 1; itsNodeColIndex = 2; itsElasticColIndex = itsNodeColIndex; ListenTo(this); }
GLFitDescriptionList::GLFitDescriptionList ( JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h), itsInput(NULL) { itsMinColWidth = 1; const JFontManager* fontMgr = GetFontManager(); const JSize rowHeight = 2*kVMarginWidth + fontMgr->GetDefaultFont().GetLineHeight(); SetDefaultRowHeight(rowHeight); const JSize count = GetFitManager()->GetFitCount(); itsNameList = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll); assert(itsNameList != NULL); AppendCols(1); SyncWithManager(); JXColormap* colormap = GetColormap(); SetRowBorderInfo(0, colormap->GetBlackColor()); SetColBorderInfo(0, colormap->GetBlackColor()); itsBuiltInIcon = jnew JXImage(GetDisplay(), JXPM(glBuiltInFit)); assert(itsBuiltInIcon != NULL); itsBuiltInIcon->ConvertToRemoteStorage(); itsNonLinearIcon = jnew JXImage(GetDisplay(), JXPM(glNonLinearFit)); assert(itsNonLinearIcon != NULL); itsNonLinearIcon->ConvertToRemoteStorage(); itsPolyIcon = jnew JXImage(GetDisplay(), JXPM(glPolyFit)); assert(itsPolyIcon != NULL); itsPolyIcon->ConvertToRemoteStorage(); itsExecutableIcon = jnew JXImage(GetDisplay(), JXPM(jx_executable_small)); assert( itsExecutableIcon != NULL ); itsExecutableIcon->ConvertToRemoteStorage(); ListenTo(GetFitManager()); }
CMLineIndexTable::CMLineIndexTable ( JOrderedSetT::CompareResult (*bpCcompareFn)(CMBreakpoint *const &, CMBreakpoint *const &), CMSourceDirector* dir, CMSourceText* text, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(1, 1, NULL, enclosure, hSizing, vSizing, x, y, w, h), itsDirector(dir), itsText(text), itsVScrollbar(scrollbarSet->GetVScrollbar()), itsCurrentLineIndex(0), itsLineMenu(NULL), itsDeselectTask(NULL) { itsLink = CMGetLink(); ListenTo(itsLink); itsBPList = jnew JPtrArray<CMBreakpoint>(JPtrArrayT::kForgetAll); assert(itsBPList != NULL); itsBPList->SetCompareFunction(bpCcompareFn); itsBPList->SetSortOrder(JOrderedSetT::kSortAscending); WantInput(kJFalse); SetBackColor(CMGetPrefsManager()->GetColor(CMPrefsManager::kBackColorIndex)); SetFocusColor(GetBackColor()); SetRowBorderInfo(0, GetBackColor()); SetColBorderInfo(0, GetBackColor()); SetDrawOrder(kDrawByCol); AppendCols(3); CMAdjustLineTableToTextTask* task = jnew CMAdjustLineTableToTextTask(this); assert( task != NULL ); task->Go(); ListenTo(itsText); ListenTo(itsVScrollbar); ListenTo(itsLink->GetBreakpointManager()); }
void CGridLocus::_ImplementColumn(int nCol,bool bAmel) { int nStart = nCol; int nStop = nCol; int i; int k; int n = GetNumberCols(); if(nCol >= n) { AppendCols(nCol - n + 1); nStart = n; } for(k = nStart; k <= nStop; ++k) { s.Printf("Peak %d",k+1); SetColLabelValue(k,s); for(i = ROW_RO_FIRST; i <= ROW_RO_LAST; i++) { DisableEdit(i,k); } SetBoolCell(ROW_HOMOZYGOUS,k); SetBoolCell(ROW_OFF_LADDER,k); SetBoolCell(ROW_DISABLE,k); SetCellEditor(ROW_BPS,k,new wxGridCellFloatEditor(12,7)); SetCellRenderer(ROW_BPS,k,new wxGridCellFloatRenderer(12,7)); if(!bAmel) { wxGridCellFloatEditor *pfe1(new wxGridCellFloatEditor(5,1)); wxGridCellFloatRenderer *pfr1(new wxGridCellFloatRenderer(5,1)); SetCellEditor(ROW_ALLELE,k,pfe1); SetCellRenderer(ROW_ALLELE,k,pfr1); } else { wxGridCellTextEditor *pe(new wxGridCellTextEditor); pe->SetParameters(_T("1")); SetCellEditor(ROW_ALLELE,k,pe); } SetCellAlignment(wxALIGN_RIGHT, ROW_ALLELE,k); SetCellAlignment(wxALIGN_RIGHT, ROW_BPS,k); SetCellAlignment(wxALIGN_RIGHT, ROW_RFU,k); SetCellAlignment(wxALIGN_RIGHT, ROW_TIME,k); SetCellAlignment(wxALIGN_RIGHT, ROW_PEAK_AREA,k); } }
SelectionTable::SelectionTable ( JXMenuBar* menuBar, JArray<JIndex>* data, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(kDefRowHeight, kDefColWidth, scrollbarSet, enclosure, hSizing, vSizing, x, y, w, h) { // This will be our data, but we don't own it so we can't delete it. itsData = data; // We need to set this to NULL in case we receive a message before // we create it. itsTableMenu = NULL; // This data needs only one column AppendCols(1, kDefColWidth); // We need to add a row for each element in the data array AppendRows(itsData->GetElementCount(), kDefRowHeight); // The table is now in sync with the data array, but in // order to hear about changes in the data, we have to listen // for messages from the data. ListenTo(itsData); // Attach our menu to the menu bar. itsTableMenu = menuBar->AppendTextMenu(kTableMenuTitleStr); // Set the menu items in our menu. itsTableMenu->SetMenuItems(kTableMenuStr); // Set the menu to never disable the menu items. itsTableMenu->SetUpdateAction(JXMenu::kDisableNone); // The table needs to listen to the menu for messages. ListenTo(itsTableMenu); }
JXRowHeaderWidget::JXRowHeaderWidget ( JXTable* table, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1,w, NULL, enclosure, hSizing,vSizing, x,y, w,h) { assert( table != NULL && scrollbarSet != NULL ); itsTable = table; itsTable->SetRowHeader(this); ListenTo(itsTable); itsVScrollbar = scrollbarSet->GetVScrollbar(); ListenTo(itsVScrollbar); itsTitles = NULL; itsAllowRowResizingFlag = kJFalse; itsMinRowHeight = 1; itsHMarginWidth = 2*kCellFrameWidth; itsMaxBcastWidth = 0; itsDragType = kInvalidDrag; itsDragLineCursor = JXGetDragHorizLineCursor(GetDisplay()); itsDragAllLineCursor = JXGetDragAllHorizLineCursor(GetDisplay()); SetColBorderInfo(0, (GetColormap())->GetBlackColor()); // override JXEditTable WantInput(kJFalse); SetBackColor((GetColormap())->GetDefaultBackColor()); AppendCols(1, GetApertureWidth()); AdjustToTable(); }
SimpleTable::SimpleTable ( JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(kDefRowHeight, kDefColWidth, scrollbarSet, enclosure, hSizing, vSizing, x, y, w, h) { // We arbitrarily choose to have one column and 10 rows. AppendCols(1, kDefColWidth); AppendRows(10, kDefRowHeight); }
GLFitParameterTable::GLFitParameterTable ( JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h), itsInput(NULL), itsHasStartValues(kJTrue), itsColHeaderWidget(NULL) { itsMinColWidth = 1; const JFontManager* fontMgr = GetFontManager(); const JSize rowHeight = 2*kVMarginWidth + fontMgr->GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()); SetDefaultRowHeight(rowHeight); itsNameList = new JPtrArray<JString>(JPtrArrayT::kDeleteAll); assert(itsNameList != NULL); itsStartValues = new JArray<JFloat>; assert(itsStartValues != NULL); itsFitValues = new JArray<JFloat>; assert(itsFitValues != NULL); itsErrorValues = new JArray<JFloat>; assert(itsErrorValues != NULL); AppendCols(4, kDefColWidth); AdjustColWidth(); JXColormap* colormap = GetColormap(); // SetRowBorderInfo(0, colormap->GetBlackColor()); // SetColBorderInfo(0, colormap->GetBlackColor()); }
CBSymbolTable::CBSymbolTable ( CBSymbolDirector* symbolDirector, CBSymbolList* symbolList, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(10, 10, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h) { itsSymbolDirector = symbolDirector; itsSymbolList = symbolList; itsMaxStringWidth = 0; itsVisibleList = new JArray<JIndex>(CBSymbolList::kBlockSize); assert( itsVisibleList != NULL ); itsVisibleListLockedFlag = kJFalse; itsNameFilter = NULL; itsNameLiteral = NULL; const JIndex blackColor = (GetColormap())->GetBlackColor(); SetRowBorderInfo(0, blackColor); SetColBorderInfo(0, blackColor); AppendCols(1); SetDefaultRowHeight((GetFontManager())-> GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()) + 2*kVMarginWidth); SetSelectionBehavior(kJTrue, kJTrue); ListenTo(itsSymbolList); ListenTo(CBGetSymbolTypeList()); }
bool CGridAnalysis::_SetGridSize(int nRowCount, int nColCount) { // return true if OK, false if error int nRowCurrent = GetNumberRows(); int nColCurrent = GetNumberCols(); bool bError = false; ClearSelection(); ClearGrid(); if((!nRowCount) || (nColCount < 1)) { bError = true; nRowCount = 1; nColCount = 1; } if(nColCurrent > nColCount) { DeleteCols(nColCount,nColCurrent - nColCount); } else if(nColCurrent < nColCount) { AppendCols(nColCount - nColCurrent); } if(nRowCurrent > nRowCount) { DeleteRows(nRowCount,nRowCurrent - nRowCount); } else if(nRowCurrent < nRowCount) { AppendRows(nRowCount - nRowCurrent); } if(bError) { SetColLabelValue(0,wxEmptyString); SetRowLabelValue(0,wxEmptyString); SetCellStyle(0,0,GRID_NORMAL); SetCellValue(0,0,wxEmptyString); } return !bError; }
GPMProcessTreeList::GPMProcessTreeList ( GPMProcessList* list, JNamedTreeList* treeList, JXTEBase* fullCmdDisplay, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXNamedTreeListWidget(treeList, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h), itsList(list), itsContextMenu(NULL), itsSelectedEntry(NULL), itsFullCmdDisplay(fullCmdDisplay), itsZombieImage(NULL) { AppendCols(GPMProcessList::kTreeCount - 2); SetColWidth(GPMProcessList::kTreeState, 20); SetColWidth(GPMProcessList::kTreePID, 50); SetColWidth(GPMProcessList::kTreeUser, 75); SetColWidth(GPMProcessList::kTreeNice, 40); SetColWidth(GPMProcessList::kTreeSize, 60); SetColWidth(GPMProcessList::kTreeCPU, 50); SetColWidth(GPMProcessList::kTreeMemory, 60); SetColWidth(GPMProcessList::kTreeTime, 60); itsZombieImage = jnew JXImage(GetDisplay(), jx_edit_clear); assert( itsZombieImage != NULL ); itsContextMenu = GPMProcessTable::CreateContextMenu(this); ListenTo(itsContextMenu); ListenTo(itsList); }
FitParmsTable::FitParmsTable ( JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXTable(1,kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h) { AppendCols(2, kDefColWidth); itsCol1 = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll); assert(itsCol1 != NULL); itsCol2 = jnew JPtrArray<JString>(JPtrArrayT::kDeleteAll); assert(itsCol2 != NULL); SetColBorderInfo(0, GetColormap()->GetBlackColor()); SetRowBorderInfo(0, GetColormap()->GetBlackColor()); }
JXTextMenuTable::JXTextMenuTable ( JXMenu* menu, JXTextMenuData* data, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXMenuTable(menu, data, enclosure, hSizing,vSizing, x,y, w,h), itsTextMenuData(data), itsHilightRow(0) { AppendCols(4); // checkbox/radio, image, text, submenu/shortcut AppendRows(itsTextMenuData->GetElementCount()); const_cast<JXTextMenuData*>(itsTextMenuData)->ConfigureTable(this); ListenTo(itsTextMenuData); }
void GMFilterNameTable::GMFilterNameTableX() { AppendCols(1, kDefColWidth); AdjustColWidths(); const JFontManager* fm = GetFontManager(); itsRowHeight = fm->GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()) + kRowHeightAdjust; const JSize count = itsFilters->GetElementCount(); AppendRows(count, itsRowHeight); AdjustButtons(); WantInput(kJFalse); ListenTo(itsNewButton); ListenTo(itsRemoveButton); const Atom dndName = GetDNDManager()->GetDNDSelectionName(); GetDisplay()->RegisterXAtom(kDragFilterXAtomName); }
JXFSBindingTable::JXFSBindingTable ( JFSBindingList* list, JXTextButton* addButton, JXTextButton* removeButton, JXTextButton* duplicateButton, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1,1, scrollbarSet, enclosure, hSizing, vSizing, x, y, w, h), itsBindingList(list), itsAddButton(addButton), itsRemoveButton(removeButton), itsDuplicateButton(duplicateButton), itsTextInput(NULL) { // row height const JSize rowHeight = 2*kVMarginWidth + JMax( (GetFontManager())->GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()), (GetFontManager())->GetLineHeight(JGetMonospaceFontName(), kJDefaultMonoFontSize, JFontStyle())); SetDefaultRowHeight(rowHeight); // buttons ListenTo(itsAddButton); ListenTo(itsRemoveButton); ListenTo(itsDuplicateButton); // type menu itsTypeMenu = new JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10); assert( itsTypeMenu != NULL ); itsTypeMenu->Hide(); itsTypeMenu->SetToHiddenPopupMenu(kJTrue); itsTypeMenu->SetMenuItems(kTypeMenuStr); itsTypeMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsTypeMenu); // regex for testing itsTestRegex = new JRegex; assert( itsTestRegex != NULL ); // data for (JIndex i=1; i<=kColCount; i++) { AppendCols(1, kInitColWidth[i-1]); } UpdateColWidths(); const JSize rowCount = itsBindingList->GetElementCount(); AppendRows(rowCount); UpdateButtons(); ListenTo(&(GetTableSelection())); }
//--------------------------------------------------------- bool CActive_Attributes_Control::Update_Table(void) { if( GetBatchCount() > 0 ) { return( false ); } BeginBatch(); //----------------------------------------------------- int Difference = (m_pTable->Get_Field_Count() - m_Field_Offset) - GetNumberCols(); if( Difference > 0 ) { AppendCols(Difference); } else if( (Difference = -Difference < GetNumberCols() ? -Difference : GetNumberCols()) > 0 ) { // here is (or was!?) a memory leak - solution: use own wxGridTableBase derived grid table class DeleteCols(0, Difference); } //----------------------------------------------------- for(int iCol=0, iField=m_Field_Offset; iField<m_pTable->Get_Field_Count(); iCol++, iField++) { SetColLabelValue(iCol, m_pTable->Get_Field_Name(iField)); switch( m_pTable->Get_Field_Type(iField) ) { default: case SG_DATATYPE_Byte: case SG_DATATYPE_Char: case SG_DATATYPE_String: case SG_DATATYPE_Date: case SG_DATATYPE_Binary: SetColFormatCustom(iCol, wxGRID_VALUE_STRING); break; case SG_DATATYPE_Bit: case SG_DATATYPE_Word: case SG_DATATYPE_Short: case SG_DATATYPE_DWord: case SG_DATATYPE_Int: case SG_DATATYPE_ULong: case SG_DATATYPE_Long: case SG_DATATYPE_Color: SetColFormatNumber(iCol); break; case SG_DATATYPE_Float: case SG_DATATYPE_Double: SetColFormatFloat(iCol); break; } } //----------------------------------------------------- if( (Difference = m_pTable->Get_Count() - GetNumberRows()) > 0 ) { AppendRows(Difference); } else if( Difference < 0 && (Difference = -Difference < GetNumberRows() ? -Difference : GetNumberRows()) > 0 ) { DeleteRows(0, Difference); } //------------------------------------------------- for(int iRecord=0; iRecord<m_pTable->Get_Count(); iRecord++) { _Set_Record(iRecord); } //----------------------------------------------------- if( GetNumberCols() > 0 && GetNumberRows() > 0 ) { SetRowLabelSize(wxGRID_AUTOSIZE); if( m_Field_Offset ) // feature attributes { if( GetClientSize().x > GetRowLabelSize() ) { SetColSize(0, GetClientSize().x - GetRowLabelSize()); } } else // grid cell values { AutoSizeColumns(); } } Enable(GetNumberRows() > 0); m_pTable->Set_Modified(false); //----------------------------------------------------- EndBatch(); return( true ); }
CBCommandTable::CBCommandTable ( const CBCommandManager::CmdList& cmdList, JXTextButton* addCmdButton, JXTextButton* removeCmdButton, JXTextButton* duplicateCmdButton, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1,1, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h) { itsTextInput = NULL; itsDNDRowIndex = 0; itsCommandXAtom = (GetDisplay())->RegisterXAtom(CBCommandSelection::GetCommandXAtomName()); // font (CBGetPrefsManager())->GetDefaultFont(&itsFontName, &itsFontSize); const JSize rowHeight = 2*kVMarginWidth + JMax( (GetFontManager())->GetLineHeight(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle()), (GetFontManager())->GetLineHeight(itsFontName, itsFontSize, JFontStyle())); SetDefaultRowHeight(rowHeight); // buttons itsAddCmdButton = addCmdButton; itsRemoveCmdButton = removeCmdButton; itsDuplicateCmdButton = duplicateCmdButton; ListenTo(itsAddCmdButton); ListenTo(itsRemoveCmdButton); ListenTo(itsDuplicateCmdButton); // type menu itsOptionsMenu = new JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10); assert( itsOptionsMenu != NULL ); itsOptionsMenu->SetToHiddenPopupMenu(); itsOptionsMenu->SetMenuItems(kOptionsMenuStr); itsOptionsMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsOptionsMenu); // base path CBProjectDocument* doc = NULL; if ((CBGetDocumentManager())->GetActiveProjectDocument(&doc)) { itsBasePath = doc->GetFilePath(); } // data itsCmdList = new CBCommandManager::CmdList(cmdList); assert( itsCmdList != NULL ); FinishCmdListCopy(itsCmdList); for (JIndex i=1; i<=kColCount; i++) { AppendCols(1, kInitColWidth[i-1]); } AppendRows(itsCmdList->GetElementCount()); UpdateButtons(); ListenTo(&(GetTableSelection())); }