Beispiel #1
0
GLVDetachable& GLVDetachable::detached(bool v){
	if(v && !detached()){			// is not detached
		if(mParentWindow){
			remGUI(parentWindow());
		}
		glv::Rect ru = unionOfChildren();
		enable(glv::DrawBack);
		{
			glv::View * cv = child;
			while(cv){
				cv->posAdd(-ru.l, -ru.t);
				cv = cv->sibling;
			}
		}
		//ru.print();
		//posAdd(-ru.l, -ru.t);
		detachedWindow().create(Window::Dim(ru.w, ru.h));
		addGUI(detachedWindow());
	}
	else if(detached()){			// is currently detached, attach back to parent, if any
		remGUI(detachedWindow());
		detachedWindow().destroy();
		if(mParentWindow){
			disable(glv::DrawBack);
			pos(0,0);
			addGUI(parentWindow());
		}
	}
	return *this;
}
static nsresult
openWindow(nsIMsgWindow *aMsgWindow, const char *chromeURL,
           nsINewsDownloadDialogArgs *param)
{
  nsresult rv;
  NS_ENSURE_ARG_POINTER(aMsgWindow);
  nsCOMPtr<nsIDocShell> docShell;
  rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
  if (NS_FAILED(rv))
      return rv;

  nsCOMPtr<nsIDOMWindow> parentWindow(do_GetInterface(docShell));
  NS_ENSURE_TRUE(parentWindow, NS_ERROR_FAILURE);

  nsCOMPtr<nsISupportsInterfacePointer> ifptr = do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  ifptr->SetData(param);
  ifptr->SetDataIID(&NS_GET_IID(nsINewsDownloadDialogArgs));

  nsCOMPtr<nsIDOMWindow> dialogWindow;
  rv = parentWindow->OpenDialog(NS_ConvertASCIItoUTF16(chromeURL),
                                NS_LITERAL_STRING("_blank"),
                                NS_LITERAL_STRING("centerscreen,chrome,modal,titlebar"),
                                ifptr, getter_AddRefs(dialogWindow));

  return rv;
}
Beispiel #3
0
GLVDetachable::GLVDetachable(Window& parent)
:	glv::GLV(0,0), 
	mInputControl(*this), mWindowControl(*this)
{
	parentWindow(parent);
	init();
}
Beispiel #4
0
GLVDetachable& GLVDetachable::parentWindow(Window& v){
	if(&v != mParentWindow){
		if(!detached()){
			if(mParentWindow){
				remGUI(parentWindow());
			}
			mParentWindow = &v;
			disable(glv::DrawBack);
			addGUI(parentWindow());
			//printf("%d\n", parentWindow().created());
		}
		else{
			mParentWindow = &v;
		}
	}
	return *this;
}
Beispiel #5
0
bool QDialogPrivate::setNativeDialogVisible(bool visible)
{
    if (QPlatformDialogHelper *helper = platformHelper()) {
        if (visible) {
            Q_Q(QDialog);
            helperPrepareShow(helper);
            nativeDialogInUse = helper->show(q->windowFlags(), q->windowModality(), parentWindow());
        } else {
            helper->hide();
        }
    }
    return nativeDialogInUse;
}
NS_IMETHODIMP
nsXPInstallManager::ConfirmInstall(nsIDOMWindow *aParent, const PRUnichar **aPackageList, PRUint32 aCount, PRBool *aRetval)
{
    *aRetval = PR_FALSE;

    nsCOMPtr<nsIDOMWindowInternal> parentWindow( do_QueryInterface(aParent) );
    nsCOMPtr<nsIDialogParamBlock> params;
    nsresult rv = LoadParams( aCount, aPackageList, getter_AddRefs(params) );

    if ( NS_SUCCEEDED(rv) && parentWindow && params)
    {
        nsCOMPtr<nsIDOMWindow> newWindow;

        nsCOMPtr<nsISupportsInterfacePointer> ifptr =
            do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv, rv);

        ifptr->SetData(params);
        ifptr->SetDataIID(&NS_GET_IID(nsIDialogParamBlock));

        char* confirmDialogURL;
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
        if (!pref)
          return rv;

        rv = pref->GetCharPref(PREF_XPINSTALL_CONFIRM_DLG, &confirmDialogURL);
        NS_ASSERTION(NS_SUCCEEDED(rv), "Can't invoke XPInstall FE without a FE URL! Set xpinstall.dialog.confirm");
        if (NS_FAILED(rv))
          return rv;

        rv = parentWindow->OpenDialog(NS_ConvertASCIItoUTF16(confirmDialogURL),
                                      NS_LITERAL_STRING("_blank"),
                                      NS_LITERAL_STRING("chrome,centerscreen,modal,titlebar"),
                                      ifptr,
                                      getter_AddRefs(newWindow));

        if (NS_SUCCEEDED(rv))
        {
            //Now get which button was pressed from the ParamBlock
            PRInt32 buttonPressed = 0;
            params->GetInt( 0, &buttonPressed );
            *aRetval = buttonPressed ? PR_FALSE : PR_TRUE;
        }
    }

    return rv;
}
Beispiel #7
0
bool WindowEdit::onMessage( const Message & msg )
{
	if ( m_Editing )
	{
		if ( msg.message == HM_CHAR )
		{
			if ( msg.wparam == HK_RETURN || msg.wparam == HK_TAB )
			{
				onEndEdit();

				if ( msg.wparam == HK_TAB )	// find next edit box in the heriarchy, and set it active
				{
					NodeWindow * pParent = parentWindow();

					for(int i=0;i<pParent->childCount();i++)
						if ( WidgetCast<WindowEdit>( pParent->child(i) ) )
						{
							((WindowEdit *)pParent->child(i))->onBeginEdit();
							break;
						}
				}

				return true;
			}
			else if ( msg.wparam == HK_ESCAPE )
			{
				onAbortEdit();
				return true;
			}
			else if ( msg.wparam == HK_BACK )
			{
				if ( m_FirstChar )
				{
					m_Text = "";
					m_FirstChar = false;
					m_Cursor = 0;
				}
				else if ( m_Cursor > 0 && m_Text.length() > 0 )
				{
					m_Text.remove( m_Cursor - 1 );
					m_Cursor--;
				}

				return true;
			}
			else if ( isprint( msg.wparam ) )
			{
				m_FirstChar = false;

				// insert new character @ m_Cursor
				m_Text.insert( msg.wparam, m_Cursor );
				m_Cursor++;

				return true;
			}

			return true;
		}
		
		if ( msg.message == HM_KEYDOWN )
		{
			if ( msg.wparam == HK_LEFT )
			{
				m_FirstChar = false;
				if ( m_Cursor > 0 )
					m_Cursor--;
			}
			else if ( msg.wparam == HK_RIGHT )
			{
				m_FirstChar = false;
				if ( m_Cursor < m_Text.length() )
					m_Cursor++;
			}
			else if ( msg.wparam == HK_DELETE )
			{
				if ( m_FirstChar )
				{
					m_Text = "";
					m_FirstChar = false;
					m_Cursor = 0;
				}
				else if ( m_Cursor < m_Text.length() )
					m_Text.remove( m_Cursor );
			}
			else if ( msg.wparam == HK_HOME )
			{
				m_FirstChar = false;
				if ( m_Cursor > 0 )
					m_Cursor = 0;
			}
			else if ( msg.wparam == HK_END )
			{
				m_FirstChar = false;
				if ( m_Cursor < m_Text.length() )
					m_Cursor = m_Text.length();
			}
			return true;
		}
		
		if ( msg.message == HM_KEYUP )
			return true;
	}

	// call base class
	return( NodeWindow::onMessage( msg ) );
}