Ejemplo n.º 1
0
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
                         const wxURI& location,
                         const wxPoint& pos,
                         const wxSize& size,
                         long style,
                         const wxString& szBackend,
                         const wxValidator& validator,
                         const wxString& name)
{
    if(!szBackend.empty())
    {
        wxClassInfo* pClassInfo = wxClassInfo::FindClass(szBackend);
        if(!pClassInfo || !DoCreate(pClassInfo, parent, id,
                                    pos, size, style, validator, name))
        {
            m_imp = NULL;
            return false;
        }

        if (!Load(location))
        {
            delete m_imp;
            m_imp = NULL;
            return false;
        }

        SetInitialSize(size);
        return true;
    }
    else
    {
        wxClassInfo::const_iterator it  = wxClassInfo::begin_classinfo();

        const wxClassInfo* classInfo;

        while((classInfo = NextBackend(&it)) != NULL)
        {
            if(!DoCreate(classInfo, parent, id,
                         pos, size, style, validator, name))
                continue;

            if (Load(location))
            {
                SetInitialSize(size);
                return true;
            }
            else
                delete m_imp;
        }

        m_imp = NULL;
        return false;
    }
}
Ejemplo n.º 2
0
PHBTreeBase HBTreeBase::Add( HANDLE nm )
  {  maCmp cmp = Cmp(nm);

     if ( cmp == masEqual ) return NULL;

     if ( cmp == masMore ) {
       if ( Left ) return Left->Add(nm);
       Left = DoCreate( nm );
       if ( !Left ) return NULL;
       Left->Parent = this;
       return Left;
     } else {
       if ( Right ) return Right->Add(nm);
       Right = DoCreate( nm );
       if ( !Right) return NULL;
       Right->Parent = this;
       return Right;
     }
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
MStatus CVsSkinnerCmd::redoIt()
{
	if ( m_undo.ArgDatabase().isFlagSet( kOptHelp ) )
	{
		GetSyntaxHelp()->PrintHelp( GetName(), GetDesc() );
		return MS::kSuccess;
	}

	m_undo.SaveCurrentSelection();

	if ( m_undo.ArgDatabase().isFlagSet( kOptCreate ) )
	{
		return DoCreate();
	}
	else if ( m_undo.ArgDatabase().isFlagSet( kOptNewVolume ) )
	{
		MSelectionList optSelectionList;
		m_undo.ArgDatabase().getObjects( optSelectionList );
		MSelectionList volumeList( DoNewVolumes( GetSpecifiedSkinnerNode(), optSelectionList ) );
		if ( volumeList.length() == 0 )
		{
			merr << "Couldn't create new volumes" << std::endl;
			return MS::kFailure;
		}
		MGlobal::setActiveSelectionList( volumeList, MGlobal::kReplaceList );
		MStringArray vA;
		volumeList.getSelectionStrings( vA );
		setResult( vA );

		return MS::kSuccess;
	}
	else if ( m_undo.ArgDatabase().isFlagSet( kOptAttachMesh ) )
	{
		return DoAttachMesh( GetSpecifiedSkinnerNode(), GetSpecifiedMesh() );
	}
	else if ( m_undo.ArgDatabase().isFlagSet( kOptDetachMesh ) )
	{
		return DoDetachMesh( GetSpecifiedSkinnerNode() );
	}
	else if ( m_undo.ArgDatabase().isFlagSet( kOptLs ) )
	{
		return DoLs();
	}

	merr << GetName() << ": No action specified" << std::endl;

	return MS::kFailure;
}
Ejemplo n.º 4
0
CMLogin::CMLogin(IMLoginListener* pListener)
{
	m_pListener = pListener;
	m_bLogin = FALSE;
	m_pSession = NULL;
	
#if defined(PLAT_IOS)	
	//copy raw file
	CMString sFileName = CMPath(CMPath::SYS_CONF_PATH).String() + L"mlplayer.cfg";
	if(!CMFile::FileExist(sFileName))
	{
		CMString sSrc = CMPath(CMPath::APP_PATH).String() + L"mlplayer.cfg";
		CMFile::CopyFile(sSrc, sFileName);
		
	}
	
	SETTING.Load();
	
	sFileName = CMPath(CMPath::DATA_PATH).String() + L"defaulticon.png";
	if(!CMFile::FileExist(sFileName))
	{
		CMString sSrc = CMPath(CMPath::APP_PATH).String() + L"defaulticon.png";
		CMFile::CopyFile(sSrc, sFileName);
	}
#endif
	
	//初始化一下SystemInfo
	CMGlobal::TheOne().SystemInfo();
    
    //数据库初始化
    utf8ncpy(m_tablename,"enterpriseInfo", 63);
    
    utf8ncpy(m_sADImagesTableName,"adimagesurl", 63);
    
    m_lisOption = new CMList<TADImages>;
    
    sqlite3* db = NULL;
    db = CheckRootTable();
    if(db)
    {
        DoCreate(db);
    }
    
    
    DoGetCacheItems(db);
}
//-----------------------------------------------------------------------------
// Called in general to actually do the work of the command
//-----------------------------------------------------------------------------
MStatus CVstAttachmentCmd::redoIt()
{
	if ( m_mArgDatabase->isFlagSet( kOptHelp ) )
	{
		return DoHelp();
	}
	else if ( m_mArgDatabase->isFlagSet( "create" ) )
	{
		return DoCreate();
	}
	else if ( m_mArgDatabase->isFlagSet( "select" ) )
	{
		return DoSelect();
	}

	merr << "No valid operation specified via command line arguments" << std::endl;

	return MS::kFailure;
}
logical TBaseComponent :: Create (logical fDeleteOnDestroy_YES )
{
  logical term = NO;
BEGINSEQ
  deleteOnDestroy = fDeleteOnDestroy_YES;

// we set owner now, but InsertComponent will be called during DoCreate!

  componentState |= csDangling;
  
  if ( DoCreate() )                                  ERROR

  if ( DoCreated() )                                 ERROR
RECOVER
  term = YES;

ENDSEQ
  return(term);
}
Ejemplo n.º 7
0
TInt RKmsChannelTest::Open()
/**
	Open a channel on the KMS LDD.
 */
	{
	// device driver factory name.  This is not the LDD filename.
	const TDesC& name = RKmsChannel::FactoryName();
	
	// The driver must have been built with at least the same version as this channel.
	const TVersion reqVer = KmsLddImpl::Version();

	return DoCreate(
		name,
		reqVer,
		KNullUnit,			// aUnit: units not supported (KDeviceAllowUnit flag not set)
		NULL,				// aDriver: PDD name, not supported (KDeviceAllocPhysicalDevice flag not set)
		NULL,				// anInfo: allow info not supported (KDeviceAllowInfo flag not set)
		EOwnerThread,		// aType: handle is owned by thread, not process
		EFalse);			// aProtected: channel cannot be shared with other processes
	}
Ejemplo n.º 8
0
bool AWinControlBase::Create()
{
	if( m_pWindow ) return true;
	
	InitControls();

	m_pWindow = CreateWnd();
	if( m_pWindow == NULL ) return false;
	m_pWindow->AddRef();

	HWND hParent = NULL;
	AControl* pParent = dynamic_cast<AControl*>( GetParent() );
	if( pParent ) hParent = pParent->GetUICore()->GetHandle();
	
	if( !m_pWindow->Create(hParent,m_WindowPos) ) 
	{
		m_pWindow->Release();
		m_pWindow = NULL;
		throw AException(_T("窗口创建失败!"));
		return false;
	}

	AContainer* pcParent = dynamic_cast<AContainer*>(GetParent());
	if( pcParent )
		pcParent->GetUICore()->AddWatcher(this);

	//再进行下面的处理
	if( m_WindowPos == wpDesign )
	{
		::SetWindowPos(GetHandle(),HWND_NOTOPMOST,GetLeft(),GetTop(),GetWidth(),GetHeight(),SWP_NOREDRAW|SWP_HIDEWINDOW);
	}
	else if( m_WindowPos == wpCenterScreen )
	{
		ARect rScreen;
		SystemParametersInfo(SPI_GETWORKAREA,0,&rScreen,0);
		int dw = (rScreen.right-rScreen.left-GetWidth())/2;
		int dh = (rScreen.bottom-rScreen.top-GetHeight())/2;
		m_iLeft = (rScreen.left+dw);
		m_iTop = (rScreen.top+dh);
		::SetWindowPos(GetHandle(),HWND_NOTOPMOST,GetLeft(),GetTop(),GetWidth(),GetHeight(),SWP_NOREDRAW|SWP_HIDEWINDOW);
	}
	else
	{
		ARect r;
		::GetWindowRect(GetHandle(),&r);
		//::SetWindowPos(GetHandle(),HWND_NOTOPMOST,r.left,r.top+1,r.GetWidth(),r.GetHeight(),0);
		m_iLeft = r.left;
		m_iTop = r.top;
		m_iWidth = r.GetWidth();
		m_iHeight = r.GetHeight();
		
	}
	//::SetWindowPos(GetHandle(),HWND_NOTOPMOST,GetLeft(),GetTop(),GetWidth(),GetHeight(),0);//SWP_NOREDRAW|SWP_HIDEWINDOW);
	//::SetWindowPos(GetHandle(),HWND_NOTOPMOST,GetLeft(),GetTop(),GetWidth(),GetHeight(),SWP_NOREDRAW|SWP_HIDEWINDOW);
	DoCreate();
	ConnectEvent();
	DoLayout();
	Refresh();


	//HRGN hRgn = ::CreateRoundRectRgn(0,0,GetWidth()+1,GetHeight()+1,5,5);
	//::SetWindowRgn(m_pWindow->GetHandle(),hRgn,FALSE);
	//::DeleteObject(hRgn);

	AEvent evt;
	OnCreate.Call(this,&evt);
	return true;
}
Ejemplo n.º 9
0
void CreateNassiBlockBrick::operator() ( wxChar const * /*first*/, wxChar const * /*last*/ ) const
{
    DoCreate();
}
Ejemplo n.º 10
0
void CreateNassiBlockBrick::operator()(const wxChar /*ch*/)const
{
    DoCreate();
}
Ejemplo n.º 11
0
//---------------------------------------------------------------------------
// wxMediaCtrl::Create (file version)
// wxMediaCtrl::Create (URL version)
//
// Searches for a backend that is installed on the system (backends
// starting with lower characters in the alphabet are given priority),
// and creates the control from it
//
// This searches by searching the global RTTI hashtable, class by class,
// attempting to call CreateControl on each one found that is a derivative
// of wxMediaBackend - if it succeeded Create returns true, otherwise
// it keeps iterating through the hashmap.
//---------------------------------------------------------------------------
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
                const wxString& fileName,
                const wxPoint& pos,
                const wxSize& size,
                long style,
                const wxString& szBackend,
                const wxValidator& validator,
                const wxString& name)
{
    if(!szBackend.empty())
    {
        wxClassInfo* pClassInfo = wxClassInfo::FindClass(szBackend);

        if(!pClassInfo || !DoCreate(pClassInfo, parent, id,
                                    pos, size, style, validator, name))
        {
            m_imp = NULL;
            return false;
        }

        if (!fileName.empty())
        {
            if (!Load(fileName))
            {
                delete m_imp;
                m_imp = NULL;
                return false;
            }
        }

        SetBestFittingSize(size);
        return true;
    }
    else
    {
        wxClassInfo::sm_classTable->BeginFind();

        wxClassInfo* classInfo;

        while((classInfo = NextBackend()) != NULL)
        {
            if(!DoCreate(classInfo, parent, id,
                         pos, size, style, validator, name))
                continue;

            if (!fileName.empty())
            {
                if (Load(fileName))
                {
                    SetBestFittingSize(size);
                    return true;
                }
                else
                    delete m_imp;
            }
            else
            {
                SetBestFittingSize(size);
                return true;
            }
        }

        m_imp = NULL;
        return false;
    }
}
Ejemplo n.º 12
0
//---------------------------------------------------------------------------
// wxMediaCtrl::Create (file version)
// wxMediaCtrl::Create (URL version)
//
// Searches for a backend that is installed on the system (backends
// starting with lower characters in the alphabet are given priority),
// and creates the control from it
//
// This searches by searching the global RTTI hashtable, class by class,
// attempting to call CreateControl on each one found that is a derivative
// of wxMediaBackend - if it succeeded Create returns true, otherwise
// it keeps iterating through the hashmap.
//---------------------------------------------------------------------------
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
                const wxString& fileName,
                const wxPoint& pos,
                const wxSize& size,
                long style,
                const wxString& szBackend,
                const wxValidator& validator,
                const wxString& name)
{
    if(!szBackend.empty())
    {
        wxClassInfo* pClassInfo = wxClassInfo::FindClass(szBackend);

        if(!pClassInfo || !DoCreate(pClassInfo, parent, id,
                                    pos, size, style, validator, name))
        {
            m_imp = NULL;
            return false;
        }

        if (!fileName.empty())
        {
            if (!Load(fileName))
            {
                wxDELETE(m_imp);
                return false;
            }
        }

        SetInitialSize(size);
        return true;
    }
    else
    {
        wxClassInfo::const_iterator it = wxClassInfo::begin_classinfo();

        const wxClassInfo* classInfo;

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
        while((classInfo = NextBackend(&it)) != NULL)
        {
            if(!DoCreate(classInfo, parent, id,
                         pos, size, style, validator, name))
                continue;

            if (!fileName.empty())
            {
                if (Load(fileName))
                {
                    SetInitialSize(size);
                    return true;
                }
                else
                    delete m_imp;
            }
            else
            {
                SetInitialSize(size);
                return true;
            }
        }

        m_imp = NULL;
        return false;
    }
}
Ejemplo n.º 13
0
void CMExerciseList::OnSessionCmd(unsigned int nCmdID, unsigned int nCode, TiXmlDocument* pDoc)
{
    INT32 result = TResult::EUnknownError;

    if (nCode == MER_OK)
    {
    //获得根元素res。
    TiXmlElement *pItem = pDoc->RootElement();
    if(pItem)
    {
        INT32 nCmdID = 0;
        pItem->QueryIntAttribute("no", &nCmdID);
        
        INT32 nErr = 0;
        if(pItem->QueryIntAttribute("errno", &nErr) == TIXML_SUCCESS)
        {
            if (nErr == 0)
            {
                
                if (nCmdID  ==  SERVICE_GETEXERCISELIST || nCmdID == SERVICE_GETEXERCISEBYID||nCmdID == SERVICE_GETMYTRAINEXERCISELIST)
                {
                    sqlite3* db = CheckTable();
                    if(db)
                    {
                        DoCreate(db);
                    }
                    pItem = pItem->FirstChildElement("item");

                    char* errorMsg;
                    
                    if (m_lstItem) {
                        m_lstItem->clear();
                    }
                    
		            if (db != NULL && sqlite3_exec(db, "BEGIN TRANSACTION;", 0,0, &errorMsg) != SQLITE_OK)
		            {
		            	CM_ERRP("BEGIN TRANSACTION failed.error:%s", errorMsg);
		            }

					while(pItem)
					{
                        TExerciseListItem a;
						if (DoPutItem(pItem, db, a))
						{
							m_lstItem->push_back(a);
						}

                        pItem = pItem->NextSiblingElement("item");
					}
                    
                    if (db != NULL && sqlite3_exec(db, "COMMIT TRANSACTION;", 0,0, &errorMsg) != SQLITE_OK)
		            {
		            	CM_ERRP("COMMIT TRANSACTION failed.error:%s", errorMsg);
		            }

                    if(GetItemCount() > 0)
						result = TResult::ESuccess;
					else
						result = TResult::ENothing;

                }
                
            }
            else
            {
                result = TResult::ENetDisconnect;
                LoadFromDB();
            }
        }
     }
    }
    else
    {
        LoadFromDB();
        result = TResult::ENetDisconnect;
    }
    if(m_pListener)
		m_pListener->OnUpdateDataFinish(m_UserData, result);

}
Ejemplo n.º 14
0
bool wxTopLevelWindowMotif::Create( wxWindow *parent, wxWindowID id,
                                    const wxString& title,
                                    const wxPoint& pos,
                                    const wxSize& size,
                                    long style,
                                    const wxString& name )
{
    SetName(name);
    m_windowStyle = style;

    if ( parent )
        parent->AddChild(this);

    wxTopLevelWindows.Append(this);

    m_windowId = ( id > -1 ) ? id : NewControlId();

    bool retval = DoCreate( parent, id, title, pos, size, style, name );

    if( !retval ) return false;

    // Intercept CLOSE messages from the window manager
    Widget shell = (Widget)GetShellWidget();
    Atom WM_DELETE_WINDOW = XmInternAtom( XtDisplay( shell ),
                                          "WM_DELETE_WINDOW", False );

    // Remove and add WM_DELETE_WINDOW so ours is only handler
    // This only appears to be necessary for wxDialog, but does not hurt
    // for wxFrame
    XmRemoveWMProtocols( shell, &WM_DELETE_WINDOW, 1 );
    XmAddWMProtocols( shell, &WM_DELETE_WINDOW, 1 );
    XmActivateWMProtocol( shell, WM_DELETE_WINDOW );

    // Modified Steve Hammes for Motif 2.0
#if (XmREVISION > 1 || XmVERSION > 1)
    XmAddWMProtocolCallback( shell, WM_DELETE_WINDOW,
                             (XtCallbackProc)wxCloseTLWCallback,
                             (XtPointer)this );
#elif XmREVISION == 1
    XmAddWMProtocolCallback( shell, WM_DELETE_WINDOW,
                             (XtCallbackProc)wxCloseTLWCallback,
                             (caddr_t)this );
#else
    XmAddWMProtocolCallback( shell, WM_DELETE_WINDOW,
                             (void (*)())wxCloseTLWCallback, (caddr_t)this );
#endif

    // This patch come from Torsten Liermann [email protected]
    if( XmIsMotifWMRunning( shell ) )
    {
        int decor = 0 ;
        if( !(m_windowStyle & wxNO_BORDER) )
            decor |= MWM_DECOR_BORDER;
        if( m_windowStyle & wxRESIZE_BORDER )
            decor |= MWM_DECOR_RESIZEH;
        if( m_windowStyle & wxSYSTEM_MENU )
            decor |= MWM_DECOR_MENU;
        if( ( m_windowStyle & wxCAPTION ) ||
            ( m_windowStyle & wxTINY_CAPTION_HORIZ ) ||
            ( m_windowStyle & wxTINY_CAPTION_VERT ) )
            decor |= MWM_DECOR_TITLE;
        if( m_windowStyle & wxTHICK_FRAME )
            decor |= MWM_DECOR_BORDER;
        if( m_windowStyle & wxMINIMIZE_BOX )
            decor |= MWM_DECOR_MINIMIZE;
        if( m_windowStyle & wxMAXIMIZE_BOX )
            decor |= MWM_DECOR_MAXIMIZE;

        XtVaSetValues( shell,
                       XmNmwmDecorations, decor,
                       NULL );
    }
    else
    {
        // This allows non-Motif window managers to support at least the
        // no-decorations case.
        if( ( m_windowStyle & wxCAPTION ) != wxCAPTION )
            XtVaSetValues( shell,
                           XmNoverrideRedirect, True,
                           NULL );
    }

    XtAddEventHandler( (Widget)GetClientWidget(),
                       ButtonPressMask | ButtonReleaseMask |
                       PointerMotionMask | KeyPressMask,
                       False,
                       wxTLWEventHandler,
                       (XtPointer)this );

    return retval;
}
TInt RSymbianUnitTest::Open(const TDesC& aName)
	{
	return DoCreate(aName,TVersion(0,0,1),KNullUnit,NULL,NULL);
	}
