Fixing warnings and style.

This commit is contained in:
Ben Vanik 2015-05-09 18:13:19 -07:00
parent 5954d23438
commit 21edd65354
10 changed files with 27 additions and 30 deletions

View file

@ -19,7 +19,8 @@ namespace xe {
namespace ui {
MainWindow::MainWindow(Emulator* emulator)
: PlatformWindow(L"xenia"), emulator_(emulator),
: PlatformWindow(L"xenia"),
emulator_(emulator),
main_menu_(MenuItem::Type::kNormal) {}
MainWindow::~MainWindow() = default;
@ -74,7 +75,8 @@ bool MainWindow::Initialize() {
main_menu_.AddChild(std::move(file));
auto debug = std::make_unique<PlatformMenu>(MenuItem::Type::kPopup, L"&Debug");
auto debug =
std::make_unique<PlatformMenu>(MenuItem::Type::kPopup, L"&Debug");
SetMenu(&main_menu_);
@ -89,9 +91,7 @@ void MainWindow::OnClose() {
exit(1);
}
void MainWindow::OnCommand(int id) {
}
void MainWindow::OnCommand(int id) {}
X_STATUS MainWindow::LaunchPath(std::wstring path) {
X_STATUS result;

View file

@ -15,8 +15,8 @@
// TODO(benvanik): only on windows.
#include "xenia/ui/win32/win32_loop.h"
#include "xenia/ui/win32/win32_window.h"
#include "xenia/ui/win32/win32_menu_item.h"
#include "xenia/ui/win32/win32_window.h"
namespace xe {
class Emulator;

View file

@ -14,8 +14,8 @@ namespace ui {
MenuItem::MenuItem(Type type) : type_(type), parent_item_(nullptr) {}
MenuItem::MenuItem(Type type, const std::wstring &text) :
type_(type), parent_item_(nullptr), text_(text) {}
MenuItem::MenuItem(Type type, const std::wstring& text)
: type_(type), parent_item_(nullptr), text_(text) {}
MenuItem::~MenuItem() = default;

View file

@ -34,7 +34,7 @@ class MenuItem {
MenuItem* parent_item() const { return parent_item_; }
Type type() { return type_; }
const std::wstring &text() { return text_; }
const std::wstring& text() { return text_; }
void AddChild(MenuItem* child_item);
void AddChild(std::unique_ptr<MenuItem> child_item);
@ -45,7 +45,7 @@ class MenuItem {
protected:
MenuItem(Type type);
MenuItem(Type type, const std::wstring &text);
MenuItem(Type type, const std::wstring& text);
virtual void OnChildAdded(MenuItem* child_item) {}
virtual void OnChildRemoved(MenuItem* child_item) {}

View file

@ -182,7 +182,7 @@ LRESULT CALLBACK Win32Control::WndProcThunk(HWND hWnd, UINT message,
if (message == WM_NCCREATE) {
auto create_struct = reinterpret_cast<LPCREATESTRUCT>(lParam);
control = reinterpret_cast<Win32Control*>(create_struct->lpCreateParams);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (__int3264)(LONG_PTR) control);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (__int3264)(LONG_PTR)control);
} else {
control =
reinterpret_cast<Win32Control*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));

View file

@ -27,8 +27,7 @@ Win32MenuItem::Win32MenuItem(Type type, int id, const std::wstring& text)
}
}
Win32MenuItem::Win32MenuItem(Type type)
: Win32MenuItem(type, 0, L"") {}
Win32MenuItem::Win32MenuItem(Type type) : Win32MenuItem(type, 0, L"") {}
Win32MenuItem::Win32MenuItem(Type type, const std::wstring& text)
: Win32MenuItem(type, 0, text) {}
@ -44,7 +43,8 @@ void Win32MenuItem::OnChildAdded(MenuItem* generic_child_item) {
switch (child_item->type()) {
case MenuItem::Type::kPopup:
AppendMenuW(handle_, MF_POPUP, (UINT)child_item->handle(),
AppendMenuW(handle_, MF_POPUP,
reinterpret_cast<UINT_PTR>(child_item->handle()),
child_item->text().c_str());
break;
case MenuItem::Type::kSeparator:

View file

@ -22,8 +22,8 @@ namespace win32 {
class Win32MenuItem : public MenuItem {
public:
Win32MenuItem(Type type);
Win32MenuItem(Type type, const std::wstring &text);
Win32MenuItem(Type type, int id, const std::wstring &text);
Win32MenuItem(Type type, const std::wstring& text);
Win32MenuItem(Type type, int id, const std::wstring& text);
~Win32MenuItem() override;
HMENU handle() { return handle_; }
@ -34,7 +34,6 @@ class Win32MenuItem : public MenuItem {
void OnChildRemoved(MenuItem* child_item) override;
private:
HMENU handle_;
uint32_t position_; // Position within parent, if any
int id_;

View file

@ -204,9 +204,7 @@ LRESULT Win32Window::WndProc(HWND hWnd, UINT message, WPARAM wParam,
case WM_COMMAND: {
OnCommand(LOWORD(wParam));
break;
}
break;
} break;
}
return Win32Control::WndProc(hWnd, message, wParam, lParam);

View file

@ -14,8 +14,8 @@
#include "xenia/base/delegate.h"
#include "xenia/ui/control.h"
#include "xenia/ui/ui_event.h"
#include "xenia/ui/menu_item.h"
#include "xenia/ui/ui_event.h"
namespace xe {
namespace ui {