void ShutdownUI::showWindow(const QString &text1, const QString &text2, int timeout)
{
    // If the widgets are not created create them now
    realize();

    if (!(text1.isEmpty() && text2.isEmpty())) {
        // Set the labels to show the text strings that we got only if they exist
        if (label1 != NULL) {
            if (text1.startsWith("qtn")) {
                label1->setText(qtTrId(text1.toLatin1().constData()));
            } else {
                label1->setText(text1);
            }
        }

        if (label2 != NULL) {
            if (text2.startsWith("qtn")) {
                label2->setText(qtTrId(text2.toLatin1().constData()));
            } else {
                label2->setText(text2);
            }
        }
    }

    timer->stop();

    show();
    raise();
    disableCompositorSwipeRect(this, rect());

    feedback->play();

    // Set the interval and start the timer to the next phase: hiding the labels and showing the logo
    timer->start(timeout);
}
Esempio n. 2
0
gSlider::gSlider(gContainer *par, bool scrollbar) : gControl(par)
{	
	g_typ = Type_gSlider;
	
	_mark = false;
	_step = 1;
	_page_step = 10;
	_value = 0;
	_min = 0;
	_max = 100;
	_tracking = true;
	
	border = gtk_alignment_new(0, 0, 1, 1);
	
	if (scrollbar)
		return;
	
	widget = gtk_vscale_new(NULL);
	gtk_scale_set_draw_value(GTK_SCALE(widget), false);
		
	init();
	
	realize(false);
	
	onChange = NULL;
	
	g_signal_connect(G_OBJECT(widget), "value-changed", G_CALLBACK(cb_change), (gpointer)this);
	//g_signal_connect_after(G_OBJECT(border),"expose-event",G_CALLBACK(slider_Expose),(gpointer)this);
}
Esempio n. 3
0
void ATOM_D3DVertexArray::restoreImpl (void) {
  ATOM_STACK_TRACE(ATOM_D3DVertexArray::restoreImpl);
  if (_M_size_bytes && ATOM_USAGE_DYNAMIC == _M_usage)
  {
    realize();
	setContentLost (true);
  }
}
Esempio n. 4
0
gSeparator::gSeparator(gContainer *parent) : gControl(parent)
{
    g_typ=Type_gSeparator;

    border = widget = gtk_fixed_new();

    realize(false);

    ON_DRAW(widget, this, cb_expose, cb_draw);
}
Esempio n. 5
0
/* *****************************************************
** in-place Radix-2 FFT for real values
** (by the so-called "packing method")
** data: array of doubles:
** re(0),re(1),re(2),...,re(size-1)
**
** output:
** re(0),re(size/2),re(1),im(1),re(2),im(2),...,re(size/2-1),im(size/2-1)
** normalized by array length
**
** Source: see the routines it calls ...
******************************************************* */
void realfft_packed(MYFLT *data, MYFLT *outdata, int size, MYFLT *twiddle) {

    int i;

	size >>= 1;
	dif_butterfly(data, size, twiddle);
	unshuffle(data, size);
	realize(data, size);

	size <<= 1;
	for (i=0; i<size; i++)
	    outdata[i] = data[i] / size;
}
Esempio n. 6
0
void QRibbonButtonBar::clearButtons()
{
	m_layouts_valid = false;
	size_t count = m_buttons.size();
	size_t i;
	for (i = 0; i < count; ++i)
	{
		QRibbonButtonBarButtonBase* button = m_buttons.at(i);
		delete button;
	}
	m_buttons.clear();
	realize();
}
Esempio n. 7
0
gMainWindow::gMainWindow(gContainer *par) : gContainer(par)
{
	initialize();
	g_typ = Type_gMainWindow;
	
	border = gtk_alignment_new(0,0,1,1); //gtk_fixed_new(); //gtk_event_box_new();
	widget = gtk_fixed_new();
	
	realize(false);
	initWindow();

	setCanFocus(false);
}
Esempio n. 8
0
gScrollBar::gScrollBar(gContainer *par) : gSlider(par, true)
{
	g_typ = Type_gScrollBar;
	widget = gtk_hscrollbar_new(NULL);
	realize(false);
	
	init();
	onChange = NULL;
	
#ifndef GTK3
	gtk_range_set_update_policy(GTK_RANGE(widget),GTK_UPDATE_CONTINUOUS);
#endif
	g_signal_connect(G_OBJECT(widget), "value-changed", G_CALLBACK(cb_change), (gpointer)this);
}
Esempio n. 9
0
gMainWindow::gMainWindow(int plug) : gContainer(NULL)
{
  initialize();
	g_typ = Type_gMainWindow;
	
	windows = g_list_append(windows, (gpointer)this);
	
	_xembed = plug != 0;
	
	if (_xembed)
		border = gtk_plug_new(plug);
	else
		border = gtk_window_new(GTK_WINDOW_TOPLEVEL);

	
	widget = gtk_fixed_new(); //gtk_layout_new(0,0);

#if 0 //def GTK3
	static bool patch = FALSE;

	if (!patch)
	{
		GtkWidgetClass *klass;

		klass = (GtkWidgetClass *)GTK_FIXED_GET_CLASS(widget);
		old_fixed_get_preferred_width = klass->get_preferred_width;
		klass->get_preferred_width = gtk_fixed_get_preferred_width;
		old_fixed_get_preferred_height = klass->get_preferred_height;
		klass->get_preferred_height = gtk_fixed_get_preferred_height;
		/*klass = (GtkWidgetClass *)GTK_FIXED_GET_CLASS(border);
		old_window_get_preferred_width = klass->get_preferred_width;
		klass->get_preferred_width = gtk_window_get_preferred_width;
		old_window_get_preferred_height = klass->get_preferred_height;
		klass->get_preferred_height = gtk_window_get_preferred_height;*/

		patch = true;
	}
#endif
	
	realize(false);
	initWindow();
	
	gtk_widget_realize(border);
	gtk_widget_show(widget);
	gtk_widget_set_size_request(border, 1, 1);

	setCanFocus(false);
}
Esempio n. 10
0
gFrame::gFrame(gContainer *parent) : gContainer(parent)
{
	g_typ=Type_gFrame;

	border = widget = gtk_fixed_new();
	
	fr = gtk_frame_new(NULL);
	//label = gtk_frame_get_label_widget(GTK_FRAME(fr));
	gtk_container_set_border_width(GTK_CONTAINER(fr),0);
	gtk_frame_set_shadow_type(GTK_FRAME(fr), GTK_SHADOW_ETCHED_IN);
	gtk_container_add(GTK_CONTAINER(widget), fr);
	
  realize(false);

	g_signal_connect(G_OBJECT(border), "size-allocate", G_CALLBACK(cb_frame_resize), (gpointer)this);
}
ShutdownUI::ShutdownUI() :
    MWindow((QWidget *)NULL),
    realized(false),
    sceneWindow(0),
    timer(new QTimer(this)),
    label1(0),
    label2(0),
    logo(0),
    layout(0),
    feedback(0)
{
    setWindowTitle("ShutdownUI");
    setObjectName("ShutdownUIWindow");

    // Pre-create/load the shutdown UI content to show it quickly when requested
    QTimer::singleShot(5000, this, SLOT(realize()));

    connect(timer, SIGNAL(timeout()), this, SLOT(showLogo()));
}
Esempio n. 12
0
static Ref<code::Type> realize(Ref<code::Type> type) {
  if (type.is<code::TypeIntegerLiteral>()) {
    return new code::TypeInteger();
  } else if (type.is<code::TypeTuple>()) {
    // Look for and realize sized-integers to integers
    // Create the initial type
    auto tuple = type.as<code::TypeTuple>();
    Ref<code::TypeTuple> result = new code::TypeTuple();

    // Iterate through the elements; and type each
    result->elements.reserve(tuple->elements.size());
    for (auto& element : tuple->elements) {
      result->elements.push_back(realize(element));
    }

    return result;
  }

  return type;
}
Esempio n. 13
0
void QRibbonButtonBar::updateWindowUI(long flags)
{
	//QRibbonControl::UpdateWindowUI(flags);

	// don't waste time updating state of tools in a hidden toolbar
	if (isHidden())
		return;

	size_t btn_count = m_buttons.size();
	bool rerealize = false;
	for (size_t btn_i = 0; btn_i < btn_count; ++btn_i)
	{
		QRibbonButtonBarButtonBase& btn = *m_buttons.at(btn_i);
		int id = btn.id;

		//QUpdateUIEvent event(id);
		//event.SetEventObject(this);

		//if (ProcessWindowEvent(event))
		//{
		//	if (event.GetSetEnabled())
		//		EnableButton(id, event.GetEnabled());
		//	if (event.GetSetChecked())
		//		ToggleButton(id, event.GetChecked());
		//	if (event.GetSetText())
		//	{
		//		btn.label = event.GetText();
		rerealize = true;
		fetchButtonSizeInfo(&btn, QRIBBON_BUTTONBAR_BUTTON_SMALL);
		fetchButtonSizeInfo(&btn, QRIBBON_BUTTONBAR_BUTTON_MEDIUM);
		fetchButtonSizeInfo(&btn, QRIBBON_BUTTONBAR_BUTTON_LARGE);
		//}
		//}
	}

	if (rerealize)
	{
		m_layouts_valid = false;
		realize();
	}
}
Esempio n. 14
0
bool QRibbonButtonBar::deleteButton(int button_id)
{
	size_t count = m_buttons.size();
	size_t i;
	for (i = 0; i < count; ++i)
	{
		QRibbonButtonBarButtonBase* button = m_buttons.at(i);
		if (button->id == button_id)
		{
			m_layouts_valid = false;
			m_buttons.erase(m_buttons.begin() + i);
			if (m_hovered_button && m_hovered_button->base == button)
				m_hovered_button = NULL;
			if (m_active_button  && m_active_button->base == button)
				m_active_button = NULL;
			delete button;
			realize();
			update();
			return true;
		}
	}
	return false;
}
Esempio n. 15
0
void QRibbonButtonBar::setArtProvider(QRibbonArtProvider* art)
{
	if (art == m_art)
	{
		return;
	}

	QRibbonControl::setArtProvider(art);

	size_t btn_count = m_buttons.size();
	size_t btn_i;
	for (btn_i = 0; btn_i < btn_count; ++btn_i)
	{
		QRibbonButtonBarButtonBase* base = m_buttons.at(btn_i);

		fetchButtonSizeInfo(base, QRIBBON_BUTTONBAR_BUTTON_SMALL);
		fetchButtonSizeInfo(base, QRIBBON_BUTTONBAR_BUTTON_MEDIUM);
		fetchButtonSizeInfo(base, QRIBBON_BUTTONBAR_BUTTON_LARGE);
	}

	m_layouts_valid = false;
	realize();
}
Esempio n. 16
0
    Window::Window (App& parent) : 
      Gtk::Window (Gtk::WINDOW_TOPLEVEL), 
      app (parent),
      close_button (Gtk::Stock::CLOSE),
      stop_button (Gtk::Stock::STOP),
      start_button (Gtk::Stock::EXECUTE),
      message_level_label ("Message level"),
      options_label ("Add option"),
      description_frame ("Description"),
      arguments_frame ("Arguments"),
      options_frame ("Options"),
      text_frame ("Program output")
    {
      window = this;
      realize();

      description_label.set_line_wrap (true);
      description_label.set_single_line_mode (false);
      description_label.set_justify (Gtk::JUSTIFY_FILL);
      description_label.set_selectable (true);

      if (app.command_description[0]) {
        description_label.set_text (app.command_description[0]);
        if (app.command_description[1]) {
          String desc (app.command_description[1]);
          for (const gchar** p = app.command_description+2; *p; p++) { desc += "\n\n"; desc += *p; }
          description_label.set_tooltip_text (desc);
        }
      }
      else description_label.set_text ("no description available");

      inner_description_box.set_border_width (GUI_SPACING);
      inner_description_box.add (description_label);
      description_frame.add (inner_description_box);

 
      for (const MR::Argument* arg = app.command_arguments; arg->is_valid(); arg++) {
        Argument* argument = manage (new Argument (*arg));
        arguments_box.pack_start (*argument, Gtk::PACK_SHRINK);
      }
      arguments_frame.add (arguments_box);

      message_level.append_text (message_level_options[0]);
      message_level.append_text (message_level_options[1]);
      message_level.append_text (message_level_options[2]);
      message_level.set_active (0);

      message_level_box.set_spacing (GUI_SPACING);
      message_level_box.pack_start (message_level_label, Gtk::PACK_SHRINK);
      message_level_box.pack_start (message_level);

      top_box.set_border_width (GUI_SPACING);
      top_box.set_spacing (GUI_SPACING);
      top_box.pack_start (description_frame);
      top_box.pack_start (arguments_frame);
      
      if (app.command_options[0].is_valid()) {
        options_box.pack_start (option_menu_box, Gtk::PACK_SHRINK);
        options_box.set_spacing (GUI_SPACING);
        options_box.set_border_width (GUI_SPACING);
        option_menu_box.pack_start (options_label, Gtk::PACK_SHRINK);
        option_menu_box.pack_start (option_combobox);
        option_menu_box.set_spacing (GUI_SPACING);
        for (guint n = 0; App::command_options[n].is_valid(); n++) {
          if (App::command_options[n].mandatory) {
            Option* opt = manage (new Option (*this, App::command_options[n], n));
            options_box.pack_start (*opt, Gtk::PACK_SHRINK);
          }
        }
        set_option_list();
        options_frame.add (options_box);
        top_box.pack_start (options_frame);
        option_combobox.signal_changed().connect (sigc::mem_fun (*this, &Window::on_add_option));
      }

      top_box.pack_start (message_level_box, Gtk::PACK_SHRINK);

      top.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
      top.set_shadow_type (Gtk::SHADOW_NONE);
      top.add (top_box);

      Glib::RefPtr<Gtk::TextBuffer::TagTable> tags = text.get_buffer()->get_tag_table();
      red  = Gtk::TextBuffer::Tag::create(); red->property_foreground()  = "red";  tags->add (red);
      blue = Gtk::TextBuffer::Tag::create(); blue->property_foreground() = "blue"; tags->add (blue);
      grey = Gtk::TextBuffer::Tag::create(); grey->property_foreground() = "grey"; tags->add (grey);

      text.set_editable (false);
      text.set_cursor_visible (false);
      inner_text_frame.set_shadow_type (Gtk::SHADOW_IN);
      inner_text_frame.set_border_width (GUI_SPACING);
      inner_text_frame.add (text);
      text_frame.add (inner_text_frame);

      close_button.signal_clicked().connect (sigc::mem_fun(*this, &Window::on_close_button));
      stop_button.set_sensitive (false);
      stop_button.signal_clicked().connect (sigc::mem_fun(*this, &Window::on_stop_button));
      start_button.signal_clicked().connect (sigc::mem_fun(*this, &Window::on_start_button));

      button_box.set_spacing (GUI_SPACING);
      button_box.set_homogeneous();
      button_box.pack_start (close_button);
      button_box.pack_start (stop_button);
      button_box.pack_start (start_button);



      bottom_box.set_border_width (GUI_SPACING);
      bottom_box.set_spacing (GUI_SPACING);
      bottom_box.pack_start (progressbar, Gtk::PACK_SHRINK);
      bottom_box.pack_start (text_frame);
      bottom_box.pack_start (button_box, Gtk::PACK_SHRINK);


      splitter.pack1 (top, true, false);
      splitter.pack2 (bottom_box, true, false);
      add (splitter);
      set_icon (App::gui_icon);


      ProgressBar::init_func = ProgressBar::init_func_gui;
      ProgressBar::display_func = ProgressBar::display_func_gui;
      ProgressBar::done_func = ProgressBar::done_func_gui;

      print = gui_print;
      error = gui_error;
      info = gui_info;
      debug = gui_debug;



      set_default_size (400, 800);
      show_all_children();
    }
