A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/table__import__listctrl_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/widgets/loaders/table_import_listctrl.cpp Source File

37 #include <wx/settings.h> 44 static const long kDefStyle

= wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES | wxLC_VRULES | wxLC_SINGLE_SEL;

52  const

wxValidator& validator,

55

parent, id, pos,

size

,

56

(style & ~wxLC_MASK_TYPE) |

kDefStyle

, validator, name)

57

, m_ViewType(eMultiColumn)

58

, m_FixedWidthUseFields(

false

)

59

, m_ImageList(16, 16,

TRUE

)

61

, m_IgnoreWidthEvent(

false

)

62

, m_DisplayTypeHeader(

false

)

66 #ifdef __WXOSX_COCOA__ 67

SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,

68  false

,

wxT

(

"Fixedsys"

)));

69  m_FirstRowAttr

.SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC,

70

wxFONTWEIGHT_NORMAL,

false

,

wxT

(

"Fixedsys"

)));

72

SetFont(wxFont(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,

73  false

,

wxT

(

"Courier New"

)));

74  m_FirstRowAttr

.SetFont(wxFont(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC,

75

wxFONTWEIGHT_NORMAL,

false

,

wxT

(

"Courier New"

)));

79  m_FirstRowAttr

.SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_MENU));

86  if

