General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Is there a way to...
Posted by: MonkeeSage
Date: April 11, 2003 03:26AM

Is there any way to make a submenu'd toolbar button that anyone knows of?

Mabye something like this:

History {
:Menu_Here
History
hist_hot.bmp[0]
hist_cold.bmp[0]
hist_dead.bmp[0]
}

where Menu_Here{...} is defined in menus.cfg??


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Is there a way to...
Posted by: jsnj
Date: April 11, 2003 04:08AM

If I understand you correctly, I asked about that awhile back specifically for having the favorites menu drop down from a toolbar button/icon instead of the double downward arrow that's only present with the bookmarks plugin but was told that no menu can be seen from any toolbar button/icon.

Options: ReplyQuote
Re: Is there a way to...
Posted by: MonkeeSage
Date: April 11, 2003 05:06AM

jsnj:

I think that is right, but I couldn't recall if there was ever a definitive answer. So the answer is that it is not possible right now?


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Is there a way to...
Posted by: jsnj
Date: April 11, 2003 05:27AM

Well a definitive answer would have to come from a developer or Andrew I guess. The following is the thread I started about it.

http://kmeleonbrowser.org/forum/read.php?f=1&i=5478&t=5444

Options: ReplyQuote
Re: Is there a way to...
Posted by: asmpgmr
Date: April 11, 2003 02:20PM

MonkeeSage,

There's commented out code in toolbars\toolbars.cpp which would allow menu items for toolbar buttons but I'm not sure if it's complete or if there are any issues. Definitely a question for the devs since there must be some reason it's commented out. Of course now that you know it's there you can uncomment it and try it. The only issue I can think of is that there's needs to be a check to disallow this for the back and forward buttons since they have their own menu handling for the session history. Also I don't think there's a way to have statusbar text appear when a menu entry is highlighted because the TrackPopupMenu function is used. This is also why the URL isn't displayed in the statusbar for the back/forward session history like it is for the bookmarks menu (bug 104).

Options: ReplyQuote
Re: Is there a way to...
Posted by: MonkeeSage
Date: April 12, 2003 04:08AM

asmpgmr:

I just came across that last night, looked interesting...

// ID_NAME | MENU

I played with it and it needs a function called GetMenu() in kFuncs (Plugins.cpp / kmeleon_plugin.h), but there are several versions of GetMenu() that K-M uses in other places...I think it is the one in CrowserFrameGlue that is the correct one, but I just need to figure out how to link it up.

Assuming that the commented code (and there was a bit more below that starting with if(!pipe) ) is complete, but was commented because of lacking core support for the GetMenu() over in kFuncs, it might be pretty easy to get working. smiling smiley


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Is there a way to...
Posted by: asmpgmr
Date: April 12, 2003 04:52PM

MonkeeSage,

Adding the required GetMenu function to Plugins.cpp is pretty easy, add GetMenu to the end of the kmeleonFunctions structure, a declaration in kmeleon_plugin.h, and the function itself is only a few lines:

HMENU GetMenu(char *MenuName)
{
CMenu *menu = theApp.menus.GetMenu(MenuName);
if (menu)
return menu->m_hMenu;
else
return NULL;
}

The second block of commented out code (three lines) wouldn't work because it's trying to do a command id lookup and pass an int value to GetMenu but I don't think any command ids have registered menus anyway so it can be left commented out.

One point is that the updated toolbars plugin would only work with the updated k-meleon.exe, it would likely crash with a previous version because the GetMenu function wouldn't exist.

Options: ReplyQuote
Re: Is there a way to...
Posted by: MonkeeSage
Date: April 13, 2003 03:21AM

asmpgmr:

OK, the GetMenu() function works correctly and all of it compiles and runs. The ID on the left side (e.g., ID_NAV_BACK | &Menu ) executes fine; but no menu ever shows up. So I added a check at the end of while (button) {}:

// ...
buttons.fsStyle = TBSTYLE_BUTTON | (button->menu?TBSTYLE_DROPDOWN:0);
buttons.bReserved[0] = 0;
if(button->menu)
MessageBox(GetParent(rebarWnd), "Button was dropdown", "Dropdown?", MB_OK);


The message box nevers shows up...

Looks like, for some reason, at the time of DoRebar, button->menu = NULL ...

Got any ideas?


Shelumi`El
Jordan

S.D.G


Options: ReplyQuote
Re: Is there a way to...
Posted by: MonkeeSage
Date: April 13, 2003 03:54AM

asmpgmr:

I played a bit more, and tried this in the if (pipe) {} block:

curButton->menu = kPlugin.kFuncs->GetMenu(SkipWhiteSpace(pipe+1));
curButton->menu ? MessageBox(GetParent(curToolbar->hWnd), "Menu Set", "Menu Test", MB_OK) : 0;

But that message box never shows up, either...

So evidentally, over in Plugins.cpp, HMENU GetMenu(char *MenuName), it is always hitting the else and so returning NULL...

I'm wondering if the menu name that theApp.menus.GetMenu(MenuName) is expecting is different from the name in menus.cfg, like mabye "Main {}" = "ID_NAMEMAIN" of something to that effect?


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Is there a way to...
Posted by: asmpgmr
Date: April 13, 2003 02:35PM

MonkeeSage,

The called GetMenu function is in MenuParser.cpp and is defined to take a char * parameter but in BrowserFrm.cpp function Create and BrowserFrameGlue.cpp function ShowContextMenu, strings are passed with _T.

Another really bad thing about c++, having multiple functions with the same name.

Options: ReplyQuote
Re: Is there a way to...
Posted by: asmpgmr
Date: April 15, 2003 09:47PM

Minor change to make IsButtonEnabled and IsButtonChecked parameter parsing consistent with EnableButton and CheckButton.

In toolbars\toolbars.cpp functions IsButtonEnabled AND IsButtonChecked

Change:

// Get BUTTON_ID param
p = SkipWhiteSpace(c+1);
int iButton = atoi(p);

to:

// Get BUTTON_ID param
p = SkipWhiteSpace(c+1);
int iButton = atoi(p);
if (!iButton)
iButton = kPlugin.kFuncs->GetID(p);

Options: ReplyQuote


K-Meleon forum is powered by Phorum.