Esempio n. 17
0
ViewerWidget::ViewerWidget():
    osgViewer::Viewer()
{
    osg::setNotifyLevel( osg::NOTICE );

    //osg::DisplaySettings::instance()->setNumMultiSamples( 4 );

    setThreadingModel( osgViewer::Viewer::SingleThreaded );

    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
    {
        osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
        traits->windowName = "Simple Viewer";
        traits->windowDecoration = true;
        traits->x = 0;
        traits->y = 0;
        traits->width = WINDOW_WIDTH;
        traits->height = WINDOW_HEIGHT;
        traits->doubleBuffer = true;
        traits->alpha = ds->getMinimumNumAlphaBits();
        traits->stencil = ds->getMinimumNumStencilBits();
        traits->sampleBuffers = ds->getMultiSamples();
        traits->samples = ds->getNumMultiSamples();
    }

    setUpViewInWindow( 0, 0, traits->width, traits->height );

    {
        osg::Camera* camera = getCamera();

        camera->setClearColor( osg::Vec4( 204.0/255, 204.0/255, 204.0/255, 1 ) );
        //camera->setViewport( new osg::Viewport( 0, 0, traits->width, traits->height ) );
        //camera->setProjectionMatrixAsPerspective( 30.0f, double( traits->width )/double( traits->height ), 1.0f, 100000.0f );
        //camera->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
        //camera->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);

        _root = new osg::Group;


        // create sunlight
        //setLightingMode( osg::View::SKY_LIGHT );
        //getLight()->setPosition(osg::Vec4(1000,2000,3000,0));
        //getLight()->setDirection(osg::Vec3(-1,-2,-3));
        //getLight()->setAmbient(osg::Vec4( 0.6,0.6,0.6,1 ));
        //getLight()->setDiffuse(osg::Vec4( 0.6,0.6,0.6,1 ));
        //getLight()->setSpecular(osg::Vec4( 0.9,0.9,0.9,1 ));

        osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;

        keyswitchManipulator->addMatrixManipulator( '1', "Terrain", new osgGA::TerrainManipulator() );
        keyswitchManipulator->addMatrixManipulator( '2', "Orbit", new osgGA::OrbitManipulator() );
        keyswitchManipulator->addMatrixManipulator( '3', "Trackball", new osgGA::TrackballManipulator() );

        setCameraManipulator( keyswitchManipulator.get() );

        addEventHandler( new osgViewer::WindowSizeHandler );
        addEventHandler( new osgViewer::StatsHandler );
        addEventHandler( new osgGA::StateSetManipulator( getCamera()->getOrCreateStateSet() ) );
        addEventHandler( new osgViewer::ScreenCaptureHandler );

        setFrameStamp( new osg::FrameStamp );

        setSceneData( _root.get() );
    }

    // back alpha blending for "transparency"
    {
        osg::StateSet* ss = _root->getOrCreateStateSet();
        ss->setAttributeAndModes( new osg::CullFace( osg::CullFace::BACK ), osg::StateAttribute::ON );
        ss->setMode( GL_BLEND, osg::StateAttribute::ON );
    }


    // SSAO
    if( 0 ) {
        osg::StateSet* stateset = _root->getOrCreateStateSet();
        //osg::ref_ptr<osg::Program> program = new osg::Program;
        //program->addShader( new osg::Shader(osg::Shader::VERTEX, vertSourceSSAO) );
        //program->addShader( new osg::Shader(osg::Shader::FRAGMENT, fragSourceSSAO) );
        //stateset->setAttributeAndModes( program.get() );
        stateset->addUniform( new osg::Uniform( "m_SubPixelShift", .5f ) );
        stateset->addUniform( new osg::Uniform( "m_SpanMax", 5.f ) );
        stateset->addUniform( new osg::Uniform( "m_ReduceMul", 1.f ) );
        stateset->addUniform( new osg::Uniform( "g_Resolution", osg::Vec2( WINDOW_WIDTH, WINDOW_HEIGHT ) ) );
        osg::Texture2D* texture = new osg::Texture2D();
        texture->setTextureSize( WINDOW_WIDTH,WINDOW_HEIGHT );

        texture->setInternalFormat( GL_RGBA );

        texture->setWrap( osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE );
        texture->setWrap( osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE );
        texture->setFilter( osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR );
        texture->setFilter( osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR );

        osg::Camera* camera = new osg::Camera;
        camera->addChild( _root.get() );
        osg::Group* newRoot = new osg::Group;
        newRoot->addChild( camera );
        setSceneData( newRoot );
        camera->setRenderOrder( osg::Camera::PRE_RENDER );
        camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
        //camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
        camera->attach( osg::Camera::COLOR_BUFFER, texture );
        camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        //camera->setProjectionMatrixAsOrtho2D(0, 0, WINDOW_HEIGHT, WINDOW_WIDTH);
        //setCameraManipulator( new osgGA::OrbitManipulator );

        stateset->addUniform( new osg::Uniform( "m_Texture", texture ) );

        // original image view
        if( 1 ) {

            //osg::Texture2D* tex = new osg::Texture2D;

            osg::Geode* geode = new osg::Geode();
            osg::Geometry* geom = new osg::Geometry();
            geode->addDrawable( geom );

            osg::Vec3Array* vtx = new osg::Vec3Array;
            vtx->push_back( osg::Vec3( 0, 0, 0 ) ); // front left
            vtx->push_back( osg::Vec3( WINDOW_WIDTH, 0, 0 ) ); // front right
            vtx->push_back( osg::Vec3( WINDOW_WIDTH, WINDOW_HEIGHT, 0 ) ); // back right
            vtx->push_back( osg::Vec3( 0,WINDOW_HEIGHT, 0 ) ); // back left
            geom->setVertexArray( vtx );

            osg::DrawElementsUInt* quads = new osg::DrawElementsUInt( osg::PrimitiveSet::QUADS, 0 );
            quads->push_back( 0 );
            quads->push_back( 1 );
            quads->push_back( 2 );
            quads->push_back( 3 );
            geom->addPrimitiveSet( quads );

            osg::Vec2Array* texcoords = new osg::Vec2Array( 5 );
            ( *texcoords )[0].set( 0.f,0.f ); // tex coord for vertex 0
            ( *texcoords )[1].set( 1.f,0.f ); // tex coord for vertex 1
            ( *texcoords )[2].set( 1.f,1.f ); // tex coord for vertex 1
            ( *texcoords )[3].set( 0.f,1.f ); // tex coord for vertex 1
            geom->setTexCoordArray( 0,texcoords );

            geode->getOrCreateStateSet()->setTextureAttributeAndModes( 0,texture,osg::StateAttribute::ON );
            osg::Camera* normalCamera = new osg::Camera();
            normalCamera->setClearColor( osg::Vec4( 0.4f,0.4f,0.4f,1.0f ) );
            normalCamera->setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
            normalCamera->setViewport( 0,0,WINDOW_WIDTH,WINDOW_HEIGHT );
            normalCamera->setProjectionMatrixAsOrtho2D( 0,WINDOW_HEIGHT,0,WINDOW_HEIGHT );
            normalCamera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
            normalCamera->setViewMatrix( osg::Matrix::identity() );
            normalCamera->setComputeNearFarMode( osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR );
            normalCamera->addChild( geode );
            //textureGroup->addChild( normalCamera );
            newRoot->addChild( normalCamera );
        }
    }

    realize();
}
Esempio n. 18
0
Proj2::Proj2(std::string const &_sproj, Direction _direction) :
sproj(_sproj), direction(_direction)
	{ realize(); }
    //____________________________________________________
    ListDemoWidget::ListDemoWidget( void )
    {

        // main widget
        GtkWidget* mainWidget( gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ) );
        gtk_box_set_spacing( GTK_BOX( mainWidget ), 5 );
        setWidget( mainWidget );

        // setup
        setName( "Lists" );
        setComments( "Shows the appearance of lists and trees" );
        setIconName( "view-list-tree" );
        realize();

        // vertical pane
        GtkWidget* vpaned( gtk_paned_new( GTK_ORIENTATION_VERTICAL ) );
        gtk_widget_show( vpaned );
        gtk_box_pack_start( GTK_BOX( mainWidget ), vpaned, true, true, 0 );

        // simple list
        {

            GtkListStore* model( gtk_list_store_new( 1, G_TYPE_STRING ) );
            const char* columns[] =
            {
                "First Item",
                "Second Item",
                "Third Item"
            };

            for( unsigned int i=0; i<3; i++ )
            {
                GtkTreeIter iter;
                gtk_list_store_append( model, &iter );
                gtk_list_store_set( model, &iter, 0, columns[i], -1 );
            }

            GtkWidget* treeView( gtk_tree_view_new_with_model( GTK_TREE_MODEL( model ) ) );
            gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( treeView ), false );
            gtk_widget_show( treeView );

            // renderer
            GtkCellRenderer *renderer( gtk_cell_renderer_text_new() );
            GtkTreeViewColumn *column( gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ) );

            gtk_tree_view_append_column( GTK_TREE_VIEW( treeView ), column );

            // scrolled window
            GtkWidget* scrolledWindow( gtk_scrolled_window_new( 0L, 0L ) );
            gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scrolledWindow ), GTK_SHADOW_IN );
            gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledWindow ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
            gtk_container_add( GTK_CONTAINER( scrolledWindow ), treeView );
            gtk_widget_show( scrolledWindow );

            gtk_paned_pack1( GTK_PANED( vpaned ), scrolledWindow, true, true );

        }

        // tree
        {

            GtkTreeStore* model( gtk_tree_store_new ( 2, G_TYPE_STRING, G_TYPE_STRING ) );
            const char* titleColumns[] =
            {
                "First Item",
                "Second Item",
                "Third Item"
            };

            const char* descriptionColumns[] =
            {
                "First Description",
                "Second Description",
                "Third Description"
            };

            const char* subTitleColumns[] =
            {
                "First Subitem",
                "Second Subitem",
                "Third Subitem"
            };

            const char* subDescriptionColumns[] =
            {
                "First Subitem Description",
                "Second Subitem Description",
                "Third Subitem Description"
            };

            for( unsigned int i=0; i<3; i++ )
            {
                GtkTreeIter iter;
                gtk_tree_store_append( model, &iter, 0L );
                gtk_tree_store_set( model, &iter, 0, titleColumns[i], 1, descriptionColumns[i], -1 );

                // append children
                if( i == 1 )
                {
                    for( unsigned int i=0; i<2; i++ )
                    {
                        GtkTreeIter subiter;
                        gtk_tree_store_append( model, &subiter, &iter );
                        gtk_tree_store_set( model, &subiter, 0, subTitleColumns[i], 1, subDescriptionColumns[i], -1 );
                    }

                } else if( i == 2 ) {

                    GtkTreeIter subiter;
                    gtk_tree_store_append( model, &subiter, &iter );
                    gtk_tree_store_set( model, &subiter, 0, subTitleColumns[2], 1, subDescriptionColumns[2], -1 );

                    for( unsigned int i=0; i<2; i++ )
                    {
                        GtkTreeIter thirditer;
                        gtk_tree_store_append( model, &thirditer, &subiter );
                        gtk_tree_store_set( model, &thirditer, 0, subTitleColumns[i], 1, subDescriptionColumns[i], -1 );
                    }

                }

            }

            GtkWidget* treeView( gtk_tree_view_new_with_model( GTK_TREE_MODEL( model ) ) );
            gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( treeView ), true );
            gtk_widget_show( treeView );

            // renderers
            {
                GtkCellRenderer *renderer( gtk_cell_renderer_text_new() );
                GtkTreeViewColumn *column( gtk_tree_view_column_new_with_attributes( "Title", renderer, "text", 0, NULL ) );
                gtk_tree_view_column_set_resizable(column, TRUE);
                gtk_tree_view_append_column( GTK_TREE_VIEW( treeView ), column );
            }

            {
                GtkCellRenderer *renderer( gtk_cell_renderer_text_new() );
                GtkTreeViewColumn *column( gtk_tree_view_column_new_with_attributes( "Description", renderer, "text", 1, NULL ) );
                gtk_tree_view_column_set_resizable(column, TRUE);
                gtk_tree_view_append_column( GTK_TREE_VIEW( treeView ), column );
            }

            // scrolled window
            GtkWidget* scrolledWindow( gtk_scrolled_window_new( 0L, 0L ) );
            gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scrolledWindow ), GTK_SHADOW_IN );
            gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledWindow ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
            gtk_container_add( GTK_CONTAINER( scrolledWindow ), treeView );
            gtk_widget_show( scrolledWindow );

            gtk_paned_pack2( GTK_PANED( vpaned ), scrolledWindow, true, true );

        }


    }