Ejemplo n.º 16
0
void wxGridCellTextEditor::Create(wxWindow* parent,
                                  wxWindowID id,
                                  wxEvtHandler* evtHandler)
{
    DoCreate(parent, id, evtHandler);
}
Ejemplo n.º 17
0
INT_PTR CALLBACK
CreateDialogProc(HWND hDlg,
                 UINT message,
                 WPARAM wParam,
                 LPARAM lParam)
{
    HICON hIcon = NULL;

    switch (message)
    {
        case WM_INITDIALOG:
        {
            hIcon = (HICON)LoadImage(hInstance,
                                     MAKEINTRESOURCE(IDI_SM_ICON),
                                     IMAGE_ICON,
                                     16,
                                     16,
                                     0);
            if (hIcon)
            {
                SendMessage(hDlg,
                            WM_SETICON,
                            ICON_SMALL,
                            (LPARAM)hIcon);
                DestroyIcon(hIcon);
            }

            return TRUE;
        }

        case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
                case IDOK:
                {
                    PCREATE_DATA Data;

                    Data = (PCREATE_DATA)HeapAlloc(ProcessHeap,
                                                   HEAP_ZERO_MEMORY,
                                                   sizeof(CREATE_DATA));
                    if (Data)
                    {
                        Data->hSelf = hDlg;

                        if (GetDataFromDialog(Data))
                        {
                            DoCreate(Data);
                        }
                        else
                        {
                            /* Something went wrong, leave the dialog
                             * open so they can try again */
                            FreeMemory(Data);
                            break;
                        }

                        FreeMemory(Data);
                    }

                    EndDialog(hDlg,
                              LOWORD(wParam));
                    return TRUE;
                }

                case IDCANCEL:
                {
                    EndDialog(hDlg,
                              LOWORD(wParam));
                    return TRUE;
                }

                case ID_CREATE_HELP:
                {
                    HWND hHelp;

                    if (! bHelpOpen)
                    {
                        hHelp = CreateDialog(hInstance,
                                             MAKEINTRESOURCE(IDD_DLG_HELP_OPTIONS),
                                             hDlg,
                                             CreateHelpDialogProc);
                        if(hHelp != NULL)
                        {
                            bHelpOpen = TRUE;
                        }
                    }
                }
                break;
            }
        }
    }

    return FALSE;
}