virtualkeyboard: style fixes
Change-Id: Iee76c0cae38a0677b60e51f73aa0e2e5d9b7c2ee Reviewed-on: https://review.haiku-os.org/c/haiku/+/8902 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
c8cd427e30
commit
9d2283baab
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <InterfaceDefs.h>
|
||||
|
||||
|
||||
extern "C" BInputServerDevice*
|
||||
instantiate_input_device()
|
||||
{
|
||||
@@ -26,8 +27,7 @@ VirtualKeyboardInputDevice::~VirtualKeyboardInputDevice()
|
||||
status_t
|
||||
VirtualKeyboardInputDevice::InitCheck()
|
||||
{
|
||||
static input_device_ref keyboard = {(char*) "VirtualKeyboard",
|
||||
B_KEYBOARD_DEVICE, (void*) this};
|
||||
static input_device_ref keyboard = {(char*)"VirtualKeyboard", B_KEYBOARD_DEVICE, (void*)this};
|
||||
static input_device_ref* devices[2] = {&keyboard, NULL};
|
||||
|
||||
RegisterDevices(devices);
|
||||
@@ -56,8 +56,8 @@ VirtualKeyboardInputDevice::Stop(const char* name, void* cookie)
|
||||
|
||||
|
||||
status_t
|
||||
VirtualKeyboardInputDevice::Control(const char* name, void* cookie,
|
||||
uint32 command, BMessage* message)
|
||||
VirtualKeyboardInputDevice::Control(const char* name, void* cookie, uint32 command,
|
||||
BMessage* message)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -32,20 +32,19 @@ compare_key_list_items(const void* a, const void* b)
|
||||
|
||||
VirtualKeyboardWindow::VirtualKeyboardWindow(BInputServerDevice* dev)
|
||||
:
|
||||
BWindow(BRect(0,0,0,0),"Virtual Keyboard",
|
||||
B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL,
|
||||
B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FOCUS),
|
||||
BWindow(BRect(0, 0, 0, 0), "Virtual Keyboard", B_NO_BORDER_WINDOW_LOOK,
|
||||
B_FLOATING_ALL_WINDOW_FEEL, B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FOCUS),
|
||||
fDevice(dev)
|
||||
{
|
||||
BScreen screen;
|
||||
BRect screenRect(screen.Frame());
|
||||
|
||||
ResizeTo(screenRect.Width(), screenRect.Height() / 3);
|
||||
MoveTo(0,screenRect.Height() - screenRect.Height() / 3);
|
||||
MoveTo(0, screenRect.Height() - screenRect.Height() / 3);
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
//Add to an options window later, use as list for now
|
||||
// Add to an options window later, use as list for now
|
||||
fMapListView = new BListView("Maps");
|
||||
fFontMenu = new BMenu("Font");
|
||||
fLayoutMenu = new BMenu("Layout");
|
||||
@@ -54,17 +53,15 @@ VirtualKeyboardWindow::VirtualKeyboardWindow(BInputServerDevice* dev)
|
||||
_LoadLayouts(fLayoutMenu);
|
||||
_LoadFonts();
|
||||
|
||||
KeymapListItem* current =
|
||||
static_cast<KeymapListItem*>(fMapListView->LastItem());
|
||||
KeymapListItem* current = static_cast<KeymapListItem*>(fMapListView->LastItem());
|
||||
fCurrentKeymap.Load(current->EntryRef());
|
||||
|
||||
|
||||
fKeyboardView = new KeyboardLayoutView("Keyboard",fDevice);
|
||||
fKeyboardView = new KeyboardLayoutView("Keyboard", fDevice);
|
||||
fKeyboardView->GetKeyboardLayout()->SetDefault();
|
||||
fKeyboardView->SetKeymap(&fCurrentKeymap);
|
||||
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL)
|
||||
.Add(fKeyboardView));
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL).Add(fKeyboardView));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +75,7 @@ VirtualKeyboardWindow::_LoadLayouts(BMenu* menu)
|
||||
B_SYSTEM_DATA_DIRECTORY,
|
||||
};
|
||||
|
||||
for (uint i = 0; i < sizeof(dataDirectories)/sizeof(directory_which); i++) {
|
||||
for (uint i = 0; i < sizeof(dataDirectories) / sizeof(directory_which); i++) {
|
||||
BPath path;
|
||||
if (find_directory(dataDirectories[i], &path) != B_OK)
|
||||
continue;
|
||||
@@ -108,8 +105,8 @@ VirtualKeyboardWindow::_LoadLayoutMenu(BMenu* menu, BDirectory directory)
|
||||
_LoadLayoutMenu(submenu, subdirectory);
|
||||
menu->AddItem(submenu);
|
||||
} else {
|
||||
//BMessage* message = new BMessage(kChangeKeyboardLayout);
|
||||
//message->AddRed("ref",&ref);
|
||||
// BMessage* message = new BMessage(kChangeKeyboardLayout);
|
||||
// message->AddRed("ref",&ref);
|
||||
menu->AddItem(new BMenuItem(ref.name, NULL));
|
||||
}
|
||||
}
|
||||
@@ -144,11 +141,11 @@ VirtualKeyboardWindow::_LoadFonts()
|
||||
font_style currentStyle;
|
||||
uint32 flags;
|
||||
|
||||
be_plain_font->GetFamilyAndStyle(¤tFamily,¤tStyle);
|
||||
be_plain_font->GetFamilyAndStyle(¤tFamily, ¤tStyle);
|
||||
|
||||
for (int32 i = 0; i< numFamilies; i++) {
|
||||
for (int32 i = 0; i < numFamilies; i++) {
|
||||
if (get_font_family(i, &family, &flags) == B_OK) {
|
||||
BMenuItem* item = new BMenuItem(family, NULL); //new BMessage(kMsgMenuFontChanged));
|
||||
BMenuItem* item = new BMenuItem(family, NULL); // new BMessage(kMsgMenuFontChanged));
|
||||
fFontMenu->AddItem(item);
|
||||
if (!strcmp(family, currentFamily))
|
||||
item->SetMarked(true);
|
||||
|
||||
@@ -16,10 +16,10 @@ class BDirectory;
|
||||
class BListView;
|
||||
class BMenu;
|
||||
|
||||
class VirtualKeyboardWindow : public BWindow{
|
||||
class VirtualKeyboardWindow : public BWindow {
|
||||
public:
|
||||
VirtualKeyboardWindow(BInputServerDevice* dev);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
private:
|
||||
KeyboardLayoutView* fKeyboardView;
|
||||
|
||||
Reference in New Issue
Block a user