Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef _TMACROX_H_
Toshihiro Shimizu 890ddd
#define _TMACROX_H_
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef FUNCPROTO
Toshihiro Shimizu 890ddd
#define FUNCPROTO 0xFF
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#include <xm xm.h=""></xm>
Toshihiro Shimizu 890ddd
#include <xm bulletinb.h=""></xm>
Toshihiro Shimizu 890ddd
#include <xm frame.h=""></xm>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tmacro.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if XtSpecificationRelease >= 5
Toshihiro Shimizu 890ddd
typedef int xargc_t;
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
typedef unsigned int xargc_t;
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
/* macro per la gestione delle liste di argomenti */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define TX_ARG_VARS(num)                                                       \
Shinya Kitaoka 120a6e
  Cardinal TxArgN = 0;                                                         \
Shinya Kitaoka 120a6e
  Arg TxArgs[num]
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_ARG(resource, value)                                            \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    if (TxArgN >= sizeof(TxArgs) / sizeof(Arg)) {                              \
Shinya Kitaoka 120a6e
      fprintf(stderr, "TX_ADD_ARG error in file %s at line %d\n", __FILE__,    \
Shinya Kitaoka 120a6e
              __LINE__);                                                       \
Shinya Kitaoka 120a6e
      abort();                                                                 \
Shinya Kitaoka 120a6e
    }                                                                          \
Shinya Kitaoka 120a6e
    XtSetArg(TxArgs[TxArgN], resource, value);                                 \
Shinya Kitaoka 120a6e
    TxArgN++;                                                                  \
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TX_RESET_ARGS TxArgN = 0;
Toshihiro Shimizu 890ddd
#define TX_ARGS TxArgs, TxArgN
Toshihiro Shimizu 890ddd
#define TX_N_ARGS TxArgN
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
/* macro per la gestione dei form */
Toshihiro Shimizu 890ddd
/* nota: l'attachment che e' widget o form a seconda che il widget ci sia o no
Toshihiro Shimizu 890ddd
   e' una correzione veloce per lesstif (linux) che scrive un warning,
Toshihiro Shimizu 890ddd
   ma andrebbe lasciato solo di tipo XmATTACH_WIDGET e corretto il codice
Toshihiro Shimizu 890ddd
   che usa la macro sbagliata
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
#define TX_ADD_LEFT_FORM(offset)                                               \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftAttachment, XmATTACH_FORM);                              \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftOffset, offset)                                          \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_LEFT_WIDGET(widget, offset)                                     \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftAttachment, widget ? XmATTACH_WIDGET : XmATTACH_FORM);   \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftWidget, widget);                                         \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftOffset, offset)                                          \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_LEFT_OPPOSITE(widget, offset)                                   \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET);                   \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftWidget, widget);                                         \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNleftOffset, offset)                                          \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_RIGHT_FORM(offset)                                              \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightAttachment, XmATTACH_FORM);                             \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightOffset, offset)                                         \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_RIGHT_WIDGET(widget, offset)                                    \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightAttachment, widget ? XmATTACH_WIDGET : XmATTACH_FORM);  \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightWidget, widget);                                        \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightOffset, offset)                                         \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_RIGHT_OPPOSITE(widget, offset)                                  \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET);                  \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightWidget, widget);                                        \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNrightOffset, offset)                                         \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_TOP_FORM(offset)                                                \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopAttachment, XmATTACH_FORM);                               \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopOffset, offset)                                           \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_TOP_WIDGET(widget, offset)                                      \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopAttachment, widget ? XmATTACH_WIDGET : XmATTACH_FORM);    \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopWidget, widget);                                          \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopOffset, offset)                                           \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_TOP_OPPOSITE(widget, offset)                                    \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET);                    \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopWidget, widget);                                          \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNtopOffset, offset)                                           \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_BOTTOM_FORM(offset)                                             \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomAttachment, XmATTACH_FORM);                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomOffset, offset)                                        \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_BOTTOM_WIDGET(widget, offset)                                   \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomAttachment, widget ? XmATTACH_WIDGET : XmATTACH_FORM); \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomWidget, widget);                                       \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomOffset, offset)                                        \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TX_ADD_BOTTOM_OPPOSITE(widget, offset)                                 \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET);                 \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomWidget, widget);                                       \
Shinya Kitaoka 120a6e
    TX_ADD_ARG(XmNbottomOffset, offset)                                        \
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
/* macro per actions e translations */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define TX_ADD_ACTIONS(w, action_table)                                        \
Shinya Kitaoka 120a6e
  XtAppAddActions(XtWidgetToApplicationContext(w), (action_table),             \
Shinya Kitaoka 120a6e
                  XtNumber(action_table));
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define TX_OVERRIDE_TRANSLATIONS(w, translation_table)                         \
Shinya Kitaoka 120a6e
  XtOverrideTranslations((w), XtParseTranslationTable(translation_table));
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define TX_ADD_ACTIONS_AND_TRANSLATIONS(w, action_table, translation_table)    \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    TX_ADD_ACTIONS((w), (action_table))                                        \
Shinya Kitaoka 120a6e
    TX_OVERRIDE_TRANSLATIONS((w), (translation_table))                         \
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif