spinctrl.hpp

来自「gspiceui电子CAD仿真程序.用于电路参数模拟仿真」· HPP 代码 · 共 132 行

HPP
132
字号
//*****************************************************************************//                                  SpinCtrl.hpp                              *//                                 --------------                             *//  Description : This class extends wxPanel, and is a replacement for the    *//                wxWidgets library class wxSpinCtrl. It adds some useful     *//                functionality :                                             *//                 - floating point or integer numbers can be displayed,      *//                 - incrementing by more or less than one,                   *//                 - variable step size incrementing.                         *//  Started     : 20/03/2004                                                  *//  Last Update : 30/06/2005                                                  *//  Copyright   : (C) 2004 by MSWaters                                        *//  Email       : M.Waters@bom.gov.au                                         *//*****************************************************************************//*****************************************************************************//                                                                            *//    This program is free software; you can redistribute it and/or modify    *//    it under the terms of the GNU General Public License as published by    *//    the Free Software Foundation; either version 2 of the License, or       *//    (at your option) any later version.                                     *//                                                                            *//*****************************************************************************#ifndef SPINCTRL_HPP#define SPINCTRL_HPP// System Includes#include <iostream>#include <cmath>// wxWidgets Includes#include <wx/wx.h>#include <wx/spinbutt.h>// Application Includes#include "ConvertType.hpp"// Local Constant Declarations//*****************************************************************************class SpinCtrl : public wxPanel{  public:    // The various variable types supported by this class    enum eVarType    {      eVAR_BIN = 0, // Binary      (not yet implemented)      eVAR_OCT,     // Octal       (not yet implemented)      eVAR_HEX,     // Hexadecimal (not yet implemented)      eVAR_INT,     // Integer      eVAR_FLT,     // Floating point      eVAR_FST = eVAR_INT,      eVAR_LST = eVAR_FLT    };  private:    eVarType  m_eVType;     // The variable type to be displayed    float     m_fInitV;     // Initial value    float     m_fMinV;      // Minimum value    float     m_fMaxV;      // Maximum value    float     m_fMinIncSz;  // Minimum increment size    float     m_fMaxIncSz;  // Maximum increment size    // Display objects    wxTextCtrl    m_oTxtValue;    wxSpinButton  m_oSbnValue;  public:    SpinCtrl( eVarType eVType = eVAR_FLT );    ~SpinCtrl( );    bool  bCreate( wxWindow * poWin, wxWindowID oWinID, int iWidth=-1 );    bool  bIsCreated( void ) { return( GetParent( )!=NULL ? TRUE : FALSE ); }    bool  bClear( void );    bool  bSetVType( eVarType eVType );    bool  bSetValue( int   iValue ) { return( bSetValue( (float) iValue ) ); }    bool  bSetValue( float fValue );    bool  bSetValue( const wxString & rosValue );    bool  bSetInitV( float fInitV );    bool  bSetMinV ( float fMinV  ) { return( bSetRange( fMinV, m_fMaxV ) ); }    bool  bSetMaxV ( float fMaxV  ) { return( bSetRange( m_fMinV, fMaxV ) ); }    bool  bSetIncSz( float fMinIncSz, float fMaxIncSz=-1.0 );    bool  bSetRange( float fMinV, float fMaxV );    bool  bSetParms( float fInitV, float fMinV, float fMaxV,                     float fMinIncSz=-1.0, float fMaxIncSz=-1.0 );    eVarType eGetVType( void ) { return( m_eVType ); }    int      iGetValue( void );    float    fGetValue( void );    const wxString & rosGetValue( void );    float    fGetInitV   ( void ) { return( m_fInitV ); }    float    fGetMinV    ( void ) { return( m_fMinV ); }    float    fGetMaxV    ( void ) { return( m_fMaxV ); }    float    fGetMinIncSz( void ) { return( m_fMinIncSz ); }    float    fGetMaxIncSz( void ) { return( m_fMaxIncSz ); }    // Event handlers    void  OnSbnScroll( wxSpinEvent & roEvtSpn );    // In order to be able to react to a menu command, it must be given a    // unique identifier such as a const or an enum.    enum ePnlItemID    {      ID_TEXTCTRL = 1,      ID_SPINBUTT,      ID_UNUSED,      ID_FST = ID_TEXTCTRL,      ID_LST = ID_SPINBUTT    };    // Leave this as the last line as private access is envoked by macro    DECLARE_EVENT_TABLE( )};//*****************************************************************************#endif // SPINCTRL_HPP

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?