bool eFileTypeZIP::Open(const char* name) const { char contain_path[xIo::MAX_PATH_LEN]; char contain_name[xIo::MAX_PATH_LEN]; if(Contain(name, contain_path, contain_name)) { unzFile h = unzOpen64(contain_path); if(!h) return false; bool ok = false; if(unzLocateFile(h, contain_name, 0) == UNZ_OK) { ok = OpenCurrent(h); } unzClose(h); return ok; } char opened_name[xIo::MAX_PATH_LEN]; bool ok = Open(unzOpen64(name), opened_name); if(ok) { char full_name[xIo::MAX_PATH_LEN]; strcpy(full_name, name); strcat(full_name, "/"); strcat(full_name, opened_name); OpLastFile(full_name); } return ok; }
void tInputFile::WarnObsoleteKeyword(const char *ancient, const char *modern) const { if (Contain(ancient)) std::cout << "Warning: `" << ancient << "' is obsolete and is ignored.\n Use `" << modern << "' instead." << std::endl; }
virtual xIo::eFileSelect* FileSelect(const char* path) const { char contain_path[xIo::MAX_PATH_LEN]; char contain_name[xIo::MAX_PATH_LEN]; if(Contain(path, contain_path, contain_name)) return xIo::FileSelectZIP(contain_path, contain_name); return NULL; }
BOOLEAN Rectangle::Contain(VALUE V_X, VALUE V_Y) const{return Contain(VECTOR(V_X, V_Y));}
Response AbstractNode::PerformMouseHover (AbstractWindow* context) { if (pressed_) return Finish; Response retval = Finish; int border = 4; Rect valid_rect(position().x() - border, position().y() - border, size().width() + 2 * border, size().height() + 2 * border); if (valid_rect.contains(context->local_cursor_position())) { if (Contain(context->local_cursor_position())) { cursor_position_ = InsideRectangle; AbstractWidget* new_hovered_widget = DispatchMouseHover(hovered_widget_, context); if (new_hovered_widget != hovered_widget_) { if (hovered_widget_) { hovered_widget_->destroyed().disconnect1( this, &AbstractNode::OnHoverWidgetDestroyed); } hovered_widget_ = new_hovered_widget; if (hovered_widget_) { hovered_widget_->destroyed().connect(this, &AbstractNode::OnHoverWidgetDestroyed); } } // if(hovered_widget_) { // DBG_PRINT_MSG("hovered widget: %s", hovered_widget_->name().c_str()); // } if (cursor_on_border()) { set_cursor_on_border(false); context->PopCursor(); } } else { set_cursor_on_border(true); cursor_position_ = InsideRectangle; if (context->local_cursor_position().x() <= position().x()) { cursor_position_ |= OnLeftBorder; } else if (context->local_cursor_position().x() >= (position().x() + size().width())) { cursor_position_ |= OnRightBorder; } if (context->local_cursor_position().y() >= (position().y() + size().height())) { cursor_position_ |= OnTopBorder; } else if (context->local_cursor_position().y() <= position().y()) { cursor_position_ |= OnBottomBorder; } // set cursor shape switch (cursor_position_) { case OnLeftBorder: case OnRightBorder: { context->PushCursor(); context->SetCursor(SplitHCursor); break; } case OnTopBorder: case OnBottomBorder: { context->PushCursor(); context->SetCursor(SplitVCursor); break; } case OnTopLeftCorner: case OnBottomRightCorner: { context->PushCursor(); context->SetCursor(SizeFDiagCursor); break; } case OnTopRightCorner: case OnBottomLeftCorner: { context->PushCursor(); context->SetCursor(SizeBDiagCursor); break; } default: break; } } } else { cursor_position_ = OutsideRectangle; // set cursor shape if (cursor_on_border()) { set_cursor_on_border(false); context->PopCursor(); } retval = Ignore; } return retval; }
bool CBound::Contain( CPosition p ) const { return Contain(p.X() , p.Y()); }