Exemplo n.º 1
0
int
main(int argc, char *argv[])
{
   struct thread_init_arg tia[MAX_WINDOWS];
   struct window *h[MAX_WINDOWS];
   HANDLE threads[MAX_WINDOWS];
   int i;

   terminate = CreateEvent(NULL, TRUE, FALSE, NULL);

   if (initMainthread())
      return -1;

   /* four windows and contexts sharing display lists and texture objects */
   h[0] = AddWindow( 10,  10, gCtx);
   h[1] = AddWindow(330,  10, gCtx);
   h[2] = AddWindow( 10, 350, gCtx);
   h[3] = AddWindow(330, 350, gCtx);

   for (i = 0; i < NumWindows; i++) {
      Windows[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
   }

   for (i = 0; i < NumWindows; i++) {
      DWORD id;

      tia[i].id = i;
      threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);

      WaitForSingleObject(Windows[i].hEventInitialised, INFINITE);
   }

   if (!wglMakeCurrent(gHDC, gCtx)) {
      Error("wglMakeCurrent failed for init thread.");
      return -1;
   }

   InitGLstuff();

   while (1) {
      MSG msg;

      /* wait 1 ms for signal either to exit or process messages */
      switch (MsgWaitForMultipleObjects(NumWindows, threads, TRUE, 1, QS_ALLINPUT)) {
      case WAIT_OBJECT_0:
         return 0;
      }

      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
         if (msg.message == WM_QUIT) {
            return 0;
         }
         TranslateMessage(&msg);
         DispatchMessage(&msg);
      }
   }

   return 0;
}
Exemplo n.º 2
0
gboolean  update_window_key_event(gpointer data)
{
    AConvert *aconv = (AConvert *)data;

    aconv->keyboard->win=get_active_window(aconv->keyboard->dpy);

    if((aconv->keyboard->win == None) || (aconv->keyboard->win == PointerRoot))
        return TRUE;

    WInfo *info = AddWindow(aconv->keyboard->win,aconv);

    if(info)
    {
        switch (get_find_name_to_grab(aconv,info))
        {
        case -1:
            grab_wind_event(aconv);
            get_key_win(aconv);
            break;
        case 0:
            grab_wind_event(aconv);
            get_key_win(aconv);
            break;
        case 1:
            get_key_win(aconv);
            break;
        case 2:
            return TRUE;
        default:
            break;
        }
    }
    //get_key_win(aconv);
    return TRUE;
}
Exemplo n.º 3
0
/*=============================================================================
 * MULTI MENU
 */