Esempio n. 20
0
Proj2::Proj2(Proj2 const &rhs) :
sproj(rhs.sproj), direction(rhs.direction)
	{ realize(); }
Esempio n. 21
0
	/** Initialize an instance */
	void init(std::string const &_sproj, Direction _direction)
	{
		sproj = _sproj;
		direction = _direction;
		realize();
	}
Esempio n. 22
0
	/** Copies an existing Proj2, but with a different direction. */
	Proj2(Proj2 const &rhs, Direction _direction) :
		sproj(rhs.sproj), direction(_direction)
		{ realize(); }
Esempio n. 23
0
    //____________________________________________________
    InfoWidget::InfoWidget( void )
    {

        // main widget
        GtkWidget* mainWidget( gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ) );
        gtk_box_set_spacing( GTK_BOX( mainWidget ), 5 );
        setWidget( mainWidget );

        // setup
        setName( "About" );
        setComments( "Shows information about this application" );
        setIconName( "dialog-information" );
        realize();

        // about information
        {
            GtkWidget* frame( gtk_frame_new( "About" ) );
            gtk_box_pack_start( GTK_BOX( mainWidget ), frame, false, true, 0 );
            gtk_widget_show( frame );

            // vbox
            GtkWidget* box( gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ) );
            gtk_box_set_spacing( GTK_BOX( box ), 5 );
            gtk_container_add( GTK_CONTAINER( frame ), box );
            gtk_container_set_border_width( GTK_CONTAINER( box ), 10 );
            gtk_widget_show( box );

            // application name
            GtkWidget* label;
            label = boldLabel();
            gtk_label_set_text( GTK_LABEL( label ), "carbon-gtk3-demo" );
            gtk_label_set_selectable( GTK_LABEL( label ), true );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            // version
            {
                std::ostringstream stream;
                stream << "version " << CARBON_VERSION;
                label = boldLabel();
                gtk_label_set_selectable( GTK_LABEL( label ), true );
                gtk_label_set_text( GTK_LABEL( label ), stream.str().c_str() );
                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
                gtk_widget_show( label );
            }

            // gtk version
            {
                std::ostringstream stream;
                stream << "using gtk version " << Version::gtkVersion();
                gtk_label_set_selectable( GTK_LABEL( label ), true );
                label = gtk_label_new( stream.str().c_str() );
                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
                gtk_widget_show( label );
            }

            // library version
            const std::string libVersion( Version::libVersion() );
            if( !libVersion.empty() )
            {
                std::ostringstream stream;
                stream << "using carbon-gtk version " << libVersion;
                gtk_label_set_selectable( GTK_LABEL( label ), true );
                label = gtk_label_new( stream.str().c_str() );
                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
                gtk_widget_show( label );
            }

            label = gtk_label_new( "" );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            // description
            label = gtk_label_new( "Gtk+ widgets preview for Carbon" );
            gtk_label_set_selectable( GTK_LABEL( label ), true );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( "" );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( "(C) 2010 Hugo Pereira Da Costa, Ruslan Kabatsayev, Cédric Bellegarde" );
            gtk_label_set_selectable( GTK_LABEL( label ), true );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( "" );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( 0L );
            gtk_label_set_markup( GTK_LABEL( label ), "<a href=\"https://projects.kde.org/projects/playground/artwork/carbon-gtk\">https://projects.kde.org/projects/playground/artwork/carbon-gtk</a>" );
            gtk_label_set_selectable( GTK_LABEL( label ), true );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( 0L );
            gtk_label_set_markup( GTK_LABEL( label ), "<a href=\"http://kde-look.org/content/show.php/?content=136216\">http://kde-look.org/content/show.php/?content=136216</a>" );
            gtk_label_set_selectable( GTK_LABEL( label ), true );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( "" );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( 0L );
            gtk_label_set_selectable( GTK_LABEL( label ), true );
            gtk_label_set_markup( GTK_LABEL( label ), "License: <a href=\"http://www.gnu.org/licenses/lgpl-2.1.html\">GNU Lesser General Public License Version 2</a>" );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );


        }

        // authors information
        {
            GtkWidget* frame( gtk_frame_new( "Authors" ) );
            gtk_box_pack_start( GTK_BOX( mainWidget ), frame, false, true, 0 );
            gtk_widget_show( frame );

            // vbox
            GtkWidget* box( gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ) );
            gtk_box_set_spacing( GTK_BOX( box ), 5 );
            gtk_container_add( GTK_CONTAINER( frame ), box );
            gtk_container_set_border_width( GTK_CONTAINER( box ), 10 );
            gtk_widget_show( box );

            GtkWidget* label = gtk_label_new( 0L );
            gtk_label_set_markup( GTK_LABEL( label ), "Please use <a href=\"https://bugs.kde.org\">bugs.kde.org</a> to report bugs" );
            gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            label = gtk_label_new( "" );
            gtk_box_pack_start( GTK_BOX( box ), label, true, true, 0 );
            gtk_widget_show( label );

            // grid
            GtkWidget* grid( gtk_grid_new() );
            gtk_box_pack_start( GTK_BOX( box ), grid, false, false, 0 );
            gtk_container_set_border_width( GTK_CONTAINER( grid ), 0 );
            gtk_grid_set_row_spacing( GTK_GRID( grid ), 5 );
            gtk_grid_set_column_spacing( GTK_GRID( grid ), 5 );
            gtk_widget_show( grid );

            // spacing
            GtkWidget* spacing( gtk_label_new( "" ) );
            gtk_grid_attach( GTK_GRID( grid ), spacing, 2, 0, 1, 1  );
            gtk_widget_show( spacing );

            addAuthor( grid, 0, "<a href=\"mailto:[email protected]\">Hugo Pereira Da Costa</a>", "Maintainer and developer" );
            addAuthor( grid, 1, "<a href=\"mailto:[email protected]\">Ruslan Kabatsayev</a>", "Maintainer and developer" );
            addAuthor( grid, 2, "<a href=\"mailto:[email protected]\">Cédric Bellegarde</a>", "Developer" );

        }

    }
