Beispiel #1
0
void spacerInit(spacer *self, const char *id, spacerDirection direction)
{
	// Init our parent
	widgetInit(WIDGET(self), id);
	
	// Prepare our vtable
	spacerInitVtbl(self);
	
	// Set our type
	WIDGET(self)->classInfo = &spacerClassInfo;
	
	// Set our direction
	self->direction = direction;
}
Beispiel #2
0
void textEntryInit(textEntry *self, const char *id)
{
	// Init our parent
	widgetInit(WIDGET(self), id);
	
	// Prepare our vtable
	textEntryInitVtbl(self);
	
	// Set our type
	WIDGET(self)->classInfo = &textEntryClassInfo;
	
	// Allocate a modestly sized text buffer
	self->text = calloc(defautSize, 1);
	self->textSize = defautSize;
	
	// On account of there being no text, all of these are 0
	self->textHead = 0;
	self->insertPosition = 0;
	self->renderLeftOffset = 0;
}
Beispiel #3
0
void buttonInit(button *self, const char *id, int w, int h)
{
	// Buttons need to be redrawn when the following events fire
	int i, handlers[] = {
	    EVT_ENABLE,
	    EVT_DISABLE,
	    EVT_MOUSE_ENTER,
	    EVT_MOUSE_LEAVE,
	    EVT_MOUSE_DOWN,
	    EVT_MOUSE_UP
	};

	// Init our parent
	widgetInit((widget *)self, id);

	// Prepare our vtable
	buttonInitVtbl(self);

	// Set our type
	((widget *)self)->classInfo = &buttonClassInfo;

	// initialise button state
	self->state = BUTTON_STATE_NORMAL;

	// Mask for exact mouse events
	widgetEnableMask(WIDGET(self));

	// Install necessary event handlers
	for (i = 0; i < sizeof(handlers) / sizeof(int); i++)
	{
		widgetAddEventHandler(WIDGET(self), handlers[i],
		                      buttonSetButtonStateHandler, NULL, NULL);
	}

	buttonSetPatternsForState(self, BUTTON_STATE_NORMAL, "button/normal/fill", "button/normal/contour");
	buttonSetPatternsForState(self, BUTTON_STATE_DISABLED, "button/disabled/fill", "button/disabled/contour");
	buttonSetPatternsForState(self, BUTTON_STATE_MOUSEOVER, "button/mouseover/fill", "button/mouseover/contour");
	buttonSetPatternsForState(self, BUTTON_STATE_MOUSEDOWN, "button/mousedown/fill", "button/mousedown/contour");

	widgetResize(WIDGET(self), w, h);
}
Beispiel #4
0
void tableInit(table *self, const char *id)
{
	// Init our parent
	widgetInit(WIDGET(self), id);
	
	// Prepare our vtable
	tableInitVtbl(self);
	
	// Set our type
	WIDGET(self)->classInfo = &tableClassInfo;
	
	// Prepare our child postional info container
	self->childPositions = vectorCreate();
	
	// We have no children and therefore no rows/columns
	self->numRows = self->numColumns = 0;
	
	// Default alignment is TOP LEFT
	tableSetDefaultAlign(self, TOP, LEFT);
	
	// Padding is 0
	self->rowPadding = self->columnPadding = 0;
}
Beispiel #5
0
/*!
 * \en	Sets property editorType. \_en
 * \ru 	Устанавливает значение свойства `editorType'.\_ru
 */
void
wField::setEditorType( tEditorType n )
{
    vEditorType=n;
    widgetInit();
}
//=================================================== TFWidgetRen
//===============================================================
TFWidgetRen::TFWidgetRen(gluvvGlobal *gl)
{
  pos[0] = 0;
  pos[1] = 0;
  pos[2] = -4;
  screenwidth = .9;
  screenheight = .2;
  screenpos[0] = .45;
  screenpos[1] = -.46;

  mode = colorBlend;
 
  float d[3];
  subV3(d, pos, gluvv.env.eye);
  float dist = normV3(d);

  width  = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenwidth;
  height = ((gluvv.env.frustum[3]-gluvv.env.frustum[2]) * 
	    dist/gluvv.env.clip[0]) * screenheight;

  pos[0] = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenpos[0];
  pos[1] = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenpos[1];

  screenbar = .01;
  screenball = screenbar * 1.5;

  barRad = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenbar;

  ballRad = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	     dist/gluvv.env.clip[0]) * screenball;

  //-------- Levoy triangles -----------
  tris = new LevWidget(&gluvv);
  tris->setWH(width-ballRad*2, height-ballRad*2);
  float b[2] = {.5,0}; float l[2]={.3,.7}; float r[2] = {.7,.7};
  tris->setPos(b,l,r);
  tris->setBallBar(ballRad/2.0, barRad/2.0);
  tris->setDepth(pos[2]);
  tris->squareType();
  tris->on = 0;  //turn root triangle off

  brush= new LevWidget(&gluvv);
  brush->setWH(width-ballRad*2, height-ballRad*2);
  brush->setPos(b,l,r);
  brush->setBallBar(ballRad/2.0, barRad/2.0);
  brush->setDepth(pos[2]);
  brush->setAlpha(.2);
  brush->squareType();
  brush->on = 1;     //turn paint brush on
  brush->drawOn = 0; //but dont actualy draw the widget

  widgetInit();

  transparent();

  gluvv.tf.loadme = 1;
  gluvv.tf.paintme = 0;
  //make space for pixel texture (memory copy)
  gluvv.tf.ptexsz[0] = 256;//value
  gluvv.tf.ptexsz[1] = 256;//grad
  gluvv.tf.ptexsz[2] = 4;  //hess, four panes
  gluvv.tf.numelts   = 4;  //rgba
  glGenTextures(1, &gluvv.tf.ptextex);  //drawable texture
  //glGenTextures(1, &gluvv.tf.ptexname); //actual pixel texture
  //cerr << "the pixel texture name " << gluvv.tf.ptexname << endl;
  
  gluvv.tf.qnptexname = 0;
  if(gluvv.tf.ptex) delete[] gluvv.tf.ptex;
  gluvv.tf.ptex = new unsigned char[(gluvv.tf.ptexsz[0]*
				     gluvv.tf.ptexsz[1]*
				     gluvv.tf.ptexsz[2]*
				     gluvv.tf.numelts)];
  gluvv.tf.paintex = new unsigned char[(gluvv.tf.ptexsz[0]*
					gluvv.tf.ptexsz[1]*
					gluvv.tf.ptexsz[2]*
					gluvv.tf.numelts)];
  gluvv.tf.shadePtex = new unsigned char[(gluvv.tf.ptexsz[0]*
					  gluvv.tf.ptexsz[1]*
					  gluvv.tf.ptexsz[2]*
					  gluvv.tf.numelts)];
  clearPaintex();
  gluvv.tf.ptex[0 + 0] = 0;
  gluvv.tf.ptex[0 + 1] = 0;
  gluvv.tf.ptex[0 + 2] = 0;
  gluvv.tf.ptex[0 + 3] = 0;
  
}