Beispiel #1
0
void Widget::CreateRootWidgetWindow(HWND hParentWnd, const char* className, int x, int y, int width, int height, DWORD style, DWORD styleEx)
{
	m_x = x;
	m_y = y;
	m_width = width;
	m_height = height;

	m_hWidget = CreateWidgetWindow(hParentWnd, className, x, y, width, height, style, styleEx);
	::SetWindowLongPtr(m_hWidget, GWLP_USERDATA, (LONG_PTR)this);
}
Beispiel #2
0
void MainInitialize(char *fname, 
                    SpaceballControlStruct *scs,  
                    SpaceballAppDataStruct *app,
                    float *CTM, PointStr *World)
{

  /*
   *  Initialize the Spaceball data structures
   */

  scs->sbDominant = FALSE;
  scs->sbAllowTranslation = TRUE;
  scs->sbAllowRotation = TRUE;
  scs->sbScale = (float)1.0;
  scs->appData = (void *)(app);
  app->CTM = (float *)CTM; 
  app->redraw = TRUE;

  /* 
   * Read in the data file containing the objects 
   */

  ReadDataFile(fname, &Spw_Points, &Spw_Edges, &Spw_Polygons, 
               &Spw_NPoints, &Spw_NEdges, &Spw_NPolygons, World);

  /* 
   *  Create scratch array of drawing points 
   */

  if ((Spw_DrawPoints = (PointStr *) malloc 
       (Spw_NPoints * sizeof(PointStr))) == NULL)
 {
    printf ("Couldn't alloc Spw_DrawPoints arrar\n");
    exit(1);
  }
  
  /* 
   *  Translate the scene to the center of the window, set center
   *  of rotation
   */

  app->center.Coord[0] = 
    ((World[0].Coord[0] + World[1].Coord[0]) / (float)2.0);
   app->centerRot.Coord[1] = app->center.Coord[1] = 
    ((World[0].Coord[1] + World[1].Coord[1]) / (float)2.0);
   app->centerRot.Coord[2] = app->center.Coord[2] = (float)0.0;

  app->centerRot.Coord[0] = (Spw_WindowWidth / (float)2.0);
  app->centerRot.Coord[1] = (Spw_WindowHeight / (float)2.0);

  /* 
   *  Initialize the transformation matrix 
   */

  SPW_MakeIdentityMatrix((float(*)[4])CTM);
  SPW_MakeTranslationMatrix((float(*)[4])CTM, app->center.Coord);

  /* 
   *  Open the main drawing window, map window
   */
  
  CreateWidgetWindow(0, 0, Spw_WindowHeight, Spw_WindowWidth, "Widget World");
  Spw_Foreground = Spw_Black;
  Spw_Background = Spw_White;

} /* end of MainInitialize */