Example #1
0
void DialogManager::DestroyAll()
{
	WindowList::iterator iter;
	for (iter=dialogs.begin(); iter!=dialogs.end(); iter++)
		delete (*iter);
	dialogs.clear();
}
Example #2
0
void FastTraxApp:: MessageReceived( BMessage * msg )
{
	switch( msg->what )
	{
		case Messages::WindowClosed:
		{
			BWindow * win ;
			msg->FindPointer( "Window", reinterpret_cast<void**>(&win) ) ;
			fWindows.RemoveWindow( win ) ;
			if( !fbQuiting && fWindows.CountWindows() == 0 )
				Quit() ;
			msg->SendReply( B_REPLY ) ;
			break ;
		}
		
		case Messages::WindowOpened:
		{
			BWindow * win ;
			msg->FindPointer( "Window", reinterpret_cast<void**>(&win) ) ;
			fWindows.AddWindow( win ) ;
			msg->SendReply( B_REPLY ) ;
			break ;
		}
				
		case Messages::LibInUse:
		case Messages::LibNotInUse:
		{
			fWindows.Broadcast( msg ) ;
			break ;
		}
			
		default:
			BApplication::MessageReceived( msg ) ;
	}
}
Window* Window::_getTopmostParent() const {
    WindowList windowList;

    getParentList(windowList);

    return windowList.back().get();
}
Example #4
0
void TraxApp:: NewWindow( entry_ref * ref )
{
	BWindow * win = new TraxWindow( ref, fWindows.CountWindows() ) ;
	fWindows.AddWindow( win ) ;
	if( (fOptions & F_Hide) )
		win->Hide() ;
	win->Show() ;
} 
Example #5
0
bool DialogManager::IsDialogMessage(LPMSG message)
{
	WindowList::iterator iter;
	for (iter = dialogs.begin(); iter != dialogs.end(); iter++) {
		if (::IsDialogMessage((*iter)->GetDlgHandle(), message))
			return true;
	}
	return false;
}
Example #6
0
void FastTraxApp:: ReadyToRun( void )
{
	if( fWindows.CountWindows() == 0 )
	{
		BWindow * win = new FastTraxWindow ;
		fWindows.AddWindow( win ) ;
		if( (fOptions & F_Hide) )
			win->Hide() ;
		win->Show() ;
	}
}
Example #7
0
void ProjectToolBoxPage::afterTrussVisibilityChange ()
{
    TrussUnitWindowManager& mng = pageProject.getTrussUnitWindowManager();
    int numb = 0;
    WindowList trussWindows = mng.getTrussUnitWindowList();
    WindowListIter iter = trussWindows.begin();
    for ( ; iter != trussWindows.end(); ++iter )
        if ( ! (*iter)->isVisible() )
            ++numb;

    setHiddenTrussNumber( numb );
}
HWND GetWoWHWND(){

	EnumWindows(&EnumerateWindowsCallback, 0);
	//_tprintf(_T("Printing %d titles\n"), windowTitles.size());
	for(WindowList::iterator iter = windowTitles.begin(); iter != windowTitles.end(); ++iter){
		WindowObject windowObject = *iter;
		LPTSTR windowTitle = windowObject.winTitle;
		if(_tcscmp(windowTitle, _T("World of Warcraft")) == 0){
			return windowObject.hwnd;
		}
	}
	return 0;
}
Example #9
0
// Clears window data list
void ClearWindowDataList( WindowList& wlWindowList )
{
    // Clear data
    POSITION pstPos = wlWindowList.GetHeadPosition();
    while( pstPos )
    {
        PWindow pWindow = wlWindowList.GetNext( pstPos );
        delete pWindow;
    }

    // Remove all items from list
    wlWindowList.RemoveAll();
}
Example #10
0
void GuiManager::findCommonWindowRoot(WindowList *out, WindowList const &first, WindowList const &second)
{
   auto it_first = first.begin();
   auto it_second = second.begin();

   while ( (it_first != first.end())
       && (it_second != second.end())
       && (*it_first == *it_second) )
   {
      out->push_back(*it_first);
      it_first++;
      it_second++;
   }
}
Example #11
0
void GuiWindow::getAncestors(WindowList *captured)
{
   WindowList backward;

   for ( GuiWindow* curr = this; curr != NULL; curr = curr->getParent() )
   {
      backward.push_back(curr);
   }

   for ( auto it = backward.rbegin(); it != backward.rend(); it++ )
   {
      captured->push_back(*it);
   }
}
bool Window::getEmbeddedList(WindowList& wl) const {
    for(ConstIterator i = begin(); i != end(); i++) if(i->valid()) {
        EmbeddedWindow* ew = dynamic_cast<EmbeddedWindow*>(i->get());

        if(!ew || !ew->getWindow()) continue;

        else {
            wl.push_back(ew->getWindow());

            ew->getWindow()->getEmbeddedList(wl);
        }
    }

    return wl.size() != 0;
}
WId QxtWindowSystem::windowAt(const QPoint& pos)
{
    Window result = 0;
    WindowList list = windows();
    for (int i = list.size() - 1; i >= 0; --i)
    {
        WId wid = list.at(i);
        if (windowGeometry(wid).contains(pos))
        {
            result = wid;
            break;
        }
    }
    return result;
}
Example #14
0
WId QxtWindowSystem::activeWindow()
{
    ProcessSerialNumber psn;
    OSErr err(noErr);
    err = ::GetFrontProcess(&psn);
    if (err != noErr) return WINDOW_NOT_FOUND;

    // in Mac OS X, first window for given PSN is always the active one
    WindowList wlist = qxt_getWindowsForPSN(&psn);

    if (wlist.count() > 0)
        return wlist.at(0);

    return WINDOW_NOT_FOUND;
}
XYCoord Window::getAbsoluteOrigin() const {
    XYCoord xy(0, 0);

    WindowList windowList;

    getParentList(windowList);

    for(WindowList::iterator i = windowList.begin(); i != windowList.end(); i++) {
        if(!i->valid()) continue;

        xy.x() += static_cast<int>(i->get()->getX());
        xy.y() += static_cast<int>(i->get()->getY());
    }

    return xy;
}
BOOL CALLBACK qxt_EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
    Q_UNUSED(lParam);
    if( ::IsWindowVisible(hwnd) && ::GetParent(hwnd) == 0 )
		qxt_Windows.push_front(hwnd);
    return true;
}
Example #17
0
BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam)
{
	TCHAR title[500];
    ZeroMemory(title, sizeof(title));
    
    //string strTitle;
    
    GetWindowText(hWnd, title, sizeof(title)/sizeof(title[0]));
	
	if (IsAltTabWindow(hWnd) && IsWindowVisible(hWnd) && GetWindowTextLength(hWnd)>0)
	{
		_tprintf(_T("Window Found: %s\n"), title);
		string nowwindow=title;
		//cout<<"string nowwindow has value: "<<nowwindow<<endl;
		openedwindows.addwindow(nowwindow);
	}
    
    //strTitle += title; // Convert to std::string
    if(_tcsstr(title, _T("Excel")))
    {
        windowHandle = hWnd;
        return FALSE;
    }
    return TRUE;
}
WindowList QxtWindowSystem::windows()
{
    qxt_Windows.clear();
    HDESK hdesk = ::OpenInputDesktop(0, false, DESKTOP_READOBJECTS);
    ::EnumDesktopWindows(hdesk, qxt_EnumWindowsProc, 0);
    ::CloseDesktop(hdesk);
    return qxt_Windows;
}
// The topmost Window always has this method called, instead of the embedded window directly.
bool Window::setFocused(const Widget* widget) {
    // TODO: I've turned on the warn() here, but perhaps I shouldn't? I need to define
    // the conditions under which it's okay to call setFocus() with a NULL widget.
    if(!widget) {
        warn() << "Window [" << _name << "] can't focus a NULL Widget." << std::endl;

        return false;
    }

    ConstIterator i = std::find(begin(), end(), widget);

    bool found = false;

    if(i == end()) {
        // We couldn't find the widget in the toplevel, so lets see if one of our
        // EmbeddedWindow objects has it.
        WindowList wl;

        getEmbeddedList(wl);

        for(WindowList::iterator w = wl.begin(); w != wl.end(); w++) {
            ConstIterator ii = std::find(w->get()->begin(), w->get()->end(), widget);
            
            if(ii != w->get()->end()) {
                found = true;
                i     = ii;
            }
        }
    }

    else found = true;

    if(!found) {
        warn()
            << "Window [" << _name
            << "] couldn't find the Widget [" << widget->getName()
            << "] in it's object list." << std::endl
        ;

        return false;
    }

    _setFocused(i->get());

    return true;
}
Example #20
0
void GuiManager::windowListCompliment(WindowList *out, WindowList const &first, WindowList const &second)
{
   auto it_first = first.begin();
   auto it_second = second.begin();

   while ( (it_first != first.end())
           && (it_second != second.end())
           && (*it_first == *it_second) )
   {
      it_first++;
      it_second++;
   }

   for (; it_first != first.end(); it_first++)
   {
      out->push_back(*it_first);
   }
}
void Window::getParentList(WindowList& wl) const {
    const Window* current = this;

    while(current) {
        wl.push_back(const_cast<Window*>(current));

        if(current->_parent) current = current->_parent;

        else current = 0;
    }
}
Example #22
0
void FastTraxApp:: RefReceived( entry_ref * ref )
{
	BEntry ent( ref ) ;
	if( ent.IsDirectory() )
	{
		BWindow * win = new FastTraxWindow( ref ) ;
		fWindows.AddWindow( win ) ;
		if( (fOptions & F_Hide) )
			win->Hide() ;
		win->Show() ;
	}
}	
Example #23
0
//----------------------------------------------------------------
bool ProjectItemFile::Load()
/**
 * \brief Loads this project item. Because this is a file,
 * it will load the project item via the load method of the
 * registered window class. If the project item is already open
 * then the load method will reload the information from the file.
 * \return True on success; false otherwise.
 **/
{
    // No window type then abort
    if (m_windowtype.IsEmpty()) {
        return (false);
    }
    // Find window type in windowlist
    WindowList* list = Environment::Get()->GetWindowList();
    if (!list->IsRegistered(m_windowtype)) {
        wxLogError(_T("[penv::ProjectItemFile::Load] The window class id '%s' in project item file '%s' is not registered in the environment."), m_windowtype.c_str(), m_name.c_str());
        return (false);
    }
    // Check if window must be created
    if (m_windowid.IsEmpty() || !list->ExistsWindow(m_windowid)) {
        // Create the window
        Window* window = list->CreateWindow(m_windowtype, this);
        list->Add(window, true);
        m_windowid = window->GetId();
        if (!window->Load(m_filename.GetPath())) {
            wxLogError(_T("[penv::ProjectItemFile::Load] Error occured while loading file '%s'."), m_filename.GetPath().c_str());
            return (false);
        }
    } else {
        // Bring the window to the front
        list->ShowWindow(m_windowid, true);
    }
    return (true);
}
bool Window::setFocused(const std::string& name) {
    Widget* w1 = getByName(name);

    bool found = false;

    if(!w1) {
        // Just like above, we couldn't find the widget in the toplevel, so lets see if
        // one of our EmbeddedWindow objects has it. The difference here is that we
        // search by name.
        WindowList wl;

        getEmbeddedList(wl);

        for(WindowList::iterator w = wl.begin(); w != wl.end(); w++) {
            Widget* w2 = w->get()->getByName(name);

            if(w2) {
                found = true;
                w1    = w2;
            }
        }
    }

    else found = true;

    if(!found) {
        warn()
            << "Window [" << _name
            << "] couldn't find a Widget named [" << name
            << "] to set as it's focus." << std::endl
        ;

        return false;
    }

    _setFocused(w1);
    
    return true;
}
Example #25
0
void Window::Update(float elapsed)
{
    if (IsDone())
    {
        return;
    }

    OnUpdate(elapsed);

    WindowList doneChildren;
    for (WindowList::iterator iter = m_children.begin(); iter != m_children.end(); ++iter)
    {
        const boost::shared_ptr<Window> child(*iter);
        if (child->IsDone())
        {
            doneChildren.push_back(child);
        }
    }

    for (WindowList::iterator iter = doneChildren.begin(); iter != doneChildren.end(); ++iter)
    {
        m_children.erase(find(m_children.begin(), m_children.end(), *iter));
    }
}
BOOL CALLBACK EnumerateWindowsCallback( HWND hwnd, LPARAM lParam){
	int titleLength = GetWindowTextLength(hwnd);
	if(!titleLength){
		return true;
	}
	titleLength += 1; // For null character

	LPTSTR buff = new TCHAR[titleLength];
	int length = GetWindowText(hwnd, buff, titleLength);
	if(!length){
		delete buff;
		_tprintf(_T("%x failed because %d\n"), hwnd, GetLastError());
		return true;
	}
	WindowObject* myWindowObject = new WindowObject(buff, hwnd);
	windowTitles.push_back(*myWindowObject);
	return true;
}
Example #27
0
 gcc_pure
 bool HasChild(const Window &w) const {
   return children.Contains(w);
 }
Example #28
0
 /**
  * Locate a child window by its relative coordinates.
  */
 gcc_pure
 Window *ChildAt(PixelScalar x, PixelScalar y) {
   return children.FindAt(x, y);
 }
Example #29
0
 void BringChildToBottom(Window &child) {
   children.BringToBottom(child);
   Invalidate();
 }
Example #30
0
 void BringChildToTop(Window &child) {
   children.BringToTop(child);
   InvalidateChild(child);
 }