Add resources for toolbar toggle behavior.

This commit is contained in:
ramiro 1998-06-01 23:44:42 +00:00
Родитель 76fcd38b25
Коммит 083e48543c
6 изменённых файлов: 95 добавлений и 11 удалений

Просмотреть файл

@ -263,6 +263,20 @@ RegisterToolBarSelectionPolicy(void)
}
/*----------------------------------------------------------------------*/
static void
RegisterToolBarToggleBehavior(void)
{
static String names[] =
{
"tool_bar_toggle_one_or_more",
"tool_bar_toggle_only_one",
"tool_bar_toggle_zero_or_more",
"tool_bar_toggle_zero_or_one"
};
XmRepTypeRegister(XmRToolBarToggleBehavior,names,NULL,XtNumber(names));
}
/*----------------------------------------------------------------------*/
static void
RegisterToolBarIndicatorLocation(void)
{
static String names[] =
@ -313,6 +327,7 @@ XfeRegisterRepresentationTypes(void)
RegisterRulesType();
RegisterToolBarIndicatorLocation();
RegisterToolBarSelectionPolicy();
RegisterToolBarToggleBehavior();
RegisterToolScrollArrowPlacement();
/* XfeRegisterArrowType(); */

Просмотреть файл

@ -182,6 +182,7 @@
#define XmNignoreExposures "ignoreExposures"
#define XmNindicatorLocation "indicatorLocation"
#define XmNindicatorPosition "indicatorPosition"
#define XmNindicatorThreshold "indicatorThreshold"
#define XmNinputDateLabel "inputDateLabel"
#define XmNinputOptionMenu "inputOptionMenu"
#define XmNinputTextField "inputTextField"
@ -275,6 +276,7 @@
#define XmNtitleFontList "titleFontList"
#define XmNtitleShadowThickness "titleShadowThickness"
#define XmNtitleShadowType "titleShadowType"
#define XmNtoggleBehavior "toggleBehavior"
#define XmNtoolBar "toolBar"
#define XmNtoolBarPosition "toolBarPosition"
#define XmNtoolBarSelectionPolicy "toolBarSelectionPolicy"
@ -388,6 +390,7 @@
#define XmCIgnoreExposures "IgnoreExposures"
#define XmCIndicatorLocation "IndicatorLocation"
#define XmCIndicatorPosition "IndicatorPosition"
#define XmCIndicatorThreshold "IndicatorThreshold"
#define XmCInsensitivePixmap "InsensitivePixmap"
#define XmCInsensitivePixmapMask "InsensitivePixmapMask"
#define XmCInstancePointer "InstancePointer"
@ -452,6 +455,7 @@
#define XmCSwapThreshold "SwapThreshold"
#define XmCTaskBarDocked "TaskBarDocked"
#define XmCTitleFontList "TitleFontList"
#define XmCToggleBehavior "ToggleBehavior"
#define XmCToolBarPosition "ToolBarPosition"
#define XmCToolBarSelectionPolicy "ToolBarSelectionPolicy"
#define XmCTopPixmap "TopPixmap"
@ -494,6 +498,7 @@
#define XmRRulesType "RulesType"
#define XmRToolBarIndicatorLocation "ToolBarIndicatorLocation"
#define XmRToolBarSelectionPolicy "ToolBarSelectionPolicy"
#define XmRToolBarToggleBehavior "ToolBarToggleBehavior"
#define XmRToolScrollArrowPlacement "ToolScrollArrowPlacement"
#define XmRTruncateProc "TruncateProc"
#define XmRXfeArrowType "XfeArrowType"

Просмотреть файл

@ -45,9 +45,11 @@
#define MESSAGE6 "XmNindicatorPosition is less than 0."
#define MESSAGE7 "XmNindicatorPosition is more than XmNnumChildren."
#define MESSAGE8 "No valid edit text found in toolbar."
#define MESSAGE9 "XmNindicatorThreshold bust be greater than 0."
#define DEFAULT_MAX_CHILD_HEIGHT 0
#define DEFAULT_MAX_CHILD_WIDTH 0
#define DEFAULT_MAX_CHILD_HEIGHT 0
#define DEFAULT_MAX_CHILD_WIDTH 0
#define DEFAULT_INDICATOR_THRESHOLD 10
#define INDICATOR_NAME "Indicator"
#define EDIT_TEXT_NAME "EditText"
@ -298,6 +300,15 @@ static XtResource resources[] =
XmRImmediate,
(XtPointer) False
},
{
XmNtoggleBehavior,
XmCToggleBehavior,
XmRToolBarToggleBehavior,
sizeof(unsigned char),
XtOffsetOf(XfeToolBarRec , xfe_tool_bar . toggle_behavior),
XmRImmediate,
(XtPointer) XmTOOL_BAR_TOGGLE_ZERO_OR_ONE
},
{
XmNactiveButton,
XmCActiveButton,
@ -367,6 +378,15 @@ static XtResource resources[] =
},
/* Indicator resources */
{
XmNindicatorLocation,
XmCIndicatorLocation,
XmRToolBarIndicatorLocation,
sizeof(unsigned char),
XtOffsetOf(XfeToolBarRec , xfe_tool_bar . indicator_location),
XmRImmediate,
(XtPointer) XmINDICATOR_LOCATION_BEGINNING
},
{
XmNindicatorPosition,
XmCIndicatorPosition,
@ -377,13 +397,13 @@ static XtResource resources[] =
(XtPointer) XmINDICATOR_DONT_SHOW
},
{
XmNindicatorLocation,
XmCIndicatorLocation,
XmRToolBarIndicatorLocation,
sizeof(unsigned char),
XtOffsetOf(XfeToolBarRec , xfe_tool_bar . indicator_location),
XmNindicatorThreshold,
XmCIndicatorThreshold,
XmRCardinal,
sizeof(Cardinal),
XtOffsetOf(XfeToolBarRec , xfe_tool_bar . indicator_threshold),
XmRImmediate,
(XtPointer) XmINDICATOR_LOCATION_BEGINNING
(XtPointer) DEFAULT_INDICATOR_THRESHOLD
},
{
XmNdynamicIndicator,
@ -623,6 +643,14 @@ Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
_XfeWarning(nw,MESSAGE4);
}
/* indicator_threshold */
if (tp->indicator_threshold == 0)
{
tp->indicator_threshold = DEFAULT_INDICATOR_THRESHOLD;
_XfeWarning(nw,MESSAGE9);
}
/* Add Button3 translations */
XfeOverrideTranslations(nw,_XfeToolBarExtraTranslations);
@ -792,6 +820,18 @@ SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
layout_indicator = True;
}
/* indicator_threshold */
if (np->indicator_threshold != op->indicator_threshold)
{
/* indicator_threshold */
if (np->indicator_threshold == 0)
{
np->indicator_threshold = op->indicator_threshold;
_XfeWarning(nw,MESSAGE9);
}
}
/* Layout the indicator if needed */
if (layout_indicator)
@ -1816,6 +1856,12 @@ ButtonSetActiveWidget(Widget w,
Cardinal i;
Widget new_active_button = NULL;
#ifdef DEBUG_ramiro
printf("ButtonSetActiveWidget(%s,%s)\n",
XtName(w),
_XfeIsAlive(button) ? XtName(button) : "NULL");
#endif
for (i = 0; i < _XfemNumChildren(w); i++)
{
Widget child = _XfemChildren(w)[i];
@ -2286,6 +2332,7 @@ XfeToolBarSetSelectedButton(Widget w,Widget button)
/* extern */ unsigned char
XfeToolBarXYToIndicatorLocation(Widget w,Widget item,int x,int y)
{
XfeToolBarPart * tp = _XfeToolBarPart(w);
unsigned char result = XmINDICATOR_LOCATION_NONE;
int start_pos;
int end_pos;
@ -2301,7 +2348,7 @@ XfeToolBarXYToIndicatorLocation(Widget w,Widget item,int x,int y)
{
if (XfeIsCascade(item))
{
start_pos = _XfeWidth(item) / 4;
start_pos = _XfeWidth(item) / tp->indicator_threshold;
end_pos = _XfeWidth(item) - start_pos;
}
else
@ -2317,7 +2364,7 @@ XfeToolBarXYToIndicatorLocation(Widget w,Widget item,int x,int y)
{
if (XfeIsCascade(item))
{
start_pos = _XfeHeight(item) / 4;
start_pos = _XfeHeight(item) / tp->indicator_threshold;
end_pos = _XfeHeight(item) - start_pos;
}
else

Просмотреть файл

@ -61,6 +61,20 @@ enum
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XmRToolBarToggleBehavior */
/* */
/*----------------------------------------------------------------------*/
enum
{
XmTOOL_BAR_TOGGLE_ONE_OR_MORE,
XmTOOL_BAR_TOGGLE_ONLY_ONE,
XmTOOL_BAR_TOGGLE_ZERO_OR_MORE,
XmTOOL_BAR_TOGGLE_ZERO_OR_ONE
};
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* */
/* XmINDICATOR_DONT_SHOW - for XmNindicatorPosition to hide indicator. */

Просмотреть файл

@ -88,6 +88,7 @@ typedef struct _XfeToolBarPart
Boolean raised; /* Raised ? */
/* Radio resources */
unsigned char toggle_behavior; /* Toggle behavior */
Boolean radio_behavior; /* Radio behavior ? */
Widget active_button; /* Active button ? */
@ -97,8 +98,9 @@ typedef struct _XfeToolBarPart
Modifiers selection_modifiers; /* Selection modifiers */
/* Indicator resources */
int indicator_position; /* Indicator Position */
unsigned char indicator_location; /* Indicator Location */
int indicator_position; /* Indicator Position */
Cardinal indicator_threshold; /* Indicator Threshold */
Boolean dynamic_indicator; /* Dynamic indicator ? */
/* Geometry resources */

Просмотреть файл

@ -5833,6 +5833,7 @@ Drag this to create a link to this page
*personalToolbar.spacing: 1
*personalToolbar.raiseBorderThickness: 2
*personalToolbar.indicatorThreshold: 10
*personalToolbar*XfeButton.marginBottom: 1
*personalToolbar*XfeButton.marginLeft: 1