static bmenuDECLARE( multi ) {

    StartF = MENUstart;
    CheckF = MENUcheck;
    InputF = MENUinput;
    DisplayF = MENUdraw;
    Fallback = "main";

    for(int i = 0; i < GAME_MAX_BRAINS; i++)
    {
	float s = BDEF_BUTTON_H;
	float y = BMENU_RATIO - .04 -1.1*s*(i+1);

	boxC* w = AddWindow("Players",
	    "This is the list of players that will take part in the game;"
	    " it also tells you which player has already pressed the"
	    " ?HReady?/ button.",
	.05, y, 1.5*BDEF_BUTTON_W, s,
	0,  mmuDisplayPlayer);
	w->Id = i;
    }


    AddButton("Ready",
	"When all the players in the list press this button, the game starts"
	" and no one else can join anymore.\n",
	.7, .05, BDEF_BUTTON_W, BDEF_BUTTON_H, 'r', btf_ready);

} bmenuINSTANCE;
Exemplo n.º 4
0
boost::optional<boost::shared_ptr<Error> > TitleScene::SceneInitialize(void) {
	next_scene.reset();
	OPT_ERROR(AddWindow(script_window, 0, 0, 0, 0));

	boost::shared_ptr<const std::wstring> image_filename(new std::wstring(L"data/scene/title.png"));
	OPT_ERROR(AddImageUI(image_filename, uis::UIBase::MOVE_MODE_CENTER_FREE, 0, 50));

	std::vector<boost::tuple<boost::shared_ptr<const std::wstring>, boost::shared_ptr<void> > > ui_list;
	const wchar_t *text_list[] = {
		L"NewGame",
		L"LoadGame",
		L"Exit"
	};
	boost::shared_ptr<void> next_list[] = {
		boost::shared_ptr<void>(new NEXT(NEXT_NEW_GAME)),
		boost::shared_ptr<void>(new NEXT(NEXT_LOAD_GAME)),
		boost::shared_ptr<void>(new NEXT(NEXT_EXIT))
	};
	for(unsigned int i = 0; i < 3; i++) {
		boost::shared_ptr<const std::wstring> text(new std::wstring(text_list[i]));
		boost::shared_ptr<void> next(next_list[i]);
		ui_list.push_back(make_tuple(text, next));
	}
	OPT_ERROR(AddSelectorWindow(ui_list, 1, boost::none, 250, 300, 140, 80));
	return boost::none;
}
/*
================
rvGENavigator::AddWindow

Adds a new window to the navigator
================
*/
void rvGENavigator::AddWindow( idWindow *window ) {
	int					index;
	LVITEM				item;
	rvGEWindowWrapper	*wrapper;
	wrapper = rvGEWindowWrapper::GetWrapper( window );
	// Dont add deleted windows
	if( !wrapper || wrapper->IsDeleted( ) ) {
		return;
	}
	// Insert the window into the tree
	ZeroMemory( &item, sizeof( item ) );
	item.mask = LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
	item.iItem = ListView_GetItemCount( mTree );
	item.lParam = ( LONG ) window;
	item.iImage = 0;
	item.state = rvGEWindowWrapper::GetWrapper( window )->IsSelected() ? LVIS_SELECTED : 0;
	item.stateMask = LVIS_SELECTED;
	ListView_InsertItem( mTree, &item );
	if( item.state & LVIS_SELECTED ) {
		ListView_EnsureVisible( mTree, item.iItem, false );
	}
	// Dont continue if not expanded.
	if( !wrapper->IsExpanded( ) ) {
		return;
	}
	// Insert all the child windows into the tree
	for( index = 0; index < wrapper->GetChildCount(); index ++ ) {
		AddWindow( wrapper->GetChild( index ) );
	}
}
Exemplo n.º 6
0
	EventLoop::EventLoop(const vector<shared_ptr<Window>> &wins, const vector<shared_ptr<Menu>> &ms){
		for(auto w : wins){
			AddWindow(w);
		}
		for(auto m : ms){
			AddMenu(m);
		}
	}