Esempio n. 24
0
void main_loop(void)
{
   char key;
   int paper_w, paper_h;
   long diff;

   if (!landscape) {
      paper_w = XLENG / shrink;
      paper_h = YLENG / shrink;
   } else {
      paper_w = YLENG / shrink;
      paper_h = XLENG / shrink;
   }
   set_all();
   XUndefineCursor(display, main_window);
   for (;;) {
      XNextEvent(display, &ev);
      switch (ev.type) {
      case Expose:
         if (ev.xexpose.count == 0)
            get_window_size();
         realize_part(ev.xexpose.x, ev.xexpose.y,
                      ev.xexpose.width, ev.xexpose.height,
                      ev.xexpose.x, ev.xexpose.y);
         break;
      case MappingNotify:
         /*      XRefreshKeyboardMapping(&ev);
          */
         XRefreshKeyboardMapping((XMappingEvent *) & ev);
         break;
         /*  case ConfigureNotify:
            get_window_size();
            shr_w = paper_w / window_w;
            shr_h = paper_h / window_h;
            shrink = (shr_w >= shr_h) ? shr_w :shr_h;
            rewind(stdin);
            plot();
            main_loop();

            origin_x += window_x;
            origin_y += window_y;
            realize();
            realize_part(origin_x, origin_y, window_w, window_h,
            origin_x, origin_y);
            origin_x = paper_w - xsh.width;
            origin_y = paper_h - xsh.height;
            origin_x += xsh.x;
            origin_y += xsh.y;
            break;
          */
      case MotionNotify:
         break;
      case ButtonPress:
         break;
      case KeyPress:
         get_window_size();
         XLookupString(&ev.xkey, &key, 1, NULL, NULL);
         switch (key) {
         case 'j':
            diff = paper_h - window_h;
            if (origin_y >= diff) {
               beep();
               break;
            }
            origin_y += window_h / 4;
            if (origin_y > diff)
               origin_y = diff;
            if (origin_y < 0)
               origin_y = 0;
            realize();
            continue;
            break;
         case 'k':
            if (origin_y <= 0) {
               beep();
               break;
            }
            origin_y -= window_h / 4;
            if (origin_y < 0)
               origin_y = 0;
            realize();
            continue;
            break;
         case 'l':
            diff = paper_w - window_w;
            if (origin_x >= diff) {
               beep();
               break;
            }
            origin_x += window_w / 4;
            if (origin_x > diff)
               origin_x = diff;
            if (origin_x < 0)
               origin_x = 0;
            realize();
            continue;
            break;
         case 'h':
            if (origin_x <= 0) {
               beep();
               break;
            }
            origin_x -= window_w / 4;
            if (origin_x < 0)
               origin_x = 0;
            realize();
            continue;
            break;
         case 'q':
         case '\003':          /*  control-C  */
         case '\004':          /*  control-D  */
            close_window();
            break;
         default:
            beep();
            break;
         }
         break;
      default:
         break;
      }
   }
}
Esempio n. 25
0
void AnalyzeType::run(ast::Node& x) {
  // Maximum # of times we can run and do nothing
  int max_null_run = 5;
  do {
    // Clear slate
    _incomplete = false;
    _assign.clear();
    _modules.clear();
    unsigned cnt = 0;
    unsigned req = 0;

    // Run the base visitor
    ast::Visitor::run(x);

    // Enumerate through each decl. and ensure that all types have been
    // annotated through context
    for (auto& ref : _assign) {
      auto slot = ref.first;

      // If this slot already has a type; get out
      if (slot->type && !slot->type->is_unknown()) continue;

      auto& assign_set = ref.second;
      req += 1;

      // If the type of this assignment is invalid (undefined);
      // we're not done yet ..
      if (assign_set.size() > 0) {
        std::vector<Ref<code::Type>> type_set;

        // Check if any of the types are unknown or invalid
        bool invalid = false;
        for (auto& assign : assign_set) {
          if (!assign.type || assign.type->is_unknown()) {
            invalid = true;
            break;
          }

          type_set.push_back(assign.type);
        }

        Ref<code::Type> type = nullptr;
        if (!invalid) {
          // Resolve the common type ..
          type = code::intersect_all(type_set);
          if (!type) {
            Log::get().error(slot->context->span,
              "unable to infer a type for variable %s",
              slot->name.c_str());
          }
        }

        if (invalid) {
          if (max_null_run <= 0) {
            slot->type = new code::TypeNone();
          } else {
            _incomplete = true;
          }
        } else {
          // We did something
          cnt += 1;
          max_null_run = 5;

          // Mark the type
          slot->type = type;

          // Ensure that integral slots always end up as `int` without
          // an explicit type annotation
          slot->type = realize(slot->type);
        }
      } else if (max_null_run <= 0) {
        // We're done ..
        slot->type = new code::TypeNone();
      }
    }

    if (cnt == 0) {
      max_null_run -= 1;
    }

    if (req == 0 && max_null_run <= 0) {
      break;
    }

    if (Log::get().count("error") > 0) break;
  } while (_incomplete);
}
Esempio n. 26
0
    //____________________________________________________
    SliderDemoWidget::SliderDemoWidget( void )
    {

        // main widget
        GtkWidget* mainWidget( gtk_hbox_new( false, 0 ) );
        gtk_box_set_spacing( GTK_BOX( mainWidget ), 5 );
        setWidget( mainWidget );

        // setup
        setName( "Sliders" );
        setComments( "Shows the appearance of sliders, progress bars and scrollbars" );
        setIconName( "measure" );
        realize();

        // horizontal sliders
        {

            // frame
            GtkWidget* frame( gtk_frame_new( "Horizontal" ) );
            gtk_box_pack_start( GTK_BOX( mainWidget ), frame, true, true, 0 );
            gtk_widget_show( frame );

            // container
            GtkWidget* box( gtk_vbox_new( false, 0 ) );
            gtk_container_set_border_width( GTK_CONTAINER( box ), 5 );
            gtk_box_set_spacing( GTK_BOX( box ), 2 );
            gtk_widget_show( box );
            gtk_container_add( GTK_CONTAINER( frame ), box );

            // scale
            _horizontalSliders._scale = gtk_hscale_new_with_range( 0, 100, 1 );
            gtk_scale_set_draw_value( GTK_SCALE( _horizontalSliders._scale ), false );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._scale, false, true, 0 );
            gtk_widget_show( _horizontalSliders._scale );


            // progress entry
            _horizontalSliders._progressEntry = gtk_entry_new();
            gtk_entry_set_text( GTK_ENTRY( _horizontalSliders._progressEntry ), "Progress Bar Entry" );
            gtk_entry_set_progress_fraction( GTK_ENTRY( _horizontalSliders._progressEntry ), 0.25 );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._progressEntry, false, true, 0 );
            gtk_widget_show( _horizontalSliders._progressEntry );

            // progress bar
            _horizontalSliders._progressBar = gtk_progress_bar_new();
            #if GTK_CHECK_VERSION(3, 0, 0)
            gtk_orientable_set_orientation( GTK_ORIENTABLE( _horizontalSliders._progressBar ), GTK_ORIENTATION_HORIZONTAL );
            #else
            gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( _horizontalSliders._progressBar ), GTK_PROGRESS_LEFT_TO_RIGHT );
            #endif

            gtk_progress_set_show_text( GTK_PROGRESS( _horizontalSliders._progressBar ), true );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._progressBar, false, true, 0 );
            gtk_widget_show( _horizontalSliders._progressBar );

            // pulse progressBar
            _pulseProgressBar = gtk_progress_bar_new();
            #if GTK_CHECK_VERSION(3, 0, 0)
            gtk_orientable_set_orientation( GTK_ORIENTABLE( _pulseProgressBar ), GTK_ORIENTATION_HORIZONTAL );
            #else
            gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( _pulseProgressBar ), GTK_PROGRESS_LEFT_TO_RIGHT );
            #endif

            gtk_progress_bar_set_pulse_step( GTK_PROGRESS_BAR( _pulseProgressBar ), 0.01 );
            gtk_box_pack_start( GTK_BOX( box ), _pulseProgressBar, false, true, 0 );
            gtk_widget_show( _pulseProgressBar );

            // scrollbar
            GtkAdjustment* adjustment( GTK_ADJUSTMENT( gtk_adjustment_new( 25, 0, 110, 1, 1, 10 ) ) );
            _horizontalSliders._scrollBar = gtk_hscrollbar_new( adjustment );
            gtk_box_pack_start( GTK_BOX( box ), _horizontalSliders._scrollBar, false, true, 0 );
            gtk_widget_show( _horizontalSliders._scrollBar );

        }

        // vertical sliders
        {

            // frame
            GtkWidget* frame( gtk_frame_new( "Vertical" ) );
            gtk_box_pack_start( GTK_BOX( mainWidget ), frame, false, true, 0 );
            gtk_widget_show( frame );

            // container
            GtkWidget* box( gtk_hbox_new( false, 0 ) );
            gtk_container_set_border_width( GTK_CONTAINER( box ), 5 );
            gtk_box_set_spacing( GTK_BOX( box ), 5 );
            gtk_widget_show( box );
            gtk_container_add( GTK_CONTAINER( frame ), box );

            // scale
            _verticalSliders._scale = gtk_vscale_new_with_range( 0, 100, 1 );
            gtk_scale_set_draw_value( GTK_SCALE( _verticalSliders._scale ), false );
            gtk_box_pack_start( GTK_BOX( box ), _verticalSliders._scale, false, true, 0 );
            gtk_widget_show( _verticalSliders._scale );

            // progress bar
            _verticalSliders._progressBar = gtk_progress_bar_new();
            #if GTK_CHECK_VERSION(3, 0, 0)
            gtk_orientable_set_orientation( GTK_ORIENTABLE( _verticalSliders._progressBar ), GTK_ORIENTATION_VERTICAL );
            #else
            gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( _verticalSliders._progressBar ), GTK_PROGRESS_BOTTOM_TO_TOP );
            #endif

            gtk_progress_set_show_text( GTK_PROGRESS( _verticalSliders._progressBar ), true );
            gtk_box_pack_start( GTK_BOX( box ), _verticalSliders._progressBar, false, true, 0 );
            gtk_widget_show( _verticalSliders._progressBar );

            // scrollbar
            GtkAdjustment* adjustment( GTK_ADJUSTMENT( gtk_adjustment_new( 25, 0, 110, 1, 1, 10 ) ) );
            _verticalSliders._scrollBar = gtk_vscrollbar_new( adjustment );
            gtk_box_pack_start( GTK_BOX( box ), _verticalSliders._scrollBar, false, true, 0 );
            gtk_widget_show( _verticalSliders._scrollBar );

        }

        // connections
        connect( G_OBJECT( _horizontalSliders._scale ), "value-changed", GCallback( valueChanged ), this );
        connect( G_OBJECT( _horizontalSliders._scrollBar ), "value-changed", GCallback( valueChanged ), this );

        connect( G_OBJECT( _verticalSliders._scale ), "value-changed", GCallback( valueChanged ), this );
        connect( G_OBJECT( _verticalSliders._scrollBar ), "value-changed", GCallback( valueChanged ), this );

        // Initialize all
        gtk_range_set_value( GTK_RANGE( _verticalSliders._scale ), 25 );
    }