(style & wxLC_ALIGN_LEFT) {

94

wxIcon ico = provider->GetIcon(

wxT

(

"tablelist_import::checked"

));

99

ico = provider->GetIcon(

wxT

(

"tablelist_import::skipped"

));

104

ico = provider->GetIcon(

wxT

(

"tablelist_import::id"

));

117

m_ImportedTableData = ds;

122  if

(m_ImportedTableData.IsNull() ||

123

m_ImportedTableData->GetColumns().size() == 0) {

128  auto

num_rows = m_ImportedTableData->GetNumRows();

131  int

first_column_char_width = (

int

)

log10

((

double

)num_rows+1) + 1;

133

wxFont

f

= GetFont();

134

wxClientDC dc(

this

);

136

m_FontWidth = dc.GetCharWidth();

141  if

(m_ViewType == eSingleColumn) {

142

SetItemCount(m_ImportedTableData->GetNumRows());

145

SetItemCount(m_ImportedTableData->GetNumImportedRows() +

146

(m_DisplayTypeHeader ? 1 : 0));

150

first_column_char_width = (first_column_char_width+2) * m_FontWidth;

157  if

(GetImageList(wxIMAGE_LIST_SMALL) !=

NULL

)

158

first_column_char_width += 16;

160  if

(GetColumnCount() == 0) {

162

wxString(

wxT

(

"#"

)),

164

first_column_char_width);

169  if

(m_ImportedTableData->GetDelimiters().size() == 0 ||

170

m_ViewType == eSingleColumn) {

172  int

width =

static_cast<int>

(

std::max

(m_ImportedTableData->GetMaxRowLength(),

173

m_ImportedTableData->GetMaxNonImportedRowLength()));

177

width = (width+2) * m_FontWidth;

181  if

(GetColumnCount() == 1) {

183

wxString(

ToWxString

(m_ImportedTableData->GetColumnName(0))),

190

item.SetWidth(width);

191

item.SetText(

ToWxString

(m_ImportedTableData->GetColumnName(0)));

197  for

(

size_t i

=1;

i

<m_ImportedTableData->GetColumns().

size

(); ++

i

) {

201  int

width = m_ImportedTableData->GetColumnWidth(

i

);

204  if

(m_DisplayTypeHeader)

209

width = (width+2) * m_FontWidth;

213  if

(GetColumnCount() <= (

int

)

i

) {

215

wxString(

ToWxString

(m_ImportedTableData->GetColumnName(

i

))),

221

GetColumn(

static_cast<int>

(

i

), item);

222

item.SetWidth(width);

223

item.SetText(wxString(m_ImportedTableData->GetColumnName(

i

)));

224

SetColumn(

static_cast<int>

(

i

), item);

231  int

width =

static_cast<int>

(m_ImportedTableData->GetMaxRowLength());

235

width = (width+2) * m_FontWidth;

242  if

(m_ImportedTableData->GetColumns().size() == 2) {

244

m_ImportedTableData->GetColumns()[1].SetWidth(

static_cast<int>

(m_ImportedTableData->GetMaxRowLength()));

246  if

(GetColumnCount() == 1) {

248

wxString(wxString(m_ImportedTableData->GetColumnName(1))),

252  else if

(GetColumnCount() == 2) {

255

item.SetWidth(width);

256

item.SetText(wxString(m_ImportedTableData->GetColumnName(1)));

260  while

(GetColumnCount() > 2)

261

DeleteColumn(GetColumnCount()-1);

265  while

(GetColumnCount() > 1)

266

DeleteColumn(GetColumnCount()-1);

268  int

full_width =

static_cast<int>

(m_ImportedTableData->GetMaxRowLength());

271  for

(

size_t i

=1;

i

< m_ImportedTableData->GetColumns().size(); ++

i

) {

272  int

w = m_ImportedTableData->GetColumns()[

i

].GetWidth();

276  if

(

i

== m_ImportedTableData->GetColumns().size()-1) {

278

m_ImportedTableData->GetColumns()[

i

].SetWidth(w);

281  int

char_width = (w+2)*m_FontWidth;

283

wxString(wxString(m_ImportedTableData->GetColumnName(

i

))),

302  if

(GetItemCount() > 0)

303

SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);

312  if

((

size_t

)col < m_ImportedTableData->GetColumns().

size

()) {

344  if

(data_cols[col].GetWidth() < 2)

347  if

(col < GetColumnCount()) {

352

GetColumn(col, item);

353  int

col_width = item.GetWidth();

354

item.SetWidth(col_width/2);

355

SetColumn(col, item);

358  int

width1 = data_cols[col].GetWidth()/2;

359  int

width2 = data_cols[col].GetWidth() - width1;

361

data_cols[col].SetWidth(width1);

367

data_cols.insert(data_cols.begin()+col, c);

377

GetColumn(col, item);

378

item.SetWidth(pixel_width1);

379

SetColumn(col, item);

383

wxString(

ToWxString

(data_cols[col].GetName())),

399  if

(col == 0 || GetColumnCount() <= 2)

405  if

(col == GetColumnCount()-1)

408  if

(col < GetColumnCount()-1) {

414

GetColumn(col, item1);

421

item1.SetWidth(pixel_width);

422

SetColumn(col, item1);

429

data_cols[col].SetWidth(data_cols[col].GetWidth() + data_cols[col+1].GetWidth());

430

data_cols.erase(data_cols.begin() + col + 1);

445  for

(

size_t i

=1;

i

<data_cols.size(); ++

i

) {

446  string

col_name = data_cols[

i

].GetName();

450

vector<string> str_arr;

452  if

(str_arr.size() == 2 &&

453

str_arr[0] ==

"Col"

&&

457

data_cols[

i

].SetName(col_name);

462

GetColumn(

static_cast<int>

(

i

), item);

464

SetColumn(

static_cast<int>

(

i

), item);

470  for

(

size_t i

=1;

i

<GetColumnCount(); ++

i

) {

472

GetColumn(

static_cast<int>

(

i

), item);

477  int

col_char_width =

static_cast<int>

(item.GetWidth()/

m_FontWidth

);

480

col_char_width -=

std::min

(col_char_width, 2);

483  if

(i < m_ImportedTableData->GetColumns().

size

())

492  for

(

int i

=1;

i

<GetColumnCount(); ++

i

) {

494

GetColumn(

i

, item);

499  size_t

col_char_width = (size_t)(item.GetWidth()/

m_FontWidth

);

501

col_char_width -=

std::min

(col_char_width, (

size_t

)2);

502

width += col_char_width;

512  for

(

size_t i

=0;

i

<(size_t)GetColumnCount(); ++

i

) {

514

GetColumn(

static_cast<int>

(

i

), item);

520  int

col_char_width =

static_cast<int>

(item.GetWidth()/

m_FontWidth

);

522

col_char_width -=

std::min

(col_char_width, 2);

536  for

(

size_t i

=0;

i

<(size_t)GetColumnCount(); ++

i

) {

538

GetColumn(

static_cast<int>

(

i

), item);

543

item.SetImage(img_idx);

545

item.SetWidth(width + 24);

547

SetColumn(

static_cast<int>

(

i

), item);

556  for

(

size_t i

=0;

i

<(size_t)GetColumnCount(); ++

i

) {

558

GetColumn(

static_cast<int>

(

i

), item);

562  _TRACE

(prefix <<

" Column Widths: ("

<< widths <<

")"

);

576

vector<int> current_widths;

578  for

(

size_t i

=0;

i

<(size_t)GetColumnCount(); ++

i

) {

580

GetColumn(

static_cast<int>

(

i

), item);

581

current_widths.push_back(item.GetWidth());

586  int

col_char_width =

static_cast<int>

(item.GetWidth()/

m_FontWidth

);

588

col_char_width -=

std::min

(col_char_width, 2);

601  if

(col >= GetColumnCount())

605

SetColumnWidth(col, width);

615

wxString tabstr(

" "

, 1);

617  for

(

size_t i

=0;

i

<

str

.size(); ++

i

) {

618  if

(

str

[

i

] !=

'\t'

) {

621  else result

.append(tabstr);

641  auto

adjusted_row_num =

row

;

646

++adjusted_row_num) {}

654  if

(adjusted_row_num >= 0)

690

GetShortDataTypeString();

698  size_t

col_start_char = 0;

699  for

(

int i

=1;

i

<GetColumnCount() && col_start_char<

str

.length(); ++

i

) {

701

GetColumn(

i

, item);

706  size_t

col_char_width = (size_t)(item.GetWidth()/

m_FontWidth

);

709

col_char_width -=

std::min

(col_char_width, (

size_t

)2);

712  if

(

i

== GetColumnCount() - 1) {

713  string

substr =

str

.substr(col_start_char,

714  str

.size()-col_start_char);

718  string

substr =

str

.substr(col_start_char,

719  std::min

(col_char_width,

str

.size()-col_start_char));

724

col_start_char += col_char_width;

eColumnType GetType() const

void SetName(const string &n)

CTableImportDataSource -.

const CTableImportRow & GetRow(size_t row) const

Return a specific row.

vector< CTableImportColumn > & GetColumns()

return the array of column data

EFieldSeparatorType GetTableType() const

const CTableImportColumn & GetColumn(size_t col) const

Return the specified column.

string GetField(size_t row, size_t col) const

return a specific field from a specific row, based on current table type and delimiter

size_t GetNumRows() const

return total number of rows read

int GetColumnWidth(size_t col) const

Get width of specified column.

int GetFirstImportRow() const

void RecomputeHeaders()

Update columns to genereated names or names parsed from row m_ColumnHeaderRow.

CRef< CTableImportDataSource > m_ImportedTableData

Data table to be rendered in the list.

void WriteWidths(const string &prefix)

bool m_FixedWidthUseFields

If fixed-length columns are not being actively adjusted, this is set to true so that they can be disp...

void SetColumnWidthIgnoreEvent(int col, int width)

Calls SetColumnWidth after setting m_IgnoreWidthEvent.

void DivideColumn(int col)

Creates a new column by dividing the specified column.

void SynchDataSourceColumnWidths()

Synch widths of datasource to updated colums.

wxImageList m_ImageList

Holds column icons (shows whether column currently selected or not)

bool m_IgnoreWidthEvent

If true, this flag can be used in column-resize event handlers to ignore resize events being generate...

int GetColumnImageID(int col, bool checkbox_only=false) const

Returns image ID for column headers.

int m_FontWidth

Need font width for calculating how many chars fit in a column.

vector< int > GetColumnWidths()

Get the most-recently set column widths (ignores first col)

bool m_DisplayTypeHeader

If true, type information will be displayed in first row.

CTableImportListCtrl()

ctor

eDataViewType m_ViewType

Do we show all columns seaprated or show as one field.

static wxString x_ToWxStringWithTabs(const string &str)

Convert strings with tab characters to wxStrings with 4 spaces for each tab.

vector< int > m_ColumnWidths

Widths of columns as updated by UpdateColumnWidths()

void UpdateColumnNames()

Update numbered column names to match current number of columns and sync column names to names in dat...

bool ColumnWidthsUpdated()

Returns true if current column widths do not match m_ColumnWidths.

void MergeColumns(int col)

Removes a column by merging the specified column with the column to its right (or does nothing if it ...

void UpdateColumnImages(bool checkbox_only=false)

Update images on column headers.

int GetColumnsCombinedCharWidth()

Add up the number of characters all the columns together can hold (ignores first column)

wxString OnGetItemText(long row, long col) const

Get the requested field (or full row if m_ViewType == eSingleColumn)

wxListItemAttr m_FirstRowAttr

First row holds type info.

wxListItemAttr * OnGetItemAttr(long item) const

Get attribute override for a specified row (allows special appearance for first row)

void UpdateColumnWidths()

Update m_ColumnWidths for use when resizing columns (ignores first col)

const string & GetValue() const

Get the entire row.

virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)

static const char * str(char *buf, int n)

bool IsNull(void) const THROWS_NONE

Check if pointer is null – same effect as Empty().

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)

Convert string to int.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

static string IntToString(int value, TNumToStringFlags flags=0, int base=10)

Convert int to string.

static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)

Convert numeric value to string.

@ fConvErr_NoThrow

Do not throw an exception on error.

unsigned int

A callback function used to compare two keys in a database.

const struct ncbi::grid::netcache::search::fields::SIZE size

#define TRUE

bool replacment for C indicating true.

#define row(bind, expected)

static const long kDefStyle

wxFileArtProvider * GetDefaultFileArtProvider()

wxString ToWxString(const string &s)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4