OptionsCtrlImpl::Check::Check(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, DWORD dwFlags, INT_PTR dwData) : Item(pCtrl, itCheck, szLabel, dwFlags, dwData) { m_bChecked = bool_(dwFlags & OCF_CHECKED); m_bDisableChildsOnUncheck = bool_(dwFlags & OCF_DISABLECHILDSONUNCHECK); pCtrl->insertItem(pParent, this, szLabel, dwFlags, getStateImage()); if (pParent) pParent->childAdded(this); }
OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, const wchar_t* szFormat, time_t timestamp, DWORD dwFlags, INT_PTR dwData) : Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(nullptr), m_strFormat(szFormat), m_timestamp(timestamp) { m_bDisableChildsOnNone = bool_(dwFlags & OCF_DISABLECHILDSONNONE); m_bAllowNone = bool_(dwFlags & OCF_ALLOWNONE); m_bNone = m_bAllowNone && bool_(dwFlags & OCF_NONE); m_strFormatDT = getDTFormatString(m_strFormat); m_pCtrl->insertItem(pParent, this, getCombinedText().c_str(), dwFlags, m_bEnabled ? siDateTime : siDateTimeG); if (pParent) { pParent->childAdded(this); } }
Stmt *Parser::if_stmt() { match(Token::IF); Expr *cond = bool_(); match(Token::THEN); Stmt *body = block(); Stmt *else_body = elsePart(); return new IfStmt(cond, body, else_body); }
Stmt *Parser::while_stmt() { match(Token::WHILE); Expr *cond = bool_(); match(Token::DO); Stmt *body = block(); match(Token::OD); return new WhileStmt(cond, body); }
DWORD OptionsCtrl::getDateTime(HANDLE hDateTime, bool* pbNone /* = NULL */) { BOOL bMyNone = FALSE; DWORD dwResult = SendMessage(m_hOptWnd, OCM_GETDATETIME, reinterpret_cast<WPARAM>(hDateTime), reinterpret_cast<LPARAM>(&bMyNone)); if (pbNone) *pbNone = bool_(bMyNone); return dwResult; }
bool dibToPng(const BITMAPINFOHEADER* pBMIH, const BYTE* pDIData, BYTE* pImageData, long* pImageLen) { DIB2PNG info; info.pbmi = const_cast<BITMAPINFO*>(reinterpret_cast<const BITMAPINFO*>(pBMIH)); info.pDiData = const_cast<BYTE*>(pDIData); info.pResult = pImageData; info.pResultLen = pImageLen; return bool_(CallService(MS_DIB2PNG, 0, reinterpret_cast<LPARAM>(&info))); }
Expr *Parser::bool_factor() { switch(lookahead_) { case Token::NOT: match(Token::NOT); return bool_factor(); case Token::LPAREN: { match(Token::LPAREN); Expr *e = bool_(); match(Token::RPAREN); return e; } default: return cmp(); } }
OptionsCtrlImpl::Group::Group(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, INT_PTR dwData) : Item(pCtrl, itGroup, szLabel, dwFlags, dwData) { m_bDrawLine = bool_(dwFlags & OCF_DRAWLINE); pCtrl->insertItem(pParent, this, szLabel, dwFlags, m_bEnabled ? siFolder : siFolderG); if (pParent) { pParent->childAdded(this); } }
multi_geometry_generator_grammar() : multi_geometry_generator_grammar::base_type(start) { boost::spirit::karma::uint_type uint_; boost::spirit::bool_type bool_; boost::spirit::karma::_val_type _val; boost::spirit::karma::_1_type _1; boost::spirit::karma::lit_type lit; boost::spirit::karma::_a_type _a; boost::spirit::karma::eps_type eps; boost::spirit::karma::string_type kstring; geometry_types.add (mapnik::geometry_type::types::Point,"\"Point\"") (mapnik::geometry_type::types::LineString,"\"LineString\"") (mapnik::geometry_type::types::Polygon,"\"Polygon\"") (mapnik::geometry_type::types::Point + 3,"\"MultiPoint\"") (mapnik::geometry_type::types::LineString + 3,"\"MultiLineString\"") (mapnik::geometry_type::types::Polygon + 3,"\"MultiPolygon\"") ; start %= ( eps(phoenix::at_c<1>(_a))[_a = multi_type_(_val)] << lit("{\"type\":\"GeometryCollection\",\"geometries\":[") << geometry_collection << lit("]}") | geometry) ; geometry_collection = -(geometry2 % lit(',')) ; geometry = ( &bool_(true)[_1 = not_empty_(_val)] << lit("{\"type\":") << geometry_types[_1 = phoenix::at_c<0>(_a)][_a = multi_type_(_val)] << lit(",\"coordinates\":") << kstring[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = '['].else_[_1 = ""]] << coordinates << kstring[ phoenix::if_ (phoenix::at_c<0>(_a) > 3) [_1 = ']'].else_[_1 = ""]] << lit('}')) | lit("null") ; geometry2 = lit("{\"type\":") << geometry_types[_1 = _a][_a = type_(_val)] << lit(",\"coordinates\":") << path << lit('}') ; coordinates %= path % lit(',') ; }
Stmt *Parser::elsePart() { switch(lookahead_) { case Token::ELSIF: { match(Token::ELSIF); Expr *cond = bool_(); match(Token::THEN); Stmt *body = block(); Stmt *else_body = elsePart(); return new IfStmt(cond, body, else_body); } case Token::ELSE: { match(Token::ELSE); Stmt *body = block(); match(Token::FI); return body; } case Token::FI: match(Token::FI); return NULL; default: throw std::runtime_error("Expecting factor!"); } }
OptionsCtrlImpl::Radio::Radio(OptionsCtrlImpl* pCtrl, Item* pParent, Radio* pSibling, const TCHAR* szLabel, DWORD dwFlags, INT_PTR dwData) : Item(pCtrl, itRadio, szLabel, dwFlags, dwData) { m_bDisableChildsOnUncheck = bool_(dwFlags & OCF_DISABLECHILDSONUNCHECK); pCtrl->insertItem(pParent, this, szLabel, dwFlags, siRadioU); m_pSiblings = pSibling ? pSibling->m_pSiblings : new RadioSiblings(); m_nIndex = m_pSiblings->join(this); if (dwFlags & OCF_CHECKED) { m_pSiblings->setChecked(m_nIndex); } else { updateItem(); } if (pParent) { pParent->childAdded(this); } }
bool OptionsCtrl::isItemEnabled(HANDLE hItem) { return bool_(SendMessage(m_hOptWnd, OCM_ISITEMENABLED, reinterpret_cast<WPARAM>(hItem), 0)); }
value __ne__$none$none(value x, value y) { assert(x.type == value::NONE && y.type == value::NONE); return make$bool_(false); }
bool BandCtrl::isButtonChecked(HANDLE hButton) { return bool_(SendMessage(m_hBandWnd, BCM_ISBUTTONCHECKED, reinterpret_cast<WPARAM>(hButton), 0)); }
value __bool__$none(value self) { assert(self.type == value::NONE); return make$bool_(false); }
value __eq__$none$none(value x, value y) { assert(x.type == value::NONE && y.type == value::NONE); return make$bool_(true); }
bool BandCtrl::isButtonVisisble(HANDLE hButton) { return bool_(SendMessage(m_hBandWnd, BCM_ISBUTTONVISIBLE, reinterpret_cast<WPARAM>(hButton), 0)); }
bool BandCtrl::isButtonEnabled(HANDLE hButton) { return bool_(SendMessage(m_hBandWnd, BCM_ISBUTTONENABLED, reinterpret_cast<WPARAM>(hButton), 0)); }
LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { OptionsCtrlImpl* pCtrl = reinterpret_cast<OptionsCtrlImpl*>(GetWindowLongPtr(hWnd, 0)); switch (msg) { case WM_NCCREATE: { CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lParam); pCS->style &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL); pCS->style |= WS_CHILD; pCS->dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE); pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<INT_PTR>(pCS->hMenu)); SetWindowLongPtr(hWnd, 0, reinterpret_cast<INT_PTR>(pCtrl)); } return pCtrl ? TRUE : FALSE; case WM_CREATE: return pCtrl->onWMCreate(reinterpret_cast<CREATESTRUCT*>(lParam)); case WM_DESTROY: pCtrl->onWMDestroy(); delete pCtrl; SetWindowLongPtr(hWnd, 0, 0); return 0; case WM_SETFOCUS: SetFocus(pCtrl->m_hTree); return 0; case WM_ENABLE: EnableWindow(pCtrl->m_hTree, wParam); return 0; case WM_GETFONT: return SendMessage(pCtrl->m_hTree, WM_GETFONT, wParam, lParam); case WM_SETFONT: return SendMessage(pCtrl->m_hTree, WM_SETFONT, wParam, lParam); case WM_WINDOWPOSCHANGED: { WINDOWPOS* pWP = reinterpret_cast<WINDOWPOS*>(lParam); SetWindowPos(pCtrl->m_hTree, NULL, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } return 0; case WM_SETREDRAW: return SendMessage(pCtrl->m_hTree, WM_SETREDRAW, wParam, lParam); case WM_NOTIFY: { NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam); if (pNM->hwndFrom == pCtrl->m_hTree) { switch (pNM->code) { case NM_CLICK: pCtrl->onNMClick(); return 0; case NM_CUSTOMDRAW: return pCtrl->onNMCustomDraw(reinterpret_cast<NMTVCUSTOMDRAW*>(pNM)); case NM_KILLFOCUS: pCtrl->onNMKillFocus(); return 0; case TVN_ITEMEXPANDING: return pCtrl->onTVNItemExpanding(reinterpret_cast<NMTREEVIEW*>(pNM)); case TVN_DELETEITEM: pCtrl->onTVNDeleteItem(reinterpret_cast<NMTREEVIEW*>(pNM)); return 0; case TVN_SELCHANGING: pCtrl->onTVNSelChanging(reinterpret_cast<NMTREEVIEW*>(pNM)); return 0; case TVN_SELCHANGED: pCtrl->onTVNSelChanged(reinterpret_cast<NMTREEVIEW*>(pNM)); return 0; case TVN_BEGINDRAG: pCtrl->onTVNBeginDrag(reinterpret_cast<NMTREEVIEW*>(pNM)); return 0; } } } break; case WM_MOUSEMOVE: { POINTS pts = MAKEPOINTS(lParam); POINT pt = { pts.x, pts.y }; pCtrl->onWMMouseMove(pt); } return 0; case WM_LBUTTONUP: { POINTS pts = MAKEPOINTS(lParam); POINT pt = { pts.x, pts.y }; pCtrl->onWMLButtonUp(pt); } return 0; case OCM_INSERTGROUP: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertGroup(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCGROUP*>(lParam))); case OCM_INSERTCHECK: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertCheck(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCHECK*>(lParam))); case OCM_INSERTRADIO: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertRadio(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCRADIO*>(lParam))); case OCM_INSERTEDIT: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertEdit(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCEDIT*>(lParam))); case OCM_INSERTCOMBO: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertCombo(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCOMBO*>(lParam))); case OCM_INSERTBUTTON: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertButton(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCBUTTON*>(lParam))); case OCM_GETITEMLABEL: return reinterpret_cast<LRESULT>(pCtrl->onOCMGetItemLabel(reinterpret_cast<HTREEITEM>(wParam))); case OCM_SETITEMLABEL: pCtrl->onOCMSetItemLabel(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const TCHAR*>(lParam)); return 0; case OCM_ISITEMENABLED: return BOOL_(pCtrl->onOCMIsItemEnabled(reinterpret_cast<HTREEITEM>(wParam))); case OCM_ENABLEITEM: pCtrl->onOCMEnableItem(reinterpret_cast<HTREEITEM>(wParam), bool_(lParam)); return 0; case OCM_GETITEMDATA: return pCtrl->onOCMGetItemData(reinterpret_cast<HTREEITEM>(wParam)); case OCM_SETITEMDATA: pCtrl->onOCMSetItemData(reinterpret_cast<HTREEITEM>(wParam), lParam); return 0; case OCM_ISITEMCHECKED: return BOOL_(pCtrl->onOCMIsItemChecked(reinterpret_cast<HTREEITEM>(wParam))); case OCM_CHECKITEM: pCtrl->onOCMCheckItem(reinterpret_cast<HTREEITEM>(wParam), bool_(lParam)); return 0; case OCM_GETRADIOCHECKED: return pCtrl->onOCMGetRadioChecked(reinterpret_cast<HTREEITEM>(wParam)); case OCM_SETRADIOCHECKED: pCtrl->onOCMSetRadioChecked(reinterpret_cast<HTREEITEM>(wParam), lParam); return 0; case OCM_GETEDITNUMBER: return pCtrl->onOCMGetEditNumber(reinterpret_cast<HTREEITEM>(wParam)); case OCM_SETEDITNUMBER: pCtrl->onOCMSetEditNumber(reinterpret_cast<HTREEITEM>(wParam), lParam); return 0; case OCM_GETEDITSTRING: return reinterpret_cast<LPARAM>(pCtrl->onOCMGetEditString(reinterpret_cast<HTREEITEM>(wParam))); case OCM_SETEDITSTRING: pCtrl->onOCMSetEditString(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const TCHAR*>(lParam)); return 0; case OCM_ADDCOMBOITEM: pCtrl->onOCMAddComboItem(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const TCHAR*>(lParam)); return 0; case OCM_GETCOMBOSELECTED: return pCtrl->onOCMGetComboSelected(reinterpret_cast<HTREEITEM>(wParam)); case OCM_SETCOMBOSELECTED: pCtrl->onOCMSetComboSelected(reinterpret_cast<HTREEITEM>(wParam), lParam); return 0; case OCM_ENSUREVISIBLE: pCtrl->onOCMEnsureVisible(reinterpret_cast<HTREEITEM>(wParam)); return 0; case OCM_DELETEALLITEMS: pCtrl->onOCMDeleteAllItems(); return 0; case OCM_GETSELECTION: return reinterpret_cast<LRESULT>(pCtrl->onOCMGetSelection()); case OCM_SELECTITEM: pCtrl->onOCMSelectItem(reinterpret_cast<HTREEITEM>(wParam)); return 0; case OCM_GETITEM: return reinterpret_cast<LRESULT>(pCtrl->onOCMGetItem(reinterpret_cast<HTREEITEM>(wParam), lParam)); case OCM_DELETEITEM: pCtrl->onOCMDeleteItem(reinterpret_cast<HTREEITEM>(wParam)); return 0; case OCM_MOVEITEM: pCtrl->onOCMMoveItem(*reinterpret_cast<HTREEITEM*>(wParam), reinterpret_cast<HTREEITEM>(lParam)); return 0; case OCM_GETSCROLLPOS: return GetScrollPos(pCtrl->m_hTree, wParam); case OCM_SETSCROLLPOS: SetScrollPos(pCtrl->m_hTree, wParam, lParam, TRUE); return 0; case OCM_INSERTDATETIME: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertDateTime(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCDATETIME*>(lParam))); case OCM_ISDATETIMENONE: return BOOL_(pCtrl->onOCMIsDateTimeNone(reinterpret_cast<HTREEITEM>(wParam))); case OCM_SETDATETIMENONE: pCtrl->onOCMSetDateTimeNone(reinterpret_cast<HTREEITEM>(wParam)); return 0; case OCM_GETDATETIME: return pCtrl->onOCMGetDateTime(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<BOOL*>(lParam)); case OCM_SETDATETIME: pCtrl->onOCMSetDateTime(reinterpret_cast<HTREEITEM>(wParam), lParam); return 0; case OCM_INSERTCOLOR: return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertColor(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCOLOR*>(lParam))); case OCM_GETITEMCOLOR: return pCtrl->onOCMGetItemColor(reinterpret_cast<HTREEITEM>(wParam)); case OCM_SETITEMCOLOR: pCtrl->onOCMSetItemColor(reinterpret_cast<HTREEITEM>(wParam), lParam); return 0; } return DefWindowProc(hWnd, msg, wParam, lParam); }
bool OptionsCtrl::isDateTimeNone(HANDLE hDateTime) { return bool_(SendMessage(m_hOptWnd, OCM_ISDATETIMENONE, reinterpret_cast<WPARAM>(hDateTime), 0)); }
bool OptionsCtrl::isItemChecked(HANDLE hItem) { return bool_(SendMessage(m_hOptWnd, OCM_ISITEMCHECKED, reinterpret_cast<WPARAM>(hItem), 0)); }