Esempio n. 27
0
void gPanel::create(void)
{
	int i;
	GtkWidget *ch, *box;
	bool doReparent = false;
	bool was_visible = isVisible();
	GdkRectangle rect;
	int bg, fg;
	gControl *nextSibling;
	
	if (border)
	{
		getGeometry(&rect);
		bg = background();
		fg = foreground();
		nextSibling = next();
		parent()->remove(this);
		
		for (i = 0; i < childCount(); i++)
		{
			ch = child(i)->border;
			g_object_ref(G_OBJECT(ch));
			gtk_container_remove(GTK_CONTAINER(widget), ch);
		}
		
		_no_delete = true;
		gtk_widget_destroy(border);
		_no_delete = false;
		doReparent = true;
	}
	
	if (_bg_set)
	{
		border = gtk_event_box_new();
		widget = gtk_fixed_new();
		box = widget;
		//gtk_widget_set_app_paintable(border, TRUE);
		//gtk_widget_set_app_paintable(box, TRUE);
	}
	else
	{
		border = widget = gtk_fixed_new();
		box = NULL;
	}

	frame = widget;
	realize(true);
	
	//g_signal_connect(G_OBJECT(border), "size-allocate", G_CALLBACK(cb_size), (gpointer)this);
	//g_signal_connect(G_OBJECT(border), "expose-event", G_CALLBACK(cb_expose), (gpointer)this);
	
	if (doReparent)
	{
		if (box)
			gtk_widget_realize(box);
		
		setNext(nextSibling);
		setBackground(bg);
		setForeground(fg);
		updateFont();
		bufX = bufY = bufW = bufH = -1;
		setGeometry(&rect);
		
		for (i = 0; i < childCount(); i++)
		{
			ch = child(i)->border;
			gtk_container_add(GTK_CONTAINER(widget), ch);
			moveChild(child(i), child(i)->x(), child(i)->y());
			g_object_unref(G_OBJECT(ch));
		}
		
		if (was_visible)
			show();
		else
			hide();
		
		//gApplication::checkHoveredControl(this);
		
		if (_inside)
		{
			_inside = false;
			if (gApplication::_enter == this)
				gApplication::_enter = NULL;
			gApplication::_ignore_until_next_enter = this;
		}
	}
}