1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// pgQueryResultEvent.h - Query Result Event from the pgQueryThread
//
//////////////////////////////////////////////////////////////////////////
#ifndef PGQUERYRESULTEVENT_H
#define PGQUERYRESULTEVENT_H
#include "wx/wx.h"
#include "wx/event.h"
class pgBatchQuery;
extern const wxEventType PGQueryResultEvent;
class pgQueryResultEvent : public wxCommandEvent
{
public:
pgQueryResultEvent(unsigned long _thrdId, pgBatchQuery *_qry, int _id = 0);
pgQueryResultEvent(const pgQueryResultEvent &_ev);
// Required for sending with wxPostEvent()
wxEvent *Clone() const
{
return new pgQueryResultEvent(*this);
}
pgBatchQuery *GetQuery()
{
return m_query;
}
unsigned long GetThreadID()
{
return m_thrdId;
}
enum
{
PGQ_RESULT_ERROR = -8,
PGQ_EXECUTION_CANCELLED = -7,
PGQ_ERROR_CONSUME_INPUT = -6,
PGQ_ERROR_SEND_QUERY = -5,
PGQ_ERROR_EXECUTE_CALLABLE = -4,
PGQ_ERROR_PREPARE_CALLABLE = -3,
PGQ_STRING_INVALID = -2,
PGQ_CONN_LOST = -1,
};
private:
pgBatchQuery *m_query;
// Thread Id (pgQueryThread)
unsigned long m_thrdId;
};
typedef void (wxEvtHandler::*pgQueryResultEventFunc)(pgQueryResultEvent &);
// This #define simplifies the one below, and makes the syntax less
// ugly if you want to use Connect() instead of an event table.
#define pgQueryResultEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction) \
wxStaticCastEvent(pgQueryResultEventFunc, &func)
// Define the event table entry. Yes, it really *does* end in a comma.
#define EVT_PGQUERYRESULT(id, fn) \
DECLARE_EVENT_TABLE_ENTRY(PGQueryResultEvent, id, wxID_ANY, \
pgQueryResultEventHandler(fn), (wxObject*) NULL),
#define EVT_PGQUERYRESULT_RANGE(id1, id2, fn) \
DECLARE_EVENT_TABLE_ENTRY(PGQueryResultEvent, id1, id2, \
pgQueryResultEventHandler(fn), (wxObject*) NULL),
#endif // PGQUERYRESULTEVENT_H
|