Exemple #1
0
Editor::Editor(Frame* parent, EditorSettings* set, int id)
  : WindowFrame(parent)
  , hFont(FontSys::getFont(set->font.size, L"Consolas", set->font.flags))
  , hFontIt(FontSys::getFont(set->font.size, L"Consolas", set->font.flags | FONT_ITALIC | FONT_BOLD))
  , hFontBf(FontSys::getFont(set->font.size, L"Consolas", set->font.flags | FONT_BOLD))
  , caret(0)
  , caretX(0)
  , selStart(0)
  , insertMode(true)
  , target(NULL)
  , historyPos(0)
  , origHistory(0)
  , running(NULL)
  , dragop(0)
  , hDC(NULL)
  , hBitmap(NULL)
  , dropPos(0)
  , currentLine(-1)
  , settings(set)
  , pCopyLine(NULL)
{
  cursors[cArrow] = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
  cursors[cBeam] = LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM));
  icons[iBreakpoint] = (HICON) LoadImage(getInstance(),
    MAKEINTRESOURCE(IDI_BREAKPOINT), IMAGE_ICON, 16, 16, 0);
  icons[iCurline] = (HICON) LoadImage(getInstance(),
    MAKEINTRESOURCE(IDI_CURLINE), IMAGE_ICON, 16, 16, 0);
  chSize = FontSys::getTextSize(hFont, L" ");
  scrollPos.x = scrollPos.y = 0;
  scrollAccum.x = scrollAccum.y;
  extent.x = extent.y = 0;
  lines.push();
  initkw();

  if (WNDCLASSEX* wcx = createclass(L"iLuaEditorWindow"))
  {
    wcx->style |= CS_DBLCLKS;
    RegisterClassEx(wcx);
  }
  create(L"", WS_CHILD | WS_TABSTOP | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE);
  setId(id);

  enableTooltips();

  target = new DropTarget(this, CF_UNICODETEXT, DROPEFFECT_COPY | DROPEFFECT_MOVE);
}
LinkFrame::LinkFrame(WideString text, Frame* parent, int id)
  : WindowFrame(parent)
  , _color(0xFF0000)
  , _flags(0)
{
  hFont = NULL;
  uFont = NULL;
  pressed = false;
  hover = false;
  if (WNDCLASSEX* wcx = createclass(L"LinkFrmClass"))
  {
    wcx->hCursor = LoadCursor(NULL, IDC_HAND);
    RegisterClassEx(wcx);
  }
  create(text, WS_CHILD, 0);
  setFont(FontSys::getSysFont());
  resetSize();
  setId(id);
}