Back out button simplification until security stuff is worked out.

This commit is contained in:
slamm%netscape.com 1998-09-16 23:29:09 +00:00
parent 434ecf7423
commit b2537071cb
11 changed files with 131 additions and 43 deletions

View File

@ -173,7 +173,7 @@ ToolbarSpec XFE_AddrBookFrame::toolbar_spec[] = {
{ // XX mail only
xfeCmdComposeMessage,
CASCADEBUTTON,
&MNTB_Compose_group, // Icons
&MNTB_Compose_group, NULL, NULL, NULL, // Icons
compose_message_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay

View File

@ -199,7 +199,7 @@ ToolbarSpec XFE_BrowserFrame::toolbar_spec[] = {
{
xfeCmdBack,
DYNA_CASCADEBUTTON,
&TB_Back_group, // Icons
&TB_Back_group, NULL, NULL, NULL, // Icons
NULL, // Submenu spec
XFE_BackForwardMenu::generate , (XtPointer) False, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -207,7 +207,7 @@ ToolbarSpec XFE_BrowserFrame::toolbar_spec[] = {
{
xfeCmdForward,
DYNA_CASCADEBUTTON,
&TB_Forward_group, // Icons
&TB_Forward_group, NULL, NULL, NULL, // Icons
NULL, // Submenu spec
XFE_BackForwardMenu::generate , (XtPointer) True, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -224,7 +224,7 @@ ToolbarSpec XFE_BrowserFrame::toolbar_spec[] = {
{
xfeCmdDestinations,
CASCADEBUTTON,
&TB_Places_group,
&TB_Places_group, NULL, NULL, NULL, // Icons
(MenuSpec*) &XFE_Frame::tb_places_menu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -282,9 +282,9 @@ static ToolbarSpec editor_style_toolbar_spec[] = {
{ xfeCmdOutdent, PUSHBUTTON, &ed_outdent_group },
{ xfeCmdIndent, PUSHBUTTON, &ed_indent_group },
{ xfeCmdSetAlignmentStyle, CASCADEBUTTON, &ed_left_group,
{ xfeCmdSetAlignmentStyle, CASCADEBUTTON, &ed_left_group, 0, 0, 0,
(MenuSpec*)&alignment_menu_spec },
{ "editorGoodiesMenu", CASCADEBUTTON, &ed_insert_group,
{ "editorGoodiesMenu", CASCADEBUTTON, &ed_insert_group, 0, 0, 0,
(MenuSpec*)&goodies_menu_spec },
{ NULL }
};

View File

@ -92,13 +92,20 @@ XFE_Button::tipCB(Widget /* w */, XtPointer cb_data)
XFE_Button::XFE_Button(XFE_Frame * frame,
Widget parent,
const char * name,
IconGroup * iconGroup)
IconGroup * iconGroup,
IconGroup * iconGroup2,
IconGroup * iconGroup3,
IconGroup * iconGroup4)
: XFE_Component(frame)
{
XP_ASSERT(parent);
XP_ASSERT(frame);
m_icons = iconGroup;
m_icons[0] = iconGroup;
m_icons[1] = iconGroup2;
m_icons[2] = iconGroup3;
m_icons[3] = iconGroup4;
m_currentIconGroup = 0;
m_name = name ? name : XP_GetString(XFE_UNTITLED);
m_cmd = Command::intern((char *) m_name);
@ -109,21 +116,30 @@ XFE_Button::XFE_Button(XFE_Frame * frame,
installDestroyHandler();
// Set the new pixmap group if needed
if (m_icons)
setPixmap(m_icons);
if (m_icons[m_currentIconGroup])
{
setPixmap(m_icons[m_currentIconGroup]);
}
}
//////////////////////////////////////////////////////////////////////////
XFE_Button::XFE_Button(XFE_Frame * frame,
Widget parent,
const char * name,
MenuSpec * spec,
IconGroup * iconGroup)
IconGroup * iconGroup,
IconGroup * iconGroup2,
IconGroup * iconGroup3,
IconGroup * iconGroup4)
: XFE_Component(frame)
{
XP_ASSERT(parent);
XP_ASSERT(frame);
m_icons = iconGroup;
m_icons[0] = iconGroup;
m_icons[1] = iconGroup2;
m_icons[2] = iconGroup3;
m_icons[3] = iconGroup4;
m_currentIconGroup = 0;
m_name = name ? name : XP_GetString(XFE_UNTITLED);
m_cmd = Command::intern((char *) m_name);
@ -134,8 +150,10 @@ XFE_Button::XFE_Button(XFE_Frame * frame,
installDestroyHandler();
// Set the new pixmap group if needed
if (m_icons)
setPixmap(m_icons);
if (m_icons[m_currentIconGroup])
{
setPixmap(m_icons[m_currentIconGroup]);
}
setMenuSpec(spec);
@ -146,13 +164,20 @@ XFE_Button::XFE_Button(XFE_Frame * frame,
const char * name,
dynamenuCreateProc generateProc,
void * generateArg,
IconGroup * iconGroup)
IconGroup * iconGroup,
IconGroup * iconGroup2,
IconGroup * iconGroup3,
IconGroup * iconGroup4)
: XFE_Component(frame)
{
XP_ASSERT(parent);
XP_ASSERT(frame);
m_icons = iconGroup;
m_icons[0] = iconGroup;
m_icons[1] = iconGroup2;
m_icons[2] = iconGroup3;
m_icons[3] = iconGroup4;
m_currentIconGroup = 0;
m_name = name ? name : XP_GetString(XFE_UNTITLED);
m_cmd = Command::intern((char *) m_name);
@ -163,8 +188,10 @@ XFE_Button::XFE_Button(XFE_Frame * frame,
installDestroyHandler();
// Set the new pixmap group if needed
if (m_icons)
setPixmap(m_icons);
if (m_icons[m_currentIconGroup])
{
setPixmap(m_icons[m_currentIconGroup]);
}
(*generateProc)(m_widget,generateArg,frame);
@ -499,6 +526,39 @@ XFE_Button::setMenuSpec(MenuSpec * spec)
}
}
//////////////////////////////////////////////////////////////////////////
int
XFE_Button::getIconGroupIndex()
{
return m_currentIconGroup;
}
//////////////////////////////////////////////////////////////////////////
void
XFE_Button::setIconGroups (IconGroup *iconGroup,
IconGroup *iconGroup2,
IconGroup *iconGroup3,
IconGroup *iconGroup4)
{
m_icons[0] = iconGroup;
m_icons[1] = iconGroup2;
m_icons[2] = iconGroup3;
m_icons[3] = iconGroup4;
if (m_icons[m_currentIconGroup] == NULL)
m_currentIconGroup = 0;
}
//////////////////////////////////////////////////////////////////////////
void
XFE_Button::useIconGroup (int iconGroupIndex)
{
if (m_currentIconGroup != iconGroupIndex
&& iconGroupIndex >= 0
&& iconGroupIndex < MAX_ICON_GROUPS
&& m_icons[iconGroupIndex] != NULL)
{
setPixmap(m_icons[iconGroupIndex]);
m_currentIconGroup = iconGroupIndex;
}
}
//////////////////////////////////////////////////////////////////////////
void
XFE_Button::setPretendSensitive(Boolean state)
{

View File

@ -52,20 +52,29 @@ public:
XFE_Button(XFE_Frame * frame,
Widget parent,
const char * name,
IconGroup * iconGroup);
IconGroup * iconGroup,
IconGroup * iconGroup2 = NULL,
IconGroup * iconGroup3 = NULL,
IconGroup * iconGroup4 = NULL);
XFE_Button(XFE_Frame * frame,
Widget parent,
const char * name,
MenuSpec * menu_spec,
IconGroup * iconGroup);
IconGroup * iconGroup,
IconGroup * iconGroup2 = NULL,
IconGroup * iconGroup3 = NULL,
IconGroup * iconGroup4 = NULL);
XFE_Button(XFE_Frame * frame,
Widget parent,
const char * name,
dynamenuCreateProc generateProc,
void * generateArg,
IconGroup * iconGroup);
IconGroup * iconGroup,
IconGroup * iconGroup2 = NULL,
IconGroup * iconGroup3 = NULL,
IconGroup * iconGroup4 = NULL);
virtual ~XFE_Button();
@ -82,6 +91,16 @@ public:
void setPixmap (IconGroup * icons);
int getIconGroupIndex();
// Give a complete list of replacements with each call
void setIconGroups (IconGroup *iconGroup,
IconGroup *iconGroup2 = NULL,
IconGroup *iconGroup3 = NULL,
IconGroup *iconGroup4 = NULL);
void useIconGroup (int index);
void setMenuSpec(MenuSpec *menu_spec);
void setPretendSensitive(Boolean sensitive);
@ -102,7 +121,9 @@ protected:
// For now allow up to four possible icons groups
// where each icon group can have up to four states
IconGroup *m_icons;
IconGroup *m_icons[MAX_ICON_GROUPS];
int m_currentIconGroup;
// The command executed by this button
CommandType m_cmd;

View File

@ -205,7 +205,7 @@ ToolbarSpec XFE_ComposeFrame::toolbar_spec[] = {
{
xfeCmdAttach,
CASCADEBUTTON,
&MNTB_Next_group, // Icons
&MNTB_Next_group, NULL, NULL, NULL, // Icons
message_attach_menu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_SHORT // Popup delay

View File

@ -388,7 +388,7 @@ static ToolbarSpec editor_file_toolbar_spec[] = {
{
xfeCmdNewBlank,
CASCADEBUTTON,
&ed_new_group, // Icons
&ed_new_group, NULL, NULL, NULL, // Icons
(MenuSpec*) &XFE_EditorFrame::new_submenu_spec, // Submenu spec
NULL , NULL, // Generate proc
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -396,7 +396,7 @@ static ToolbarSpec editor_file_toolbar_spec[] = {
{
xfeCmdOpenPage,
DYNA_CASCADEBUTTON,
&ed_open_group, // Icons
&ed_open_group, NULL, NULL, NULL, // Icons
NULL, // Submenu spec
XFE_EditRecentMenu::generate, (void *) True, // Generate proc
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -404,7 +404,7 @@ static ToolbarSpec editor_file_toolbar_spec[] = {
{
xfeCmdSave,
CASCADEBUTTON,
&ed_save_group, // Icons
&ed_save_group, NULL, NULL, NULL, // Icons
(MenuSpec*) &XFE_EditorFrame::save_submenu_spec, // Submenu spec
NULL , NULL, // Generate proc
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -414,14 +414,14 @@ static ToolbarSpec editor_file_toolbar_spec[] = {
#ifdef MOZ_MAIL_NEWS
"publishMenu",
CASCADEBUTTON,
&ed_publish_group, // Icons
&ed_publish_group, NULL, NULL, NULL, // Icons
(MenuSpec*) &XFE_EditorFrame::publish_submenu_spec, // Submenu spec
NULL , NULL, // Generate proc
XFE_TOOLBAR_DELAY_LONG // Popup delay
#else /* MOZ_MAIL_NEWS */
xfeCmdPublish,
PUSHBUTTON,
&ed_publish_group, // Icons
&ed_publish_group, NULL, NULL, NULL, // Icons
NULL, // Submenu spec
NULL , NULL, // Generate proc
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -466,7 +466,7 @@ static ToolbarSpec editor_style_toolbar_spec[] = {
{ xfeCmdOutdent, PUSHBUTTON, &ed_outdent_group },
{ xfeCmdIndent, PUSHBUTTON, &ed_indent_group },
{ xfeCmdSetAlignmentStyle, CASCADEBUTTON, &ed_left_group,
{ xfeCmdSetAlignmentStyle, CASCADEBUTTON, &ed_left_group, 0, 0, 0,
(MenuSpec*)&XFE_EditorFrame::alignment_menu_spec },
{ NULL }
};

View File

@ -96,9 +96,9 @@ static ToolbarSpec editor_style_toolbar_spec[] = {
{ xfeCmdOutdent, PUSHBUTTON, &ed_outdent_group },
{ xfeCmdIndent, PUSHBUTTON, &ed_indent_group },
{ xfeCmdSetAlignmentStyle, CASCADEBUTTON, &ed_left_group,
{ xfeCmdSetAlignmentStyle, CASCADEBUTTON, &ed_left_group, 0, 0, 0,
(MenuSpec*)&alignment_menu_spec },
{ "editorGoodiesMenu", CASCADEBUTTON, &ed_insert_group,
{ "editorGoodiesMenu", CASCADEBUTTON, &ed_insert_group, 0, 0, 0,
(MenuSpec*)&goodies_menu_spec },
{ NULL }
};

View File

@ -127,7 +127,7 @@ ToolbarSpec XFE_FolderFrame::toolbar_spec[] = {
{ // XX mail only
xfeCmdComposeMessage,
CASCADEBUTTON,
&MNTB_Compose_group, // Icons
&MNTB_Compose_group, NULL, NULL, NULL, // Icons
compose_message_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay

View File

@ -329,7 +329,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = {
{ // XX mail only
xfeCmdComposeMessage,
CASCADEBUTTON,
&MNTB_Compose_group, // Icons
&MNTB_Compose_group, NULL, NULL, NULL, // Icons
compose_message_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -337,7 +337,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = {
{ // XX newsgroup only
xfeCmdComposeArticle,
CASCADEBUTTON,
&MNTB_Compose_group, // Icons
&MNTB_Compose_group, NULL, NULL, NULL, // Icons
compose_article_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -346,7 +346,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = {
{ // XX mail only
xfeCmdReplyToSender,
CASCADEBUTTON,
&MNTB_Reply_group, // Icons
&MNTB_Reply_group, NULL, NULL, NULL, // Icons
reply_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -354,7 +354,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = {
{ // XX news only
xfeCmdReplyToNewsgroup,
CASCADEBUTTON,
&MNTB_Reply_group, // Icons
&MNTB_Reply_group, NULL, NULL, NULL, // Icons
reply_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -364,23 +364,21 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = {
{
xfeCmdCopyMessage, // XX news only
DYNA_CASCADEBUTTON,
NULL, // Submenu spec
&MNTB_File_group,
&MNTB_File_group, NULL, NULL, NULL, NULL,
XFE_FolderMenu::generate, (void*)xfeCmdCopyMessage,
XFE_TOOLBAR_DELAY_SHORT
},
{
xfeCmdMoveMessage, // XX mail only
DYNA_CASCADEBUTTON,
NULL, // Submenu spec
&MNTB_File_group,
&MNTB_File_group, NULL, NULL, NULL, NULL,
XFE_FolderMenu::generate, (void*)xfeCmdMoveMessage,
XFE_TOOLBAR_DELAY_SHORT
},
{
xfeCmdNextUnreadMessage,
CASCADEBUTTON,
&MNTB_Next_group, // Icons
&MNTB_Next_group, NULL, NULL, NULL, // Icons
next_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay
@ -389,7 +387,7 @@ ToolbarSpec XFE_ThreadFrame::toolbar_spec[] = {
HG20938
{ xfeCmdMarkMessageRead, // XX news only
CASCADEBUTTON,
&MNTB_MarkRead_group, // Icons
&MNTB_MarkRead_group, NULL, NULL, NULL, // Icons
mark_submenu_spec, // Submenu spec
NULL, NULL, // Generate proc/arg
XFE_TOOLBAR_DELAY_LONG // Popup delay

View File

@ -601,7 +601,10 @@ XFE_Toolbar::createPush(ToolbarSpec * spec)
XFE_Button * button = new XFE_Button(m_parentFrame,
m_toolBar,
spec->toolbarButtonName,
spec->iconGroup);
spec->iconGroup,
spec->iconGroup2,
spec->iconGroup3,
spec->iconGroup4);
//
button->setToplevel(m_parentFrame);
@ -1106,6 +1109,9 @@ XFE_Toolbar::user_addItem(String widgetName,
spec->toolbarButtonName = (char *) XtNewString(widgetName);
spec->tag = tag;
spec->iconGroup = ig;
spec->iconGroup2 = NULL;
spec->iconGroup3 = NULL;
spec->iconGroup4 = NULL;
spec->submenu = subMenuSpec;
spec->generateProc = generateProc;
spec->generateArg = generateArg;

View File

@ -50,6 +50,9 @@ typedef struct ToolbarSpec
EChromeTag tag;
IconGroup *iconGroup;
IconGroup *iconGroup2;
IconGroup *iconGroup3;
IconGroup *iconGroup4;
struct MenuSpec *submenu;