예제 #1
0
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" ));

}
LogMessagesViewer::LogMessagesViewer( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name )
        : wxGrid( parent, id, pos, size, style, name ),
        _timer( this )
{
    // grid
    CreateGrid( 0, 4 );
    EnableEditing( false );
    EnableGridLines( false );
    EnableDragGridSize( false );
    SetMargins( 0, 0 );
    // columns
    //EnableDragColMove( false );
    EnableDragColSize( true );
    SetColLabelSize( 20 );
    SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
    // rows
    EnableDragRowSize( true );
    SetRowLabelSize( 40 );
    SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
    // label appearance
    SetColLabelValue( 0, _T( "description" ) );
    SetColLabelValue( 1, _T( "source" ) );
    SetColLabelValue( 2, _T( "line" ) );
    SetColLabelValue( 3, _T( "clock" ) );
    // cell defaults
    SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );

    coca::getLogger().addHandler( *this );

    _timer.Start( 200 );
}
예제 #3
0
//------------------------------------------------------------------------------
//          custom grid implementation
//------------------------------------------------------------------------------
CustomGrid::CustomGrid( wxWindow *parent, wxWindowID id, const wxPoint &pos,
					   const wxSize &size, long style,
					   const wxString &name )
  : wxGrid( parent, id, pos, size, style, name )
{
    //create grid
    SetTable( new wxGridStringTable(0, 0), true, wxGridSelectRows );
    //some general settings
    EnableEditing( false );
    EnableGridLines( true );
    EnableDragGridSize( false );
    SetMargins( 0, 0 );
    EnableDragColMove( false );
    EnableDragColSize( false );
    EnableDragRowSize( false );
    //init rows pref
    wxFileConfig *pConf = GetOCPNConfigObject();
    if (pConf) {
        pConf->SetPath(_T("/Settings/GRIB"));
        m_IsDigit = pConf->Read(_T("GribDataTableRowPref"), _T("XXX"));
    }
    if( m_IsDigit.Len() != wxString(_T("XXX")).Len() ) m_IsDigit = _T("XXX");
    //create structure for all numerical rows
    for( unsigned int i = 0; i < m_IsDigit.Len(); i++ ){
        m_NumRow.push_back(wxNOT_FOUND);
        m_NumRowVal.push_back(std::vector <double>());
    }
    //init labels attr
    wxFont labelfont = GetOCPNGUIScaledFont_PlugIn( _T("Dialog") ).MakeBold();
    SetLabelFont(labelfont);
    wxColour colour;
    GetGlobalColor(_T("DILG0"), &colour);
    SetLabelBackgroundColour(colour);
    //set row label size
    int w;
    GetTextExtent( _T("Ab"), &w, NULL, 0, 0, &labelfont);
    double x = (double)w * 6.5;
    SetRowLabelSize((int)x);
    //colour settings
    GetGlobalColor(_T("GREEN1"), &m_greenColour);
    GetGlobalColor(_T("DILG1"), &m_greyColour);

#ifdef __WXOSX__
    m_bLeftDown = false;
#endif

    //connect events at dialog level
    Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollEventHandler( CustomGrid::OnScroll ), NULL, this );
    Connect(wxEVT_SIZE, wxSizeEventHandler( CustomGrid::OnResize ), NULL, this );
    Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( CustomGrid::OnLabeClick ), NULL, this );
    //connect events at grid level
    GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this );
    GetGridWindow()->Connect(wxEVT_LEFT_UP, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this );
    GetGridWindow()->Connect(wxEVT_MOTION, wxMouseEventHandler( CustomGrid::OnMouseEvent ), NULL, this );
    //timer event
    m_tRefreshTimer.Connect(wxEVT_TIMER, wxTimerEventHandler( CustomGrid::OnRefreshTimer ), NULL, this);
}