#include <ctype.h>
+#if wxUSE_DISPLAY
+#include "wx/display.h"
+#endif
+
#include "wx/encconv.h"
#include "wx/listctrl.h"
#include "wx/mstream.h"
Font::~Font() {
}
-void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic, bool extraFontFlag) {
-
+void Font::Create(const char *faceName, int characterSet,
+ int size, bool bold, bool italic,
+ bool extraFontFlag) {
Release();
// The minus one is done because since Scintilla uses SC_SHARSET_DEFAULT
// TODO: do something with cornerSize
wxUnusedVar(cornerSize);
-
+
int x, y;
wxRect r = wxRectFromPRectangle(rc);
wxBitmap bmp(r.width, r.height, 32);
p.Green() = wxPy_premultiply(green, alphaFill);
p.Blue() = wxPy_premultiply(blue, alphaFill);
p.Alpha() = alphaFill;
- ++p;
+ ++p;
}
}
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
- p.Alpha() = alphaOutline;
+ p.Alpha() = alphaOutline;
p.MoveTo(pixData, x, r.height-1);
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
- p.Alpha() = alphaOutline;
+ p.Alpha() = alphaOutline;
}
for (y=0; y<r.height; y++) {
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
- p.Alpha() = alphaOutline;
+ p.Alpha() = alphaOutline;
p.MoveTo(pixData, r.width-1, y);
p.Red() = wxPy_premultiply(red, alphaOutline);
p.Green() = wxPy_premultiply(green, alphaOutline);
p.Blue() = wxPy_premultiply(blue, alphaOutline);
- p.Alpha() = alphaOutline;
+ p.Alpha() = alphaOutline;
}
-
+
// Draw the bitmap
hdc->DrawBitmap(bmp, r.x, r.y, true);
}
+// Returns rectangle of monitor pt is on
+PRectangle Window::GetMonitorRect(Point pt) {
+ wxRect rect;
+ if (! id) return PRectangle();
+#if wxUSE_DISPLAY
+ // Get the display the point is found on
+ int n = wxDisplay::GetFromPoint(wxPoint(pt.x, pt.y));
+ wxDisplay dpy(n == wxNOT_FOUND ? 0 : n);
+ rect = dpy.GetGeometry();
+#endif
+ return PRectangleFromwxRect(rect);
+}
+
//----------------------------------------------------------------------
// Helper classes for ListBox
wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point WXUNUSED(location)) :
wxPopupWindow(parent, wxBORDER_NONE)
{
-
+
SetBackgroundColour(*wxBLACK); // for our simple border
lv = new wxSTCListBox(parent, id, wxPoint(-50,-50), wxDefaultSize,
wxFRAME_NO_TASKBAR
| wxFRAME_FLOAT_ON_PARENT
#ifdef __WXMAC__
- | wxPOPUP_WINDOW
+ | wxPOPUP_WINDOW
| wxNO_BORDER
#else
| wxSIMPLE_BORDER
lv->SetFocus();
Hide();
- }
+ }
// On OSX and (possibly others) there can still be pending
if (frame)
frame->Raise();
}
-
+
virtual void DoSetSize(int x, int y,
int width, int height,
void ListBoxImpl::Append(const wxString& text, int type) {
long count = GETLB(id)->GetItemCount();
long itemID = GETLB(id)->InsertItem(count, wxEmptyString);
+ long idx = -1;
GETLB(id)->SetItem(itemID, 1, text);
maxStrWidth = wxMax(maxStrWidth, text.length());
if (type != -1) {
wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap"));
- long idx = imgTypeMap->Item(type);
- GETLB(id)->SetItemImage(itemID, idx, idx);
+ idx = imgTypeMap->Item(type);
}
+ GETLB(id)->SetItemImage(itemID, idx, idx);
}
void ListBoxImpl::SetList(const char* list, char separator, char typesep) {
if (!len)
return wxEmptyString;
- size_t wclen = UCS2Length(str, len);
+ size_t wclen = UTF16Length(str, len);
wxWCharBuffer buffer(wclen+1);
- size_t actualLen = UCS2FromUTF8(str, len, buffer.data(), wclen+1);
+ size_t actualLen = UTF16FromUTF8(str, len, buffer.data(), wclen+1);
return wxString(buffer.data(), actualLen);
}
size_t len = UTF8Length(wcstr, wclen);
wxCharBuffer buffer(len+1);
- UTF8FromUCS2(wcstr, wclen, buffer.data(), len);
+ UTF8FromUTF16(wcstr, wclen, buffer.data(), len);
// TODO check NULL termination!!