start:继续继续。
This commit is contained in:
parent
e8774bee10
commit
c272847c8f
@ -4,26 +4,6 @@
|
|||||||
#include <InfoCommunicate.hpp>
|
#include <InfoCommunicate.hpp>
|
||||||
#include <wx/renderer.h>
|
#include <wx/renderer.h>
|
||||||
|
|
||||||
class ButtonCellRenderer : public wxGridCellRenderer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected) override
|
|
||||||
{
|
|
||||||
wxRendererNative::Get().DrawPushButton(&grid, dc, rect, wxCONTROL_PRESSED);
|
|
||||||
dc.DrawText(grid.GetCellValue(row, col), rect.x + 5, rect.y + (rect.height - dc.GetCharHeight()) / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col) override
|
|
||||||
{
|
|
||||||
return wxSize(80, 25); // 按钮默认大小
|
|
||||||
}
|
|
||||||
|
|
||||||
wxGridCellRenderer* Clone() const override
|
|
||||||
{
|
|
||||||
return new ButtonCellRenderer;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
RemoteControl::RemoteControl(wxWindow* parent, std::shared_ptr<ClientCore>& clientCore) : wxPanel(parent), clientCore_(clientCore)
|
RemoteControl::RemoteControl(wxWindow* parent, std::shared_ptr<ClientCore>& clientCore) : wxPanel(parent), clientCore_(clientCore)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
@ -156,7 +136,7 @@ void RemoteControl::OnRightClick(wxGridEvent& event)
|
|||||||
|
|
||||||
void RemoteControl::SetGrid()
|
void RemoteControl::SetGrid()
|
||||||
{
|
{
|
||||||
grid_->CreateGrid(10, 6);
|
grid_->CreateGrid(10, 5);
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
grid_->DisableRowResize(i);
|
grid_->DisableRowResize(i);
|
||||||
@ -173,9 +153,6 @@ void RemoteControl::SetGrid()
|
|||||||
grid_->SetColSize(2, 100);
|
grid_->SetColSize(2, 100);
|
||||||
grid_->SetColSize(3, 150);
|
grid_->SetColSize(3, 150);
|
||||||
grid_->SetColSize(4, 100);
|
grid_->SetColSize(4, 100);
|
||||||
|
|
||||||
grid_->SetCellRenderer(0, 5, new ButtonCellRenderer());
|
|
||||||
grid_->SetCellValue(0, 5, _("Download"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteControl::setRemoteID(const wxString& id)
|
void RemoteControl::setRemoteID(const wxString& id)
|
||||||
|
@ -1,13 +1,28 @@
|
|||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
#include <wx/uilocale.h>
|
#include <wx/uilocale.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
void setProcessDPIAwareIfAvailable()
|
||||||
|
{
|
||||||
|
HMODULE hUser32 = LoadLibrary(wxT("User32.dll"));
|
||||||
|
if (hUser32) {
|
||||||
|
typedef BOOL(WINAPI * SetProcessDPIAwareFunc)();
|
||||||
|
SetProcessDPIAwareFunc pSetProcessDPIAware = (SetProcessDPIAwareFunc)GetProcAddress(hUser32, "SetProcessDPIAware");
|
||||||
|
if (pSetProcessDPIAware) {
|
||||||
|
pSetProcessDPIAware();
|
||||||
|
}
|
||||||
|
FreeLibrary(hUser32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class RelayFileApp : public wxApp
|
class RelayFileApp : public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool OnInit() override
|
bool OnInit() override
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetProcessDPIAware();
|
setProcessDPIAwareIfAvailable();
|
||||||
#endif
|
#endif
|
||||||
loadLocale();
|
loadLocale();
|
||||||
f_ = new UserInterface(_("RelayFile"));
|
f_ = new UserInterface(_("RelayFile"));
|
||||||
|
Reference in New Issue
Block a user