diff --git a/src/apps/charactermap/CharacterWindow.cpp b/src/apps/charactermap/CharacterWindow.cpp index c599635209..abc7e6205c 100644 --- a/src/apps/charactermap/CharacterWindow.cpp +++ b/src/apps/charactermap/CharacterWindow.cpp @@ -64,6 +64,7 @@ private: mutable char fText[32]; }; + class RedirectUpAndDownFilter : public BMessageFilter { public: RedirectUpAndDownFilter(BHandler* target) @@ -89,6 +90,7 @@ private: BHandler* fTarget; }; + class EscapeMessageFilter : public BMessageFilter { public: EscapeMessageFilter(uint32 command) @@ -298,20 +300,25 @@ CharacterWindow::MessageReceived(BMessage* message) case kMsgFontSelected: { BMenuItem* item; + if (message->FindPointer("source", (void**)&item) != B_OK) break; fSelectedFontItem->SetMarked(false); // If it's the family menu, just select the first style - if (item->Submenu() != NULL) + if (item->Submenu() != NULL) { + item->SetMarked(true); item = item->Submenu()->ItemAt(0); + } if (item != NULL) { item->SetMarked(true); fSelectedFontItem = item; _SetFont(item->Menu()->Name(), item->Label()); + item = item->Menu()->Superitem(); + item->SetMarked(true); } break; } @@ -467,6 +474,7 @@ BMenu* CharacterWindow::_CreateFontMenu() { BMenu* menu = new BMenu("Font"); + BMenuItem* item; font_family currentFamily; font_style currentStyle; @@ -475,6 +483,8 @@ CharacterWindow::_CreateFontMenu() int32 numFamilies = count_font_families(); + menu->SetRadioMode(true); + for (int32 i = 0; i < numFamilies; i++) { font_family family; if (get_font_family(i, &family) == B_OK) { @@ -487,8 +497,7 @@ CharacterWindow::_CreateFontMenu() font_style style; uint32 flags; if (get_font_style(family, j, &style, &flags) == B_OK) { - BMenuItem* item = new BMenuItem(style, - new BMessage(kMsgFontSelected)); + item = new BMenuItem(style, new BMessage(kMsgFontSelected)); subMenu->AddItem(item); if (!strcmp(family, currentFamily) @@ -501,5 +510,8 @@ CharacterWindow::_CreateFontMenu() } } + item = menu->FindItem(currentFamily); + item->SetMarked(true); + return menu; }