Ejemplo n.º 1
0
int cglc_main() {
  cglc::screen scr;
  scr.renderer.back = "47";
  scr.clean();
  window win0(20, 10);
  window win1(20, 10);
  window win2(20, 10);
  win0.x = win0.y = 3;
  win1.x = win1.y = 6;
  win2.x = win2.y = 9;
  win0.renderer.back = "42";
  win1.renderer.back = "43";
  win2.renderer.back = "44";
  win0.clean();
  win1.clean();
  win2.clean();
  win2.title = "About Windows";
  scr << win0;
  scr << win1;
  scr << win2;
  std::string startmenu(scr.width(), ' ');
  static_text sm(startmenu);
  sm.y = scr.high() - 1;
  sm.nib.back = "44";
  scr << sm;
  static_text hl("#START");
  hl.nib.back = "42";
  hl.y = scr.high() - 1;
  scr << hl;
  static_text hw("\"Windows\" XP 2.0");
  hw.nib.back = "44";
  win2 << hw;
  scr << win2;
  scr.updscr();
}
Ejemplo n.º 2
0
void CTTSprite::GeneralTestsL()
	{
//
// Close cursor while still active on a window
//
	
	RWindow win(TheClient->iWs);
	win.Construct(*TheClient->iGroup->GroupWin(),1);
	win.Activate();
	SetUpPointerCursorL(iCursor1,TheClient->iWs);
	win.SetCustomPointerCursor(iCursor1);
	iCursor1.Close();
//
// Close window while cursor active on it
//
	SetUpPointerCursorL(iCursor1,TheClient->iWs);
	win.SetCustomPointerCursor(iCursor1);
	win.Close();
	iCursor1.Close();
	
//
// Close session with:
// An open cursor active on a window & A closed cursor active on another window
//
	RWsSession ws;
	User::LeaveIfError(ws.Connect());
	// use correct screen
	//
	ws.SetFocusScreen(iTest->iScreenNumber);
	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
	CleanupStack::PushL(screen);
	User::LeaveIfError(screen->Construct(0));

	RWindowGroup group(ws);
	User::LeaveIfError(group.Construct(123));
	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
	RWindow win2(ws);
	User::LeaveIfError(win2.Construct(group, 1));
	win2.Activate();
	RWindow win3(ws);
	User::LeaveIfError(win3.Construct(group, 2));
	win3.Activate();
//
	SetUpPointerCursorL(iCursor1,ws);
	SetUpPointerCursorL(iCursor2,ws);
	win2.SetCustomPointerCursor(iCursor1);
	win3.SetCustomPointerCursor(iCursor2);
//
	TSpriteMember member;
	member.iBitmap=member.iMaskBitmap=NULL;
	TInt err = iCursor1.UpdateMember(9999,member);
	TEST(err==KErrArgument);
	if (err!=KErrArgument)
		INFO_PRINTF3(_L("iCursor1.UpdateMember(9999,member) return value  - Expected: %d, Actual: %d"), KErrArgument, err);

	iCursor1.Close();

	CleanupStack::PopAndDestroy(screen);	
	ws.Close();
	}
Ejemplo n.º 3
0
int main(){
	Simple_window win2(Point(100, 100), 600, 400, "lines: +");

	Lines x;

	x.add(Point(100, 100), Point(200, 100));	// 1つ目のライン: 水平
	x.add(Point(150, 50), Point(150, 150));		// 2つ目のライン: 垂直

	win2.attach(x);
	win2.wait_for_button();		// 表示!
}
Ejemplo n.º 4
0
int main(int argc, char *argv[]) {
    int w = WIDTH/2, h = HEIGHT/2;
    SDL_Rect window_rect = {(WIDTH - w) / 2, (HEIGHT - h) / 2, w, h};
	Application *app = Application::getInstance();

    char dir[513] = {0x00};
    getcwd(dir, 512);
    LOGD("DIR: %s", dir);
	Window      win2(std::string("uuuuu hello world"), WIDTH , HEIGHT , SDL_WINDOW_SHOWN); 
    Layout dlg2("Hello, world!", window_rect);
	win2.addChild(&dlg2);
	LOGD("create win2 end");	

	std::string title("hello");
	Window      win(title, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); 
	//Window      win(std::string("hello"), WIDTH, HEIGHT); 

    Layout dlg("Hello, world!", window_rect);
    //Label label(renderer, (SDL_Rect){0,0,w,h}, "Hello!");
    Label label((SDL_Rect){0,0, 64,28}, "Hello!");
    dlg.addChild(&label);

    Input input((SDL_Rect){64 + 4, 0, 128,28});
    dlg.addChild(&input);

    Button button((SDL_Rect){w / 2,h / 2,w / 2 ,h / 2}, "OK");
    dlg.addChild(&button);

	win.addChild(&dlg);

    LOGD("app addChild 1");
    app->addChild(&win);
    LOGD("app addChild 2");
    //app->addChild(&win2);
    LOGD("app run");
    //sleep(1000 * 30);
	app->run();
    return 0;
}
Ejemplo n.º 5
0
int main(int argc,char *argv[])

{
	// init application, pretty usual
	PG_Application app;
	app.SetEmergencyQuit(true);
	app.LoadTheme("default");
	app.InitScreen(800,600,32,SDL_SWSURFACE);

	// init cairo, more interesting
	cr = cairo_create();
	char* image = (char*)PG_Application::GetScreen()->pixels;
	int width = PG_Application::GetScreenWidth();
	int height = PG_Application::GetScreenHeight();
	int stride = PG_Application::GetScreen()->pitch;
	
	cairo_set_target_image(cr, image, CAIRO_FORMAT_ARGB32, width, height, stride);
	
	// connect PG_Button::sigBlit to cairoBlitButton
	PG_Button::sigBlit.connect(slot(cairoBlitButton));

	PG_Button btn1(NULL, PG_Rect(300,400,200,50), "Button 1");
	btn1.Show();

	CMyWindow win1(NULL, PG_Rect(200,200,360,290), "CAIRO sample", PG_Window::DEFAULT);
	win1.Show();

	CMyWindow win2(NULL, PG_Rect(50,50,200,350), "CAIRO sample", PG_Window::DEFAULT);
	win2.Show();

	CMyWindow win3(NULL, PG_Rect(100,80,400,200), "CAIRO sample", PG_Window::DEFAULT);
	win3.Show();

	app.Run();
	
	return 0;
}
Ejemplo n.º 6
0
int Own2::Win(int x, int y)                            // 胜利条件
{
     return win1(x, y) || win2(x, y) || win3(x, y) || win4(x ,y);
}