controls.cpp Aggiunta set_caption ai TTagbutton_control
golem.cpp Aggiunte potenzialita' di server a DDE mask.cpp Corretta setaption per pageine con tagbuttons msksheet.cpp Corretto colore bordo sheet.cpp Corretto colore bordo git-svn-id: svn://10.65.10.50/trunk@2975 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
68c0d1ddae
commit
c3c4897010
@ -1398,6 +1398,19 @@ bool TTagbutton_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TTagbutton_control::set_caption(const char* text)
|
||||
{
|
||||
TToken_string cap = text;
|
||||
int num;
|
||||
XI_OBJ** tag = xi_get_member_list(_obj, &num);
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
text = cap.get();
|
||||
if (text == NULL)
|
||||
text = cap.get(0);
|
||||
xi_set_text(tag[i], (char*)text);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TListbox_control
|
||||
|
@ -246,6 +246,8 @@ protected: // TControl
|
||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||
|
||||
public:
|
||||
virtual void set_caption(const char* text);
|
||||
|
||||
TTagbutton_control(WINDOW win, short cid,
|
||||
short left, short top, short width, short height,
|
||||
const char* flags, const char* text, int tag);
|
||||
|
@ -216,41 +216,104 @@ bool TGolem::import()
|
||||
// DDE
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
static TDDE* DDEWIN = NULL;
|
||||
static TDDE* CUR_DDE = NULL;
|
||||
|
||||
HIDDEN BOOLEAN hook(HWND hwnd,
|
||||
UINT msg,
|
||||
UINT wparam,
|
||||
ULONG lparam,
|
||||
long* ret)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
CHECK(CUR_DDE, "No DDE available");
|
||||
bool normal_process = TRUE;
|
||||
|
||||
if (CUR_DDE->hwnd() == (word)hwnd) switch (msg)
|
||||
{
|
||||
case WM_DDE_ACK:
|
||||
DDEWIN->set_server(wparam);
|
||||
GlobalDeleteAtom(LOWORD(lparam));
|
||||
GlobalDeleteAtom(HIWORD(lparam));
|
||||
*ret = TRUE;
|
||||
case WM_DDE_INITIATE:
|
||||
if (wparam != CUR_DDE->hwnd()) // Non initiarti da solo!
|
||||
{
|
||||
ATOM app = LOWORD(lparam);
|
||||
ATOM topic = HIWORD(lparam);
|
||||
TString a(256), t(256);
|
||||
if (app)
|
||||
GlobalGetAtomName(app, (char*)(const char*)a, a.size());
|
||||
if (topic)
|
||||
GlobalGetAtomName(topic, (char*)(const char*)t, t.size());
|
||||
|
||||
bool ok = FALSE;
|
||||
const char* an = CUR_DDE->get_app_name();
|
||||
if (an && *an)
|
||||
ok = a.empty() || a == an;
|
||||
if (ok)
|
||||
{
|
||||
ok = CUR_DDE->do_initiate(wparam, t);
|
||||
if (ok)
|
||||
{
|
||||
TToken_string topics(t);
|
||||
if (topics.empty_items())
|
||||
topics = CUR_DDE->get_topics();
|
||||
for (t = topics.get(0); t.not_empty(); t = topics.get())
|
||||
{ // E' obbligatorio crearne dei nuovi! Non spostare fuori dal ciclo!
|
||||
app = GlobalAddAtom(CUR_DDE->get_app_name());
|
||||
topic = GlobalAddAtom(t);
|
||||
SendMessage((HWND)wparam, WM_DDE_ACK, (WPARAM)hwnd, MAKELPARAM(app,topic));
|
||||
}
|
||||
}
|
||||
}
|
||||
normal_process = FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case WM_DDE_ACK:
|
||||
{
|
||||
ATOM a = LOWORD(lparam); if (a) GlobalDeleteAtom(a);
|
||||
ATOM t = HIWORD(lparam); if (t) GlobalDeleteAtom(t);
|
||||
CUR_DDE->do_ack(wparam);
|
||||
normal_process = FALSE;
|
||||
}
|
||||
break;
|
||||
case WM_DDE_EXECUTE:
|
||||
{
|
||||
TString cmd(256);
|
||||
cmd = (const char*)GlobalLock((HGLOBAL)lparam);
|
||||
GlobalUnlock((HGLOBAL)lparam);
|
||||
|
||||
DDEACK ack; memset(&ack, 0, sizeof(ack));
|
||||
ack.fAck = CUR_DDE->do_execute(wparam, cmd);
|
||||
// Ritorna indietro l'handle globale che verra' distrutto dal chiamante
|
||||
PostMessage((HWND)wparam, WM_DDE_ACK, (WPARAM)hwnd, lparam);
|
||||
normal_process = FALSE;
|
||||
}
|
||||
break;
|
||||
case WM_DDE_TERMINATE:
|
||||
CUR_DDE->do_terminate(wparam);
|
||||
normal_process = FALSE;
|
||||
break;
|
||||
default:
|
||||
if (msg > (UINT)WM_USER && msg < 0x7FFF)
|
||||
{
|
||||
if (CUR_DDE->do_custom_message(msg, wparam, lparam))
|
||||
normal_process = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
*ret = !normal_process;
|
||||
return normal_process;
|
||||
}
|
||||
|
||||
TDDE::TDDE()
|
||||
: _old_hook(NULL), _server(0)
|
||||
: _server(0), _old_hook(NULL)
|
||||
{
|
||||
CHECK(DDEWIN == NULL, "Non puoi lanciare due DDE, bestia!");
|
||||
create(0, 0, 0, 0, "DDE", WSF_INVISIBLE, W_PLAIN, NULL_WIN);
|
||||
_hwnd = (word)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
|
||||
DDEWIN = this;
|
||||
CHECK(CUR_DDE == NULL, "Non puoi lanciare due DDE, bestia!");
|
||||
_hwnd = (word)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
CUR_DDE = this;
|
||||
}
|
||||
|
||||
TDDE::~TDDE()
|
||||
{
|
||||
terminate();
|
||||
DDEWIN = NULL;
|
||||
_hwnd = 0;
|
||||
CUR_DDE = NULL;
|
||||
}
|
||||
|
||||
bool TDDE::initiate(const char* app, const char* topic)
|
||||
@ -262,7 +325,7 @@ bool TDDE::initiate(const char* app, const char* topic)
|
||||
_server = 0;
|
||||
ATOM a_app = GlobalAddAtom(app);
|
||||
ATOM a_topic = GlobalAddAtom(topic);
|
||||
SendMessage(HWND_BROADCAST, WM_DDE_INITIATE, (WORD)_hwnd, MAKELPARAM(a_app, a_topic));
|
||||
SendMessage(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)_hwnd, MAKELPARAM(a_app, a_topic));
|
||||
GlobalDeleteAtom(a_app);
|
||||
GlobalDeleteAtom(a_topic);
|
||||
return _server != 0;
|
||||
@ -274,7 +337,7 @@ bool TDDE::execute(const char* cmd) const
|
||||
char* c = (char*)GlobalLock(hg);
|
||||
strcpy(c, cmd);
|
||||
GlobalUnlock(hg);
|
||||
return PostMessage((HWND)_server, WM_DDE_EXECUTE, (WORD)_hwnd, MAKELPARAM(0, hg));
|
||||
return PostMessage((HWND)_server, WM_DDE_EXECUTE, (WPARAM)_hwnd, MAKELPARAM(0, hg));
|
||||
}
|
||||
|
||||
|
||||
@ -284,7 +347,8 @@ void TDDE::terminate()
|
||||
{
|
||||
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, _old_hook);
|
||||
_old_hook = NULL;
|
||||
PostMessage((HWND)_server, (WORD)_hwnd, WM_DDE_TERMINATE, 0L);
|
||||
PostMessage((HWND)_server, (WPARAM)_hwnd, WM_DDE_TERMINATE, (LPARAM)0);
|
||||
_server = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,11 +84,11 @@ public:
|
||||
|
||||
// @class TDDE | Classe per la gestione del DDE
|
||||
//
|
||||
// @base public | TWindow
|
||||
class TDDE : public TWindow
|
||||
// @base public | TObject
|
||||
class TDDE : public TObject
|
||||
|
||||
// @comm Attualmente utilizzato all'avvio di PRASSI per comunicare al Program Manager il nome
|
||||
// dell'utente in modo da comunicarlo a tutti i programmi PRASSI avviati in seguito.
|
||||
// dell'utente in modo da comunicarlo a tutti i programmi PRASSI avviati in seguito.
|
||||
|
||||
// @author:(INTERNAL) Guido
|
||||
|
||||
@ -100,17 +100,25 @@ class TDDE : public TWindow
|
||||
word _server;
|
||||
// @cmember:(INTERNAL) Puntatore alla funzione di gestione dei messaggi
|
||||
long _old_hook;
|
||||
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
void set_server(word s)
|
||||
{ _server = s; }
|
||||
public:
|
||||
virtual bool do_initiate(word id, const TString& topic) { return FALSE; }
|
||||
virtual bool do_execute(word id, const TString& cmd) { return FALSE; }
|
||||
virtual bool do_ack(word id) { _server = id; return TRUE; }
|
||||
virtual bool do_terminate(word id) { return FALSE; }
|
||||
virtual bool do_custom_message(word msg, word wparam, long lparam) { return FALSE; }
|
||||
virtual const char* get_app_name() const { return NULL; }
|
||||
virtual const char* get_topics() const { return NULL; }
|
||||
|
||||
// @cmember Stabilisce il collegamento dell'<p app> per i <p topic> indicati
|
||||
bool initiate(const char* app, const char* topic);
|
||||
// @cmember Esegue il comando <p cmd>
|
||||
bool execute(const char* cmd) const;
|
||||
// @cmember Chiude la connessione
|
||||
void terminate();
|
||||
|
||||
word hwnd() const { return _hwnd; }
|
||||
|
||||
// @cmember Costruttore
|
||||
TDDE();
|
||||
|
@ -1650,9 +1650,16 @@ const char* TMask::get_caption() const
|
||||
}
|
||||
|
||||
void TMask::set_caption(const char* c)
|
||||
{
|
||||
{
|
||||
TToken_string captions(c);
|
||||
for (int p = 0; p < _pages; p++)
|
||||
xvt_vobj_set_title(_pagewin[p], (char*)c);
|
||||
{
|
||||
const char* cap = captions.get();
|
||||
if (cap == NULL) cap = captions.get(0);
|
||||
xvt_vobj_set_title(_pagewin[p], (char*)cap);
|
||||
TTagbutton_control* tag = (TTagbutton_control*)_pagetag.objptr(p);
|
||||
if (tag) tag->set_caption(c);
|
||||
}
|
||||
}
|
||||
|
||||
void TMask::post_error_message(const char* msg, int sev)
|
||||
|
@ -325,7 +325,7 @@ TSpreadsheet::TSpreadsheet(
|
||||
l->fixed_columns = fixed_columns;
|
||||
l->active_back_color = FOCUS_BACK_COLOR;
|
||||
l->white_space_color = MASK_DARK_COLOR;
|
||||
l->rule_color = MASK_BACK_COLOR;
|
||||
l->rule_color = MASK_DARK_COLOR;
|
||||
|
||||
// Definizione della prima colonna (numero di riga)
|
||||
word attr = XI_ATR_RJUST;
|
||||
@ -957,11 +957,9 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
refused = TRUE;
|
||||
}
|
||||
}
|
||||
if (!refused)
|
||||
{
|
||||
// Notifica l'abbandono della riga
|
||||
notify(_cur_rec, K_CTRL+K_TAB);
|
||||
}
|
||||
if (!refused) // Notifica l'abbandono della riga
|
||||
refused = !notify(_cur_rec, K_CTRL+K_TAB);
|
||||
|
||||
_check_enabled = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -177,7 +177,7 @@ TSheet_control::TSheet_control(
|
||||
l->scroll_bar = TRUE;
|
||||
l->scroll_bar_button = TRUE;
|
||||
l->white_space_color = MASK_DARK_COLOR;
|
||||
l->rule_color = MASK_BACK_COLOR;
|
||||
l->rule_color = MASK_DARK_COLOR;
|
||||
// Definizione della prima colonna (numero di riga)
|
||||
const long attr = XI_ATR_VISIBLE | XI_ATR_RJUST | XI_ATR_SELECTABLE;
|
||||
XI_OBJ_DEF* coldef = xi_add_column_def(listdef, FIRST_FIELD-1, attr, FIRST_FIELD,
|
||||
|
Loading…
x
Reference in New Issue
Block a user