Algorithm-VSM

 view release on metacpan or  search on metacpan

examples/corpus_with_java_and_cpp/CrazyWindow.cc  view on Meta::CPAN

///////////////     file:  CrazyWindow.cc   ///////////////

#include "CrazyWindow.h"
#include <qpainter.h>
#include <qlayout.h>

#include "MyTextPanel.h"
#include "MyDrawPanel.h"


CrazyWindow::CrazyWindow( QWidget* parent, const char* name )    // (B)
    : QWidget( parent, name )
{
    QGridLayout* grid = new QGridLayout( this, 0, 1 );           // (C)

    MyTextPanel* textPanel = 
               new MyTextPanel( this, "for text only" );         // (D)

    MyDrawPanel* drawPanel = 
               new MyDrawPanel( this, "for graphics only" );     // (E)

    grid->addWidget( textPanel, 0, 0 );

examples/corpus_with_java_and_cpp/MyDrawPanel.cc  view on Meta::CPAN

////////////////  file:  MyDrawPanel.cc  ///////////////

#include "MyDrawPanel.h"
#include <string.h>
#include <qpainter.h>
#include <qwidget.h>
#include <stdlib.h>       // for rand()
#include <time.h>         // for time(NULL) to seed rand()


MyDrawPanel::MyDrawPanel( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    setPalette( QPalette( QColor( 250, 250, 200 ) ) );
    srand( (unsigned) time(NULL) );
}



void MyDrawPanel::paintEvent( QPaintEvent* )
{
    QPainter p( this );

examples/corpus_with_java_and_cpp/MyTextPanel.cc  view on Meta::CPAN

//


////////////////  file:  MyTextPanel.cc  ///////////////

#include "MyTextPanel.h"
#include <qtextstream.h>
#include <stdlib.h>                   // for malloc()


MyTextPanel::MyTextPanel( QWidget* parent, const char* name )
    : QMultiLineEdit( parent, name )
{
    word = QString( "" );
    setPalette( QPalette( QColor( 250, 250, 200 ) ) );

    //MyTextPanel inherits the signal textChanged() 
    //from its superclass QMultiLineEdit
    QObject::connect( this,                                // (I)
                      SIGNAL( textChanged() ),
                      this,
                      SLOT( doSomethingTextChanged( ) ) );

examples/corpus_with_java_and_cpp/SignalSlotLCD.cc  view on Meta::CPAN

    QApplication myApp( argc, argv );                     
    QWidget* myWidget= new QWidget();                     
    myWidget->setGeometry( 400, 300, 170, 110 );          

    QSlider* myslider = 
               new QSlider( 0,      // minimum value              //(A)
               9,                   // maximum value      
               1,                   // step               
               1,                   // initial value      
               QSlider::Horizontal, // orient.            
               myWidget );          // parent             

    myslider->setGeometry( 10, 10, 150, 30 );             

    //first arg below is the number of digits to display:
    QLCDNumber* mylcdnum = new QLCDNumber( 1, myWidget );         //(B)
    mylcdnum->setGeometry( 60, 50, 50, 50 ); 
    //manual invocation of slot:
    mylcdnum->display( 1 );                                       //(C)

    // connect slider and number display

examples/corpus_with_java_and_cpp/Sketch.cc  view on Meta::CPAN

//Sketch.cc

#include <qapplication.h>
#include <qpainter.h>
#include <qwidget.h>

const int MAXPOINTS = 200;

class SketchWidget : public QWidget {
public:
    SketchWidget( QWidget *parent=0, const char *name=0 );
   ~SketchWidget();
protected:
    void        paintEvent( QPaintEvent * );
    void        mousePressEvent( QMouseEvent *);
    void        mouseDoubleClickEvent( QMouseEvent* );
private:
    QPoint     *points;
    int         count; 
};

SketchWidget::SketchWidget( QWidget *parent, const char *name )
    : QWidget( parent, name ) {
    setBackgroundColor( white );     
    count = 0;
    points = new QPoint[MAXPOINTS];
}

SketchWidget::~SketchWidget() {
    delete[] points; 
}


examples/corpus_with_java_and_cpp/WindowWithMenu.cc  view on Meta::CPAN


///////////  file: WindowWithMenu.cc  /////////////


#include "WindowWithMenu.h"
#include <qfiledialog.h>
#include <iostream> 
using namespace std;


WindowWithMenu::WindowWithMenu( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    setPalette( QPalette( QColor( 250, 250, 200 ) ) );

    filemenu = new QPopupMenu( this ); //arg is parent, useful for auo destruct
    filemenu->insertItem( "New", this, SLOT( allowTextEntry() ) );
    filemenu->insertItem( "Open", this, SLOT( getTextFromFile() ) );
    filemenu->insertItem( "Save", this, SLOT( saveTextToFile() ) );


    colormenu = new QPopupMenu( this );
    colormenu->insertItem( "blue", BLUE );
    colormenu->insertItem( "yellow", YELLOW );
    colormenu->insertItem( "magenta", MAGENTA );



( run in 0.265 second using v1.01-cache-2.11-cpan-4d50c553e7e )