Exemplo n.º 7
0
uint8_t CManagerWindow::CreateNewWindow( SDL_Rect& size,
                                         std::string& text,
                                         SDL_Color* bkgnd_color, CGraphic* bkgnd_image )
{
    // Create the window
    CWindow* window = new CWindow( size, mEvents, text, bkgnd_color, bkgnd_image );
    return AddWindow( window );
}
Exemplo n.º 8
0
void TWindow::Create()
{
	ASSERT(!IsCreated());
	if (!IsCreated())
	{
		int screen = gApplication->GetDefaultScreen();
		Window parent = (fParent ? fParent->GetXWindow() : RootWindow(sDisplay, screen));

		XSetWindowAttributes	attributes;
		unsigned long attributesMask = CWBackPixel;
		int border = fBorder;

		attributes.background_pixel = fBackColor.GetPixel();

		if (fStyle == kPopupWindow)
		{
			attributes.save_under = true;
			attributes.override_redirect = true;
			attributesMask |= CWSaveUnder;
			attributesMask |= CWOverrideRedirect;
			border = 1;
		}
		
		fWindow = XCreateWindow(sDisplay, parent, fBounds.left, fBounds.top, GetWidth(), GetHeight(), 
										border,	CopyFromParent, InputOutput, CopyFromParent, attributesMask, &attributes);

		XSelectInput(sDisplay, fWindow, ExposureMask|FocusChangeMask|
									KeyPressMask|KeyReleaseMask|
									ButtonPressMask|ButtonReleaseMask|
									EnterWindowMask|LeaveWindowMask|PointerMotionMask|
									StructureNotifyMask | VisibilityChangeMask /*|SubstructureNotifyMask*/
									);
									
		XWindowAttributes	attr;
		XGetWindowAttributes(sDisplay, fWindow, &attr);
		fDepth = attr.depth;

	 	if (fStyle == kTopLevelWindow)
	 	{
	 		Atom	atoms[2] = { sDeleteWindowAtom, sTakeFocusAtom };
//ignore take focus?			XSetWMProtocols(sDisplay, fWindow, atoms, 2);
			XSetWMProtocols(sDisplay, fWindow, atoms, 1);
		}

		AddWindow(this);

		// give the positioner a chance to do its thing
//		if (fParent && fPositioner)
//			fPositioner(this, fParent->fBounds, fParent->fBounds);

		SetCursor(sDefaultCursor);

		TListIterator<TWindow> iter(fChildren);
		TWindow* child;
		while ((child = iter.Next()) != NULL)
			child->Create();
	}
}
Exemplo n.º 9
0
boost::optional<boost::shared_ptr<Error> > CastleScene::SceneInitialize(void) {
	OPT_ERROR(CampScene::SceneInitialize());
	next_scene.reset();
	OPT_ERROR(AddWindow(script_window, 0, 0, 0, 0));
	OPT_ERROR(AddBoxUI(uis::UIBase::MOVE_MODE_FREE_FREE, 10, 25, 620, 445));
	OPT_ERROR(AddTextUI(title, uis::UIBase::MOVE_MODE_CENTER_FREE, 262, 9, 116, 32));
	OPT_ERROR(AddPTStatusUI(pt, uis::UIBase::MOVE_MODE_FREE_FREE, 0, 350, DEFAULT_SCREEN_SIZE_X, 130));
	return StepInitialize();
}
Exemplo n.º 10
0
void CreateIconManagers()
{
    IconMgr *p;
    int mask;
    char str[100];
    char str1[100];
    Pixel background;
    char *icon_name;

    if (Scr->NoIconManagers)
	return;

    if (Scr->siconifyPm == None)
    {
	Scr->siconifyPm = XCreatePixmapFromBitmapData(dpy, Scr->Root,
	    (char *)siconify_bits, siconify_width, siconify_height, 1, 0, 1);
    }

    for (p = &Scr->iconmgr; p != NULL; p = p->next)
    {
	mask = XParseGeometry(p->geometry, &JunkX, &JunkY,
			      (unsigned int *) &p->width, (unsigned int *)&p->height);

	if (mask & XNegative)
	    JunkX = Scr->MyDisplayWidth - p->width - 
	      (2 * Scr->BorderWidth) + JunkX;

	if (mask & YNegative)
	    JunkY = Scr->MyDisplayHeight - p->height -
	      (2 * Scr->BorderWidth) + JunkY;

	background = Scr->IconManagerC.back;
	GetColorFromList(Scr->IconManagerBL, p->name, (XClassHint *)NULL,
			 &background);

	p->w = XCreateSimpleWindow(dpy, Scr->Root,
	    JunkX, JunkY, p->width, p->height, 1,
	    Scr->Black, background);

	sprintf(str, "%s Icon Manager", p->name);
	sprintf(str1, "%s Icons", p->name);
	if (p->icon_name)
	    icon_name = p->icon_name;
	else
	    icon_name = str1;

	XSetStandardProperties(dpy, p->w, str, icon_name, None, NULL, 0, NULL);

	p->twm_win = AddWindow(p->w, TRUE, p);
	SetMapStateProp (p->twm_win, WithdrawnState);
    }
    for (p = &Scr->iconmgr; p != NULL; p = p->next)
    {
	GrabButtons(p->twm_win);
	GrabKeys(p->twm_win);
    }
}
int
main(int argc, char *argv[])
{
   const char *dpyName = XDisplayName(NULL);

   struct window *h0, *h1, *h2, *h3;

   /* four windows and contexts sharing display lists and texture objects */
   h0 = AddWindow(dpyName,  10,  10, NULL);
   h1 = AddWindow(dpyName, 330,  10, h0);
   h2 = AddWindow(dpyName,  10, 350, h0);
   h3 = AddWindow(dpyName, 330, 350, h0);

   InitGLstuff(h0);

   EventLoop();
   return 0;
}
Exemplo n.º 12
0
TextBox::TextBox(std::string text, SDL_Rect location, Renderer *renderer)
{
  SetLocation(location);
  SDL_Color color = { 160, 160, 160, 255};
  SetTexture(TextureFactory::CreateWindowTexture(location.w, location.h, color, renderer));

  std::unique_ptr<TextField> element(new TextField(text, 13, location, renderer));
  AddWindow(std::move(element));
}
Exemplo n.º 13
0
int
main(int argc, char *argv[])
{
   const char *dpyName = XDisplayName(NULL);
   pthread_t t0, t1, t2, t3;
   struct thread_init_arg tia0, tia1, tia2, tia3;
   struct window *h0;

   XInitThreads();

   gDpy = XOpenDisplay(dpyName);
   if (!gDpy) {
      Error(dpyName, "Unable to open display");
      return -1;
   }

   if (initMainthread(gDpy, dpyName))
      return -1;

   /* four windows and contexts sharing display lists and texture objects */
   h0 = AddWindow(gDpy, dpyName,  10,  10, gCtx);
   (void) AddWindow(gDpy, dpyName, 330,  10, gCtx);
   (void) AddWindow(gDpy, dpyName,  10, 350, gCtx);
   (void) AddWindow(gDpy, dpyName, 330, 350, gCtx);

   if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) {
      Error(dpyName, "glXMakeCurrent failed for init thread.");
      return -1;
   }

   InitGLstuff();

   tia0.id = 0;
   pthread_create(&t0, NULL, threadRunner, &tia0);
   tia1.id = 1;
   pthread_create(&t1, NULL, threadRunner, &tia1);
   tia2.id = 2;
   pthread_create(&t2, NULL, threadRunner, &tia2);
   tia3.id = 3;
   pthread_create(&t3, NULL, threadRunner, &tia3);
   EventLoop();
   return 0;
}
Exemplo n.º 14
0
// warning: initialization of item is incomplete!
// initialization of item's height, text static and icon still necessary
CUIPdaMsgListItem* CUIGameLog::AddPdaMessage(LPCSTR msg, float delay){
	CUIPdaMsgListItem* pItem				= xr_new<CUIPdaMsgListItem>();
	pItem->Init								(0,0, GetDesiredChildWidth(), 10);	//fake height
	pItem->UIMsgText.SetTextST				(msg);
	pItem->SetClrAnimDelay					(delay);
    pItem->SetClrLightAnim					(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true);
	AddWindow								(pItem, true);

	return pItem;
}
Exemplo n.º 15
0
void LoadAllWindowPlacements()
{
	std::vector<HWND> handles;
	EnumWindows(EnumWindowsProc, (LPARAM)&handles);

	for(HWND hWnd : handles)
	{
		if(IsApplicationWindow(hWnd))
			AddWindow(hWnd);
	}
}
Exemplo n.º 16
0
CUIPdaKillMessage* CUIGameLog::AddLogMessage(KillMessageStruct& msg){
	CUIPdaKillMessage* pItem = pItem = xr_new<CUIPdaKillMessage>();	
	pItem->SetFont(GetFont());
	pItem->SetWidth(GetDesiredChildWidth());
	pItem->SetHeight(kill_msg_height);
	pItem->Init(msg);
	pItem->SetClrAnimDelay(5000.0f);
	pItem->SetClrLightAnim(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true);
	AddWindow(pItem, true);
	return pItem;
}
Exemplo n.º 17
0
void createWindowBoxes(void)
{
	WindowBox *winbox;
	char title [128];
	XWMHints      wmhints;
	XSizeHints    sizehints;

	for(winbox = Scr->FirstWindowBox; winbox; winbox = winbox->next) {
		int mask, x, y, gravity;
		unsigned int w, h;
		Window win;

		mask = XParseGeometry(winbox->geometry, &x, &y, &w, &h);
		if(mask & XNegative) {
			x += Scr->rootw  - w;
			gravity = (mask & YNegative) ? SouthEastGravity : NorthEastGravity;
		}
		else {
			gravity = (mask & YNegative) ? SouthWestGravity : NorthWestGravity;
		}
		if(mask & YNegative) {
			y += Scr->rooth - h;
		}

		win = XCreateSimpleWindow(dpy, Scr->Root, x, y, w, h, 0, Scr->Black,
		                          Scr->White);
		/*printf ("createWindowBoxes : name = %s, win = 0x%x, x = %d, y = %d, w = %d, h = %d\n",
		        winbox->name, win, x, y, w, h); */
		sprintf(title, "%s", winbox->name);
		XSetStandardProperties(dpy, win, title, title, None, NULL, 0, NULL);
		sizehints.flags  = USPosition | USSize | PWinGravity;
		sizehints.x      = x;
		sizehints.y      = y;
		sizehints.width  = w;
		sizehints.height = h;
		sizehints.win_gravity = gravity;
		XSetWMSizeHints(dpy, win, &sizehints, XA_WM_NORMAL_HINTS);

		wmhints.initial_state = NormalState;
		wmhints.input         = True;
		wmhints.flags         = InputHint | StateHint;
		XSetWMHints(dpy, win, &wmhints);

		winbox->window = win;
		winbox->twmwin = AddWindow(win, ADD_WINDOW_WINDOWBOX, NULL, Scr->currentvs);
		if(!winbox->twmwin) {
			fprintf(stderr, "cannot create %s window box, exiting...\n", winbox->name);
			exit(1);
		}
		winbox->twmwin->iswinbox = TRUE;
		XMapWindow(dpy, win);
	}
}
Exemplo n.º 18
0
bool BedWindow::FindOneOrMoreWindowOverlaps(const BED &a) {

    // update the current feature's start and end
    // according to the slop requested (slop = 0 by default)
    CHRPOS aFudgeStart = 0;
    CHRPOS aFudgeEnd;
    AddWindow(a, aFudgeStart, aFudgeEnd);

    bool overlapsFound = _bedB->anyHits(a.chrom, a.start, a.end, a.strand, 
                                        _matchOnSameStrand, _matchOnDiffStrand, 0.0, false);
    return overlapsFound;
}
/*
================
rvGENavigator::Update

Updates the contents of the navigator window from the current workspace
================
*/
void rvGENavigator::Update( void ) {
	// Clear the list first
	ListView_DeleteAllItems( mTree );
	// Add starting with the desktop window
	if( mWorkspace ) {
		AddWindow( mWorkspace->GetInterface( )->GetDesktop( ) );
	}
	// For some reason the horizontal scrollbar wants to show up initially after an update
	// so this forces it not to
	RECT rClient;
	GetClientRect( mTree, &rClient );
	ListView_SetColumnWidth( mTree, 0, rClient.right - rClient.left - 1 );
}
Exemplo n.º 20
0
void BedWindow::FindWindowOverlaps(const BED &a, vector<BED> &hits) {

    /*
        Adjust the start and end of a based on the requested window
    */

    // update the current feature's start and end
    // according to the slop requested (slop = 0 by default)
    CHRPOS aFudgeStart = 0;
    CHRPOS aFudgeEnd;
    AddWindow(a, aFudgeStart, aFudgeEnd);

    /*
        Now report the hits (if any) based on the window around a.
    */
    // get the hits in B for the A feature
    _bedB->allHits(a.chrom, aFudgeStart, aFudgeEnd, a.strand, hits, 
                   _matchOnSameStrand, _matchOnDiffStrand, 0.0, false);

    int numOverlaps = 0;

    // loop through the hits and report those that meet the user's criteria
    vector<BED>::const_iterator h = hits.begin();
    vector<BED>::const_iterator hitsEnd = hits.end();
    for (; h != hitsEnd; ++h) {

        int s = max(aFudgeStart, h->start);
        int e = min(aFudgeEnd, h->end);
        int overlapBases = (e - s);             // the number of overlapping bases b/w a and b
        int aLength = (a.end - a.start);        // the length of a in b.p.

        if (s < e) {
            // is there enough overlap (default ~ 1bp)
            if ( ((float) overlapBases / (float) aLength) > 0 ) {
                numOverlaps++;
                if (_anyHit == false && _noHit == false && _writeCount == false) {
                    _bedA->reportBedTab(a);
                    _bedB->reportBedNewLine(*h);
                }
            }
        }
    }
    if (_anyHit == true && (numOverlaps >= 1)) {
        _bedA->reportBedNewLine(a); }
    else if (_writeCount == true) {
        _bedA->reportBedTab(a); printf("%d\n", numOverlaps);
    }
    else if (_noHit == true && (numOverlaps == 0)) {
        _bedA->reportBedNewLine(a);
    }
}
Exemplo n.º 21
0
void CUIListBox::AddExistingItem(CUIListBoxItem* item)
{
	item->InitFrameLineWnd		(Fvector2().set(0,0), Fvector2().set(GetDesiredChildWidth()-5, m_def_item_height));
	item->SetWidth				(GetDesiredChildWidth());

	if(m_selection_texture.size())
		item->InitTexture		(m_selection_texture.c_str(), "hud\\default");
	else
        item->InitDefault		();

	item->SetSelected			(false);
	item->SetMessageTarget		(this);
	AddWindow					(item, true);
}
Exemplo n.º 22
0
DWORD WINAPI HandleClients(LPVOID cl)
{
	SOCKET Client;
	Client = ((SOCKET *) cl)[0];
	cString string;	
	string.PutString(Client,"Welcome to your Smart-House Manager!\n>");
	while (string.ReadLine("", Client) && string != "exit")
	{		
		if (string == "add house")
		{			
			AddHouse(Client);
		}

		else if (string == "delete house")
		{
			DelHouse(Client);
		}

		else if (string == "print")
		{
			Print(Client);
		}
		else if (string == "add floor")
		{
			AddFloor(Client);
		}
		else if (string == "add room")
		{
			AddRoom(Client);
		}

		else if (string == "help")
		{
			PrintHelp(Client);
		}
		else if (string == "add window")
		{
			AddWindow(Client);
		}

		else
		{
			string.PutString(Client,"You've entered unknown command \n>");
			break;
		}
		string.PutString(Client, "");
	}

	return 0;
}
Exemplo n.º 23
0
// _____________________________________________________________________ //
//
// Global event listener
// _____________________________________________________________________ //
void CALLBACK WinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)
{
	if(IsPaused)
		return;

	switch(event)
	{
	case EVENT_OBJECT_LOCATIONCHANGE:
		if(!idObject && HasWindow(hwnd))
			ScheduleWindowPlacementUpdate(hwnd);
	break;

	case EVENT_OBJECT_CREATE:
	case EVENT_OBJECT_SHOW:
		if(!HasWindow(hwnd) && IsApplicationWindow(hwnd))
			AddWindow(hwnd);
	break;

	case EVENT_OBJECT_DESTROY:
	case EVENT_OBJECT_HIDE:
		if(!idObject)
			RemoveWindow(hwnd);
	break;

	case EVENT_OBJECT_PARENTCHANGE:
		if(HasWindow(hwnd))
		{
			if(!IsApplicationWindow(hwnd))
				RemoveWindow(hwnd);
		}
		else if(IsApplicationWindow(hwnd))
		{
			AddWindow(hwnd);
		}
	break;
	}
}
Exemplo n.º 24
0
/* Display the submenu pointed to by the passed show: menu item. */
void ShowSubMenu (Menu_Item_Type *i) {
  int c;
  Menu_Type *m;

  /* find matching menu, if any */
  if ((m=LookupMenu(i->command)) != NULL) {
    /* got match -- show it and handle input for it. */
    AddWindow(m);
    DrawAll();
    do {
      c=DoMenu(m,Pdmenu_Action,Handle_Ctrl_C);
      if ((c==QUIT_EXIT) || (c==Q_KEY_EXIT))
        ExitWindow();
    } while (c==0);
  }
}
Exemplo n.º 25
0
int FreePM_DeskTop::Init(int nx, int ny, int bytesPerPixel)
{
    int i, ordinal,tid,rc, len,inf[2];

/* desktop is a usual application with its HAB, queue and procedure */
/* initialize hab */

    ordinal = QueryThreadOrdinal(tid);
    rc = _shab.QueryOrdinalUsed(ordinal, Q_ORDINAL_HAB);
    if(rc != -1)
    {  _shab.SetError(rc, PMERR_ALREADY_INITIALIZED);
       fatalf("FreePM_DeskTop::Init WARNING: Tread Ordinal already used\n");
       return NULLHANDLE;
    }

    iHab = pSession->hab_list.Add(iClientId,-1);
/* Create queue */
    _shab.hab[iHab].pQueue = new FreePM_Queue(iHab);
    pQueue =  _shab.hab[iHab].pQueue;
    debug(8, 0) ("FreePM_DeskTop::Init iHab = %i\n", iHab);

/* создание окна HWND_DESKTOP  */
/*  the creation of window HWND_DESKTOP */
   pWindow = new DeskTopWindow(); /* bytesPerPixel */
   pWindow->CreateDeskTopWindow(0L,nx, ny,  NULL, NULL); /* bytesPerPixel */
   hwnd = AddWindow(pWindow);
   pWindow->SetHandle(hwnd);

/* Init device i.e. memory, PM, gradd or else */
   rc = pSession->InitDevice(FPM_DEV_PMWIN, this);
   /*rc = pSession->InitDevice(FPM_DEV_SERVERMEM, this);*/
   /* init videomode */

   /* Draw a picture in a buffer */
   //pBmpBuffer = (PBYTE)this->pVBuffmem;
   InitBuffer(this->pVBuffmem, nx, ny, bytesPerPixel);
   debug(8, 0) ("FreePM_DeskTop::Init OK\n");

/* создание остальных окон     */
/* the creation of the remaining windows */
//todo

  // prokushev: I think here we must create separate thread which will
  // process desktop messages loop.

   return 0;
}
Exemplo n.º 26
0
CUIListBoxItem*  CUIListBox::AddItem()
{
	CUIListBoxItem* item		= xr_new<CUIListBoxItem>(m_def_item_height);
	item->InitFrameLineWnd		(Fvector2().set(0,0), Fvector2().set(GetDesiredChildWidth()-5, m_def_item_height));
	item->GetTextItem()->SetWidth	(GetDesiredChildWidth());
	item->SetWidth					(GetDesiredChildWidth());

	if(m_selection_texture.size())
		item->InitTexture		(m_selection_texture.c_str(), "hud\\default");
	else
        item->InitDefault		();

	item->SetFont				(GetFont());
	item->SetSelected			(false);
	item->SetMessageTarget		(this);
	AddWindow					(item, true);
	return						item;
}
Exemplo n.º 27
0
void WindowsModel::updateWinList ()
{
    auto& w = Util::XWrapper::Instance ();

    QSet<Window> known;
    for (const auto& info : Windows_)
        known << info.WID_;

    auto current = w.GetWindows ();
    current.erase (std::remove_if (current.begin (), current.end (),
    [this, &w] (Window wid) {
        return !w.ShouldShow (wid);
    }), current.end ());

    for (auto i = current.begin (); i != current.end (); )
    {
        if (known.remove (*i))
            i = current.erase (i);
        else
            ++i;
    }

    for (auto wid : known)
    {
        const auto pos = std::find_if (Windows_.begin (), Windows_.end (),
        [&wid] (const WinInfo& info) {
            return info.WID_ == wid;
        });
        const auto dist = std::distance (Windows_.begin (), pos);
        beginRemoveRows ({}, dist, dist);
        Windows_.erase (pos);
        endRemoveRows ();

        ImageProvider_->RemoveIcon (QString::number (wid));
    }

    if (!current.isEmpty ())
    {
        beginInsertRows ({}, Windows_.size (), Windows_.size () + current.size () - 1);
        for (auto wid : current)
            AddWindow (wid, w);
        endInsertRows ();
    }
}
Exemplo n.º 28
0
void CUIGameLog::AddChatMessage(LPCSTR msg, LPCSTR author){
	string256 fullLine;
	sprintf_s(fullLine, "%s %s", author, msg);
	_TrimRight	(fullLine);
    
	CUIStatic* pItem = NULL;

	pItem = xr_new<CUIStatic>();
	pItem->SetTextComplexMode		(true);
	pItem->SetText(fullLine);
    pItem->m_pLines->SetCutWordsMode(true);
	pItem->SetFont(GetFont());
	pItem->SetTextColor(txt_color);
	pItem->SetClrAnimDelay(5000.0f);
	pItem->SetClrLightAnim(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true);	
	pItem->SetWidth(this->GetDesiredChildWidth());
	pItem->AdjustHeightToText();
	AddWindow(pItem, true);	
}
Exemplo n.º 29
0
void CDBPickView::Run()
	{
	ClearWaveformInfo();
	nLastMarkRightPos=0;
	int nElem=this->pRTDisplay->WaveformInfo.GetSize();
	for(int i=0; i<nElem; ++i)
		{
		CMWindow *pMWin=pRTDisplay->WaveformInfo[i];
		CString sSta=pMWin->StaName;
		CString sChan=pMWin->ChanName;
		double dSpS=pMWin->dSpS;
		AddWindow(sSta, sChan,dSpS);
		}
	t1=this->pRTDisplay->t1;
	t2=this->pRTDisplay->t2;
	nActiveScreen=0;
	CalculateWindowsSize();
	DrawWaveforms();
	}
Exemplo n.º 30
0
CUIListBoxItem* CUIListBox::AddItem(LPCSTR text)
{
	if (!text)			
		return					NULL;

	CUIListBoxItem* pItem		= new CUIListBoxItem();
	pItem->InitFrameLineWnd		(Fvector2().set(0,0), Fvector2().set(this->GetDesiredChildWidth()-5, m_def_item_height) );
	if (!m_selection_texture)
        pItem->InitDefault		();
	else
		pItem->InitTexture		(*m_selection_texture,"hud\\default");

	pItem->SetSelected			(false);
	pItem->m_text.SetText		(*CStringTable().translate(text));
	pItem->SetTextColor			(m_text_color, m_text_color_s);
	pItem->SetMessageTarget		(this);
	AddWindow					(pItem, true);
	return						pItem;
}