Ejemplo n.º 1
0
TWindow::TWindow(TWindow* parent, const TRect& bounds, TWindowStyle style)
	:	TCommandHandler(NULL),
		TDrawable(bounds),
		fWindow(0),
		fParent(parent),
		fForeColor(kBlackColor),
		fBackColor(kWhiteColor),
		fBorder(0),
		fVisibility(kWindowLatent),
		fUpdateRegion(NULL),
		fInputContext(NULL),
		fCurrentEventTime(0),
		fIsSelectionOwner(false),
		fStyle(style),
		fPositioner(NULL),
		fMapped(false),
		fObscured(true),
		fHasFocus(false),
		fRaiseOnMapNotify(false),
		fSetFocusOnMapNotify(false),
		fLastClickTime(0),
		fClickCount(1),
		fNextUpdate(NULL)
{
	if (parent)
	{
		SetNextHandler(parent);
		parent->AddChild(this);
		fForeColor = parent->GetForeColor();
		fBackColor = parent->GetBackColor();
	}
	else
		SetNextHandler(gApplication);
}
Ejemplo n.º 2
0
/// Starts the thread, and resolves and connects to a recorder.
/// Sends a wxEVT_CONTROLLER_THREAD FAILURE event if unsuccessful
/// @param name The name of the recorder.
/// @param comms The comms object, to allow the recorder object to be resolved.
/// @param handler The handler where events will be sent.
Controller::Controller(const wxString & name, Comms * comms, wxEvtHandler * handler)
: wxThread(wxTHREAD_JOINABLE), mComms(comms), mTimecodeRunning(false), mReconnecting(false), mPendingCommand(NONE), mPendingCommandSent(false), mName(name), mPrevCommand(NONE)  //joinable means we can wait until the thread terminates, and this object doesn't delete itself when that happens
{
	mCondition = new wxCondition(mMutex);
	SetNextHandler(handler); //allow thread ControllerThreadEvents to propagate to the frame
	wxString msg;
	mPollingTimer = new wxTimer(this);
	mMutex.Lock(); //to allow a test for the thread being ready, when it unlocks the mutex with Wait();
	if (!mCondition->IsOk()) {
		msg = wxT("Could not create condition object for recorder.");
	}
	else if (wxTHREAD_NO_ERROR != wxThread::Create()) {
		msg = wxT("Could not create thread for recorder.");
	}
	else if (wxTHREAD_NO_ERROR != wxThread::Run()) {
		msg = wxT("Could not run thread for recorder.");
	}
	else { //thread is starting
		mMutex.Lock(); //wait, if necessary, for thread to be ready to accept signals (which is indicated by it unlocking the mutex, locked before the thread started)
		mMutex.Unlock(); //undo the above to return to normal
		Signal(CONNECT);
	}
	if (!msg.IsEmpty()) {
		//whine
		ControllerThreadEvent event(wxEVT_CONTROLLER_THREAD);
		event.SetName(mName);
		event.SetCommand(CONNECT);
		event.SetResult(FAILURE);
		event.SetMessage(msg);
		handler->AddPendingEvent(event);
	}
}
Ejemplo n.º 3
0
/// Starts the thread, and resolves and connects to a recorder.
/// Sends an EVT_CONTROLLER_THREAD FAILURE event if unsuccessful
/// @param name The name of the recorder.
/// @param comms The comms object, to allow the recorder object to be resolved.
/// @param handler The handler where events will be sent.
Controller::Controller(const wxString & name, Comms * comms, wxEvtHandler * handler)
: wxThread(wxTHREAD_JOINABLE), mComms(comms), mTimecodeRunning(false), mReconnecting(false), mPendingCommand(NONE), mPendingCommandSent(false), mName(name), mPrevCommand(NONE), mOK(false) //making the thread joinable means that we can start the deletion process without waiting for it to end, which might take a long time if there is a CORBA command waiting for a response.  Instead, we issue an event to signal when the thread has exited and hence the object can be deleted.
{
    mCondition = new wxCondition(mMutex);
    SetNextHandler(handler); //allow thread ControllerThreadEvents to propagate to the frame
    wxString msg;
    mPollingTimer = new wxTimer(this);
    mMutex.Lock(); //to allow a test for the thread being ready, when it unlocks the mutex with Wait();
    if (!mCondition->IsOk()) {
        msg = wxT("Could not create condition object for recorder.");
    }
    else if (wxTHREAD_NO_ERROR != wxThread::Create()) {
        msg = wxT("Could not create thread for recorder.");
    }
    else if (wxTHREAD_NO_ERROR != wxThread::Run()) {
        msg = wxT("Could not run thread for recorder.");
    }
    else { //thread is starting
        mOK = true;
        mMutex.Lock(); //wait, if necessary, for thread to be ready to accept signals (which is indicated by it unlocking the mutex, locked before the thread started)
        mMutex.Unlock(); //undo the above to return to normal
        Signal(CONNECT);
    }
    if (!msg.IsEmpty()) {
        //whine
        ControllerThreadEvent event(EVT_CONTROLLER_THREAD);
        event.SetName(mName);
        event.SetCommand(CONNECT);
        event.SetResult(FAILURE);
        event.SetMessage(msg);
        handler->AddPendingEvent(event);
    }
}
Ejemplo n.º 4
0
void wxProcess::Init(wxEvtHandler *parent, int id, int flags)
{
    if ( parent )
        SetNextHandler(parent);

    m_id         = id;
    m_pid        = 0;
    m_redirect   = (flags & wxPROCESS_REDIRECT) != 0;

#if wxUSE_STREAMS
    m_inputStream  = NULL;
    m_errorStream  = NULL;
    m_outputStream = NULL;
#endif // wxUSE_STREAMS
}
bool CslIrcSession::InitContext(CslIrcContext *context)
{
    irc_callbacks_t callbacks;

    memset(&callbacks,0,sizeof(callbacks));

    callbacks.event_connect=event_connect;
    callbacks.event_join=event_join;
    callbacks.event_nick=event_nick;
    callbacks.event_quit=event_quit;
    callbacks.event_part=event_part;
    callbacks.event_mode=event_mode;
    callbacks.event_topic=event_topic;
    callbacks.event_kick=event_kick;
    callbacks.event_channel=event_chanmsg;
    callbacks.event_privmsg=event_privmsg;
    callbacks.event_notice=event_notice;
    //callbacks.event_invite
    //callbacks.event_umode
    callbacks.event_ctcp_req=event_ctcp_request;
    //callbacks.event_ctcp_rep;
    callbacks.event_ctcp_action=event_ctcp_action;
    //callbacks.event_unknown
    callbacks.event_numeric=event_numeric;
    //callbacks.event_dcc_chat_req
    //callbacks.event_dcc_send_req

    if (!(context->Session=irc_create_session(&callbacks)))
        return false;

    //nicknames only, strip them from nick!host.
    irc_option_set(context->Session,LIBIRC_OPTION_STRIPNICKS);

    context->EvtHandler=this;

    SetNextHandler(context->Target);

    return true;
}
Ejemplo n.º 6
0
void wxProcess::Detach()
{
    SetNextHandler(NULL);
}